0%

The Pragmatic Programmer Quick Reference Guide

  1. 关心你的技艺
    Care About Your Craft
    如果你不在乎能否漂亮地开发出软件,你又为何要耗费生命去开发软件呢?

  2. 思考!你的工作
    Think!About Your Work
    关掉自动驾驶,接管操作,不断地批评和评估你的工作

  3. 提供各种选择,不要找蹩脚的借口
    Provide Options, Don’t Make Lame Excuses
    要提供各种选择,而不是找借口,不要说事情做不到,说明能够做什么

  4. 不要容忍破窗户
    Don’t Live with Broken Windows
    当你看到糟糕的设计、错误的决策和糟糕的代码时,修正它们

  5. 做变化的催化剂
    Be a Catalyst for Change
    你不能强迫人们改变。相反,要向他们展示未来可能会怎样,并帮助他们参与对未来的创造

  6. 记住大图景
    Remember the Big Picture
    不要太过专注于细节,已忘了查看周围正在发生什么

Read more »

1. GET KAFKA

Download the latest Kafka release and extract it:

1
2
$ tar -xzf kafka_2.13-3.2.1.tgz
$ cd kafka_2.13-3.2.1

2.START THE KAFKA ENVIRONMENT

NOTE: Your local environment must have Java 8+ installed.

Run the following commands in order to start all services in the correct order:

1
2
3
# Start the ZooKeeper service
# Note: Soon, ZooKeeper will no longer be required by Apache Kafka.
$ bin/zookeeper-server-start.sh config/zookeeper.properties

Open another terminal session and run:

1
2
# Start the Kafka broker service
$ bin/kafka-server-start.sh config/server.properties

Once all services have successfully launched, you will have a basic Kafka environment running and ready to use.

Read more »

1. What is event streaming?

Event streaming is the digital equivalent of the human body’s central nervous system. It is the technological foundation for the ‘always-on’ world where businesses are increasingly software-defined and automated, and where the user of software is more software.

事件流是人体中枢神经系统的数字等效物。它是”永远在线”世界的技术基础,在这个世界中,企业越来越多地由软件定义和自动化,并且软件的用户更多地是软件。

Technically speaking, event streaming is the practice of capturing data in real-time from event sources like databases, sensors, mobile devices, cloud services, and software applications in the form of streams of events; storing these event streams durably for later retrieval; manipulating, processing, and reacting to the event streams in real-time as well as retrospectively; and routing the event streams to different destination technologies as needed. Event streaming thus ensures a continuous flow and interpretation of data so that the right information is at the right place, at the right time.

从技术上讲,事件流是从事件源(如数据库、传感器、移动设备、云服务和软件应用程序)以事件流的形式实时捕获数据的实践;持久存储这些事件流以供以后检索;实时和回顾性地操作、处理和响应事件流;并根据需要将事件流路由到不同的目标技术。因此,事件流确保了数据的连续流动和解释,以便正确的信息在正确的时间出现在正确的位置。

Read more »

# Problems Difficulty Solutions
1 Two Sum Easy Two Sum
2 Add Two Sum Medium Add Two Number
3 Longest Substring Without Repeating Characters Medium Longest Substring Without Repeating Characters
4 Median of Two Sorted Arrays Hard Median of Two Sorted Arrays
5 Longest Palindromic Substring Medium Longest Palindromic Substring
10 Regular Expression Matching Hard Regular Expression Matching
12 Integer to Roman Medium Integer to Roman
22 Generate Parentheses Medium Generate Parentheses
39 Combination Sum Medium Combination Sum
42 Trapping Rain Water Hard Trapping Rain Water
90 Subsets II Medium Subsets II
94 Binary Tree Inorder Traversal Medium Binary Tree Inorder Traversal(简书)
108 Convert Sorted Array to Binary Search Tree Medium Convert Sorted Array to Binary Search Tree
122 Best Time to Buy and Sell Stock II Medium Best Time to Buy and Sell Stock II
136 Single Number Medium Single Number(简书)
144 Binary Tree Preorder Traversal Medium Binary Tree Preorder Traversal
167 Two Sum II - Input array is sorted Medium Two Sum II - Input array is sorted
238 Product of Array Except Self Medium Product of Array Except Self(简书)
260 Single Number III Medium Single Number III(简书)
268 Missing Number Medium Missing Number
309 Best Time to Buy and Sell Stock with Cooldown Medium Best Time to Buy and Sell Stock with Cooldown
318 Maximum Product of Word Lengths Medium Maximum Product of Word Lengths(简书)
319 Bulb Switcher Medium Bulb Switcher(简书)
338 Counting Bits Medium Counting Bits(简书)
343 Integer Break Medium Integer Break(简书)
347 Top K Frequent Elements Medium Top K Frequent Elements(简书)
357 Count Numbers with Unique Digits Medium Count Numbers with Unique Digits
377 Combination Sum IV Medium Combination Sum IV
492 Construct the Rectangle Easy Construct the Rectangle
530 Minimum Absolute Difference in BST Easy Minimum Absolute Difference in BST
535 Encode and Decode TinyURL Medium Encode and Decode TinyURL
599 Minimum Index Sum of Two Lists Easy Minimum Index Sum of Two lists
606 Construct String from Binary Tree Easy Construct String from Binary Tree
进度

Github

https://github.com/eazow/leetcode

作者

Eazow

版本

0.3.0.0

He put on his goggles, fitted them tight, tested the vacuum. His hands were shaking. Then he chose the biggest stone he could carry and slipped over the edge of the rock until half of him was in the cool, enclosing water and half in the hot sun. He looked up once at the empty sky, filled his lungs once, twice, and then sank fast to the bottom with the stone. He let it go and began to count. He took the edges of the hole in his hands and drew himself into it, wriggling his shoulders in sideways as he remembered he must, kicking himself along with his feet.

Soon he was clear inside. He was in a small rock-bound hole filled with yellowish-gray water. The water was pushing him up against the roof. The roof was sharp and pained his back. He pulled himself along with his hands — fast, fast — and used his legs as levers. His head knocked against something; a sharp pain dizzied him. Fifty, fifty-one, fifty-two… He was without light, and the water seemed to press upon him with the weight of rock. Seventy-one, seventy-two… There was no strain on his lungs. He felt like an inflated balloon, his lungs were so light and easy, but his head was pulsing.

He was being continually pressed against the sharp roof, which felt slimy as well as sharp. Again he thought of octopuses, and wondered if the tunnel might be filled with weed that could tangle him. He gave himself a panicky, convulsive kick forward, ducked his head, and swam. His feet and hands moved freely, as if in open water. The hole must have widened out. He thought he must be swimming fast, and he was frightened of banging his head if the tunnel narrowed.

A hundred, a hundred and one… The water paled. Victory filled him. His lungs were beginning to hurt. A few more strokes and he would be out. He was counting wildly; he said a hundred and fifteen and then, a long time later, a hundred and fifteen again. The water was a clear jewel-green all around him. Then he saw, above his head, a crack running up through the rock. Sunlight was falling through it, showing the clean dark rock of the tunnel, a single mussel shell, and darkness ahead.

He was at the end of what he could do. He looked up at the crack as if it were filled with air and not water, as if he could put his mouth to it to draw in air. A hundred and fifteen, he heard himself say inside his head — but he had said that long ago. He must go on into the blackness ahead, or he would drown. His head was swelling, his lungs cracking. A hundred and fifteen, a hundred and fifteen pounded through his head, and he feebly clutched at rocks in the dark, pulling himself forward, leaving the brief space of sunlit water behind. He felt he was dying. He was no longer quite conscious. He struggled on in the darkness between lapses into unconsciousness. An immense, swelling pain filled his head, and then the darkness cracked with an explosion of green light. His hands, groping forward, met nothing; and his feet, kicking back, propelled him out into the open sea.

How does the older investor differ in his approach to investment from the younger investor?

There is no shortage of tipsters around offering “get-rich-quick” opportunities.

But if you are a serious private investor, leave the Las Vegas mentality to those with money to fritter.

The serious investor needs a proper “portfolio“ - a well-planned selection of investments, with a definite structure and a clear aim.

But exactly how does a newcomer to the stock market go about achieving that?

Well, if you go to five reputable stockbrokers and ask them what you should do with your money, you’re likely to get five different answers, — even if you give all the relevant information about your age, family, finances and what you want from your investments.

Moral? There is no one “right” way to structure a portfolio.

However, there are undoubtedly some wrong ways, and you can be sure that none of our five advisers would have suggested sinking all (or perhaps any) of your money into Periwigs*.

So what should you do? We’ll assume that you have sorted out the basics — like mortgages, pensions, insurance and access to sufficient cash reserves.

You should then establish your own individual aims.

These are partly a matter of personal circumstances, partly a matter of psychology.

For instance, if you are older you have less time to recover from any major losses, and you may well wish to boost your pension income.

So preserving your capital and generating extra income are your main priorities.

In this case, you’d probably construct a portfolio with some shares (but not high risk ones), along with gilts, cash deposits, and perhaps convertibles or the income shares of split capital investment trusts.

If you are younger, and in a solid financial position, you may decide to take an aggressive approach — but only if you’re blessed with a sanguine disposition and won’t suffer sleepless nights over share prices.

If you recognize yourself in this description, you might include a couple of heady growth stocks in your portfolio, alongside your more pedestrian investments.

Once you have decided on your investment aims, you can then decide where to put your money.

The golden rule here is “spread your risk” — if you put all of your money into Periwigs International, you’re setting yourself up as a hostage to fortune.

“Periwigs” is the name of a fictitious company.

What is one of the features of modern camping where nationality is concerned?

Economy is one powerful motive for camping, since after the initial outlay upon equipment, or through hiring it, the total expense can be far less than the cost of hotels.

But, contrary to a popular assumption, it is far from being the only one, or even the greatest.

The man who manoeuvres carelessly into his twenty pounds’ worth of space at one of Europe’s myriad permanent sites may find himself bumping a Bentley.

More likely, Ford Escort will be hub to hub with Renault or Mercedes, but rarely with bicycles made for two.

That the equipment of modern camping becomes yearly more sophisticated is an entertaining paradox for the cynic, a brighter promise for the hopeful traveler who has sworn to get away from it all.

It also provides—and some student sociologist might care to base his thesis upon the phenomenon—an escape of another kind.

The modern traveller is often a man who dislikes the Splendide and the Bellavista, not because he cannot afford, or shuns their material comforts, but because he is affraid of them.

Affluent he may be, but he is by no means sure what to tip the doorman or the chambermaid.

Master in his own house, he has little idea of when to say boo to a maitre d’hotel.

From all such fears camping releases him.

Granted, a snobbery of camping itself, based upon equipment and techniques, already exists; but it is of a kind that, if he meets it, he can readily understand and deal with.

There is no superior ‘they’ in the shape of managements and hotel hierarchies to darken his holiday days.

To such motives, yet another must be added.

The contemporary phenomenon of car worship is to be explained not least by the sense of independence and freedom that ownership entails.

To this pleasure camping gives an exquisite refinement.

From one’s own front door to home or foreign hills or sands and back again, everything is to hand.

Not only are the means of arriving at the holiday paradise entirely within one’s own command and keeping, but the means of escape from holiday hell(if the beach proves too crowded, the local weather too inclement) are there, outside—or, as likely, part of—the tent.

Idealists have objected to the practice of camping, as to the package tour, that the traveller abroad thereby denies himself the opportunity of getting to know the people of the country visited.

Insularity and self-containment, it is argued, go hand in hand.

The opinion does not survive experience of a popular Continental camping place.

Holiday hotels tend to cater for one nationality of visitors especially, sometimes exclusively.

Camping sites, by contrast, are highly cosmopolitan.

Granted, a preponderance of Germans is a characteristic that seems common to most Mediterranean sites; but as yet there is no overwhelmingly specialized patronage.

Notices forbidding the open-air drying of clothes, or the use of water points for car washing, or those inviting “our camping friends” to a dance or a boat trip are printed not only in French or Italian or Spanish, but also in English, German and Dutch.

At meal times the odour of sauerkraut vies with that of garlic.

The Frenchman’s breakfast coffee competes with the Englishman’s bacon and eggs.

Whether the remarkable growth of organized camping means the eventual death of the more independent kind is hard to say.

Municipalities naturally want to secure the campers’ site fees and other custom.

Police are wary of itinerants who cannot be traced to a recognized camp boundary or to four walls.

But most probably it will all depend upon campers themselves: how many heath fires they cause; how much litter they leave; in short, whether or not they wholly alienate landowners and those who live in the countryside.

Only good scouting is likely to preserve the freedoms so dear to the heart of the eternal Boy Scout.

Who, according to the author, are ‘Fortune’s favoured children’?

A gifted American psychologist has said, ‘Worry is a spasm of the emotion; the mind catches hold of something and will not let it go.’

It is useless to argue with the mind in this condition.

The stronger the will, the more futile the task.

One can only gently insinuate something else into its convulsive grasp.

And if this something else is rightly chosen, if it really attended by the illumination of another field of interest, gradually, and often quite swiftly, the old undue grip relaxes and the process of recuperation and repair begins.

The cultivation of a hobby and new forms of interest is therefore a policy of the first importance to a public man.

But this is not a business that can be undertaken in a day or swiftly improvised by a mere command of the will.

The growth of alternative mental interests is a long process.

The seeds must be carefully chosen; they must fall on good ground; they must be sedulously tended, if the vivifying fruits are to be at hand when needed.

To be really happy and really safe, one ought to have at least two or three hobbies, and they must all be real.

It is no use starting late in life to say: “I will take an interest in this or that.”

Such an attempt only aggravates the strain of mental effort.

A man may acquire great knowledge of topics unconnected with his daily work, and yet get hardly any benefit or relief.

It is no use doing what you like; you have got to like what you do.

Broadly speaking, human beings may be divided into three classes: those who are toiled to death, those who are worried to death, and those who are bored to death.

It is no use offering the manual laborer, tired out with a hard week’s sweat and effort, the chance of playing a game of football or baseball on Saturday afternoon.

It is no use inviting the politician or the professional or business man, who has been working or worrying about serious things for six days, to work or worry about trifling things at the weekend.

As for the unfortunate people who can command everything they want, who can gratify every caprice and lay their hands on almost every object of desire—for them a new pleasure, a new excitement if only an additional satiation.

In vain they rush frantically round from place to place, trying to escape from avenging boredom by mere clatter and motion.

For them discipline in one form or another is the most hopeful path.

It may also be said that rational, industrious, useful human being are divided into two classes: first, those whose work is work and whose pleasure is pleasure; and secondly, those whose work and pleasure are one.

Of these the former are the majority.

They have their compensations.

The long hours in the office or the factory bring with them as their reward, not only the means of sustenance, but a keen appetite for pleasure even in its simplest and most modest forms.

But Fortune’s favoured children belong to the second class.

Their life is a natural harmony.

For them the working hours are never long enough.

Each day is a holiday, and ordinary holidays, when they come, are grudged as enforced interruptions in an absorbing vocation.

Yet to both classes, the need of an alternative outlook, of a change of atmosphere, of a diversion of effort, is essential.

Indeed, it may well be that those whose work is their pleasure are those who most need the means of banishing it at intervals from their minds.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
Easter Egg
1
>>> import this

How does the writer describe sport at the international level?

I am always amazed when I hear people saying that sport create goodwill between nations, and that if only the common peoples of the world could meet one another at football or cricket, they would have no inclination to meet on the battle field. Even if one didn’t know from concrete examples (the 1936 Olympic Games, for instance) that international sporting contests lead to orgies of hatred, one could deduce it from general principles.

Nearly all the sports practised nowadays are competitive. You play to win, and the game has little meaning unless you do your utmost to win. On the village green, where you pick up sides and no feeling of local patriotism is involved, it is possible to play simply for the fun and exercise: but as soon as the question of prestige arises, as soon as you feel that you and some larger unit will be disgraced if you lose, the most savage combative instincts are aroused. Anyone who has played even in a school football match knows this. At the international level, sport is frankly mimic warfare. But the significant thing is not the behavior of the players but the attitude of the spectators; and, behind the spectators, of the nations who work themselves into feries over these absurd contests, and seriously believe—at any rate for short periods—that running, jumping and kicking a ball are tests of national virtue.