PHP7与Apache2用FPM连接

PHP7编译不再赘述。

然后去掉mod_proxy.so和mod_proxy_fcgi.so之前的注解,确保他们被apache加载。

如果php-fpm使用的是TCP socket,那么在httpd.conf末尾加上:

<FilesMatch \.php$>
         SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>

如果用的是unix socket,那么httpd.conf末尾加上:

<Proxy "unix:/dev/shm/php-fpm.sock|fcgi://php-fpm">
    ProxySet disablereuse=off
</Proxy>

<FilesMatch \.php$>
    SetHandler proxy:fcgi://php-fpm
</FilesMatch>

注意,对于Apache 2.4.10之前的版本,配置写法改为:

<IfModule mpm_event_module>
    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/webroot/$1
</IfModule>

特别注意的是,红色字体部分需要与每个 中的 DocumentRoot 后的路径一致!

PHP7在Ubuntu 12.04下安装的历程

php7“PHP7性能达到5.5的两倍”。太令人惊喜了,自己VPS的版本还停留在5.3,要不要升级体验一下?

周末乘着有时间,终于下决心尝试升级安装了一次。周折不少,但结果是成功了,很开心,下面就把流水账记一下。

(1)LAMP环境准备工作

官网给出的安装方法及网上找到的,都需要通过全新编译PHP7来完成安装,考虑到需要重新安装,就备份了Apache和MySQL的数据。

编译安装指导,来源如下:

1、官方PHP通用的安装指导:http://php.net/manual/zh/install.unix.php

2、从百度搜索PHP7安装的成功案例,有两个网址可供参考,提供详细的编译参数和问题解决办法:

http://www.zimuel.it/install-php-7/

http://blog.csdn.net/qf0129/article/details/51195522

3、下载PHP7源代码,并完成解压缩,不再详述。

(2)设置编译参数,执行编译步骤

官网提供的编译配置参数很简单:./configure --with-apxs2=/usr/bin/apxs --with-mysqli

可以先按此参数完成编译安装动作:

1、按上述命令执行编译配置;

2、执行make

3、执行make install

(3)解决编译问题

1、编译中如出现所需模块不存在的问题,可以通过Ubuntu的apt-get包管理工具安装。

例如,错误提示:Error: Unable to locate gmp.h

则缺失 libgmp-dev 程序库,安装方法:

sudo apt-get install libgmp-dev
需要安装的开发库:
xml2
curl4-openssl
bz2
jpeg
png
freetype6
gmp
mcrypt
mysqlclient
recode
xlst
gmp.h如果找不到,按如下命令解决:
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h

 

2、注意--with-apxs2=/usr/bin/apxs 参数的正确性

一般Apache2.2版本,路径地址需要改为--with-apxs2=/usr/bin/apxs2

注意:默认情况Ubuntu的Apache安装不带有apxs这个程序,需要安装apache2-dev软件包。

如果不带这个参数编译,通过是没问题的,但不能产生Apache所需的动态库文件:libphp7.so。

(4)卸载老版本的lamp-server,重新安装apache和mysql

这一步其实可能不需要做,但是我做了。这个步骤浪费了绝大部分时间。

lamp-server包是ubuntu定制的一套软件包,含有非线程化Apache,版本是2.2,删除之后安装Apache的默认版本是2.4,而且是线程化版本。

Apache重新安装后,注意配置文件apache2.conf中增加对PHP的支持:

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

线程化版本Apache安装之后,与编译好的PHP7对接,直接提示不支持,无法运行。只好退回去安装Apache2.2的非线程化版本。

需要安装的软件包(为了找到这个老版本,还不少力气,感兴趣的可去研究apt-get和aptitude,不再详述):apache2-mpm-prefork,apache2-prefork-dev

(5)重新编译PHP7

这两个包安装之后,重新编译PHP7,按之前的方法解决出现的问题,补上缺失的软件包。编译安装完毕后,Apache+PHP7应该能跑起来了。

(6)完整的编译参数

WordPress站点已能正常运行,突然发现软件包更新有问题,才发现curl模块没有启用。参考后两个安装经验的配置参数,修改配置参数,再重新编译一次。

./configure \
    --with-apxs2=/usr/bin/apxs2 \
    --enable-mbstring \
    --enable-zip \
    --enable-bcmath \
    --enable-pcntl \
    --enable-ftp \
    --enable-exif \
    --enable-calendar \
    --enable-sysvmsg \
    --enable-sysvsem \
    --enable-sysvshm --enable-mbregex \
	--enable-xml --enable-soap  --enable-sockets --enable-opcache --enable-shmop --enable-fpm --enable-libxml --enable-inline-optimization \
    --enable-wddx \
    --with-curl \
    --with-mcrypt \
    --with-iconv \
    --with-gmp \
    --with-gd --with-xsl --with-xmlrpc --with-pear --with-pdo-sqlite --with-libxml-dir \
    --with-jpeg-dir=/usr \
    --with-png-dir=/usr \
    --with-zlib-dir=/usr \
    --with-freetype-dir=/usr \
    --enable-gd-native-ttf \
    --enable-gd-jis-conv \
    --with-openssl \
    --with-pdo-mysql=/usr \
    --with-gettext=/usr \
    --with-zlib=/usr \
    --with-bz2=/usr \
    --with-recode=/usr \
    --with-mysqli=/usr/bin/mysql_config

哈哈,编译安装后,重新启动Apache,cURL能用了,Wordpress软件包更新顺利完成。

 

Over,整个过程讲完了,提醒大家升级有风险,谨慎再谨慎,再见!

 

SaaS的10年

saasSaaS市场可谓命运多舛,2007年ASP退出让Saas走向历史舞台,2011年在人们的一片追逐声中SaaS迎来他的巅峰时刻,随后一泻千理,2015年开始重新回归我们的视野,走过十年的SaaS依然两眼茫茫?

SaaS十年都经历了什么?

通过百度指数,我们看到过去十年SaaS呈现出这样的发展态势, 2007年SaaS、云计算,开始在百度发声,11年达到了人声鼎沸的状态,然后就没有然后了,2015年又开始有所复苏!SaaS百度指数

在这样的一种环境下,我们看到的结果是,SaaS厂商们非死即伤。 自Salesforce 2003年在国内成功布道以来,无数SaaS先烈们前赴后继,有些重创,有些阵亡! 可以看到在众多厂商当中,许多如今天天上头条的名字都曾经一败涂地,无所不能的阿里软件,雄踞ERP的用友等等。

可以说过去的十年,是SaaS成长当中最烦恼的十年,有希望、有绝望,到底SaaS经历了怎样的磨难,十年的血泪史,给SaaS写出了怎样一部教科书。

经过十年的历练,无论是国产SaaS自己摸索,还是留洋归来的从国外SaaS汲取的经验,对SaaS总结出了三个小秘密!

第一个秘密,获取客户的第一年是赔钱的,并且客户数量越多,赔钱越多,这个比较容易理解,第一年无论是对于产品开发的投入、还是对于客户开拓所需的人力成本、资源开销都是非常大的投入,而客户带来的收入相比投入来说是入不敷出的,有点像是手机生产在产能爬坡的过程,当客户数量达到一定程度以后,才能慢慢抵消亏损转为盈利;

第二个秘密则是如何盈利,SaaS只有留住客户,增加客户的重购率,才能实现稳定的盈利,收入的增长越没有瓶颈,要达到这样的目的,必须做好客户服务。

第三个秘密,对于自身的产品的修炼,SaaS产品也要走上平台化策略,但这里的平台化不同于传统软件的平台化,而是产品提供丰富的接口能力,与其他SaaS产品能够有机的融合,令SaaS服务避免出现信息孤岛问题!

在了解了三个小秘密以后,不难理解下面这张图,SaaS应该是一种什么样的服务,复杂产品高价值的服务与简单产品低价值的服务。

saas

前一种依靠大客户带来的单比大收入来缓冲前期的大额投入,对于大客户不断挖掘业务应用,增加其回购率,而此时对于产品的要求必然是高大全的复杂产品;所以这条路是优选方案;

后一种,向广大的中小企业客户寻得市场,由于单价相对较低,需要通过快速积累客户数量来缓冲前期的大笔投入,中小企业业务不复杂,但需求庞杂,厂商通过开发简单产品,只面向标准化业务,统一客户的需求,然后培育客户增加回购率,这也是一条不错的路径,也是中国目前多数的SaaS企业在做的事情。

而另外两种情况,简单产品高价值的服务,理论上是可以做到的,但实际情况是很难做到,如果真有企业做到了,那一定是颠覆性的;右下角,我相信没有一家SaaS厂商会去做这么2的事,复杂产品低价值服务,无疑自掘坟墓。

其中复杂高价值的代表厂商,国外的有Salesforce,国内的有北森云计算。简单低价值国内的有今目标。

中国目前的SaaS现状多数尚处失衡状态?

为什么这么说主要是我们很多公司不会算CAC(获取的客户成本)和LTV (life time value)生命周期总价值,意为客户终生价值,是公司从用户所有的互动中所得到的全部经济收益的总和,为什么SaaS厂商一定要会算这两个数?

因为客户盈利能力=LTV-CAC

解析LTV

影响LTV的因素:LTV=ARPU x 单个客户的平均生命周期 – 服务客户的成本(COGS)

客户平均生命周期为“1/客户流失率”。假设流失率为50%,客户的平均生命周期就是“1/50%”即为两个月。大多数SaaS公司都不重视追踪平均生命周期,而是记录每月客户流失率。对企业而言,保持低客户流失率至为重要。如果客户流失率高,显然说明客户满意度出了问题。

解析CAC

计算CAC的公式是:CAC=销售与营销的总成本/完成交易数

事实证明,我们实际上感兴趣的CAC数据分两类。一类看上去纯粹是营销项目的成本,一类要考虑到营销人力成本以及其它相关营销运营费用。前一类数据让我们了解,如果选择低接触或者不接触的销售模式,人力成本不会随着潜在客户增加而剧增。后一类数据对销售模式而言更加重要,因为它需要通过人的接触来完成销售,因此对CAC的影响也最大。要真正理解微观经济,就得考虑到这类数据。

何时开始衡量以上CAC数据,这得根据现实情况的评估结果。假如正处创业初期,还在试图明确适合初创公司的特定产品和市场,就没有必要做这类衡量。但要是已经反复使用某一种销售模式,上述CAC数据就变得很重要,因为这一阶段的企业经常希望加速发展。一旦微观经济无法带来盈利,企业经营者就不该踩加速的油门。如果计算一家成立没多久的公司产生了多少成本,得去除销售副总和营销副总等重要员工的人力成本才算合理。理由是,公司不会大量聘请这种高级别的员工。

至于降低CAC的方法,可以考虑改变许多重要的变量。而一个好的商业模式是需要LTV大于CAC的。

客户怎么看SaaS?中大型企业与小微企业有差别

在2015年由移动信息化研究中心发布《2015年CIO 决策采购指数分析报告》中,共调研200多家IT决策者得出的结论。86.7%的企业认为需要引入云计算,云计算的需求全面激活。 在应用层面,云计算已经普遍被企业所接受,B2B市场互联网的进程进一步加快,云端办公与云端业务已经成为企业信息化的必然之路。

51.9%的企业会采用PaaS级别的云服务,37%的企业会引入SaaS级的云服务,仅有11.1%的企业会将IaaS作为引入企业的云服务。 随着云计算的普及,对于大部分企业来说,单一应用级的云服务已经不能满足于企业需求,进而平台级的PaaS服务成为企业关注的焦点。

在公有云提供的众多服务中,前五名的公有云服务分别是:协同软件占15.3%;云财务占13.7%;供应链管理占到12.9%;云ERP占11.3%;存储占10.5%。 在所有公有云服务中协同类服务是当前提供的服务体系中比较成熟和完善的,但云财务、云ERP,云HR等偏向后端管理的服务正在逐渐被企业认可和接受。

转载自CSDN

开源软件与SaaS模式应用

open开源SaaS是一种广义的SaaS模式。目前,利用开源软件做出SaaS应用已经逐渐出现,开源软件将相当适合实施SaaS模式。

Open Source自从诞生之日起,它的商业模式就不断地被探索。开源在一般人眼里就是免费,即使不是免费也是廉价的代名词。 但开源软件的发展需要资本的支持,我们不能指望开源体系里面每一件东西都是捐来的,于是人们寻找开源的商业模式,这也是开源必须的发展之路。

开源软件的授权方式注定了开源不可能走传统商业软件靠卖licence的老路,因为开源软件版权不是某个人的,而是属于某个松散的技术社区或组织,无论从商业还是道德的角度想等同封闭代码软件一样卖许可都是不可能的,或者说是靠不住的。

这使得很多的开源软件的商业模式都是将开源软件作为一种附属品,增值品存在。免费的开源软件与收费的商业版组件捆绑是典型的做法,比如说收费的书籍教程、嵌 入式模式(硬件收费)、混合模式(特有商业模块收费、高级版本收费)等。这些商业模式都是将开源软件作为其它东西的陪衬而存在的模式。

当提到“软件即服务”的时候,突然感觉这个词汇天生就是为开源软件而创造的。开源软件的自身特征也决定了软件即服务将是最好的开源商业模式:免费的开源软件+收费的专业服务,这是真正以开源软件为中心的模式,这些服务包括培训、实施、定制开发、软件托管等。

广义的SaaS概念既包括在线托管型SaaS,也应该包括现场实施型SaaS,只是这种现场实施服务,不是靠授权收费,而是靠服务收费。红帽的订阅模式,众多开源软件的定制化、服务销售模式,都是对SaaS理念进行的有力的支撑和延伸。

开源SaaS是一种广义的SaaS模式,因为开源软件没有授权费,所以所有开源软件现场部署也可算是软件即服务的一种体现。另外,开源软件SaaS还可免除上文提到的商业软件实施SaaS时潜在的各种风险。

开源软件没有授权费用,而且可能会出现同一开源软件的多家SaaS运营商,如果老运营商出现问题,客户可在数据导出后,将数据很方便的迁移到另外一个服务提供商处,免除了采用商业软件SaaS时,运营商出现问题时,难以更换服务商的问题。

开源软件传播的自由性,使得用户可通过多种途径获得软件。在用户需要本地部署、需要特定功能时,用户可很方便的将原SaaS运营商处的商业数据导入到本地系统内,还可自行开发所需特定功能,或聘请专业的开源软件服务公司代为进行,免除了商业软件SaaS时,难以迁移到本地,或迁移成本很高的问题。

开源SaaS模式大概可分为两大类:开源在线版SaaS,通过一对多的服务模式,满足客户共通的需求,开源软件公司只需要维护这一个系统,就能给千万个客户提供服务,公司的维护和开发工作也相对少了,客户的成本也降低了。开源现场版SaaS,通过一对一的服务模式,满足客户特有的需求,如现场部署、定制开 发、现场培训等需求,这种服务模式适合不需复制性的客户,相对效率比较低,但可满足客户灵活性需求。

另外,使用开源软件做SaaS模式的时候开发周期大大缩短,优势非常明显。 开源软件一般都会有相对坚固和强壮的底层架构,源代码开放使得在其基础上开发Web应用可以更快速,而Linux、Apache、Mysql等优秀开源软 件可以提供从操作系统、Web服务器、数据库等全套的SaaS基础解决方案。

目前一些用开源软件做出的SaaS应用渐渐的出现了,highrisehq.com这个刚上线就备受欢迎的CRM是基于开源的Ruby on Rails。可喜的是,国内也出现的开源的SaaS应用,基于开源组合Pyhton/Zope/Plone的在线团队项目协作产品EveryDo。这些都 预示着开源软件相当适合实施SaaS模式。

 

MVVM and View Models

mvvmModel-View-View Model (MVVM) is a design pattern for building user interfaces. It describes how you can keep a potentially sophisticated UI simple by splitting it into three parts:

A model: your application’s stored data. This data represents objects and operations in your business domain (e.g., bank accounts that can perform money transfers) and is independent of any UI. When using KO, you will usually make Ajax calls to some server-side code to read and write this stored model data.

A view model: a pure-code representation of the data and operations on a UI. For example, if you’re implementing a list editor, your view model would be an object holding a list of items, and exposing methods to add and remove items.

Note that this is not the UI itself: it doesn’t have any concept of buttons or display styles. It’s not the persisted data model either – it holds the unsaved data the user is working with. When using KO, your view models are pure JavaScript objects that hold no knowledge of HTML. Keeping the view model abstract in this way lets it stay simple, so you can manage more sophisticated behaviors without getting lost.

A view: a visible, interactive UI representing the state of the view model. It displays information from the view model, sends commands to the view model (e.g., when the user clicks buttons), and updates whenever the state of the view model changes.

When using KO, your view is simply your HTML document with declarative bindings to link it to the view model. Alternatively, you can use templates that generate HTML using data from your view model.

充分利用青春期大脑的学习潜力(中英对照)

Harnessing the Incredible Learning Potential of the Adolescent Brain

充分利用青春期大脑的学习潜力

brainIt has become a cultural cliché that raising adolescents is the most difficult part of parenting. It’s common to joke that when kids are in their teens they are sullen, uncommunicative, more interested in their phones than in their parents and generally hard to take. But this negative trope about adolescents misses the incredible opportunity to positively shape a kid’s brain and future life course during this period of development.

习惯上认为青春期是孩子最难培养的阶段,这个时间段的孩子通常被认为是忧郁、难以沟通,对手机的兴趣超过他们的父母,以至于难以管理的。这些负面的认识会错过孩子们的良好大脑、甚至未来生活道路的形成的好机会。

“[Adolescence is] a stage of life when we can really thrive, but we need to take advantage of the opportunity,” said Temple University neuroscientist Laurence Steinberg at a Learning and the Brain conference in Boston. Steinberg has spent his career studying how the adolescent brain develops and believes there is a fundamental disconnect between the popular characterizations of adolescents and what’s really going on in their brains.

“青春期是生命中真正繁荣的阶段,但我们需要利用这个机会才行。”坛珀大学的劳冉.舒坦博格说。舒坦博格是研究青少年大脑开发的研究员。

Because the brain is still developing during adolescence, it has incredible plasticity. It’s akin to the first five years of life, when a child’s brain is growing and developing new pathways all the time in response to experiences. Adult brains are somewhat plastic as well — otherwise they wouldn’t be able to learn new things — but “brain plasticity in adulthood involves minor changes to existing circuits, not the wholesale development of new ones or elimination of others,” Steinberg said.

大脑在青春期仍在成长中,有非常大的可塑性,与生命的最初5年类似,大脑通过对经验的响应产生和发展新的路径。而成年后,大脑虽然仍具有可塑性,但仅仅是对存在环路的小的修正,而不是建立全新的内容。

Adolescence is the last time in a person’s life that the brain can be so dramatically overhauled.

青春期是一个人生命中大脑可以有大改变的最后时间窗。

“The adolescent brain is exquisitely sensitive to experience,” Steinberg said. “It is like the recording device is turned up to a different level of sensitivity.” That’s why humans tend to remember even the most mundane events from adolescence much better than even important events that took place later in life. It also means adolescence could be an extremely important window for learning that sticks. Steinberg notes this window is also lengthening as scientists observe the onset of puberty happening earlier and young people taking on adult roles later in life. Between these two factors, one biological and one social, adolescence researchers now generally say the period lasts 15 years between the ages of 10 and 25.

“青春期的大脑对各种体验非常敏感,”史丹博格说。“就像一个记录设备提升到不同的敏感级别。”这就是为什么人更容易记住青少年时代的平常事甚于生命后期的重要事件。这也意味着,青春期是对学习来说是一个非常重要的时间窗。史丹博格强调,这个时间窗正在延长,因为科学家观察到,生理青春期的提前,同时年轻人推迟承担成年人的责任。这个因素之间,生理、社会和青少年研究者认为青春期的时间长达15年,从10岁到25岁。

 

“When adolescence is this long, we can’t look at it as something to just survive,” Steinberg said.

史丹博格说:“当青春期是这么长的时候,我们不能将它看作是生存的东西,”。

 

Teenagers get a bad reputation as risk-takers because parts of their brains are more plastic than others, creating an imbalance. The prefrontal cortex, which controls things like planning, thinking ahead, weighing risk and reward, and logical reasoning is the most malleable during adolescence. Meanwhile, sex hormones released by puberty affect brain functioning by adding more dopamine to the system. Every time an adolescent feels good about something he gets a dopamine squirt. That’s why adolescents seek out pleasurable experiences, despite the risks.

青少年爱冒险的坏名声是因为他们的大脑还未定型而造成的不平衡现象。大脑的前额叶皮层,它控制着诸如计划、思考、权衡风险和回报,以及在青春期最具可塑性的逻辑推理功能。同时,青春期性激素释放影响大脑功能,增加更多的多巴胺系统。每一次青少年感觉良好的东西他得到多巴胺注射。这就是为什么青少年会寻求快乐的经历,尽管有风险。

 

“Nothing will ever feel as good to you for the rest of your life as it did when you were a teenager,” Steinberg said. The imbalance between an aroused dopamine system and a still developing prefrontal cortex, which would inhibit some of the risky pleasure-seeking behaviors, is why adolescence is such a dangerous time. While adolescents are extremely healthy, mortality rates increase by 200-300 percent due to risky behavior. Scientists have also shown that reward pathways are activated when an adolescent is with a group of peers, which is why kids take extra risks when with friends that they might not take when alone.

斯坦伯格说:“整个一生中,当你十几岁的时候,你的感觉是最好的”。一个被激发的多巴胺系统加上一个仍在发展的前额皮质,会激发一些冒险的寻求快乐的行为,这就是为什么青春期阶段为什么如此危险。而青少年是非常健康的,危险行为导致的死亡率增加大概200-300分之一。科学家还表明,当一个青少年与一组同龄人在一起时,大脑的奖励回路被激活,这就是为什么与朋友们一起时,比他们独自一个人,可能会增加额外的风险。

 

The imbalance between aroused dopamine systems and self-regulation systems sounds like a scary story, but it also represents a unique opportunity to reach adolescents with positive stimuli that will be hard-wired in high definition years later. Unfortunately, American high schools are by and large not taking advantage of this opportunity.

多巴胺系统和自我调节系统之间的不平衡听起来像一个可怕的故事,但它也代表了一个唯一难得的机会,可以使青少年受到正面、积极的刺激,这些获得的刺激可以高质量、永久地保存下来。不幸的是,美国的高中一般并没有利用到这个机会。

 

 

“Our high school students are among the worst in the developed world,” Steinberg said. The high school math and reading scores on the National Assessment of Educational Progress (NAEP) have been flat for 40 years. In contrast, both elementary school students and middle school students have improved. And U.S. schools tend to spend more money on high schools, those teachers make more money, and on the whole elementary schools enroll more low-income kids than high schools. Steinberg contends that the traditional arguments for why schools fail don’t explain everything that’s going on.

斯坦伯格说:“我们的高中生是世界上最差的学生之一。”全美教育评估发展协会发布的高中数学和阅读成绩(NAEP)已连续40年没有提高。相比之下,小学学生和中学生都有了改进。而美国的学校往往把更多的钱花在高中,那些老师赚更多的钱,相对比小学反而招收更多的低收入的孩子。斯坦伯格强调,传统关于学校为什么失败的观点,已经不能充分解释当前所有的发生了的现象。

 

 

“It’s because our high schools are so boring,” Steinberg said. He notes U.S. high school students who study abroad report their experiences were more interesting and more challenging, while foreign students who study in the U.S. say American high school is more boring.

“这是因为我们的高中是如此的无聊,”斯坦伯格说。他指出,在国外学习的美国高中生反映,他们的体验更有趣,更富挑战性,而在美国学习的外国学生说美国高中会更无聊些。

 

Steinberg believes part of the reason school is so boring for teens is that it doesn’t challenge them; they’re bored. Students themselves report that they can get by in school without doing much. “When we are not challenging our kids in high school, not only are we hindering their academic development, but we also aren’t taking advantage of the plastic prefrontal cortex,” Steinberg said. The prefrontal cortex is strengthened by challenge and novelty.

斯坦伯格认为,学校对孩子们来说如此的无聊,一部分原因是因为这并不挑战他们,他们很无聊。学生自己报告说,他们不需要做太多就可以通过。斯坦伯格说:“在高中时对我们的孩子没有挑战,不仅是阻碍了他们的学习发展,而且我们也没有利用的前额皮层的可塑性优势”。前额叶皮层只能通过接受足够的挑战、新奇事物才能得到加强。

 

“This is when we want them to be challenged and pushed because this is when we can develop advanced thinking, as well as self-regulation,” Steinberg said.

“我们希望他们受到挑战和压力,因为在这个阶段我们可以发展他们更高级的思考能力,以及自我调节能力。”斯坦伯格说。

 

Teachers often say their students struggle with work that is below grade level and must catch up before they can take on more challenging tasks. But scaffolding can ensure that even the catch-up process is challenging in an interesting way. Consistently providing students with work that is slightly more challenging than their current level keeps them engaged. If the work is too easy, they will disengage and become frustrated.

老师们经常说,低水平学生要努力工作,在他们能承担更具挑战性的任务之前必须达到他们的当前工作的标准。老师们的教学方法可以确保追赶过程也兼具挑战性和趣味性。不断地为学生提供工作,且比他们目前的水平更具挑战性的工作。如果工作太容易了,他们会走开并变得沮丧。

 

The problem is that many high schools confuse “challenging work” with “amount of work.” Students are stressed out by the volume of tasks they must complete each night or week, but that isn’t the same thing as being challenged by the work. Steinberg points out that hours of repetitious work that is not challenging do nothing but make kids hate school.

问题是许多高中都把“具有挑战性的工作”和“工作的数量”混淆起来,学生们追求任务的数量,他们有每一个晚上或一周必须完成的任务,但这不是挑战。斯坦伯格指出,重复的功课时间,没有挑战性,只能让孩子讨厌学校。

 

“Rates of anxiety disorders among adolescents are at record levels,” Steinberg said. “We are raising generations of students who we are driving crazy with what we are asking of them.” Recognizing this pitfall is not only important for maximizing the opportunity to make a lasting impact on students’ extremely malleable developing brains, but also because a plastic brain is also vulnerable to the wrong influences.

“青少年的焦虑症的比率创下新高,”斯坦伯格说。“我们培养一代又一代被逼疯的学生。”认识这个问题,不仅是因为这是最大化开发学生大脑的发育、产生持久的影响重要的机会,但也因为具有可塑性大脑也容易受到错误的影响。

Adolescence is the most likely time for mental illness to develop, and substance abuse is 10 times worse if a student starts using before the age of 15. “It’s not just the type of people who begin using earlier, it’s the way the adolescent brain is responding to the use,” Steinberg said. The aroused dopamine system in the adolescent brain craves drugs, nicotine or alcohol in a different way than at other times in life.

精神疾病在青春期发生的几率是最大的,如果一个学生在15岁以前开始,使用滥用药物上瘾的几率则是成年人的10倍。斯坦伯格说:“这不只跟人的类型相关,这是青春期的大脑反应的方式。” 尼古丁和酒精会引起在青少年的大脑的多巴胺系统渴望药物的固定回路,这种影响对成年人是不同。

Stress also has a big impact on adolescent brains. A recent study from UC Berkeley showed that growing up as an adolescent during wartime took years off people’s lives. “[Stress] takes more years off of your life if you are a teenager than if you are a child or an adult,” Steinberg said.

压力也对青少年的大脑有很大的影响。从加州大学伯克利最近的一项研究表明,经过战争年代的青少年人,会老很多年。斯坦伯格说:“如果你是一个十几岁的孩子,相比你是一个幼儿或是一个成年人,你的生活需要花费更多的时间恢复”。

 

 

TAKING ADVANTAGE OF A MALLEABLE BRAIN

利用一个可延展的大脑

Understanding the neuroscience at work in the adolescents populating classrooms can help teachers develop lessons that challenge, engage and satisfy the search for novelty in teens. Those experiences in turn could be some of the most meaningful ones in their lives. If educators and parents don’t take note of this research, kids will continue to tune out, seek pleasure in risky places and continue on into college-level courses unprepared.

了解神经科学在青少年课堂的作用,可以帮助教师开发具有挑战和吸引性,满足青少年好奇感的课程。这些课程的经验可能是他们生活中最有意义的一个。如果教育工作者和家长不注意到这项研究,孩子们将继续寻找,在冒险的地方寻求乐趣,并继续进入大学水平课程的准备。

Research has shown that targeting prefrontal cortex development in adolescents does help. Despite being a bit clichéd, Steinberg pointed to initial research findings that mindfulness in schools can improve self-regulation, the single most important quality to leading a successful life. Steinberg says that statistically there are four things everyone has to do to have a good life: graduate high school, don’t have a child until being married, don’t get in trouble with the law and don’t be idle.

研究表明,针对前额叶皮质的开发对青少年确有帮助。尽管有点老生常谈,斯坦伯格指出,初步研究发现,在学校的专注可以提高自律,这是引导一个成功的人生的最重要的品质。斯坦伯格说,统计上有四件事每个人都要做的有一个好的生活:高中毕业,婚前没有孩子,没有触犯法律,不要懒惰。

“If you play by those rules you will be guaranteed a basically decent life,” Steinberg said. “This is not a moral thing, this is a statistical fact.”

Self-regulation and delayed gratification are important skills to clear those four hurdles. Steinberg basically says that if educators and parents can teach kids self-regulation, they can reduce poverty.

“如果你遵守这些规则,你将得到一个基本体面的生活,”斯坦伯格说。“这不是一个道德的东西,这是一个统计的事实。”

Self-regulation and delayed gratification are important skills to clear those four hurdles. Steinberg basically says that if educators and parents can teach kids self-regulation, they can reduce poverty.

自我调节和延迟满足是重要的技能,以清除这四个障碍。斯坦伯格基本上说,如果教育者和家长可以教孩子自我调节,他们可以减少贫困。

 

 

 

Author

Katrina Schwartz

Katrina Schwartz is a journalist based in San Francisco. She’s worked at KPCC public radio in LA and has reported on air and online for KQED since 2010. She’s a staff writer for KQED’s education blog MindShift.

作者a u t h or

Katrina Schwartz

卡特里娜 施瓦茨

 

Katrina Schwartz is a journalist based in San Francisco. She’s worked at KPCC public radio in LA and has reported on air and online for KQED since 2010. She’s a staff writer for KQED’s education blog MindShift.

卡特里娜是居住在旧金山,是一个记者。她从2010年起在KPCC公共无线公司工作。她是教育博客作者成员。

 

WordPress的插件实现原理

wpplugWordPress的插件利用add_action将自定义函数挂到内核上的action(动作)上运行。那么,action又是如何定义的呢?

WordPress是PHP语言开发的,不像C/C++那么严谨,action的插件侧定义非常简单,请看如下语句:

add_action( 'wp_head', 'do_activate_header' );

语句中可以看到,两个参数:action和准备挂接的函数,都是以字符串的形式出现的,这个关联关系可与说是完全手工方式建立的,系统没有做任何检验。

而这两个参数是建立与内核关联的关键,举一个极端的例子,add_action完全可以随便填写参数,但填错了,就无法与内核发生关联。

在内核侧,action的定义是则通过如下语句:

do_action( 'wp_head' );

通过“wp_head”的匹配,完成与插件的关联。同样,这个定义也是直接通过手工直接编码完成的。

很搞笑吧。:O

Call to action (marketing)

ctaIn marketing, a call to action (CTA) is an instruction to the audience to provoke an immediate response, usually using an imperative verb such as “call now”, “find out more” or “visit a store today”.

A CTA can be a simple non-demanding request like “choose a colour” or “watch this video”, or a much more demanding request. An obvious CTA would be requesting the audience to purchase a product or provide personal details and contact information.

Clever marketing strategies often combine a series of small CTAs. These smaller CTAs create a pattern of behaviour that makes it easy for the audience to follow-through with just one last CTA, completing a more demanding request, had it been asked without context. An example could be the purchase of a designer torch. The website might request you choose a style, then a colour, a size and even a personalised engraving. When you get to see your personalised one-of-a-kind product, you are more likely to feel inclined to buy it as it rotates in full 3D rendered colour on your computer monitor or tablet.

On websites

In web design, a CTA is a banner, button, or some type of graphic or text on a website meant to prompt a user to click it and continue down a conversion funnel. It is an essential part of inbound marketing as well as permission marketing in that it actively strives to convert a user into a lead and later into a customer. The main goal of a CTA is a click, or a scan in the case of a qr code, and its success can be measured via a conversion rate formula that calculates the number of clicks over the times the CTA was seen. Another way to test the effectiveness of a CTA is using A/B testing where several graphics are presented to users and the graphic with highest success rate becomes the default.