Something about AJAX

Posted on 17th May 2006 by Nio in AJAX, 程序人生

1. Easy AJAX inline text edit 2.0

As everybody knows, refreshing pages is so 1999. AJAX, DOM, whatever you call it makes it possible to let people edit a piece of text inline without having to use a submit button.
You say: but that ain’t new at all! I say: But all of this has been made easy to use and implement: 2.0!

It supports IE & Firefox. Demo.

2. 通过 PHP 和 Sajax 使用 Ajax

在本教程中,将学习 Ajax 以及围绕它的应用的问题。将用 PHP 构建一个 Ajax 应用程序,显示以前写的一个教程中的面板。点击面板链接只会重新载入内容区,并用选定面板的内容替换它,从而节约了带宽和页面装入的时间。然后将把简单 Ajax 工具包(Sajax)集成进 Ajax 应用程序,它可以同步 Ajax 的使用,从而简化开发。

泡沫?

Posted on 16th May 2006 by Nio in 程序人生

It Feels Like 1998 All Over Again

Signs of a new bubble in Silicon Valley are rising, but whether that's cause for concern is a matter of fierce debate

When Caterina Fake, co-founder of the Flickr photo-sharing Web site, sat down in March to write a blog entry, she expected to rankle some readers. Her post, titled "It's a bad time to start a company," was a frank argument that a bubble was reinflating Internet businesses. Valuations are rising, hordes of copycat companies are getting funded, and venture capitalists are flooding hot areas with money again. Fake, who bootstrapped her company on $250,000 after the dot-com bust and sold it last year to Yahoo! Inc. (YHOO ), wrote that those trends are making it impossible for upstarts to stand out. She dissed the notion that a second wave of Net development, dubbed Web 2.0, will benefit all the new ventures, many of which she called "features," not companies. The frothiness, she added, reminded her of 1998. [...]

你相信 Web 2.0 是泡沫吗?或者至少有泡沫的成分?!我相信最终会有不少追随潮流的人会因此而受挫。当然,也有人因此而暴富,但这毕竟是少数。

使用 AJAX 构建 RSS 阅读器

Posted on 14th May 2006 by Nio in AJAX, 程序人生

IBM 最近发布了一个使用 AJAX 构建 RSS 阅读器的教程-Ajax RSS reader。服务器端的代码使用 PHP5 编写。

实现原理非常简单,服务器端程序通过 RSS URL 获取到 RSS 内容,然后解析,将解析出来的各项数据保存到数据库中,最后以自定义的 XML 格式完成输出,客户端只是通过 AJAX 获取到服务器端的自定义 XML 代码,然后解析出需要的标签内容,放置到恰当的位置。

服务器端使用自定义 XML 格式是有很多好处的,比如编码问题,使用 XMLHttpRequest 获取 responseText 是 UTF-8 编码的,而 responseXML 则可以是其他编码,这样就避免了对 RSS 的内容进行转码的繁琐工作。

其实这个工作原理还可以再优化,把 RSS 内容的解析工作从服务器端移到客户端,这样对于服务器端可以减轻一些负担。到这里,也许有些同学会想到干脆把通过 URL 获取 RSS 内容的工作也移交给客户端,那样服务器不是更加省事了,毕竟让服务器 GET URL 内容还是会带来很多消耗的(主要问题是网络的不确定性导致)。这种想法很好,但是不可行,因为 XMLHttpRequest 是被禁止获取别的服务器内容的,这也是出于安全的考虑。所以,服务器端至少要完成获取 RSS URL 内容这一步,其它的都可以尽可能地移交给客户端完成。

基于 WEB 的 RSS 阅读器,BlogLines、M$ 的 start.com、GOOGLE 等等做得都挺不错的。

晚上不上网

Posted on 12th May 2006 by Nio in 日常生活

这一段时间晚上极少上网,因为回到家之后的主要工作就是陪宝宝 :) 今晚因为广东的一个项目,合作厂商在整合时有些问题需要咨询,所以有了机会上网,顺便看了看朋友们的 BLOG,看了看技术方面的一些文章。

Guide lines to becoming a solid developer.

Posted on 10th May 2006 by Nio in 程序人生

via Dr. Java

1. Make sure your class represents a single thing. (确定你的类仅代表一件事/一个事物)
2. Early on think about the interaction between classes and their not implementation. (优先考虑类之间相互作用的关系)
3. Write methods that are focused on a single task. (类的方法仅关注一件任务)
4. Keep your methods no larger than 10 lines of executable code. (方法中的可执行代码保持在 10 行以内)
5. Watch your use of exceptions (当心异常)
6. Don't try to be fancy, get the job done. (不要妄想华丽,代码逻辑越简单越好,只要能够完成实际工作就够了)