分类目录归档:互联网

[摘]微博力量是博客200倍

[摘]微博力量是博客200倍

第一,能写并有意愿写有价值微博的人群是博客的4倍。第二,这群人的人均微博产量是之前人均博客产量的5倍。这两条讲的是生产成本大大降低。

第三,有时间并且愿意读微博的人群是博客的2倍。第四,适合阅读微博的场所和碎片时间加总是博客的5倍。这两条讲的是消费成本大大降低。

4乘5乘2乘5,得到200倍。

(via 英国《金融时报》中文网专栏作家 程苓峰)

什么是气度和视野?

google:整合全球的信息
facebook:从根本上改变人们沟通方式
twitter:地球的脉搏
apple:Think Different

第一次听到”地球的脉搏”时,突然间眼前一亮,感觉自己豁然开朗,神清气爽,夸张点说,那一瞬间升华了。虽然中国的脉搏如此不清晰,虽然眼前的道路仍然很迷茫,虽然尼采说,人生就是带着镣铐的舞蹈,但那最原始的梦想,我仍会珍藏在心底。

JavaScript引擎速度比较

自从Google的Chrom浏览器推出以来,Javascript的速度就成为大家追的焦点。一个比一个宣称快。

Mozilla的TraceMonkey: (现在Firefox3.0里面的还是SpiderMonkey)

Webkit的SquirrelFish & SquirrelFish Extreme:

于是测试了玩玩。SquirrelFish Extreme用的是Webkit r36712 nightly build版本。有空再补TraceMonkey的。

测试集 V8 IE8 SpiderMonkey SquaireFish Extreme
SunSpider 3080.8ms 12977.8ms 5744.0ms 2704.2ms
jsTimeTest 74ms 785ms(*) 329ms 107ms

(*): 这个数据可能偏大,因为中间弹出了对话框:”脚本执行时间太长,是否继续”之类的,但不比不知道,IE8还是慢得太多了。

MSN上的好友列表

一些基本概念,摘自http://www.hypothetic.org/docs/msn/notification/get_details.php

Forward List (FL)

The forward list, abbreviated as FL, is the list of principals whose presence you are subscribed to. You can expect to be notified about their on-line state, phone numbers, etc. This is what a layman would call their “contact list”.

This list currently (as of March 23, 2003), has a limit of 150 people, doubled from a previous 75. If you try to add a 151st person, you will receive error 210 and they will not be added.

Everyone in your forward list belongs to one or more groups, identified by their group number. By default, they belong to group 0.

Reverse List (RL)

The reverse list, abbreviated as RL, is the list of principals that have you on their forward list. You cannot make modifications to it. If you attempt to add or remove people from this list, you will be immediately disconnected from the NS with no error message.

Allow List (AL)

The allow list, abbreviated as AL, is the list of principals that you allow to see your online presence – as opposed to your reverse list, which is the list of people who request to see your online presence. If someone removes you from his or her contact list, he or she is automatically removed from your RL but not your AL. He or she no longer receives online presence from you, but if he or she adds you again, your client can act in the knowledge that you previously allowed him or her to see your presence.

Block List (BL)

The block list, abbreviated as BL, is the list of people that are blocked from seeing your online presence. They will never receive your status, and when they try to invite you to a switchboard session, they will be notified that you are offline. No-one can be on the AL and the BL at the same time, and if you try to add someone to both lists, you will receive error 219.

用Miranda, MSN, 还有自己的程序做了些实验,基本上搞清楚了:

  • 假设一开始都是新的帐号
  • jimax 加了 xiao, xiao收到“被加为好友”信息,选择确认,现在xiao里面是 FL, AL, RL; jimax 里面是FL, AL, RL, 双方都能看到对方信息
  • 下面 xiao 删除 jimax (MSN里面, 但不阻止), 此时xiao里面是 AL, RL (只是从FL里删除), jimax里面是FL, AL (只是RL中删除) jimax 仍然能看到 xiao 的在线信息
  • 下面 xiao 阻止 jimax,此时xiao里面是 BL, RL, jimax里面是FL, AL, jimax看不到xiao的在线信息了
  • 现在 jimax 删除 xiao (用自己程序), jimax里面彻底没有(从FL, AL里面都删除了), xiao里面是 BL
  • 现在 xiao 加了 jimax, jimax 里面 FL, AL,RL. jimax 看不到xiao的信息,因为xiao里面是 FL, BL, RL
  • jimax删除xiao(自己程序) RL, BL (而不是全部删除), xiao里应该是FL, BL
    (这里是有些不同的地方:删除的时候,如果FL, AL ==> 0; 如果FL, AL, RL ==> RL, BL)

  • 此时xiao删除jimax, jimax里面是BL, xiao里面是BL
  • 此时xiao加jimax,jimax得不到“被加为好友”,jimax BL, RL, xiao里面是FL, BL
  • 此时jimax加xiao, 变为 FL, AL, RL, xiao里面是FL, BL,RL , jimax得不到xiao信息,xiao能得到jimax消息
  • xiao 解除阻止,jimax不变 FL, AL, RL, xiao为FL, AL, RL, 则两边都可以得到消息了

    原来主要的问题是,MSN里面删除帐号的时候,并不从AL里面删除,这就导致了再次加好友的时候,好友帐号不会再次得到“被加为好友”信息

  • pyMSNt 和 MSNShell不兼容的问题

    最早用国外的一些Jabber的MSN Gateway(比如jaim.net 和anywise.com上的),从MSN发送消息发现消息总会丢失,或者提示“无法将以下消息发送给所有接收者:”但发送消息给MSN客户端却总是能成功。但jabbernet.dk上MSN Gateway的就一直都没问题。后来自己安装了pyMSNt,发现也出现挂不上去的问题,开始总以为是pyMSNt的安装或者配置哪里不对。一个朋友又说总是在家里能挂上,在单位就总是出问题。总结了各种现象,才发现,是MSNShell和pyMSNt不兼容的问题。卸载了MSNShell,不管连哪个都很正常了。而msn.jabbernet.dk不是pyMSNt的,(它有个msnnew.jabbernet.dk好象是pyMSNt的)所以一直没有问题。

    问题是这样发生的:在一般情况下协议里都是一个空行来隔开消息头和消息体的。而对于没有消息体的消息来说,消息头结束后要跟两个回车换行,也即下面必须要有个空行的。
    根据http://msnpiki.msnfanatic.com/index.php/MSNP8:Payload_Commands

    “It’s possible for messages to have no body. If you just end a message with the two newlines at the end of the header, it will have an empty body. ”

    但是如果你安装了MSNShell, 并且开启了”加密聊天”模式后,MSNShell会在发送正常的消息前,进行握手(看看对方是不是也支持加密),发送如下的信息
    MSG test@msn.com ming 165
    MIME-Version: 1.0
    Content-Type: text/x-bobo
    sv: 4.2.28.32
    mv: 8.1.178.0
    state: ssShellHandShake1
    bobo1: 1658134426017880279626016817.6426387281559877623017753
    问题就在于,MSNShell的这条信息也是没有消息体的,但是在消息头后面只有一个回车换行。虽然前面的MSG后面跟的playload size是正确的。但pyMSNt的做法是在读完一行,发现是消息头之后,并不立刻判断其长度是否已经满足,而总是去读下一行,直到读到一个空行后再判断,如果size还不够再转到读消息体的函数里判断长度。这就造成了pyMSNt把下一条正式消息
    MSG test@msn.com ming 130
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    X-MMS-IM-Format: FN=%E5%AE%8B%E4%BD%93; EF=; CO=0; CS=86; PF=2
    的第一行也当成是本消息的内容了,然后丢弃,然后造成把MIME-Version一行当作下一条命令的开始,然后造成Invalid Command 异常。

    弄清楚原因,简单改造一下pyMSNt,问题就解决了。圣诞之夜,孩子睡了,独自在屏幕前。不过解决了这个问题,感觉还挺爽….

    Zend Optimizer 和 PHP 5.2.3 不兼容?

    客户的机器是台FreeBSD,装了PHP 5.2.3 和 Zend Optimizer 3.2.8。想给用户先是加密的代码,等客户付钱后再改成不加密的,但是Zend Guard 4 加密过的代码执行起来IE说找不到网页,Firefox提示下载这个网页。于是换了Zend Guard 5, 因为Guard 5需要Zend Optimizer 3.3.0以上,于是升级了Zend Optimizer,但是仍然不行,加密过的代码显示一片空白。试了几个简单的加密倒是没问题,但一到比较复杂的程序就不行了。在网上也查不到相关的问题和说明。

    最后实在没辙了,把PHP5.2.3换成5.2.1,问题解决了。看样子是5.2.3和Optimizer的兼容性问题,感觉这是个挺大的 BUG,PHP的这次升级太不负责任了,折腾了起码三四天 🙁

    在openfire基础上安装jwchat

    Openfire 已经直接支持HTTP Binding, 因此jwchat不用再依赖于JHB(JabberHTTPBinding),但Openfire的Http binding 是以8080端口提供的,因此需要做如下步骤:

    1. 在apache的httpd.conf

    AddDefaultCharset UTF-8
    ProxyPass /http-bind/ http://127.0.0.1:8080/http-bind/

    另外要注意的是,需要把

    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so

    这两句都打开。

    2 更改jwchat/config.js里面的 SITENAME 为你所提供的jabber server的域名。

    注释掉其它的增加一个新的Backend

    httpbase:”http-bind/”
    type:”binding”
    servers_allowed:[SITENAME]

    3. 在openserver的管理端增加两个服务器属性:

    xmpp.httpbind.client.requests.polling = 0
    xmpp.httpbind.client.requests.wait = 10

    这就OK了。

    参考了http://chromus.kajigger.com/blog/index.php?p=100,但实际上没有必要和<virtualhost>较劲, 开始的失败就是配置<virtualhost>总不对。

    还有一个问题是只打开了proxy_module,没有打开 proxy_http_module,这时候的现象就是总说server disconnected。

    JavaScript的一些经验

    firefox下 没有obj.innerText,只能用innerHTML
    firefox下 没有currentStyle, 可以用document.defaultView.getComputedStyle(aaa,null) 得到类似的currentStyle
    prototype.js 中提供的class挺好的,能把代码组织得比较清晰,但什么原理还没搞得太清楚

    另一种局部刷新

    学到另一招,不需要象AJAX一样创建对象:


    function testScript(resultRowCnts)
    {
    MyScript.src = “new.js”; // 或者”new.asp”
    }