给交大同学的讲座 – 2010年4月24日
有同学问我要讲义,在这里可以拿到:
http://libaocun.com/my-pm-talk-in-sjtu
这篇blog也作为一个交流平台吧。
另外:我们这个班级还有艺术类的学生,正好有这方面问题需要请教。请和我联系一下。
有同学问我要讲义,在这里可以拿到:
http://libaocun.com/my-pm-talk-in-sjtu
这篇blog也作为一个交流平台吧。
另外:我们这个班级还有艺术类的学生,正好有这方面问题需要请教。请和我联系一下。
I had a CentOS Linux box bundled with a MySQL with Latin as default charset. As time goes by, I need
a) utf-8 everywhere(client, server, collation, everywhere) to support Chinese.
b) Innodb as default engine
Here is what I did:
1) Download latest source(mysql-5.1.44) from MySQL site
2) rpm -i xxx.src.rpm to install the source. By default, the source will be installed to /usr/src/redhat/SOURCES/mysql-5.1.44.
3) Go the root dir of source, run:
CFLAGS=”-O3″ CXX=gcc CXXFLAGS=”-O3 -felide-constructors \
-fno-exceptions -fno-rtti” ./configure \
–prefix=/usr/local/mysql –enable-assembler \
–with-mysqld-ldflags=-all-static \
–with-charset=utf8 \
–with-collation=utf8_general_ci \
–with-plugins=all
Explain: use gcc as compiler; install mysql to /usr/local/mysql; utf8 as default char set; install all plugins including innodb.
During this process, you may see errors saying “I need this, I need that”, use ‘yum‘ to install them.
And ./configure –help will show all possible options.
4) make
5) make install
And /usr/local/mysql will be the rool dir of new mysql installation.
6) Modify /etc/my.cnf. /usr/src/redhat/SOURCES/mysql-5.1.44/support-files/ contains sample configuration files. Note to set below:
[mysqld]
default-storage-engine = INNODB
7) Modify /etc/init.d/mysqld. You may need sym-link to new mysql installation.
Done. Below message should prove the installation is fine:
mysql> show engines;
+————+———+—————————————————————-+————–+——+————+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+————+———+—————————————————————-+————–+——+————+
| ndbcluster | NO | Clustered, fault-tolerant tables | NULL | NULL | NULL |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MyISAM | YES | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+————+———+—————————————————————-+————–+——+————+
9 rows in set (0.00 sec)mysql> show variables like ‘%char%’;
+————————–+—————————————-+
| Variable_name | Value |
+————————–+—————————————-+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
+————————–+—————————————-+
8 rows in set (0.00 sec)mysql> show variables like ‘%colla%’;
+———————-+—————–+
| Variable_name | Value |
+———————-+—————–+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+———————-+—————–+
3 rows in set (0.00 sec)
(Keep in touch. My msn: baocun_hld AT hotmail DOT com, email: bill.z.li AT gmail DOT com)
My dear friends,
Today is my last working day in Microsoft, and it is time for me to start a long-awaited adventure. During past 3 years, many folks impressed me deeply and I hope have a slice of knowledge/skills you have. After working in such a wonderful place, I possessed enough confidence to face any subtle difficulties ahead. What I got are much more than what I contributed to this company.
I won’t claim I am a guru in any of areas above because I see what the highest standards are in this company. And I just reach the good(to me) level of combination of these ingredients.
In addition to taking part in shipping 3 products…
Almost everyone asked about where I am going. This world is undertaking dramatic changes, especially this country. I can’t stay in this huge market to build software for anywhere else except here forever. Life is short, and I won’t forgive myself if time just passes by as “yet another year” way. Pursuing a fair ROI is another factor which won’t be achieved by working for any company. I am happy to complete engagement with Microsoft roughly on schedule.
2010 will be a new exciting start. I will enjoy in any event.
Good luck to us all! (And luck is actually where preparations meet opportunities.)
Bill
概述
Taobao Open Platform(TOP),淘宝开放平台,是淘宝将一些(不是全部)数据(店铺,商品等)通过编程接口开放给开发者。说简单点是这样,一般我们大家都是在网页里面点点点,来装修店铺,买卖东西的,是人肉通过鼠标和键盘完成的。TOP API,可以帮助大家用程序来完成同样的事情。
目标
该文主要回答一下几个问题:
1) 淘宝为什么开放平台?对于开发者意味着什么?
2) 开放了些什么东东?
3) 如何写一个简单的基于开放平台应用?
淘宝开放的缘由
Taobao经过几年的发展,已经成为国内X2C的头块品牌。它发起并完善了广大的网商,用户,以及与之相关的支付,物流,信用等系统。现在基本无人不淘宝。我的一位同事,所有的东西基本上都在taobao上买,还有一位朋友一大爱好就是周末在taobao上买东西。
但淘宝已经差不多到了不得不开放的地步。在内部,大的卖家渴望走出去,店主渴望以某种方式在300w个网店中脱颖而出,各种购买方式层出不穷,团购、限时拍卖等;在外部,社区、sns、购物搜索已经开始直接或间接涉足X2C市场。面对这么多元化的需求,淘宝自己去满足,肯定会力不从心;视而不见,那会引起积怨,累计到一定程度,必然有后来者取而代之。那怎么办?简单。既然这个钱,我不想赚,那就帮别人去赚,但你们得围绕着我来玩。开放应运而生。如果要看fancy版本的同样解释,请看博文:
小前端、大后台 路鹏(淘宝副总裁)
业务方向
现在淘宝主推三大业务方向:独立网店、社区电子商务化、第三方开发的工具海。
· 淘宝不讳言独立网店,真是很令人佩服。独立网店的样品工程就是优衣库,基本思路就是网站的域名和UI是独立网店的,其他的东西都是淘宝的,比如用户、支付、商品信息等。ShopEx在这方面是淘宝的合作伙伴。
· 社区电子商务化。简单来说,就是在bbs(如天涯)和sns(如人人网)中通过TOP API展示淘宝上商品,一但成交,大家分钱。
· 工具海。做垂直行业的商家管理工具,卖给旺铺卖家。
当然还有其他。参考:TOP业务方向
盈利模式
光炒概念,没有盈利模式的事情,我一向是只看不碰。那大多只是烧钱者的游戏,一般人玩儿不起。淘宝开放还是有比较清楚的变现模式的(包括但不限于):
· 淘宝客佣金。淘宝客是按成交计费的,CPA模式。而且API中允许用户加入一些自定义数据,用于确定购买行为过程中的贡献方,使得分享利润成为可能。以前写过篇文章,就提到分享利润的一个应用。
· 插件分成。插件分为店铺管理插件和淘江湖SNS平台插件。前者是方便管理店铺用的,后者偏重娱乐性,概念类似Facebook的应用。
· 软件销售。C/S模式,或者ShopEx独立网店大多属于这种模式。
· 传统广告。比如你调用淘宝API生成网页,加Google AdSense进入,也是可以的。
参考:TOP盈利模式
API
参考:TOP API文档
API/角色
六个基本角色,权限从低到高依次为:公开查询应用、买家应用、卖家应用、商家应用、高级应用、专业应用。较高角色的权限包含较低角色的权限。
还有三个独立角色,社区应用、媒体应用、淘宝客应用。相互独立,与六个基本角色不存在依赖关系。
API/分类
API操作的对象,有如下11种:用户,产品,类目,商品,交易,评价,物流,店铺,淘宝客,淘江湖(v=2.0),图片空间。
API基本的命名规则是<namespace>.<object>.<action>,如taobao.item.get用于获取单个商品的详细信息。
API/如何进行API调用
基于REST协议的API。调用接口地址是:
测试环境地址:http://gw.api.tbsandbox.com/router/rest
正式环境地址:http://gw.api.taobao.com/router/rest
TOP会给每个应用分配app_key和app_secret,相当于该应用的用户名和密码。API调用传入的参数分为系统参数(每个API都需要,且格式相同)和API专有参数(随API不同而不同)两类。系统参数中,app_key由系统分配所得,session通过下列方法获得,而sign是根据签名规则生成,其实就是通过一个hash函数完成了加密和校验的双重功能。这和Facebook的那一套东西很像。
参考:TOP API系统级参数定义 How Facebook Authenticates Your Application
Demo
TOP开放的是基于REST的API,和编程语言无关的。下面用Java语言为例,写个hello world。
不用TOP Java SDK的demo:http://open.taobao.com/demo/javaDemo.zip
用TOP SDK的demo: http://wiki.open.taobao.com/index.php/FAQ
注意:SDK给的其实Java源文件,需要copy到源文件的目录下,进行编译。
大家可能注意到blog上方多了广告,来自taobao称为淘宝客。这是个新的实验性质的尝试。多数都是靓衣美女,没有购买意愿的朋友,就养养眼吧,呵呵。