Archive for June 2008

 
 

服务器租用、域名注册必须注意的几点

1、一定要支持远程ssh

2、一定要有独立IP

3、一定要支持fsockopen()函数

4、一定要支持mod_rewrite

5、一定不能用大陆的虚拟主机(虚拟空间)

据我所知,同时满足1、2、3、4条件的服务器,国内只有独立主机才会有(租金大概5000~10000之间/年),独立主机的速度一般不错,可以考虑。

大陆的虚拟主机千万不要用,年轻的时候几乎用遍了国内的每一个知名的虚拟主机,包括中国频道,中资源,万网。。。。。。没有一个不是垃圾。国外3000G的空间才卖60美金一年,万网200M的垃圾空间要卖5000元。国外的mysql数据库免费无限量,国内的50M数据库就要另加400元一年,无耻到极点。更不用说ssh,独立IP等了。

顺便点评一下国外比较流行的两个公司:IXWebhostingMediaTemple

IXWebhosting:免费赠送8个独立IP,可以放很多个网站(而且可以直接用IP访问),这点很牛。我用过一年时间,有两个大问题:1、不支持SSH,备份和转移非常麻烦;2、经常出现无法上传的问题,查了之后发现是“out of disk space”,明显是服务器配置错误,联系在线客服之后,10分钟左右就解决好了。但是经过连续4次同样的问题之后,我彻底失去耐心了。于是换到了大名鼎鼎的MediaTemple

MediaTemple: IT知名博客TechCrunch就是用MediaTemple,其界面UI设计堪称完美,可以说是主机界的苹果电脑。价格偏高,但口碑甚好,可谓物有所值。提供ssh,一个独立IP。刚开始用,速度不错,其他情况还需要观察。

最后,注册域名千万别用国内的注册商,理由如下:

1、国外只需要7美金一个.com域名,换算一下也不到50元;而国内要卖100~150元

2、在国内,你花了钱注册了域名,管理权却并不真正属于你。注册商里的任何一个员工都可以轻易的把你的域名所属权搞成别人的

3、在国内,你注册了域名,如果某一天想更换注册商,可谓比登天还难,因为更换的时候需要向国内的注册商请求一个“转移密码”才能完成,而这个转移密码,他们是不愿意告诉你的

4、国外的域名解析措施更加完整方便 ,可以指定多个子域名,自由设置A记录、CNAME、MX记录等,国内却限制多多

国外的域名注册商建议用godaddy.com,最保险。国外也有很多垃圾注册商 ,小心为妙。

Stupid things happening everyday in China

1. Before and during the Olympics, my friend in Hong Kong is not allowed to send packaged food by express company.

2. Most hotels are not allowed to accommodate foreigners, unless they have special “Foreigner Accommodation” certificate.

3. Only in 4-star and 5-star hotels are you allowed to watch foreign TV programs. Damn, if foreign TV is brain-washing and mind-corrupting, why is it legitimate in good hotels?

4. If you are not born in big cities like Shanghai or Beijing, you are not legitimate to live there without a “Temporary Staying Card”.

5. A normal house in big cities like Shanghai or Beijing costs over USD100,000 which is equal to 20 years’ full salary of an average Chinese citizen.

6. In the best universities like Peking Univ. (or Beijing Univ.), there are really smart and hard-working Chinese students, but they can only access domestic websites by default, unless they officially pay a “foreign network access” fee every month.

公民生活与社区氛围

所有社区都希望用户每天主动来发起讨论,如何刺激这个欲望呢?

看托克维尔写的《论美国的民主》,提到,在美国结社和发表政治言论是非常简单的事情,所以很容易拉帮结派,为自己的利益呼吁和斗争。所以美国成就了一批全世界最活跃的人群。

社区也需要根据人的不同特点来鼓励拉帮结派,形成各自的小圈子,甚至鼓励互相斗争。

公民生活起来了,社区才会有归属感。

Firefox和IE的CSS兼容性问题漫谈

先从设置最小高度:min-height说起吧

对于某些内容可变的层(比如用户评论),我们希望它有个最小的高度(比如30px),这样的话,即使内容只有一行字,也不会太难看;同时又希望在内容比较多的时候,层的高度能自动撑开,也就是要求height: auto。这时候就可以设置css的min-height属性。min-height在Firefox里有效,但IE无法识别。可以使用下面这个解决方案:

.div_class{min-height:30px;height:auto !important;height:30px;}

第一行设置 min-height:30px;对Firefox有效;第二行height:auto !important;也对Firefox有效,后面紧跟的“!important”是Firefox专用的一个标记,带有这个标记的设置具有最高优先级,之后的设置都无效。所以第三行的height:30px对Firefox无效了;同时,由于IE无法识别min-height和“! important”,所以只有第三行有效,由于IE默认就是高度自适应的,所以即使设置了30px的高度,只要内容很多,也会自动撑开,不需要设置 height:auto。最后,上述代码产生如下效果:

对于Firefox,等同于:

.div_class{min-height:30px;height:auto;}

对于IE,等同于:

.div_class{height:30px;}

“!important” 是个非常好用的东西,如果你写过几个月的跨浏览器的CSS代码,就很容易被Firefox和IE之间的差别而感到恼火。比如padding属性就是一个例子。

假设这样一个层:

.div_name {width:100px;padding:10px;}

在IE里面,层的宽度是100px,四周的余空为10px;但是对于Firefox,层的宽度变成了100px+10px+10px=120px,对于宽度敏感的设计来说,整个就混乱了。怎么办呢?还是求助于“!important”吧。只要这样写就可以了:

.div_name {width:80px !important;width:100px;padding:10px;}
因为80+10+10=100。正好让宽度 变成100px。

有时候,我们给一个层加上边框 ,在Firefox里面也会出现宽度增加的情况,比如:

.div_name {width:100px;padding:10px;border:2px solid #ccc;}

上面这个层,在Firefox里面的实际宽度等于100+10+10+2+2=124px,因为边框也会增加宽度。怎么办呢,还是靠“!important”,这样写就可以了:

.div_name {width:76px !important;width:100px;padding:10px;border:2px solid #ccc;}

写CSS经常要做这样的计算,还要写很多!important,苦了设计师们,什么时候IE和Firefox的CSS标准统一就好了。

Mysql数据转移编码问题

MySql的字符集是越来越严格了,涉及到好几个层面的编码。

实用的来说,我们一般就用gb2312或者utf8两种编码(个人严重推荐utf8) ,下面以utf8为例说一下:

1、转移数据的时候,在Create table后面注明字符集为 utf8,数据库校验(collation)字符集为utf8_unicode_ci,比如:

CREATE TABLE `member` (
`id` int(7) NOT NULL auto_increment,
`account` varchar(50) default NULL,
`password` varchar(100) default NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;

2、客户端读写数据的时候,在select database前面加上SET NAMES ‘utf8′这个语句,这是为了告诉MySql连接校验(connection collation)的字符集也是utf8,比如:

$mysql->host=”localhost”;
$mysql->user=”foor”;
$mysql->pass=”bar”;
$mysql->db=”db”;
$mysql->connect();
mysql_query(”SET NAMES ‘utf8′”);
$mysql->select_db();

这样就搞定了,gb2312也是类似的修改这两层就可以了

A Long-tail case study

This morning when I opened google analytics, I was a little bit surprised that CAIMAI’s daily unique visits increased by 30%, and 90% of visits came from Baidu search results. The interesting part is the 90% of leading keywords are very infrequent, such as:

  • The best Peking Roasted Duck
  • The best movie about mummified corpse
  • The most popular blood type in Taiwan
  • The best way of oral sex
  • Why people like panda
  • ….

Since CAIMAI is a Chinese web2.0 site for sharing the best stuff and best memories (similar to Bestuff.com) , everything could be found on it. That’s why so many wacky keywords work.

I immediately told myself:”WOW! This is a good case for long tail theory.”

But I was suddenly frustrated when I saw a 70% high bounce rate. Damn, Netflix is not like that. So What’s the difference?

There are official sites for Roasted Duck, and movie, and blood type analysis, and sex position, and panda. They are more professional & detailed than CAIMAI in this specific area. In contrast, there are scarcely any substitute for those hard-to-find DVDs which could be only found on Netflix ( Those add up to 21% of all sales).

Yeah. I guess substitutability is fatal weakness for a failed Long Tail model.