Sunday, July 31

About blogger.com's templates

In you can pick a template you like, and publish your blogs using this templates.

When I picked a new template yesterday, I noticed that there're 3 problems in most of the templates:

1, I think everyone can see that most of the templates have a fixed width to fit 800 x 600 screen. I can't say all, but all the templates I tested are. Those designers are too lazy to test their products under other resolutions, for example, 1280*1024 as my screen, so we can see those blogs only use 70% of the screen, like CNN. In my template I have to adjust width of #main from 485px to 70%, and #sidebar from 235 to 28%.

2, To make it portable, all the stylesheet information (css info) are on the top of the template, so make it on the top of every blog file. Currently my template has a 7,518 bytes css header, that means in my 100 blogs it took 700k bytes of the space. Actually we can replace the css header with <style type="text/css" src="template.css"/> and puth that 7,518 bytes into the file template.css, then we can save 693k bytes in the host and the network traffic.

3, All the templates I used have a header like:
<head>
<title><$BlogPageTitle$></title>
<$BlogMetaData$>

This is wrong. In any html file we should always put
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

before the title, because when the browser render title without knowing the encoding information, the browser will make a wild guess, and usually it's wrong. These templates work fine for English blogs, but not all the blogs are in English. So we have to change the template as:
<head>
<$BlogMetaData$>
<title><$BlogPageTitle$></title>

Saturday, July 30

Firefox doesn't support disable-output-escaping feature

If you have to know, disable-output-escaping is an atribute of xsl:text to stop escapes & and < into & and <. It's a pity that Firefox can't handle this well. From Denis de Bernardy I found a letter from Mozilla developers saying that the Mozilla(Firefox, Netscape) was already doing the right thing, following the standard of W3C. So they are not going to fix this bug, because they even don't think it is a bug.

Good, we have to find some way to go around it. Sean M. Burke made a javascript program to render the paragraph before it's output. It works pretty well: Feedburners is using this program too. I made a xsl file using this js program to make RSS (0.91/0.92/2.0) pretty in browsers. If you are thinking to deal with RSS, you can simply copy this rss.xsl into the same folder of your RSS file, and add
<?xml-stylesheet type="text/xsl" href="rss.xsl" ?>

under the first line
<?xml version="1.0"?>

If you want to handle other xml files, you can look into the code of the rss.xsl. Happy hacking!

Labels:

This is very helpful.

In my feeding program, I limited the rss text to less than 500 lines. Enough for most of them.
 
In your blog you don't put any link, any image, not even any Bold or Italic type, so it's easy for you. :)
 
You might also try my in-line solution for this problem. Find "Firefox disable-output-escaping" in my AJAX xslt lib source listing:

http://ajamyajax.com/ajaMyXSL.html

or download the free lib which has a few RSS Feed ideas also. Hope this helps.
 
Not sure if this will work for everyone but I believe if you use copy-of rather than value-of when copying across your xml content, it works cross-browser. We're using it with a simple JS script to turn the whole thing into html rather than having the .xml in the address bar but it works for us. More detailed instructions here.
 
Thanks Bobble,

But when the content isn't enclosed with CDATA, can it also be traversed with JavaScript?
 
Bobble, my script can work "cross-browser", so I didn't try yours.
 

RSS显示的技术问题

在IE中,如果使用 disable-output-escaping="yes" 来规范大块html文字的输出,能够得到很好的效果,
但是相同的程序在Firefox下面就得到不同的效果:

所有的HTML格式都没有起作用,而是简单地显示出来了,界面很乱。

我不是第一个发现Firefox不能实现这个功能的人。Google一下,Gea-Suan Lin在3月份就开始寻找答案。Denis de Bernardy在5月份给出一个2001-11-18的Mozilla通信,说明Mozilla不认为这是一个bug,因为它已经正确地遵循了w3c的要求,不打算改正(反而Microsoft IE的做法不规范?)。

我忽然记起Feedburner以前的feed(在firefox中)也是乱的,访问一下,发现现在居然好了!所以我深挖进去,发现它调用了Sean M. Burke的一个javascript程序,在程序中把需要格式化的文字重新排版一遍,其实只有一句话:to_decode[i].innerHTML = to_decode[i].textContent。我赶紧把它应用到我的RSS (RSS 2.0格式)上,果然实现了格式化排版的效果:


上一个帖子已经说明了使用方法:
如果你拥有自己的blog,发布RSS 2.0,只需要把这个xsl文档拷到你的RSS所在目录下面,在自己的RSS头(<?xml version="1.0" encoding="GB2312"?>下一行)加上
<?xml-stylesheet type="text/xsl" href="rss.xsl" ?>就可以了。

这个程序是开源的,遵循共同创作原则:你可以自由分发、修改这个程序,但是请在源程序中保留我的版权信息。

Labels:

RSS 的显示

RSS推广的第一个问题,就是当访问者点击那个红色标记或者后,看到

(IE)


(火狐)

就心惊胆跳的离开了。Herock的帖子不厌其烦的告诉大家:
“这个图标是用来订阅的,但却不能直接用浏览器查看,你应该在该图标上单击鼠标右键,在弹出菜单中选择“复制快捷方式(IE)”或“复制链接地址(Firefox)”,之后将这个地址添加进您习惯使用的RSS订阅软件或在线服务即可完成订阅。”
。可是如果不马上让访问者看到好处,访问者还需要去找一个“RSS订阅软件或在线服务”,其实是一种22条军规:已经有RSS软件的人不需要看这些东西,而没有RSS软件经验的人看不到什么好处,也不会跑去安装。

所以,我觉得为RSS文档添加格式说明,让用户看到里面的内容,才能让他们接受这种xml格式。我尝试了CSS格式和XSL格式,发现Firefox在这里有一个缺陷,总算把这个问题解决了。如果你拥有自己的blog,发布RSS,只需要把这个xsl文档拷到你的RSS所在目录下面,在自己的RSS头(<?xml version="1.0" encoding="GB2312"?>下一行)加上
<?xml-stylesheet type="text/xsl" href="rss.xsl" ?>
就可以显示出这样的效果:



8, August update:
发现在Firefox下看MSN Space的rss feed,是效果很差的那种。

Labels:

Friday, July 29

RSS博览:怎么看不到全文了?

bkzg的RSS博览指出有侵权嫌疑之后,关闭了全文内容的显示。新语丝少了一个镜像站点

新语丝因为各种原因,国内无法访问,因此在方舟子的邀请下出现了不少镜像站点,把主站的内容分流到世界各地,方便网友访问。我也曾经维护过一个镜像,一年后因为搬家,维护不便,镜像点关闭了。

三月,我做了新语丝的RSS。RSS只是用标准格式来提供更新的资料。至于怎么使用这些资料,每个软件开发者都可以自由发挥。bloglines可以缓存资料
(http://www.bloglines.com/preview?siteid=989295),而BlogChina也在每天读取我那个RSS,发布到http://rss.blogchina.com/feed.459.html
因此在我的建议之下,方舟子把RSS博览上的新语丝内容也写入到首页的镜像站点列表之中。

keso说,
Bokee的RSS博览之所以受到很多人的非议,是因为他们没有与客户建立良性关系,却擅自将别人的内容完全公开在自己的网站上,不管有没有利用这些内容去赚钱,这都是不道德的,严重点说,是侵权。

horse说,
绝大部分读者会流向而不是原来的blog,如果这是个人blog则完全可能因为无人阅读而兴趣阑珊。


我同意这些观点。RSS博览尽可能地淡化原blog的标识,很容易让人混淆,以为这是bkzg的文章。Bloglines也把别人RSS全文放到自己的网站,但是你要是访问http://www.bloglines.com/preview?siteid=989295,首先注意到的肯定是右边的新语丝的图标,绝对不会跟别的网站混淆起来。而且这页上你只能看到大概20片最新文章:你必须登陆bloglines之后加入新语丝,才能够看到所有的文章。

希望bkzg把rss博览整得好一些,恢复全文阅读的功能。前段时间不是有人呼吁大家发布全文RSS么?全文RSS才符合RSS发布的实质。

Updated on 3rd, Aug:
其实,看天下也在做跟rss博览一样的东西:看天下RSS地址目录同样发布了新语丝的全文。右下角能看见。什么时候成了newsgator的合作伙伴,却没人知道。悄悄的进村,打枪的不要。

Labels:

Tuesday, July 19

Will Microsoft buy a nortious spam company?

Today when I was deleting spam emails as usual, I found one topic interesting:
MICROSOFT Plans to Purchase a Spyware Company...


Huh, interesting. It's said to be originally reported by NewYork Times, that Microsoft was in talks to buy Claria, "one of the world's most notorious peddlers of spyware and adware".

A spam email is not a trustful source, so I googled and found it's also reported in News.com, so that's real then. Claria, formerly known as Gator, renamed itself in 2003 because Gator really had a bad name. GAIN(Gator Advertising and Information Network) was built in many freeware/shareware and became a major pop-up ad source of our PCs.

Anyway, adware market is a big market. I remember that it is a 3 Billion dollars markey. No wonder that Microsoft is thinking to buy it.