PHP

浏览模式: 标准 | 列表 | 图文
phpsqlsrv for windows

phpsqlsrv for windows

http://www.microsoft.com/download/en/confirmation.aspx?id=20098
其实在很久前就有这玩意了,现在居然是3.0了。在win下用这个驱动好啊,支持最新的Sql server,而且速度很快。同时,它居然还支持了PDO。。。

下载下来很方便,有几种不同的文件,根据你当前的情况来设置:
Perform the following steps to download and install the Microsoft Drivers for PHP for SQL Server:
1. Download SQLSRV30.EXE to a temporary directory
2. Run SQLSRV30.EXE
3. When prompted, enter the path to the PHP extensions directory
4. After extracting the files, read the Installation section of the SQLSRV30_Readme.htm file for next steps
看着readme一步一步就Over了。
08年的时候根据第一版的文件写过一个很简单的连接库,替换掉了当时discuz的sql连接库。现在。。。还是用PDO吧

Microsoft SQL Server Functions (PDO_SQLSRV)

Introduction

PDO_SQLSRV is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MS SQL Server (starting with SQL Server 2005) and SQL Azure databases.

Installation

The PDO_SQLSRV extension is enabled by adding appropriate DLL file to your PHP extension directory and the corresponding entry to the php.ini file. The PDO_SQLSRV download comes with several driver files. Which driver file you use will depend on 3 factors: the PHP version you are using, whether you are using thread-safe or non-thread-safe PHP, and whether your PHP installation was compiled with the VC6 or VC9 compiler. For example, if you are running PHP 5.3, you are using non-thread-safe PHP, and your PHP installation was compiled with the VC9 compiler, you should use the php_pdo_sqlsrv_53_nts_vc9.dll file. (You should use a non-thread-safe version compiled with the VC9 compiler if you are using IIS as your web server). If you are running PHP 5.2, you are using thread-safe PHP, and your PHP installation was compiled with the VC6 compiler, you should use the php_pdo_sqlsrv_52_ts_vc6.dll file.

For more information about system requirements, see » SQLSRV System Requirements.

The PDO_SQLSRV extension is only compatible with PHP running on Windows. For Linux, see ODBC and » Microsoft's SQL Server ODBC Driver for Linux.

System Requirements (Microsoft Drivers for PHP for SQL Server)

SQL Server 2008 R2

To access data in a SQL Server 2005 or later database using the Microsoft Drivers for PHP for SQL Server, you must have the following components installed on your computer:

  • Supported operating systems for version 3.0 of the driver include:

    • Windows Server 2008 R2 SP1

      Windows Vista SP2

      Windows Server 2008 SP2

      Windows 7 SP1

  • Supported operating systems for version 2.0 of the driver include:

    • Supported operating systems for version 2.0 of the driver include:

    • Windows Server 2003 Service Pack 1

    • Windows XP Service Pack 3

    • Windows Vista Service Pack 1 or later

    • Windows Server 2008

    • Windows Server 2008 R2

    • Windows 7

  • PHP 5. For information about how to download and install the latest stable binaries, visit http://php.net.

    Microsoft Drivers for PHP for SQL Server, version 3.0 requires PHP 5.3.0 or later. If possible, use PHP 5.3.6, or later. The version 2.0 driver works with PHP 5.2.4 or later. If possible, use PHP 5.2.13, or later.

  • A version of the driver file must be in your PHP extension directory. See Driver Versions later in this topic for information about the different driver files. See Loading the Microsoft Drivers for PHP for SQL Server for information on configuring the driver for the PHP runtime.

    (See The Data Center for the Microsoft Drivers for PHP for SQL Server for information on where to download the Microsoft Drivers for PHP for SQL Server.)

  • A Web server. Your Web server must be configured to run PHP. For information about hosting PHP applications with Internet Information Services (IIS) 6.0, see Using FastCGI to Host PHP Applications on IIS 6.0. For information about hosting PHP applications with IIS 7.0, see Using FastCGI to Host PHP Applications on IIS 7.0.

    The Microsoft Drivers for PHP for SQL Server has been tested using IIS 6 and IIS 7 with FastCGI.

  • The x86 version of SQL Server Native Client is required on the computer where PHP is running. If you are using a 64-bit operating system, the x86 version of SQL Server Native Client will be installed with the x64 version of SQL Server Native Client (do not install the x86 version of SQL Server Native Client on an x64 operating system).

    If you are using the SQLSRV driver, sqlsrv_client_info will return information about which version of SQL Server Native Client is being used by the Microsoft Drivers for PHP for SQL Server. If you are using the PDO_SQLSRV driver, you can use PDO::getAttribute to discover the version.

This section lists the drivers that are installed for version 2.0 and version 3.0 of the Microsoft Drivers for PHP for SQL Server. PHP version 5.2 is not supported in version 3.0 of the Microsoft Drivers for PHP for SQL Server.

Follow the installation instructions in Loading the Driver to configure the driver for use with the PHP runtime.

Microsoft Drivers 2.0 for PHP for SQL Server installs several versions of the driver:

Driver file

PHP version

Thread safe?

Use with PHP .dll

php_sqlsrv_53_nts_vc6.dll

php_pdo_sqlsrv_53_nts_vc6.dll

5.3

no

php5.dll

php_sqlsrv_53_nts_vc9.dll

php_pdo_sqlsrv_53_nts_vc9.dll

5.3

no

php5.dll

php_sqlsrv_53_ts_vc6.dll

php_pdo_sqlsrv_53_ts_vc6.dll

5.3

yes

php5ts.dll

php_sqlsrv_53_ts_vc9.dll

php_pdo_sqlsrv_53_ts_vc9.dll

5.3

yes

php5ts.dll

php_sqlsrv_52_nts_vc6.dll

php_pdo_sqlsrv_52_nts_vc6.dll

5.2

no

php5.dll

php_sqlsrv_52_ts_vc6.dll

php_pdo_sqlsrv_52_ts_vc6.dll

5.2

yes

php5ts.dll

If the name of the driver file contains "vc9", it should be used with a PHP version compiled with Visual C++ 9.0.

Microsoft Drivers 3.0 for PHP for SQL Server installs several versions of the driver:

Driver file

PHP version

Thread safe?

Use with PHP .dll

php_sqlsrv_53_nts.dll

php_pdo_sqlsrv_53_nts.dll

5.3

no

php5.dll

php_sqlsrv_53_ts.dll

php_pdo_sqlsrv_53_ts.dll

5.3

yes

php5ts.dll

phpQuery的一个小疑问。

phpQuery的一个小疑问。

最近在使用phpQuery处理xml的时候发生了一点小问题。由于xml还算是比较规范,但我又不想用simplexml_load_string,所以就偷懒用phpQuery处理了。
但在处理的时候发现一个问题,比如我要处理的内容是:

<title>揭秘日本巨型OLED地球仪:实时显示地球变化</title>
<link>http://news.dili360.com/gclw/xxjs/2012/0312/32136.shtml</link>
<description><a href='http://news.dili360.com/gclw/xxjs/2012/0312/32136.shtml'><img src='http://image.dili360.com/news/gclw/xxjs/2012/0312/36_5132136203_20120312094816.jpg' style='border: 1px solid #000000;'/></a> 新浪科技讯 北京时间3月12日消息,据国外媒体报道,如果你前往日本东京,别忘了去参观一下“未来科学馆”(Miraikan),这里展示着一些最尖端的技术成就。就在去年年中,这里揭幕了全世界首个大型OLED显示屏,直径超过19英尺(约合5.8米)。尽管名叫“Geo-Cosmos”,但这并非一般的地球仪,它几乎能实时显示我们这颗星球上正在发生的一切!全球各地的科学家和研究机构将数据发送给Geo-Cosmos,后者将其呈现给观众。 这..</description>
<category>中国国家地理网地理资讯频道</category>
<author>dili360.com</author>
<pubdate>2012-03-12 09:48:16</pubdate>

请看加红的那一段。
当我用phpQuery处理完后,发现,右边的</link>不见了。其他元素都正常。我的心一下子就碎了。
开始以为页面有问题,但怎么处理都是这样,最终只能将link换成了url来 进行处理。说实话,心是哇凉哇凉的。。

但是,同事在win下面就没有这个问题,我在ubuntu下就有这个问题。(我现在不知道是否我的PHP版本有问题,还是平台的问题,也没有心思深究了)【同事是5.3.9,我是5.3.6】,

Using Redis as a backend for Active Record

Using Redis as a backend for Active Record

说白了,yiiredis中的AR功能的model其实就是一个hash,只是稍作封装了而已

官方有例子:

Using Redis as a backend for Active Record

It is possible to store active record like structures in redis using ARedisRecord.

Note: this is experimental functionality and may be subject to change

$record = ARedisRecord::model()->findByPk(1); // loads a record with a unique id of 1 $record->name = "a test name"; // sets the name attribute on the record $record->somethingElse = "some other value"; $record->save(); // saves the record to redis $record->delete(); // deletes the record from redis

不过,上面的例子不能直接拿来用,因为ARedisRecord是一个abstract类,所以你得写一个类继承于他才行。
顺便,如果用setAttributes的时候,记得加第二个参数(除非你写了rules),否则一定要加第二个参数,不然save不成功哦。
昨天被它折腾了好久才发现
----
笔记而已

开始启用Yii的redis插件

开始启用Yii的redis插件

该死的command+左箭头。。。写了十分钟的东西全没了。
-------重新开始-----
由于目前的一个项目涉及到的数据库需要跨库跨表操作,而且该库会被频繁的插入、更新、删除,所以相对速度会较慢。但查询量又较大,在一台服务器的情况下,怎么办?分端口主从吧,意义不大,因为某些操作会导致CPU瞬间100%。
这时候我想到了key/value的数据库,想用它来做中间处理,比如大量的内容先经过它,再真正入库,毕竟我不需要过分实时,也不涉及到金钱交易。于是乎就在redis和mongo中间犹豫了。
在这期间咨询了三个人:老王(基于博客http://huoding.com/2012/02/29/146,基于Redis消息系统实现);11爷(redis有pub/sub功能);烂桔(mongo不太适用于单机,redis有内存模式)

基于上述原因,于是选择了redis,那么就开始我的Redis之旅吧
1、安装 Redis ,参考:http://library.linode.com/databases/redis/ubuntu-10.10-maverick(如果我没记错,这应该是11爷推荐的地址,他本来推荐的是Centos下的,但我用的是ubuntu,所以就参考这个了)
先来三个常规操作

apt-get update
apt-get upgrade
apt-get install build-essential

完事之后,接着:

cd /opt/
mkdir /opt/redis
wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
tar -zxvf /opt/redis-2.4.8.tar.gz
cd /opt/redis-2.4.8/
make

make完后做如下操作,将一些配置文件拷贝到/opt/redis目录下:

cp /opt/redis-2.4.8/redis.conf /opt/redis/redis.conf.default
cp /opt/redis-2.4.8/src/redis-benchmark /opt/redis/
cp /opt/redis-2.4.8/src/redis-cli /opt/redis/
cp /opt/redis-2.4.8/src/redis-server /opt/redis/
cp /opt/redis-2.4.8/src/redis-check-aof /opt/redis/
cp /opt/redis-2.4.8/src/redis-check-dump /opt/redis/
cp /opt/redis/redis.conf.default /opt/redis/redis.conf

接着,更新/opt/redis/redis.conf:

daemonize yes
pidfile /var/run/redis.pid
logfile /var/log/redis.log

port 6379
bind 127.0.0.1
timeout 300

loglevel notice

## Default configuration options
databases 16

save 900 1
save 300 10
save 60 10000

rdbcompression yes
dbfilename dump.rdb

dir /opt/redis/
appendonly no

以上是linode里的配置,你可以参考一下做处理。大部分都一样,但timeout/loglevel/dir这三个参数不太一样。可以看着注释改一下。 linode 中有一个:glueoutputbuf yes ,这个在2.4.8下面会出错,所以我就没有启用它。
接着是加入启用脚本,既然linode有配置参考,那么它就有启动脚本,默认redis是没有给你这些启动脚本的,所以偷懒一下吧,下载linode的脚本:

cd /opt/
wget -O init-deb.sh http://library.linode.com/assets/630-redis-init-deb.sh
adduser --system --no-create-home --disabled-login --disabled-password --group redis
mv /opt/init-deb.sh /etc/init.d/redis
chmod +x /etc/init.d/redis
chown -R redis:redis /opt/redis
touch /var/log/redis.log
chown redis:redis /var/log/redis.log
update-rc.d -f redis defaults

在这一步之后,你就可以直接用/etc/init.d/redis 来 start和stop redis服务了。

2、安装phpredis(https://github.com/nicolasff/phpredis)
在安装之前,先看readme:https://github.com/nicolasff/phpredis/blob/master/README.markdown
看完readme之后你会发现,原来一切是这样的简单啊
OK,先wget 回源代码,然后tar解开目录。。
接着3步搞定:

phpize
./configure
make && make install

速度超快,make install后,会告诉你redis.so生成在哪里,你将这extension=redis.so,加入到你的php.ini中即可。

3、下载YiiRedis项目。(由于我是用Yii的,所以直接用这个插件了,否则,还是参考一下phpredis的一些用法)
同样,在这里有readme:https://github.com/phpnode/YiiRedis/blob/master/README.md
项目地址:https://github.com/phpnode/YiiRedis(请自行下载)
使用方法也很简单,和db一样,在components下加一个组件:

"components" => array(
"redis" => array(
"class" => "packages.redis.ARedisConnection",
"hostname" => "localhost",
"port" => 6379
),
//...
),

加完它之后就可以写上一段测试代码了:

Yii::import("ext.yiiredis.*");
$list = new ARedisList("aNameForYourListGoesHere");
$list->add("cats");
$list->add("dogs");
$list->add("goods");
foreach($list as $i => $val) {
print_r($val) ;
echo "<br />";
}
$list->clear(); // delete the list

直接输出在浏览器中。是不是很HIGH?
------
OK,就介绍到这里,请试用吧。

=------

备注:

$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE); // don't serialize data
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP); // use built-in serialize/unserialize
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY); // use igBinary serialize/unserialize

$redis->setOption(Redis::OPT_PREFIX, 'myAppName:'); // use custom prefix on all keys

由于redis默认不做序列化,因此如果要存储PHP的数据,如:数组、对象,那就必须用第二个setOption进行设置,以便 让数据自动序列化

Yii Framework DB 中的一些参数

Yii Framework DB 中的一些参数

Yii的AR一直在被使用,当然,偶尔也只是看看其中的参数,都是直接把main.php中的数据注释掉就完事了
但事实上我们都忽略了一点点现实,那就是默认参数是没有什么性能提升的。

1、'schemaCachingDuration'=>3600,
这个在默认参数中是不存在的,如果你的表结构不太变动,完全可以不需要每次都show columns,show create table之类的。加上这个参数,可以将表结构缓存一小时(嗯,前提是,你配置了cache组件)

2、emulatePrepare=true ,这个是默认里面就带有的,它有什么用呢?
官方是这样说的:whether to turn on prepare emulation. Defaults to false, meaning PDO will use the native prepare support if available. For some databases (such as MySQL), this may need to be set true so that PDO can emulate the prepare support to bypass the buggy native prepare support. Note, this property is only effective for PHP 5.1.3 or above.
好吧,为了以防万一,还是打开算了

3、'enableProfiling'=>true
如果你想优化代码的话,可以尝试设置为true看看。官方在guide里说:By setting CDbConnection::enableProfiling to be true in the application configuration, every SQL statement being executed will be profiled. The results can be readily displayed using the aforementioned CProfileLogRoute, which can show us how much time is spent in executing what SQL statement. We can also call CDbConnection::getStats() to retrieve the total number SQL statements executed and their total execution time.

4、 'enableParamLogging'=>true,
这个就相对比较简单了,如果你设置为True,你在log中,就可以看到你的每次参数的参数是什么了,而不是:y01:y02这样的顺序变量。

5、tablePrefix = "xxx",这没什么好解释的。。。

6、charset="xxx" ,也没有什么好解释的,utf-8的话,中间的减号不要。。


这些都是常用的。。所以列出来

PHP 5.4.0 released!

PHP 5.4.0 released!

[01-Mar-2012]

The PHP development team is proud to announce the immediate availability of PHP 5.4.0. This release is a major leap forward in the 5.x series, which includes a large number of new features and bug fixes.

Some of the key new features include: traits, a shortened array syntax, a built-in webserver for testing purposes and more. PHP 5.4.0 significantly improves performance, memory footprint and fixes over 100 bugs.

For users upgrading from PHP 5.3 there is a migration guide available here, detailing the changes between those releases and PHP 5.4.0.

Further details about the PHP 5.4.0 release can be found in the release announcement, and the full list of changes are available in the ChangeLog.

Please note that it may take a while until the release is available on all mirrors.

----------

你还在犹豫什么?而且,传说中性能提高了超级多,20倍?50倍?太夸张了,不过提升一点点我还是可信的

diogin在大致浏览了下,稍作了整理:

增加 cli-server SAPI
FPM SAPI 增加 process.max 配置项
增加 http_response_code(), get_declared_traits(), trait_exists(), header_register_callback(), class_uses() 函数
增加 Closure::bind(), Closure::bindTo() 方法
mysql, mysqli 扩展默认使用 mysqlnd
增加 trait
增加关键字 callable,insteadof
E_ALL 包含了 E_STRICT
增加了 <?=
支持 (new Foo)->bar()
支持 0b001001101
支持 $a = [1, 2, 3, 4]; $b = ['one' => 1, 'two' => 2, 'three' => 3];
支持 Class::{expr}()
支持 foo()[0]
闭包里支持 $this 引用
continue $v,break $v 不再支持
缺省时区设为 UTC
缺省编码设为 UTF-8

------

一个MINI的测试server还是有点用的。难道它也想象nodejs那样?谁知道呢

来自80sec:XML实体注入漏洞安全警告

来自80sec:XML实体注入漏洞安全警告

文章不长,可以仔细看看,说的是php中的两个函数,其他语言也可能会有类似问题,但simplexml_load_string是PHP比较常用的函数,所以,要注意一下了。
原文地址是:http://www.80sec.com/xml-entity-injection.html

漏洞介绍:可扩展标记语言 (Extensible Markup Language, XML) ,用于标记电子文件使其具有结构性的标记语言,可以用来标记数据、定义数据类型,是一种允许用户对自己的标记语言进行定义的源语言。 XML是标准通用标记语言 (SGML) 的子集,非常适合 Web 传输。XML 提供统一的方法来描述和交换独立于应用程序或供应商的结构化数据。80sec发现目前一些普遍使用xml的场景中都存在一种古老的XML实体注入漏洞,这 可能导致较为严重的安全问题,使得攻击者可能可以任意访问服务器以及应用所在网络的任何资源;

漏洞分析:XML作为一种使用较为广泛的数据传输格式,在语言内部允许引用外部资源来作为语言的补充,譬如


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE copyright [
<!ELEMENT copyright (#PCDATA)>
<!ENTITY hi80sec SYSTEM "http://www.wooyun.org/">
]>
<wooyun version="2.0">
<whitehats>
&hi80sec; is a legend
</whitehats>
</wooyun>

这将使得xml解析器以当前上下文的环境引用外部的资源www.wooyun.org作为hi80sec实体的内容,从而在实际的应用上下文里将该部分数据引入逻辑流程进行处理。同样,我们可以使用

file:///etc/passwd
file://localhost/etc/password

进行访问本地文件系统的操作。

不同的解析器可能默认对于外部实体会有不同的处理规则,以PHP语言为例,默认处理xml的方法就包括:

xml_parse
和
simplexml_load

两种不同的方法,这两种不同的方法在底层完全采取不同的底层逻辑实现,xml_parse的实现方式为expat库,而simplexml_load使用 的是libxml库,两个底层库在解析的时候细节并不一样,expat默认对外部实体并不解析,而simplexml_load默认情况下会解析外部实体 等,所以simplexml_load和DOM等函数会受此问题影响,而xml_parse则默认不会受到影响。
我们不止在PHP,在包括Java,Python等处理xml的外部组件及函数中都证明可能存在此问题,而且已经在一些互联网公司的应用及一些使用广泛的开源软件中都发现存在问题。

漏洞证明:我们将在WooYun漏洞报告平台上提交我们发现的已经被证明的安全漏洞

解决方案:检查所使用的底层xml解析库,默认禁止外部实体的解析,同时增强对系统的监控,防止此问题被人利用;我们将在WooYun漏洞报告平台上发布可能受影响的,请及时关注;

转:对Java初学者的忠告

转:对Java初学者的忠告

标题很庞大,其实,适用于任何人。不过文中的第一条其实对于PHP开发人员来说真的很痛苦,没有一本系统的好书,那本亚马逊的圣经或许算得上一本好书,但相对于java来说,书籍真的太少了。或许有人说,手册就是最好的书籍,但不是每个初学者看着手册就能一下子开始的。
原文是从博客园贴过来的,对于一个.net社区会有这样的文章,其实也很纳闷。海纳百川?好吧,我就当这么理解了。
URL在这里:http://kb.cnblogs.com/page/132067/ ,这是原文链接,(仔细一看,原来是来自CSDN,我坦然了)

  1) 适合自己的图书才是最好的,最好的书并不一定适合你,看自己的情况。

  如果你是一个Java初学者一上手就捧一本Thinking in Java在手里,我想你的日子是不会好过的,那样的书给有一定基础的人看的,当工具书使用的,当然有一定基础后,可以跟着上边流程学,如果你能学下来,那么你的基础就不用说了。

  2) 看书要用心,多动脑,实践很重要,要抱着怀疑的态度看书。

  再好的书也可能会出现错误,人非圣人吗!多练这个很重要,如果你光看不练,我想你年过几天会就会忘的差不多了!

  3) 遇到问题多查帮助文档,还可以上网站进行搜索。

  现如今的搜索引擎功能十分强大,只要你能用得到就能搜到的,还担心什么,不要碰到一点什么问题,都去烦别人,这样别人会小瞧你的!可以加一些Java交流群,对于初学者可能会有一些作用,如果你已经是高手了,我认为这样的群对你的提高不会很大。

  4) 忌讳急功近利,越急就越容易走弯路。

  不要急,基础虽然很简单,一个月或半年,甚至是一年,这都很正常。但出来的成效绝对是不一样的,相信你的时间不会白白浪费。

  5) 我们要精而非全,语言都是相通的。

  学精一门语言再转其它语言也会容易的多。基础很重要,不要贪高。(这个就不用说了,如果你精通C++,改学Java还不简单,思想你已经掌握,你要学的就是一点语法,还不容易?)

  6) 欣赏他人的代码

  初学者不要看,因为理解别人的思路原比自己写要困难的多。认为自己的基础到了一定的程度,可以看看一些开源的软件,因为那都是一些 优秀的杰作,会对提高你的水平有很大帮助。(注意方法:先找主线——>从界面入手——>在纸上画出结构图——>然后再分步分析)

  7) 在实践中提高自己的能力

  边学边练,别给自己找借口。买一些带实例的书,可以试着做一些日常生活中常用到的小程序,只有在实践中你才会发现更多的问题。

  8) 培养自己发现、思考、解决问题的能力。

  能自己想办法解决,不求别人!对于初学者很重要。

  9) 心态要平衡,不要总觉得高人一等。

  一个事物的存在总有它的合理性。你的技术比别人牛,这没什么,或许你是学的早,也或许你比别人反应快一点,永远不要自大,计算机是技术更新很快的行业,你不会永远都站在别人的前头的。心态平衡,不断学习,这才是王道!

  10) 可以下载视频,买书,借书,在线观看。

  如果你是大学生,那么不要浪费资源,一头扎头图书馆里吧。现在网络资源,网上的视频和电子书极多,还愁找不到资源吗?
  11) 认证的价值不大,在一些企业还不是特殊认可,没必要花费大的精力去考。

  个人没有去学过认证,认为价值不大,但如果你根本不缺那几个钱,又有能力的话,可以考,多少还是会有一定作用的。如果你的经济情况不怎么样,照我说,就先算了。在职学习比较困难,比较忙,压力大,时间紧。

  12) 找工作,基础扎实,有一年开发经验,不用担心。你可能会有3K左右的工资了。

  13) 做开发不一定要数学好,只不过你不适合做算法方面的工作。(能当程序员的,谁都不白痴,呵呵!)

  14) 没有什么捷径,如果有的话,价值也就不大了。

  别梦想一步登天,给自己作一个学习过程计划,先学什么,后学什么,合理一点。如果非要说有什么捷径的话,我认为培训不错,条件允许的话,这可以省掉你很多的宝贵时间,当然选择培训机构的时候一定要慎重。因为那不光是Money的问题。

------

按原文的话来说,我觉得最后这三条有点意思,最起码第12条不象是一个老外的忠告。。。WEB程序员,有时候对于算法还真的不需要了解过多。最的一条确实重要,开发不是搞营销,真的没有什么捷径。

看到一段歇斯底里的话

看到一段歇斯底里的话

看到一段歇斯底里的话:

保持该死的主线干净!
在该死的独立分支上进行该死的新功能的开发!
一旦你公布了代码,并且某些人使用了它,那就 TMD 不要修改 API!
如果想要或者必须修改 API,修改 TMD 主版本号 并且 在独立于原代码库的新的代码库上进行该死的开发!
如果有必要,非常有必要使用某些特别的标签,做分支或提交作为依赖,你得 TMD 用自己 fork 出来的代码库进行 TMD 所需要的提交!
哦,还有保持简单,狗娘养的!

好吧。我看了很恐怖。
当然,顺便说一下taoAPI的SDK,里面有一段居然是:

public function execute($request, $session = null)
{
if($this->checkRequest) {
try {
$request->check();
} catch (Exception $e) {
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
}
}

哥,你能不能先定义一下$result = new StdClass;
搞得我IDE里全是血红一片。。。