Why tech needs the humanities - Eric Berridge - TED@IBM - Transcript

It is in Apple’s DNA that technology alone is not enough — it’s technology married with liberal arts, married with the humanities, that yields us the results that make our heart sing. — Steve Jobs


You’ve all been in a bar, right?

(Laughter)

But have you ever gone to a bar and come out with a $200 million business? That’s what happened to us about 10 years ago. We’d had a terrible day. We had this huge client that was killing us. We’re a software consulting firm, and we couldn’t find a very specific programming skill to help this client deploy a cutting-edge cloud system. We have a bunch of engineers, but none of them could please this client. And we were about to be fired.

So we go out to the bar, and we’re hanging out with our bartender friend Jeff, and he’s doing what all good bartenders do: he’s commiserating with us, making us feel better, relating to our pain, saying, “Hey, these guys are overblowing it. Don’t worry about it.” And finally, he deadpans us and says, “Why don’t you send me in there? I can figure it out.” So the next morning, we’re hanging out in our team meeting, and we’re all a little hazy …

(Laughter)

and I half-jokingly throw it out there. I say, “Hey, I mean, we’re about to be fired.” So I say, “Why don’t we send in Jeff, the bartender?”

(Laughter)

And there’s some silence, some quizzical looks. Finally, my chief of staff says, “That is a great idea.”

(Laughter)

“Jeff is wicked smart. He’s brilliant. He’ll figure it out. Let’s send him in there.”

Now, Jeff was not a programmer. In fact, he had dropped out of Penn as a philosophy major. But he was brilliant, and he could go deep on topics, and we were about to be fired. So we sent him in. After a couple days of suspense, Jeff was still there. They hadn’t sent him home. I couldn’t believe it. What was he doing?

Here’s what I learned. He had completely disarmed their fixation on the programming skill. And he had changed the conversation, even changing what we were building. The conversation was now about what we were going to build and why. And yes, Jeff figured out how to program the solution, and the client became one of our best references.

Back then, we were 200 people, and half of our company was made up of computer science majors or engineers, but our experience with Jeff left us wondering: Could we repeat this through our business? So we changed the way we recruited and trained. And while we still sought after computer engineers and computer science majors, we sprinkled in artists, musicians, writers … and Jeff’s story started to multiply itself throughout our company. Our chief technology officer is an English major, and he was a bike messenger in Manhattan. And today, we’re a thousand people, yet still less than a hundred have degrees in computer science or engineering. And yes, we’re still a computer consulting firm. We’re the number one player in our market. We work with the fastest-growing software package to ever reach 10 billion dollars in annual sales. So it’s working.

Meanwhile, the push for STEM-based education in this country – science, technology, engineering, mathematics – is fierce. It’s in all of our faces. And this is a colossal mistake. Since 2009, STEM majors in the United States have increased by 43 percent, while the humanities have stayed flat. Our past president dedicated over a billion dollars towards STEM education at the expense of other subjects, and our current president recently redirected 200 million dollars of Department of Education funding into computer science. And CEOs are continually complaining about an engineering-starved workforce. These campaigns, coupled with the undeniable success of the tech economy – I mean, let’s face it, seven out of the 10 most valuable companies in the world by market cap are technology firms – these things create an assumption that the path of our future workforce will be dominated by STEM.

I get it. On paper, it makes sense. It’s tempting. But it’s totally overblown. It’s like, the entire soccer team chases the ball into the corner, because that’s where the ball is. We shouldn’t overvalue STEM. We shouldn’t value the sciences any more than we value the humanities. And there are a couple of reasons.

Number one, today’s technologies are incredibly intuitive. The reason we’ve been able to recruit from all disciplines and swivel into specialized skills is because modern systems can be manipulated without writing code. They’re like LEGO: easy to put together, easy to learn, even easy to program, given the vast amounts of information that are available for learning. Yes, our workforce needs specialized skill, but that skill requires a far less rigorous and formalized education than it did in the past.

Number two, the skills that are imperative and differentiated in a world with intuitive technology are the skills that help us to work together as humans, where the hard work is envisioning the end product and its usefulness, which requires real-world experience and judgment and historical context. What Jeff’s story taught us is that the customer was focused on the wrong thing. It’s the classic case: the technologist struggling to communicate with the business and the end user, and the business failing to articulate their needs. I see it every day. We are scratching the surface in our ability as humans to communicate and invent together, and while the sciences teach us how to build things, it’s the humanities that teach us what to build and why to build them. And they’re equally as important, and they’re just as hard.

It irks me … when I hear people treat the humanities as a lesser path, as the easier path. Come on! The humanities give us the context of our world. They teach us how to think critically. They are purposely unstructured, while the sciences are purposely structured. They teach us to persuade, they give us our language, which we use to convert our emotions to thought and action. And they need to be on equal footing with the sciences. And yes, you can hire a bunch of artists and build a tech company and have an incredible outcome.

Now, I’m not here today to tell you that STEM’s bad. I’m not here today to tell you that girls shouldn’t code.

(Laughter)

Please. And that next bridge I drive over or that next elevator we all jump into – let’s make sure there’s an engineer behind it.

(Laughter)

But to fall into this paranoia that our future jobs will be dominated by STEM, that’s just folly. If you have friends or kids or relatives or grandchildren or nieces or nephews … encourage them to be whatever they want to be.

(Applause)

The jobs will be there. Those tech CEOs that are clamoring for STEM grads, you know what they’re hiring for? Google, Apple, Facebook. Sixty-five percent of their open job opportunities are non-technical: marketers, designers, project managers, program managers, product managers, lawyers, HR specialists, trainers, coaches, sellers, buyers, on and on. These are the jobs they’re hiring for. And if there’s one thing that our future workforce needs – and I think we can all agree on this – it’s diversity. But that diversity shouldn’t end with gender or race. We need a diversity of backgrounds and skills, with introverts and extroverts and leaders and followers. That is our future workforce. And the fact that the technology is getting easier and more accessible frees that workforce up to study whatever they damn well please.

Thank you.

(Applause)


Steve Jobs: “Technology Alone Is Not Enough”

Code Monkey (song)

by Jonathan Coulton

Verse 1

Code Monkey get up, get coffee
Code Monkey go to job
Code Monkey have boring meeting
With boring manager Rob
Rob say Code Monkey very diligent
But his output stink
His code not “functional” or “elegant”
What do Code Monkey think?

Pre-Chorus 1

Code Monkey think maybe manager want to write god-damned login page himself
Code Monkey not say it out loud
Code Monkey not crazy, just proud

Chorus

Code Monkey like Fritos
Code Monkey like Tab and Mountain Dew
Code Monkey very simple man
With big warm fuzzy secret heart
Code Monkey like you
Code Monkey like you

Verse 2

Code Monkey hang around at front desk
Tell you sweater look nice
Code Monkey offer buy you soda
Bring you cup, bring you ice
You say no thank you for the soda cause
Soda make you fat
Anyway you busy with the telephone
No time for chat

Pre-Chorus 2

Code Monkey have long walk back to cubicle
He sit down pretend to work
Code Monkey not thinking so straight
Code Monkey not feeling so great

Chorus

Code Monkey like Fritos
Code Monkey like Tab and Mountain Dew
Code Monkey very simple man
With big warm fuzzy secret heart
Code Monkey like you
Code Monkey like you a lot

Verse 3

Code Monkey have every reason
To get out this place
Code Monkey just keep on working
See your soft pretty face
Much rather wake up, eat a coffee cake
Take bath, take nap
This job “fulfilling in creative way”
Such a load of crap

Pre-Chorus 3

Code Monkey think someday he have everything
Even pretty girl like you
Code Monkey just waiting for now
Code Monkey say someday, somehow

Chorus

Code Monkey like Fritos
Code Monkey like Tab and Mountain Dew
Code Monkey very simple man
With big warm fuzzy secret heart
Code Monkey like you
Code Monkey like you



The workings and concepts of Git - Reader's Digest

concepts

The repository holds all versions of the content, while the working directory is the place where you modify the code. You checkout code from the repository to the working directory and commit changes you’ve made in this working directory back into a new version of the content in the repository.

The main principle of Git

First, Git handles content in snapshots, one for each commit, and knows how to apply or roll back the change sets between two snapshots. This is an important concept. In my opinion, understanding the concept of applying and rolling back change sets makes Git much easier to understand and work with. This is the real basic principle. Anything else follows from this.

Naming

Snapshots are the main elements in Git. They are named with the commit ID, which is a hash ID like “c69e0cc32f3c1c8f2730cade36a8f75dc8e3d480” for example.

Note that the term commit, is used both as verb for creating a snapshot and as name for the resulting snapshot.

Normally you don’t have to work with the commit IDs; instead you work with branches.

In Git, a stream of changes is an ordered list of change sets as they are applied one after another to go from one snapshot to the next. A branch in Git is only a named pointer to a specific snapshot. It notes the place where new changes should be applied to when this branch is used. When a change is applied to a branch, then also the branch label moves to the new commit.

How does Git know where to put the change from a workspace? That is where HEAD points. The HEAD of the development is where you last checked out your workspace and, more importantly, where to commit the changes. It usually points to the branch you last checked out.

The tag command names a commit and allows you to address the individual commit with a readable name. Basically, a tag is an alias for a commit ID but commits can also be addressed with some shortcuts.

gitrevisions is a revision parameter typically, but not necessarily, names a commit object.

Because names like tags or branch names are references to commits, they are called refnames. A reflog shows what has been changed during the lifetime of the name, from when it was created (usually by a branch) until the current state.

Branching

The concept behind branching is that each snapshot can have more than one child. Applying a second change set to the same snapshot creates a new, separate stream of development. And if it is named, it is called a branch.

Branches are created with the git branch <branch name> command on the current HEAD, or git branch <branch name> <commit id> on any valid snapshot version. This creates a new branch pointer in the repository. Be careful, branching this way leaves your workspace at the old branch. You need to checkout the new branch first. With git checkout -b <branch name> the new branch is created, and your workspace is also moved to the new branch.

Two other commands are rather useful:

  • git diff <branch> -- <path> as already mentioned above prints a diff of the given path (file or directory) between the current working directory and the specified branch.
  • git checkout <branch> -- <path> checks out files from a different branch into the working directory, so you can pick changes from another branch.

useful commands concerning to branch

  • git branch — creates a new branch from the current HEAD (working directory).
  • git checkout -b — creates a new branch from the current HEAD, and switches the working directory to the new branch.
  • git diff – — shows the difference of between the working directory and the given branch.
  • git checkout – — checks out files from the given branch into the working directory.
  • git merge — merges the given branch into the current branch.
  • git merge -abort — aborts a merge that resulted in conflicts.

Merging

When you implemented your new feature, you checked it into the repository, for example, on your “feature” branch. When the feature is finished, you need to merge it back into the master branch. You do this by checking out the master branch, and use git merge <branch name>. Git then merges the changes from the given branch into the checked out branch. What Git does to achieve this is it applies all of the change sets from the feature branch onto the tip of the master branch.

Depending on the type of changes in the two branches, and possible conflicts, there are three possibilities that can happen.

  • Fast forward merge
  • No-conflict merge
  • Conflicting merge

merge conflict

如何消除对合并时出现冲突的恐惧心理?

  • 首先可以放心的是,你随时可以撤销一个合并操作,并且返回到冲突发生之前的状态。
  • 只要在命令行界面中键入 git merge --abort 命令,你的合并操作就会被安全的撤销。
  • 当你解决完冲突,并且在合并完成后发现一个错误,仍然还有机会来简单地撤销它。你只须键入 git reset --hard 命令,系统就会回滚到那个合并开始前的状态

git status 显示 unmerged paths,表明存在冲突

发生冲突的文件的内容

  • Git 会非常友好地把文件中那些有问题的区域在 <<<<<<< HEAD>>>>>>> other/branch/name 之间标记出来。

  • 第一个标记后的内容源于当前分支。在尖括号之后,Git 会告诉我们这些改动是从哪里(哪个分支)来的。然后有冲突的改动会被 ======= 分割起来。

  • 使用一个专门的合并工具可以使清理这些冲突变得更容易,你可以通过 git config 命令来设置这个合并工具给 Git。之后当发生合并冲突时,你可以使用 git mergetool 命令来调用这个工具。

  • 手动处理冲突,你必须手动地将文件标记为已解决状态(通过执行命令 git add <filename>)。最终,当所有的冲突被解决后,你必须通过一个正常的提交操作来完成这个清理合并冲突的工作。

resources

The Speed of Darkness

by Muriel Rukeyser

I

Whoever despises the clitoris despises the penis
Whoever despises the penis despises the cunt
Whoever despises the cunt despises the life of the child.

Resurrection music, silence, and surf.

II

No longer speaking
Listening with the whole body
And with every drop of blood
Overtaken by silence

But this same silence is become speech
With the speed of darkness.

III

Stillness during war, the lake.
The unmoving spruces.
Glints over the water.
Faces, voices. You are far away.
A tree that trembles.

I am the tree that trembles and trembles.

IV

After the lifting of the mist
after the lift of the heavy rains
the sky stands clear
and the cries of the city risen in day
I remember the buildings are space
walled, to let space be used for living
I mind this room is space
this drinking glass is space
whose boundary of glass
lets me give you drink and space to drink
your hand, my hand being space
containing skies and constellations
your face
carries the reaches of air
I know I am space
my words are air.

V

Between between
the man : act exact
woman : in curve senses in their maze
frail orbits, green tries, games of stars
shape of the body speaking its evidence

VI

I look across at the real
vulnerable involved naked
devoted to the present of all I care for
the world of its history leading to this moment.

VII

Life the announcer.
I assure you
there are many ways to have a child.
I bastard mother
promise you
there are many ways to be born.
They all come forth
in their own grace.

VIII

Ends of the earth join tonight
with blazing stars upon their meeting.
These sons, these sons
fall burning into Asia.

IX

Time comes into it.
Say it. Say it.

The universe is made of stories,
not of atoms.

X

Lying
blazing beside me
you rear beautifully and up—
your thinking face—
erotic body reaching
in all its colors and lights—
your erotic face
colored and lit—
not colored body-and-face
but now entire,
colors lights the world thinking and reaching.

XI

The river flows past the city.

Water goes down to tomorrow
making its children I hear their unborn voices
I am working out the vocabulary of my silence.

XII

Big-boned man young and of my dream
Struggles to get the live bird out of his throat.
I am he am I? Dreaming?
I am the bird am I? I am the throat?

A bird with a curved beak.
It could slit anything, the throat-bird.
Drawn up slowly. The curved blades, not large.
Bird emerges wet being born
Begins to sing.

XIII

My night awake
staring at the broad rough jewel
the copper roof across the way
thinking of the poet
yet unborn in this dark
who will be the throat of these hours.
No. Of those hours.
Who will speak these days,
if not I,
if not you?


  • Muriel Rukeyser, “The Speed of Darkness” from The Collected Poems of Muriel Rukeyser. Copyright © 2006 by Muriel Rukeyser. Reprinted by permission of International Creative Management.
  • Source: Out of Silence: Selected Poems (TriQuarterly Books, 1992)

LeetCode - Algorithms - 349. Intersection of Two Arrays

Problem

349. Intersection of Two Arrays

Java

brute force method

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Solution {
public int[] intersection(int[] nums1, int[] nums2) {
final int len1 = nums1.length;
final int len2 = nums2.length;

Set<Integer> ret = new HashSet<Integer>();
for (int i = 0; i < len1; i++) {
for (int j = 0; j < len2; j++) {
if (nums1[i] == nums2[j])
ret.add(nums1[i]);
}
}
int[] r = new int[ret.size()];
int k = 0;
for (Integer e : ret)
r[k++] = e.intValue();
return r;
}
}

Submission Detail

  • 60 / 60 test cases passed.
  • Runtime: 8 ms, faster than 11.36% of Java online submissions for Intersection of Two Arrays.
  • Memory Usage: 39.9 MB, less than 54.69% of Java online submissions for Intersection of Two Arrays.

retainAll of HashSet in Java collections framework

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Solution {
public int[] intersection(int[] nums1, int[] nums2) {
Set<Integer> set1 = new HashSet<Integer>();
Set<Integer> set2 = new HashSet<Integer>();
for (int i = 0; i < nums1.length; i++)
set1.add(nums1[i]);
for (int i = 0; i < nums2.length; i++)
set2.add(nums2[i]);
set1.retainAll(set2);
int[] r = new int[set1.size()];
int k = 0;
for (Integer e : set1)
r[k++] = e.intValue();
return r;
}
}

Submission Detail

  • 60 / 60 test cases passed.
  • Runtime: 2 ms, faster than 99.40% of Java online submissions for Intersection of Two Arrays.
  • Memory Usage: 39.4 MB, less than 90.00% of Java online submissions for Intersection of Two Arrays.

《昨日歌》《今日歌》《明日歌》

作者:文嘉

昨日歌

昨日兮昨日,
昨日何其好!
昨日過去了,
今日徒懊惱。
世人但知悔昨日,
不覺今日又過了。
水去日日流,
花落日日少,
成事立業在今日,
莫待明朝悔今朝。


今日歌

今日復今日,今日何其少!
今日又不為,此事何時了?!
人生百年幾今日,今日不為真可惜!
若言姑待明朝至,明朝又有明朝事。
為君聊賦《今日詩》,努力請從今日始!


明日歌

明日復明日,明日何其多!
我生待明日,萬事成蹉跎。
世人苦被明日累,春去秋來老將至。
朝看水東流,暮看日西墜,
百年明日能幾何?請君聽我《明日歌》。

LeetCode - Algorithms - 1470. Shuffle the Array

I can solve some easy problem on leetcode directly without IDE now. A little bit better.

Problem

1470. Shuffle the Array

Java

1

1
2
3
4
5
6
7
8
class Solution {
public int[] shuffle(int[] nums, int n) {
int[] r = new int[2 * n];
for (int i = 0; i < 2 * n; i++)
r[i] = (i & 1) == 1 ? nums[n + i / 2] : nums[i / 2];
return r;
}
}

Submission Detail

  • 53 / 53 test cases passed.
  • Runtime: 0 ms, faster than 100.00% of Java online submissions for Shuffle the Array.
  • Memory Usage: 39.3 MB, less than 95.59% of Java online submissions for Shuffle the Array.

2

1
2
3
4
5
6
7
8
9
10
11
12
13
class Solution {
public int[] shuffle(int[] nums, int n) {
int[] r = new int[2 * n];
for (int i = 0; i < 2 * n; i++) {
if ((i & 1) == 1) {
r[i] = nums[n + i / 2];
} else {
r[i] = nums[i / 2];
}
}
return r;
}
}

Submission Detail

  • 53 / 53 test cases passed.
  • Runtime: 0 ms
  • Memory Usage: 39.7 MB, Your memory usage beats 47.43 % of java submissions.

3

1
2
3
4
5
6
7
8
class Solution {
public int[] shuffle(int[] nums, int n) {
int[] r = new int[2 * n];
for (int i = 0; i < 2 * n; i++)
r[i] = nums[(i & 1) * n + i / 2];
return r;
}
}

Submission Detail

  • 53 / 53 test cases passed.
  • Runtime: 0 ms, faster than 100.00% of Java online submissions for Shuffle the Array.
  • Memory Usage: 39.6 MB, less than 56.99% of Java online submissions for Shuffle the Array.

4

1
2
3
4
5
6
7
8
class Solution {
public int[] shuffle(int[] nums, int n) {
int[] r = new int[2 * n];
for (int i = 0; i < 2 * n; i++)
r[i] = nums[((i & 1) == 1 ? n : 0) + i / 2];
return r;
}
}

Submission Detail

  • 53 / 53 test cases passed.
  • Runtime: 0 ms, faster than 100.00% of Java online submissions for Shuffle the Array.
  • Memory Usage: 39.2 MB, less than 95.96% of Java online submissions for Shuffle the Array.

Renascence

by Edna St. Vincent Millay

All I could see from where I stood
Was three long mountains and a wood;
I turned and looked the other way,
And saw three islands in a bay.
So with my eyes I traced the line
Of the horizon, thin and fine,
Straight around till I was come
Back to where I’d started from
And all I saw from where I stood
Was three long mountains and a wood.
Over these things I could not see:
These were the things that bounded me;
And I could touch them with my hand,
Almost, I thought, from where I stand.
And all at once things seemed so small
My breath came short, and scarce at all.
But, sure, the sky is big, I said;
Miles and miles above my head;
So here upon my back I’ll lie
And look my fill into the sky.
And so I looked, and, after all,
The sky was not so very tall.
The sky, I said, must somewhere stop,
And — sure enough! — I see the top!
The sky, I thought, is not so grand;
I ‘most could touch it with my hand!
And reaching up my hand to try,
I screamed to feel it touch the sky.
I screamed, and-lo!-Infinity
Came down and settled over me;
Forced back my scream into my chest,
Bent back my arm upon my breast,
And, pressing of the Undefined
The definition on my mind,
Held up before my eyes a glass
Through which my shrinking sight did pass
Until it seemed I must behold
Immensity made manifold;
Whispered to me a word whose sound
Deafened the air for worlds around,
And brought unmuffled to my ears
The gossiping of friendly spheres,
The creaking of the tented sky,
The ticking of Eternity.
I saw and heard and knew at last
The How and Why of all things, past,
And present, and forevermore.
The Universe, cleft to the core,
Lay open to my probing sense
That, sick’ning, I would fain pluck thence
But could not,—nay! But needs must suck
At the great wound, and could not pluck
My lips away till I had drawn
All venom out.—Ah, fearful pawn!
For my omniscience paid I toll
In infinite remorse of soul.
All sin was of my sinning, all
Atoning mine, and mine the gall
Of all regret. Mine was the weight
Of every brooded wrong, the hate
That stood behind each envious thrust,
Mine every greed, mine every lust.
And all the while for every grief,
Each suffering, I craved relief
With individual desire,—
Craved all in vain! And felt fierce fire
About a thousand people crawl;
Perished with each,—then mourned for all!
A man was starving in Capri;
He moved his eyes and looked at me;
I felt his gaze, I heard his moan,
And knew his hunger as my own
I saw at sea a great fog bank
Between two ships that struck and sank;
A thousand screams the heavens smote;
And every scream tore through my throat.
No hurt I did not feel, no death
That was not mine; mine each last breath
That, crying, met an answering cry
From the compassion that was I.
All suffering mine, and mine its rod;
Mine, pity like the pity of God
Ah, awful weight! Infinity
Pressed down upon the finite Me!
My anguished spirit, like a bird,
Beating against my lips I heard;
Yet lay the weight so close about
There was no room for it without.
And so beneath the weight lay I
And suffered death, but could not die.
Long had I lain thus, craving death,
When quietly the earth beneath
Gave way, and inch by inch, so great
At last had grown the crushing weight,
Into the earth I sank till I
Full six feet under ground did lie,
And sank no more,-there is no weight
Can follow here, however great.
From off my breast I felt it roll,
And as it went my tortured soul
Burst forth and fled in such a gust
That all about me swirled the dust.

Deep in the earth I rested now
Cool is its hand upon the brow
And soft its breast beneath the head
Of one who is so gladly dead
And all at once, and over all
The pitying rain began to fall;
I lay and heard each pattering hoof
Upon my lowly, thatchèd roof,
And seemed to love the sound far more
Than ever I had done before.
For rain it hath afriendly sound
To one who’s six feet under grounds
And scarce the friendly voice or face:
A grave is such quiet place.

The rain, I said, is kind to come
And speak to me in my new home
I would I were alive again
To kiss the fingers of the rain,
To drink into my eyes the shine
Of every slanting silver line,
To catch the freshened, fragrant breeze
From drenched and dripping apple-trees
For soon the shower will be done,
And then the broad face of the sun
Will laugh above the rain-soaked earth
Until the world with answering mirth
Shakes joyously, and each round drop
Rolls, twinkling, from its grass-blade top.
How can I bear it; buried here,
While overhead the sky grows clear
And blue again after the storm?
O, multi-colored, multiform,
Beloved beauty over me,
That I shall never, never see
Again! Spring-silver, autumn-gold,
That I shall never more behold!
Sleeping your myriad magics through,
Close-sepulchred away from you!
O God, I cried, give me new birth,
And put me back upon the earth!
Upset each cloud’s gigantic gourd
And let the heavy rain, down-poured
In one free, big torrent, set me
Washing my grave away from me!

I ceased; and through the breathless hush
That answered me, the far-off rush
Of herald wings came whispering
cameLike music down the vibrant string
Of my ascending prayer, and—crash!
Before the wild wind’s whistling lash
The startled storm-clouds reared on high
And plunged in terror down the sky,
And the big rain in one black wave
Fell from the sky and struck my grave.
I know not how such things can be;
I only know there came to me
A fragrance such as never clings
To aught save happy living things
A sound as of some joyous elf
Singing sweet songs to please himself,
And, through and over everything,
A sense of glad awakening.
The grass, a-tiptoe at my ear,
Whispering to me I could hear;
I felt the rain’s cool finger-tips
Brushed tenderly across my lips,
Laid gently on my sealèd sight,
And all at once the heavy night
Fell from my eyes and could see,—
A drenched and dripping apple-tree,
A last long line of silver rain,
A sky grown clear and blue again.
And as I looked a quickening gust
Of wind blew up to me and thrust
Into my face a miracle
Of orchard-breath, and with the smell,—
I know not how such things can be!—
I breathed my soul back into me.
Ah! Up then from the ground sprang I
And hailed the earth with such a cry
As is not heard save from a man
Who has been dead, and lives again.
About the trees my arms I wound;
Like one gone mad I hugged the ground;
I raised my quivering arms on high;
I laughed and laughed into the sky,
Till at my throat a strangling sob
Caught fiercely, and a great heart-throb
Sent instant tears into my eyes;
O God, I cried, no dark disguise
Can e’er hereafter hide from me
Thy radiant identity!
Thou canst not move across the grass
But my quick eyes will see Thee pass,
Nor speak, however silently,
But my hushed voice will answer Thee
I know the path that tells Thy way
Through the cool eve of every day;
God, I can push the grass apart
And lay my finger on Thy heart!

The world stands out on either side
No wider than the heart is wide;
Above the world is stretched the sky,—
No higher than the soul is high.
The heart can push the sea and land
Farther away on either hand;
The soul can split the sky in two,
And let the face of God shine through.
But East and West will pinch the heart
That can not keep them pushed apart;
And he whose soul is flat-the sky
Will cave in on him by and by.


  • Renascence and The Ballad of the Harp-Weaver are often considered poet’s finest poems.
  • Thomas Hardy once said that America had two great attractions: the skyscraper and the poetry of Edna St. Vincent Millay.
  • Cora, poet’s mother, moved from town to town with her three daughters after divorced. In spite of living in poverty, Cora travelled with a trunk full of classic literature, including Shakespeare and Milton, which she read to her children. Needless to say, the influence of parents is enormous.

How societies can grow old better - Jared Diamond - TED2013 - Transcript

There’s an irony behind the latest efforts to extend human life: It’s no picnic to be an old person in a youth-oriented society. Older people can become isolated, lacking meaningful work and low on funds. In this intriguing talk, Jared Diamond looks at how many different societies treat their elders – some better, some worse – and suggests we all take advantage of experience.


To give me an idea of how many of you here may find what I’m about to tell you of practical value, let me ask you please to raise your hands: Who here is either over 65 years old or hopes to live past age 65 or has parents or grandparents who did live or have lived past 65, raise your hands please. (Laughter)

Okay. You are the people to whom my talk will be of practical value. (Laughter) The rest of you won’t find my talk personally relevant, but I think that you will still find the subject fascinating.

I’m going to talk about growing older in traditional societies. This subject constitutes just one chapter of my latest book, which compares traditional, small, tribal societies with our large, modern societies, with respect to many topics such as bringing up children, growing older, health, dealing with danger, settling disputes, religion and speaking more than one language.

Those tribal societies, which constituted all human societies for most of human history, are far more diverse than are our modern, recent, big societies. All big societies that have governments, and where most people are strangers to each other, are inevitably similar to each other and different from tribal societies. Tribes constitute thousands of natural experiments in how to run a human society. They constitute experiments from which we ourselves may be able to learn. Tribal societies shouldn’t be scorned as primitive and miserable, but also they shouldn’t be romanticized as happy and peaceful. When we learn of tribal practices, some of them will horrify us, but there are other tribal practices which, when we hear about them, we may admire and envy and wonder whether we could adopt those practices ourselves.

Most old people in the U.S. end up living separately from their children and from most of their friends of their earlier years, and often they live in separate retirements homes for the elderly, whereas in traditional societies, older people instead live out their lives among their children, their other relatives, and their lifelong friends. Nevertheless, the treatment of the elderly varies enormously among traditional societies, from much worse to much better than in our modern societies.

At the worst extreme, many traditional societies get rid of their elderly in one of four increasingly direct ways: by neglecting their elderly and not feeding or cleaning them until they die, or by abandoning them when the group moves, or by encouraging older people to commit suicide, or by killing older people. In which tribal societies do children abandon or kill their parents? It happens mainly under two conditions. One is in nomadic, hunter-gather societies that often shift camp and that are physically incapable of transporting old people who can’t walk when the able-bodied younger people already have to carry their young children and all their physical possessions. The other condition is in societies living in marginal or fluctuating environments, such as the Arctic or deserts, where there are periodic food shortages, and occasionally there just isn’t enough food to keep everyone alive. Whatever food is available has to be reserved for able-bodied adults and for children. To us Americans, it sounds horrible to think of abandoning or killing your own sick wife or husband or elderly mother or father, but what could those traditional societies do differently? They face a cruel situation of no choice. Their old people had to do it to their own parents, and the old people know what now is going to happen to them.

At the opposite extreme in treatment of the elderly, the happy extreme, are the New Guinea farming societies where I’ve been doing my fieldwork for the past 50 years, and most other sedentary traditional societies around the world. In those societies, older people are cared for. They are fed. They remain valuable. And they continue to live in the same hut or else in a nearby hut near their children, relatives and lifelong friends.

There are two main sets of reasons for this variation among societies in their treatment of old people. The variation depends especially on the usefulness of old people and on the society’s values.

First, as regards usefulness, older people continue to perform useful services. One use of older people in traditional societies is that they often are still effective at producing food. Another traditional usefulness of older people is that they are capable of babysitting their grandchildren, thereby freeing up their own adult children, the parents of those grandchildren, to go hunting and gathering food for the grandchildren. Still another traditional value of older people is in making tools, weapons, baskets, pots and textiles. In fact, they’re usually the people who are best at it. Older people usually are the leaders of traditional societies, and the people most knowledgeable about politics, medicine, religion, songs and dances.

Finally, older people in traditional societies have a huge significance that would never occur to us in our modern, literate societies, where our sources of information are books and the Internet. In contrast, in traditional societies without writing, older people are the repositories of information. It’s their knowledge that spells the difference between survival and death for their whole society in a time of crisis caused by rare events for which only the oldest people alive have had experience. Those, then, are the ways in which older people are useful in traditional societies. Their usefulness varies and contributes to variation in the society’s treatment of the elderly.

The other set of reasons for variation in the treatment of the elderly is the society’s cultural values. For example, there’s particular emphasis on respect for the elderly in East Asia, associated with Confucius’ doctrine of filial piety, which means obedience, respect and support for elderly parents. Cultural values that emphasize respect for older people contrast with the low status of the elderly in the U.S. Older Americans are at a big disadvantage in job applications. They’re at a big disadvantage in hospitals. Our hospitals have an explicit policy called age-based allocation of healthcare resources. That sinister expression means that if hospital resources are limited, for example if only one donor heart becomes available for transplant, or if a surgeon has time to operate on only a certain number of patients, American hospitals have an explicit policy of giving preference to younger patients over older patients on the grounds that younger patients are considered more valuable to society because they have more years of life ahead of them, even though the younger patients have fewer years of valuable life experience behind them. There are several reasons for this low status of the elderly in the U.S. One is our Protestant work ethic which places high value on work, so older people who are no longer working aren’t respected. Another reason is our American emphasis on the virtues of self-reliance and independence, so we instinctively look down on older people who are no longer self-reliant and independent. Still a third reason is our American cult of youth, which shows up even in our advertisements. Ads for Coca-Cola and beer always depict smiling young people, even though old as well as young people buy and drink Coca-Cola and beer. Just think, what’s the last time you saw a Coke or beer ad depicting smiling people 85 years old? Never. Instead, the only American ads featuring white-haired old people are ads for retirement homes and pension planning.

Well, what has changed in the status of the elderly today compared to their status in traditional societies? There have been a few changes for the better and more changes for the worse. Big changes for the better include the fact that today we enjoy much longer lives, much better health in our old age, and much better recreational opportunities. Another change for the better is that we now have specialized retirement facilities and programs to take care of old people. Changes for the worse begin with the cruel reality that we now have more old people and fewer young people than at any time in the past. That means that all those old people are more of a burden on the few young people, and that each old person has less individual value. Another big change for the worse in the status of the elderly is the breaking of social ties with age, because older people, their children, and their friends, all move and scatter independently of each other many times during their lives. We Americans move on the average every five years. Hence our older people are likely to end up living distant from their children and the friends of their youth. Yet another change for the worse in the status of the elderly is formal retirement from the workforce, carrying with it a loss of work friendships and a loss of the self-esteem associated with work. Perhaps the biggest change for the worse is that our elderly are objectively less useful than in traditional societies. Widespread literacy means that they are no longer useful as repositories of knowledge. When we want some information, we look it up in a book or we Google it instead of finding some old person to ask. The slow pace of technological change in traditional societies means that what someone learns there as a child is still useful when that person is old, but the rapid pace of technological change today means that what we learn as children is no longer useful 60 years later. And conversely, we older people are not fluent in the technologies essential for surviving in modern society. For example, as a 15-year-old, I was considered outstandingly good at multiplying numbers because I had memorized the multiplication tables and I know how to use logarithms and I’m quick at manipulating a slide rule. Today, though, those skills are utterly useless because any idiot can now multiply eight-digit numbers accurately and instantly with a pocket calculator. Conversely, I at age 75 am incompetent at skills essential for everyday life. My family’s first TV set in 1948 had only three knobs that I quickly mastered: an on-off switch, a volume knob, and a channel selector knob. Today, just to watch a program on the TV set in my own house, I have to operate a 41-button TV remote that utterly defeats me. I have to telephone my 25-year-old sons and ask them to talk me through it while I try to push those wretched 41 buttons.

What can we do to improve the lives of the elderly in the U.S., and to make better use of their value? That’s a huge problem. In my remaining four minutes today, I can offer just a few suggestions. One value of older people is that they are increasingly useful as grandparents for offering high-quality childcare to their grandchildren, if they choose to do it, as more young women enter the workforce and as fewer young parents of either gender stay home as full-time caretakers of their children. Compared to the usual alternatives of paid babysitters and day care centers, grandparents offer superior, motivated, experienced child care. They’ve already gained experience from raising their own children. They usually love their grandchildren, and are eager to spend time with them. Unlike other caregivers, grandparents don’t quit their job because they found another job with higher pay looking after another baby. A second value of older people is paradoxically related to their loss of value as a result of changing world conditions and technology. At the same time, older people have gained in value today precisely because of their unique experience of living conditions that have now become rare because of rapid change, but that could come back. For example, only Americans now in their 70s or older today can remember the experience of living through a great depression, the experience of living through a world war, and agonizing whether or not dropping atomic bombs would be more horrible than the likely consequences of not dropping atomic bombs. Most of our current voters and politicians have no personal experience of any of those things, but millions of older Americans do. Unfortunately, all of those terrible situations could come back. Even if they don’t come back, we have to be able to plan for them on the basis of the experience of what they were like. Older people have that experience. Younger people don’t.

The remaining value of older people that I’ll mention involves recognizing that while there are many things that older people can no longer do, there are other things that they can do better than younger people. A challenge for society is to make use of those things that older people are better at doing. Some abilities, of course, decrease with age. Those include abilities at tasks requiring physical strength and stamina, ambition, and the power of novel reasoning in a circumscribed situation, such as figuring out the structure of DNA, best left to scientists under the age of 30. Conversely, valuable attributes that increase with age include experience, understanding of people and human relationships, ability to help other people without your own ego getting in the way, and interdisciplinary thinking about large databases, such as economics and comparative history, best left to scholars over the age of 60. Hence older people are much better than younger people at supervising, administering, advising, strategizing, teaching, synthesizing, and devising long-term plans. I’ve seen this value of older people with so many of my friends in their 60s, 70s, 80s and 90s, who are still active as investment managers, farmers, lawyers and doctors. In short, many traditional societies make better use of their elderly and give their elderly more satisfying lives than we do in modern, big societies.

Paradoxically nowadays, when we have more elderly people than ever before, living healthier lives and with better medical care than ever before, old age is in some respects more miserable than ever before. The lives of the elderly are widely recognized as constituting a disaster area of modern American society. We can surely do better by learning from the lives of the elderly in traditional societies. But what’s true of the lives of the elderly in traditional societies is true of many other features of traditional societies as well. Of course, I’m not advocating that we all give up agriculture and metal tools and return to a hunter-gatherer lifestyle. There are many obvious respects in which our lives today are far happier than those in small, traditional societies. To mention just a few examples, our lives are longer, materially much richer, and less plagued by violence than are the lives of people in traditional societies. But there are also things to be admired about people in traditional societies, and perhaps to be learned from them. Their lives are usually socially much richer than our lives, although materially poorer. Their children are more self-confident, more independent, and more socially skilled than are our children. They think more realistically about dangers than we do. They almost never die of diabetes, heart disease, stroke, and the other noncommunicable diseases that will be the causes of death of almost all of us in this room today. Features of the modern lifestyle predispose us to those diseases, and features of the traditional lifestyle protect us against them.

Those are just some examples of what we can learn from traditional societies. I hope that you will find it as fascinating to read about traditional societies as I found it to live in those societies.

Thank you.

LeetCode - Algorithms - 977. Squares of a Sorted Array

Problem

977. Squares of a Sorted Array

Java

1

1
2
3
4
5
6
7
8
9
10
11
class Solution {
public int[] sortedSquares(int[] A) {
int tmp = 0;
for(int i=0;i<A.length;i++) {
tmp = A[i];
A[i]=tmp*tmp;
}
Arrays.sort(A);
return A;
}
}

Submission Detail

  • 132 / 132 test cases passed.
  • Runtime: 2 ms, faster than 72.59% of Java online submissions for Squares of a Sorted Array.
  • Memory Usage: 41.6 MB, less than 24.34% of Java online submissions for Squares of a Sorted Array.

Two Pointer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class Solution {
public int[] sortedSquares(int[] A) {
final int N = A.length;
if (A[0] >= 0) {
int tmp = 0;
for (int i = 0; i < N; i++) {
tmp = A[i];
A[i] = tmp * tmp;
}
return A;
} else {
int[] r = new int[N];
int left = 0, right = 0;
int k = N - 1;
for (int i = 0, j = N - 1; i <= j; ) {
left = A[i] * A[i];
right = A[j] * A[j];
if (left < right) {
j--;
r[k--] = right;
} else {
i++;
r[k--] = left;
}
}
return r;
}
}
}

Submission Detail

  • 132 / 132 test cases passed.
  • Runtime: 1 ms, faster than 100.00% of Java online submissions for Squares of a Sorted Array.
  • Memory Usage: 41.2 MB, less than 73.53% of Java online submissions for Squares of a Sorted Array.

3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class Solution {
public int[] sortedSquares(int[] A) {
final int N = A.length;
if (A[0] >= 0) {
int tmp = 0;
for (int i = 0; i < N; i++) {
tmp = A[i];
A[i] = tmp * tmp;
}
return A;
} else if (A[N - 1] <= 0) {
int[] r = new int[N];
for (int i = 0; i < N; i++) {
r[i] = A[N - 1 - i] * A[N - 1 - i];
}
return r;
} else {
int[] r = new int[N];
int left = 0, right = 0;
int k = N - 1;
for (int i = 0, j = N - 1; i <= j; ) {
left = A[i] * A[i];
right = A[j] * A[j];
if (left < right) {
j--;
r[k--] = right;
} else {
i++;
r[k--] = left;
}
}
return r;
}
}
}

Submission Detail

  • 132 / 132 test cases passed.
  • Runtime: 1 ms, faster than 100.00% of Java online submissions for Squares of a Sorted Array.
  • Memory Usage: 41.3 MB, less than 62.05% of Java online submissions for Squares of a Sorted Array.

4

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Solution {
public int[] sortedSquares(int[] A) {
final int N = A.length;
int[] r = new int[N];
int left = 0, right = 0;
int k = N - 1;
for (int i = 0, j = N - 1; i <= j; ) {
left = A[i] * A[i];
right = A[j] * A[j];
if (left < right) {
j--;
r[k--] = right;
} else {
i++;
r[k--] = left;
}
}
return r;
}
}

Submission Detail

  • 132 / 132 test cases passed.
  • Runtime: 1 ms, faster than 100.00% of Java online submissions for Squares of a Sorted Array.
  • Memory Usage: 41 MB, less than 85.39% of Java online submissions for Squares of a Sorted Array.