20100831

闭包

闭包

读 The Little Schemer

* pp. 137开始。递归太复杂。

** [http://www.michaelharrison.ws/weblog/?p=34]
:
: (define multirember&co
: (lambda (a lat col)
: (cond
: ((null? lat)
: (col '() '()))
: ((eq? (car lat) a)
: (multirember&co a
: (cdr lat)
: (lambda (newlat seen)
: (col newlat
: (cons (car lat) seen)))))
: (else
: (multirember&co a
: (cdr lat)
: (lambda (newlat seen)
: (col (cons (car lat) newlat)
: seen)))))))


基于closures的解释,参见文献[1]。

** 文献[2]提到,可以用Dr.Scheme 语言Pretty Big的debug观察。

实验。定义multirember&co以后。Dr.Scheme, Pretty Big.
: >(define foo
: (lambda (x y)
: (length x)))
:
: > (multirember&co 'tuna '(tuna aa bb cc) foo)
: 3

** 尝试用drscheme"展开"闭包,不支持;求助刘典,用display显示变量,不够直观,只能显示应用求值,不能显示代换的过程。

** QUOTE 手动
: (define multirember&co
: (lambda (a lat col)
: (cond
: ((null? lat)
: (col '() '()))
: ((eq? (car lat) a)
: (multirember&co a
: (cdr lat)
: (lambda (newlat seen)
: (col newlat
: (cons (car lat) seen)))))
: (else
: (multirember&co a
: (cdr lat)
: (lambda (newlat seen)
: (col (cons (car lat) newlat)
: seen)))))))
: (define foo
: (lambda (x y)
: (length x)))
:
: ultirember&co 'tuna '(tuna aa bb cc) foo)

substitute:

The arguments of calling multirember&co:
| calling | current lat | col | col, substituted a and lat
| col, substituted lambda |
| multirember&co | | |
| |
|----------------+-----------------+-----+----------------------------+-------------------------|
| 1st round | (tuna aa bb cc) | col | /
| lambda (x y)(length x) |


The arguments of calling multirember&co:
| calling | current lat | col, before substitution
| col, substituted a and lat
| col, substituted lambda
|
| multirember&co | |
|
|
|
|----------------+-----------------+---------------------------------------------------------+----------------------------------------------------------------------+-------------------------------------------------------------------------------------------|
| 2nd round | (tuna aa bb cc) | lambda (newlat seen) (col newlat
(cons (car lat) seen)) | lambda (newlat seen) (col newlat (cons (car
'(tuna aa bb cc)) seen)) | lambda (newlat seen) ((lambda (x y)(length
x)) newlat (cons (car '(tuna aa bb cc)) seen)) |

Note:

In the expression
: lambda (newlat seen) (col newlat (cons (car lat) seen))
lat is (tuna aa bb cc), insetead of (aa bb cc).
The substitution happens before multirember&co is called,
so the lat is the original one without cdr applying.
Sic passim.

End of the note.

The col
lambda (newlat seen) ((lambda (x y)(length x)) newlat (cons (car
'(tuna aa bb cc)) seen))
is from:
lambda (newlat seen)
((lambda (x y)(length x))
newlat
(cons (car '(tuna aa bb cc)) seen))

The arguments of calling multirember&co:
| calling | current lat | col, before substitution
| col, substituted a and lat
| col, substituted lambda

|
| multirember&co | |
|
|

|
|----------------+-------------+---------------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------|
| 3rd round | (aa bb cc) | lambda (newlat seen) (col (cons (car
lat) newlat) seen) | lambda (newlat seen) (col (cons (car '(aa bb cc))
newlat) seen) | lambda (newlat seen) ((lambda (newlat seen) ((lambda
(x y)(length x)) newlat (cons (car '(tuna aa bb cc)) seen))) (cons
(car '(aa bb cc)) newlat) seen) |

The col
lambda (newlat seen) ((lambda (newlat seen) ((lambda (x y)(length x))
newlat (cons (car '(aa bb cc)) seen))) (cons (car '(bb cc)) newlat)
seen)
is from:
lambda (newlat seen)
((lambda (newlat seen) ((lambda (x y)(length x)) newlat (cons (car
'(aa bb cc)) seen)))
(cons (car '(aa bb cc)) newlat)
seen)

The arguments of calling multirember&co:
| calling | current lat | col, before substitution
| col, substituted a and lat
| col, substituted lambda


|
| multirember&co | |
|
|


|
|----------------+-------------+---------------------------------------------------------+--------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 4th round | (bb cc) | lambda (newlat seen) (col (cons (car
lat) newlat) seen) | lambda (newlat seen) (col (cons (car '(bb cc))
newlat) seen) | lambda (newlat seen) ((lambda (newlat seen) ((lambda
(newlat seen) ((lambda (x y)(length x)) newlat (cons (car '(tuna aa bb
cc)) seen))) (cons (car '(aa bb cc)) newlat) seen)) (cons (car '(bb
cc)) newlat) seen) |

The col
lambda (newlat seen) ((lambda (newlat seen) ((lambda (newlat seen)
((lambda (x y)(length x)) newlat (cons (car '(tuna aa bb cc)) seen)))
(cons (car '(aa bb cc)) newlat) seen)) (cons (car '(bb cc)) newlat)
seen)
is from:
lambda (newlat seen)
((lambda (newlat seen) ((lambda (newlat seen) ((lambda (x y)(length
x)) newlat (cons (car '(tuna aa bb cc)) seen))) (cons (car '(aa bb
cc)) newlat) seen))
(cons (car '(bb cc)) newlat)
seen)

The arguments of calling multirember&co:
| calling | lat | col, before substitution
| col, substituted a and lat
| col, substituted lambda |
| multirember&co | for multirember&co |
|
| |
|----------------+---------------------+---------------------------------------------------------+-----------------------------------------------------------+-------------------------|
| 5th round | (cc) | lambda (newlat seen) (col
(cons (car lat) newlat) seen) | lambda (newlat seen) (col (cons (car
'(cc)) newlat) seen) | |


The col
lambda (newlat seen) ((lambda (newlat seen) ((lambda (newlat seen)
((lambda (newlat seen) ((lambda (x y)(length x)) newlat (cons (car
'(tuna aa bb cc)) seen))) (cons (car '(aa bb cc)) newlat) seen)) (cons
(car '(bb cc)) newlat) seen)) (cons (car '(cc)) newlat) seen)
is from:
lambda (newlat seen)
((lambda (newlat seen) ((lambda (newlat seen) ((lambda (newlat seen)
((lambda (x y)(length x)) newlat (cons (car '(tuna aa bb cc)) seen)))
(cons (car '(aa bb cc)) newlat) seen)) (cons (car '(bb cc)) newlat)
seen))
(cons (car '(cc)) newlat)
seen)

There is no 6th round of calling multirember&co, because of cond fullfilled.

: ((null? lat)
: (col '() '()))

Current lat is (cdr '(cc)), as '().

The procedure col has been subsitituted in the previous steps to be
: lambda (newlat seen) ((lambda (newlat seen) ((lambda (newlat seen)
((lambda (newlat seen) ((lambda (x y)(length x)) newlat (cons (car
'(tuna aa bb cc)) seen))) (cons (car '(aa bb cc)) newlat) seen)) (cons
(car '(bb cc)) newlat) seen)) (cons (car '(cc)) newlat) seen)

Eval (applying '() '() as arguements on col);

(col '() '())
=>
((lambda (newlat seen) ((lambda (newlat seen) ((lambda (newlat seen)
((lambda (newlat seen) ((lambda (x y)(length x)) newlat (cons (car
'(tuna aa bb cc)) seen))) (cons (car '(aa bb cc)) newlat) seen)) (cons
(car '(bb cc)) newlat) seen)) (cons (car '(cc)) newlat) seen))
'()
'()
)

* 参考文献

[1] [http://www.michaelharrison.ws/weblog/?p=34]

Unpacking multirember&co from TLS The purpose of The Little Schemer,
its authors profess, is to teach you to think recursively, and to do
so without presenting too much math or too many computer science
concepts. The book is a ball to read. However, from the perspective of
this reader, who is fairly new to functional programming and totally
new to Scheme, the book gets almost asymptotically more difficult and
complicated towards the end of chapter 8, when we hit the function
multirember&co. Looking around on the web, I noticed quite a few
people had also hit this speed bump and were scratching their heads
about how to go on. I think I can offer some assistance. So, as
threatened yesterday, I now unveil my initial contribution to the wild
world of Lisp, my explication of multirember&co and the concept of
currying. Here's hoping I don't embarrass myself too much.


The Little Schemer, (hereafter "TLS") is the latest iteration of The
Little LISPer, and is presented as a dialogue between teacher and
student. If you take the roll of the student, and try to answer the
teacher's questions, especially those of the form "define this
function whose behavior we've been describing," you can really flex
your neurons. Each chapter is a little more complicated than the
previous, and within each chapter the questions get slightly harder as
you go. It's like walking up a steadily graded hill. Until you get to
page 137 and they hit you with a long function definition, for a
function you've never seen before, and they ask, "What does this do?"

Yikes!

Here is the code for the function. (Thank you, Geoffrey King, for
transcribing it in your post.)

(define multirember&co
(lambda (a lat col)
(cond
((null? lat)
(col '() '()))
((eq? (car lat) a)
(multirember&co a
(cdr lat)
(lambda (newlat seen)
(col newlat
(cons (car lat) seen)))))
(else
(multirember&co a
(cdr lat)
(lambda (newlat seen)
(col (cons (car lat) newlat)
seen)))))))

The first clue to dealing with this function is its context. The
previous pages of TLS deal with currying, in which you define a
function like (lambda (x) (lambda(y) (eq? x y) )) — it takes one
argument, parameter x, and then returns the inner function, which also
takes one argument, parameter y. The value you pass as x acts to
customize the inner function by binding the occurance of variable x in
the inner function to the value you passed in. So chapter 8 is about
the practice of wrapping functions in this way.

The chapter is also about passing functions as arguments. The first
line of multirember&co, (lambda (a lat col) defines three
parameters. The variables 'a' and 'lat' are by convention used for an
atom and a list of atoms. But 'col' is a function–you have to pass
multirember&co a function that it uses inside its own definition.

TLS admits that multirember&co is complicated. "That looks really
complicated!" says the student. But it seeks to simplify the function
by defining functions to stand in for a) the function that will be
passed as 'col'; b) the first inner function defined in the cond
branch (eq? (car lat) a); and c) the inner function defined in the
cond else branch. To try to make you feel better about being up to
your eyelids in deep water, the TLS authors give their functions
friendly names, like "a-friend" and "next-friend." But I prefer names
that tell me what roll the functions play, so here are my renamed
functions:

a) the function that will be passed initially as 'col' (and will be
executed last):

(define last-function
(lambda(x y) (length x)))

b) the function called when a matches (car lat):

(define when-match
(lambda (newlat seen) (col newlat (cons (car lat) seen)))

c) the function called when the cond else branch executes:

(define when-differ
(lambda (newlat seen) (col (cons (car lat) newlat) seen))

TLS walks you through an execution of multirember&co, and so will
I. To further simplify things, and reduce the amount of typing I have
to do, I'll change the example in the book. Instead of a four-word lat
with some longer words, let's use (berries tuna fish) for our list,
and we'll keep tuna as our atom argument.

Here's multirember&co, with the two inner functions replaced by the
pre-defined helper functions:

(define multirember&co
(lambda (a lat col)
(cond
((null? lat)
(col '() '()))
((eq? (car lat) a)
(multirember&co a
(cdr lat)
(when-match)))
(else
(multirember&co a
(cdr lat)
(when-differ))))))

When the function is called the first time, a is tuna, lat is (berries
tuna fish), and col is last-function. (car lat) is berries, which does
NOT eq tuna, so the else branch executes: multirember&co is called
with tuna as a, (tuna fish) as lat because we pass (cdr lat) and so we
lose the berries atom at the front of the list, and when-differ as
col.

But wait. Actually, we're not just passing the when-differ function we
defined above. Here is that definition:

(lambda (newlat seen) (col (cons (car lat) newlat) seen))

This definition contains a variable, lat, that has a value at the time
multirember&co is called recursively: (berries tuna fish). So (car
lat) is (quote berries). What we've got here is a version, or an
instance, of when-differ that has a value bound to one of its
variables.

This is like currying, this binding of values to the variable of a
function and then using this altered function to do something. I think
that currying, however, refers to wrapping functions so that only one
variable at a time is given a value. What this apparent creation of a
specific instance of the function when-differ DOES have in common with
currying is this: both use closures to encapsulate the instance of the
function with bound variables, or, to be precise, to make a copy of
the function with its own scope that will persist so long as there are
references to the closure. I didn't realize this on my own, of
course. I owe this insight to Richard P. Gabriel's essay The Why of Y,
which you can read in this Dr. Dobb's article or download as a PDF.

There's something else in when-differ that will bind to a value:
col. The function passed, remember, is last-function. So we can (and
should) substitute that in for col.

Let's give a unique name to the instance (technically the closure) of
the function when-differ that has these two values bound to it:
when-differ-1. Let's write it out, and set it aside for later use:

(define when-differ-1
(lambda (newlat seen) (last-function (cons (quote berries) newlat) seen))
)

Now, on to iteration two, which we can summarize like this:

(multirember&co (quote tuna) (tuna fish) when-differ-1)

OK, so this time, (eq? (car lat) a) yields true, and the other branch
of the condexecutes: multirember&co is called with tuna as a, (fish)
as lat, and when-match as col. Once again, thanks to currying, the
definition of when-match contains expressions to which values are
bound:(car lat), which becomes (quote tuna) , and col, which becomes
when-differ-1. Remember, we just recurred by calling multirember&co
with when-differ-1 as the function argument for the parameter col. So
now let's define the resulting instance of when-match as when-match-1:

(define when-match-1
(lambda (newlat seen) (when-differ-1 newlat (cons (quote tuna) seen)))
)

On on to iteration three–we're nearly there–which we can summarize
like this:

(multirember&co (quote tuna) (fish) when-match-1)

This time, tuna and fish don't match, which means we're going to recur
with another version of when-differ, when-differ-2:

(define when-differ-2
(lambda (newlat seen) (when-match-1 (cons (quote fish) newlat) seen))
)

Finally, iteration four:
(multirember&co (quote tuna) () when-differ-2)

This time lat is an empty list, which means (null? lat) is true, and
the terminating line (col (quote()) (quote())) is executed. Yay! We're
done!

Except…

The result of the completed execution (col (quote()) (quote())) has to
be evaluated. Here's where everything turns inside out, or rightside
out if you like.

First of all, the value of col in the final iteration was
when-differ-2. So we'll start there.

(when-differ-2 (quote()) (quote()))

Now, look back up and get the definition of when-differ-2 and
substitute it.

((lambda (newlat seen) (when-match-1 (cons (quote
fish) newlat) seen)) (quote()) (quote()))

OK, so the parameters newlat and seen both get assigned the value of
an empty list:

(when-match-1 (cons (quote fish) (quote())) (quote()))

We can simplify this by consing fish onto the empty list:

(when-match-1 (fish) (quote()))

We have a definition for when-match-1 too. Let's substitute that in now.

((lambda (newlat seen) (when-differ-1 newlat (cons (quote tuna)
seen))) (fish) (quote())) )

And again assign values, this time (fish) and () to newlat and seen:
(when-differ-1 (fish) (tuna))

We're getting somewhere now. Do you see how at each step we're consing
a value onto either seen or newlat? seen has gotten the instance of
tuna, which was the atom we passed to multirember&co at the start,
whereas newlat has gotten the other atom, fish. Guess where berries is
going to go when we get to it.

Now, let's substitute our definition of when-differ-1:

((lambda (newlat seen) (last-function (cons (quote berries) newlat)
seen)) (fish) (tuna))

Which becomes….
(last-function (berries fish) (tuna) )

And now we're back where we started, with last-function.

( (lambda(x y) (length x)) (berries fish) (tuna) )

(length (berries fish) )

2

So that's how multirember&co works. What does it accomplish? It seems
to separate occurrences of the atom a in the list of atoms lat from
the other atoms in lat, and then it executes last-function using the
list of occurrences and the list of other atoms.

In an imperative language like C or Java, you would probably define
two variables, one for each list, and then loop through the list of
atoms, testing each element in the list for equality with a, and then
pushing the element onto either of the two lists. Finally, you would
call the final function with the two lists you built.

Consider the differences in this approach. Throughout the loop, you
have several variables remaining in scope, which means you have an
opportunity to munge one of them accidentally. Also, how modular is
this hypothetical code? In C, you could pass the last-function
function as an argument to a procedure that encapsulates the loop, but
try it in Java. No sir, in Java you'd have to call a method to get the
two lists (which would have to come back wrapped into one object,
probably a String[] array) and then call last-function with returnval[
0 ] and returnval[ 1 ]. Not terrible, but not elegant either.

That's just scratching the surface, I'm sure. If the example were more
complicated, other implications of the recursive approach might become
clear, at least to smarter people than me. But there is one other
thing to point out.

As TLS points out, the function you supply for use with the two lists
is assigned to a parameter names col because "col" stands for
"collector" by convention. What is this function collecting? The two
lists, of course. But more than that each use of col, as it changes
from when-differ to when-match, is persisting the values of the lists
from one step to the next. And that's important because as of page
136, there has been no mention in TLS of an assignment operator. So
even if we wanted to define variables to reference while looping
through the list, we could not. Not yet. After all, such code would
produce what functional programmers refer to, with a sniff, as side
effects.

[2] [http://www.rhinocerus.net/forum/lang-scheme/100568-how-why-did-they-do.html]

20100828

周末工程 伊阿宋

周末工程 伊阿宋

昨天晚上autro和今天上午,花了大约8小时,写了一个小程序。

这个小程序的名字叫做Jason,不是英文的詹森,而是希腊神话里大名鼎鼎的伊
阿宋。叫这个名字的原因后面再说,先说说它的作用是这样的。

1. 环境和需求
已知电驴支持WEB远程管理。
一台服务器工作在NAT之内,NAT的外网IP是电信链路,动态IP。
在NAT上做电驴和FTP的端口映射(虚拟服务器)。

在这种情况下,如果知道NAT 的外网IP,就可以通过IP和端口访问NAT内网的电驴
WEB界面和FTP了。

伊阿宋 能回答服务器的外网IP。

2. 原理

伊阿宋 是Emacs下的lisp程序,
调用了jabber.el。

插话,jabber是用于网络聊天的协议,著名的Gtalk使用了这一协议,
另一个著名的聊天工具,MSN,也可以与jabber的服务器群(是这么叫么?)连
起来。还有一个著名的聊天工具 QQ, 也可以与它们相连,不同QQ协议是企业保
密的协议,不公开,反向工具是可能判有期徒刑的。

jabber.el是工具在emacs下的jabber客户端,因此也可以视为
gtalk/msn/oicq/qq等的客户端。

伊阿宋调用了jabber。

当我在NAT外网――也可以是内网,举外网为例是说明它比较强大的意思――或者
任何地方用GTALK联系一下伊阿宋,它已经在NAT内网的一台计算机上运行了。

伊阿宋接到GTALK聊天以后,会忽略绝大部分内容,如果没有人操作,看起来就
像一个挂在线上主人离开的GTALK。

如果伊阿宋接收到的消息是"/ip",则视为指令,用curl(一个工具,不知请
GOOGLE之)访问某个可以获取外网IP(public IP)的站点,从而得到自己的外
网IP,然后这一IP用消息发送给刚刚发出"/ip"请求的GTALK用户。

curl为什么能获取到请求者的外网IP呢?熟悉php/asp/jsp的同学一定知道这些
语言都支持获取浏览器客户端的IP等信息吧。curl在这里扮演了浏览器的角色。
事实上,你可以视curl为命令行的浏览器。

伊阿宋把外网IP发送给我的GTALK客户端――上面提到,我在外网。

然后我用外网IP加上事先就知道的端口,就可以在世界上任何有网络或有
GPRS/3G的地方,把要下载的电驴资源提交到我的电驴上――运行在NAT内网,配
置了web管理。电驴web管理界面的IP地址是,正是伊阿宋告诉我的。伊阿宋运行
在与电驴相同的NAT内网,具有相同的外网IP。

最后,我还可以根据这一外网IP通过FTP下载或移除已经下完成的电驴资源,只
要设置电驴的incoming目录可以被FTP服务器访问就可以了。

3. 命名

这个小程序为啥叫伊阿宋呢?

这个小子当年因为啥啥需要金羊毛,组织了个敢死队,历尽艰险。

话说伊阿宋是个牛人,他的老师是个马人,错了,半人马。这匹半人马叫做喀戎,
是比伊阿宋还著名的――最著名的英雄赫拉克勒斯的老师,后来被赫英雄误伤死
了。

而赫英雄做了N件伟业,像徒手杀狮子(载于初中语文课本来着),是后来阿喀硫
斯的偶像。

阿喀硫斯,这个就牛到大部分人都知道了,就是 布拉德・比特 在特洛伊里扮演
的那个家伙。他的事迹,我就不赘述了。

赫英雄的老师也教了伊阿宋。伊阿宋没啥太多的英雄事迹,不过似乎是个领导,
他带了一船人去整金羊毛,这一船人后来有N多都载入了史册。恩,载入了神话。

其中有 赫拉克勒斯,刚才我们说过了;还有埃阿斯他爸,埃英雄在特洛伊中戏份
也不少,特洛伊里有两个非亲非故同名的埃阿斯,这个不知道是哪个的爸――查
到了,两位爸爸都在;还有阿喀琉斯他爸,这位兄弟娶了一位女海神,就是她整
出了阿喀硫斯的脚踵;还有忒修斯,后来是雅典的国王……这里N多都是宙斯的
儿子或者波塞东的儿子之类。

总之,这么个富二代官二代,及后来的牛人的爹们组成的全明星队,居然拿不到
金羊毛。

最后多亏了一位女巫 美狄亚,与我们有关的,她最大的优势就是她是内部人。她
喜欢上了英俊的伊阿宋,背叛了自己的祖国啥的,跟我们的评书里弃暗投明的肖
太后她姑娘有得一拼。

伊阿宋答应并兑现诺言娶了美狄亚,但是后来他背信弃义抛弃了她。她诅咒伊阿
宋和并杀害了他们的两个儿子,跑了。

后面悲惨的结局不是关键,伊阿宋是通过内部的美狄亚才取得了外网IP,从而得
到金羊毛,这是伊阿宋的故事的亮点。

中国父母的身上藏着十把刀 zz

中国父母的身上藏着十把刀 zz

中国父母的身上藏着十把刀:第一刀:砍去民主,种下强权的种子;第二刀:砍去爱心,种下自私的种子;第三刀:砍去诚实,种下说谎的种子
from 牛博山寨 编辑推荐 by (author unknown)
100+ people liked this
Shared by 程颖


我们的家庭教育是磨灭儿童天性的,是把优秀儿童品质赶尽杀绝的钝化教育。是到了反思我们家庭教育的时候了。中国父母的身上藏着十把刀,父母往往在不知不觉
中使用这十把刀,使孩子天生纯真的品性一步步消失怠尽。

第一刀:砍去民主,种下强权的种子

中国的民主改革应该说已经取得了不小的进展。中国人习惯了在专制下生活。在传统的中国式家庭里父母也就是家里的皇帝。他们说一不二,强行决定孩子应该怎么 样,

不能怎么着。现在的孩子估计都不会下跪了,但在家庭生活中我们有没有做到最基本的民主呢?比方说涉及孩子利益的事情父母有没有征求过孩子的意见?当家庭内
部出现争执的时候有没有采用民主的办法来解决问题?

父母总是习惯于用简单粗暴的办法,以"都是为了你好"的名义来代替孩子做出决定。而这种行为就是一刀砍去了孩子脑子里的民主意识,而让他觉得强权就能战胜 一切。

第二刀:砍去爱心,种下自私的种子

当你为如何抚养年迈的父母而与你的兄弟撕破脸皮,为分父母的那点遗产又与你的姐妹大打出手的时候,有没有注意到有一双惶恐的眼睛正疑惑地看着你的表演?

当你看到小偷在撬邻居家的门,拉着儿子匆忙离去的时候,有没有发现儿子的另一只手握成了拳头?

当女儿告诉你小区花园的水龙头坏了,你是提上工具就去修理或者立即给物业打电话,还是告诉她不要多管闲事?

你假装没有看见公共汽车上站不稳的老人,当孩子想起身让座的时候,你却用眼神去制止他。

你的这些表现是对孩子潜移默化的家庭教育的一部分,你的每一个行为都在一刀刀砍去孩子的爱心,而在他幼小的心灵里埋下了自私的种子。

第三刀:砍去诚实,种下说谎的种子

孩子一旦明白说谎就可以不挨揍、不挨骂,或者可以让皮肉之痛尽可能迟一些来临的时候,他就可能慢慢变成说谎专家。

小孩子说谎都是被逼出来的。如果我们说实话可以得到实惠,那谁还愿意冒险去说谎呢?

很多的孩子都有一个困惑----为什么大人可以说谎,而小孩就不能呢?小孩在思考这个问题的时候说明他已经发觉了大人是经常说谎的。

我们给孩子的解释往往是辩解说我们的谎言是"善意"的。但对孩子来讲,善意的也好,恶意的也罢,那都是谎言!

第四刀:砍去冒险,种下平庸的种子

孩子要下河游泳不是教会他怎样保证自己在水里的安全,而是简单地拒绝——理由当然是危险。

孩子要登高也是安全的原因不被允许。

孩子都十多岁了,还不敢一个人到门口小卖部去买瓶酱油,因为大街上是危险的。

不会自己削苹果,因为刀子是危险的。

二十岁的孩子还不会开火做饭,因为煤气是危险的。

是啊!现在的社会有些乱,出门有危险,在家也不安全。但俺们就这样一直抱着,他们又如何能长大呢?一点点危险都不能经历的孩子肯定是平庸的。危险处处存
在,躲是不能解决问题的,关键是要教会孩子识别危险,处理危机!

第五刀:砍去守纪,种下违法的种子

孩子自己过马路很少会去闯红灯。孩子骑车也会规规矩矩地在自行车道里行驶。孩子在幼儿园的时候就背"红灯停,绿灯行"的口诀。可是当他们跟父母一起上街的
时候总是被大人拉扯着不走人行横道线,不走地下通道,也不走人行天桥,而是翻栏杆、横穿马路。

大人的借口是我忙,赶时间。殊不知这一刀让孩子体会到的是规则是可以不遵守的,自己的利益大于规则的严肃性。有很多的人已经开上车了,车上带着孩子。脑子
里没有交通规则,眼睛里没有交通标志在街上横冲直撞。非得看到警察叔叔了才收敛一些。

这就教会了孩子人治大于法制,在法规的执行者看不见的情况下,我们可以为了自己的利益而肆意践踏法规。

哪个人天生就是罪大恶极的呢?不都是从一些占小便宜开始一步步地走向违法的道路的吗?

第六刀:砍去善良,种下恶行的种子

古人云:勿以恶小而为之,勿以善小而不为。

我们不愿意带着孩子去为灾区捐献衣物,因为我们交过税了,那是政府的事情。

我们不给街角的乞丐一点施舍,因为他们肮脏。

当孩子想给交不起学费又体弱多病的同学捐款的时候,你问他是不是学校规定必须做的,还问学校规定最少捐多少?你在一点一点砍去孩子身上善良的本性。

买东西时别人多找了钱,你拖着孩子快速离开。

同事得罪了你,你指使孩子偷偷拔掉他自行车的气门心。

家里做饭少几棵大葱,你不去找邻居借,而是叫孩子到走廊去"拿"几根。你又一点点地在孩子身上播种着恶行的种子。

第七刀:砍去自然,种下破坏的种子

在公园游玩时你带着孩子去攀枝摘花。离开的时候孩子要带走垃圾你说不用管有清洁工干。为了让孩子高兴也不管栏杆上禁止的牌子向笼中的猴子投喂食物。喝完饮
料你随手扔瓶子,抽完烟你随地扔烟头。

孩子的天性是热爱自然、喜欢动物的。我们却当着孩子的面杀掉了她喜欢的鱼,杀掉了她觉得可爱的鸡鸭。让伤心的孩子怎么也不愿意再吃这些动物了。

我们在劝说孩子的时候用的是"万物为我所用"的逻辑。告诉孩子的是为了人类自己的生存,可以戕害一切的生灵!

第八刀:砍去创新,种下机械的种子

我们可怜的孩子在学校和父母的双重摧残下,已经不懂得什么是创新了。

当孩子多问几个为什么的时候,我们或许会因为自己工作的劳累而懒得回答,或许就是他问的问题已经超出了我们的知识范围而敷衍塞责,或许你正在为麻将的不胡 牌而烦恼。

而我们惯用的伎俩就是这个等你长大了就懂了!这个不要求掌握,你记住就行了!这个是不会考的!没有为什么!等等等等自以为聪明的说辞。殊不知已经让孩子慢
慢变成了考试动物,脑子机械化了,不会思考了。

中国目前最大的悲哀是拥有知识但没有产权。这就是几十年应试教育的恶果。事实上应试教育在很大程度上是父母逼迫的结果。我们在为孩子选择学校的时候首要考
虑的不还是它的升学率吗?我们才不管孩子学到了什么知识,只要能上清华、北大就好!

第九刀:砍去欣赏,种下嫉妒的种子

孩子小的时候总会毫不掩饰对一个人或者一件东西的欣赏,会毫无顾及地表达出自己的喜爱。

孩子告诉父母某某同学多么优秀的时候,父母总是拿孩子的短处去跟他崇拜的人进行比较,要么说看人家多聪明,多努力啊!哪儿像你这么懒啊!要么说要向他学习
啊,给父母争光!这种批评式的比较很容易挫伤孩子的积极性,极大地影响孩子的自尊心。

当孩子不知天高地厚的时候会说我要比他还棒。可是一次次地超越不了自己欣赏的对象,又被父母奚落之后,孩子那良好的欣赏的心态就会变成糟糕的嫉妒心了。嫉
妒这个人生的一大公害就被我们天真的孩子学会了!

第十刀:砍去竞争,种下仇恨的种子

竞争本来是社会发展的动力。一个没有竞争的社会自然就失去了向上的冲劲。人都是在这个竞争的环境中生存的。人类本身就是在动物的竞争中优胜出来的,所以人
天生就有竞争意识。一个再正常不过的事情就是失败者要学会握着优胜者的手真心地向他表示祝贺。

我们都可能会在单位被同事超越,在生意场上被对手打败。回到家里我们不是客观地分析失败的原因,争取下次的胜利,更多的是找客观理由,辱骂竞争对手。别以
为你的孩子还小,还听不懂这些大人的事情。他已经从你的身上学会了仇恨超越他的人。学会了为考第一名而在成绩好的同学的水杯里加安眠药!

反思吧!我们每个做父母的人都应该反思。当然这一切与社会大环境有关,与统治者有关。但如果我们自己能在培养我们的孩子方面,收起这些刀,让我们的孩子从
小学会真诚、善良、忍让,能够健康地茁壮成长。就能给我们的社会以希望。

20100814

独立思考 zz

独立思考

以前,韩寒老师总在博客里强调"独立思考"。大概是看他博客的小孩比较多,当然,傻逼也比较多,所以,时不时提醒一下。以前我没注意人们还不会独立思考,后来写博客,发现确实存在不会独立思考的主儿。连最基本的白话文里解上都有障碍。

什么叫独立思考,这东西说起来很简单,当你有一个正常的价值观判断,你就会独立思考了。但麻烦的是,正常的价值观怎么形成呢?这可不是你经济独立、生活独立就能形成的,需要时间,需要慢慢认识这个世界。新闻里说牛奶里有催性早熟的激素,其实,牛奶里没有激素,别的东西里也有。食品之外的信息,可能也是催性早熟的激素。我常常遇到这样的人,聊天的时候什么都知道,但是什么都不懂。昨天跟土摩托说话,土老师说,那个谁谁谁就代表了这一类人,什么都知道,但什么又都不明白。这也正常,本来,过去,人都成熟了之后才把自己放出来,现在,人都是先把自己放出来再慢慢把自己混熟,总要经历这个过程。熟了总比蒸不熟煮不烂强。

在我看来,很多人的思考是半封建半殖民地思考,不是独立思考。所谓半封建思考,就是不动脑子,但似乎有点体力,就像一有人嚷嚷革命他就跟着喊"同去同去"。所谓半殖民地思考,表现症状是爱动脑子,但只会一个动作,就是寻找对立面,这是典型的山寨版独立思考。这些症状一般体现在愤情身上。打个比方,张三说:牛奶是白色的。但是"山寨独立"由于不喜欢张三,便说:"牛奶是黑色的。"李四说:"牛奶是白色的。"由于"山寨独立"喜欢李四,便说:"牛奶是白色的。"那么,请听题:你们家牛奶是什么颜色的?答案是:看人脸色是什么颜色决定。

在我的祖国,牛奶的颜色确实很难辨别清楚,一般而言,他们说是红色的。这就是在我的祖国,价值观为什么混乱,导致出现那么多半封建半殖民思考型人才的原因。

20100810

解决KMPlayer播放黑白

解决KMPlayer播放黑白

右键->视频(高级)->质量(3GHz)

解决.
以后恢复成普通也是彩色的了.

参考文献 [Vista事件簿 01] KMPlayer 或 Media Player Classic 播放影片�黑白 on
[http://m955.com/wp/archives/249]