Synchronizing a Web Client Database: LocalCalendar and Google Calendar

Posted on 23rd January 2007 by Nio in AJAX, Java, JavaScript, 程序人生

Synchronizing a Web Client Database: LocalCalendar and Google Calendar

Rich Internet Applications (RIAs) are becoming more and more popular as the capabilities available to internet clients increase. There is a growing demand for RIAs to be able to store rich, structured, searchable data on the same machine as the web browser, and to be able to synchronize this data with a centralized data store running behind the web server.

Prototype based Tooltip

Posted on 7th December 2006 by Nio in AJAX, JavaScript, 程序人生

昨天需要在项目中使用 JavaScript 的 Tooltip,在网上找了很多,但都不太好用,大多数都用到了 document.write(),而且是在 window.init 的时候对所有的 tooltips 进行初始化,当使用 AJAX 的时候,这些就不能正常工作了,所以最后决定还是自己写一个简单的基于 Prototype 的 Tooltip,以后有需要的话再增加一些功能、效果。

Requirements:
Prototype 1.5.0_rc1. You can download it from the Prototype web site.

Download:
Tooltip 0.1.0

Demo:
Click here to see online demo.

Usage:
1. Insert the following lines into section in your html file:


<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="tooltip.js"></script>

2. Define a cool css for tooltip, for example:


<style type="text/css">
#tooltip {
    background-color: #ffffcc;
    color: #000000; 
    padding: 4px; 
    border: 1px solid gray; 
    text-align: left; 
    cursor: default;
    opacity: 0.85;
    z-index: 10000;
}
</style>

3. Create a new Tooltip instance for your tooltip source html element:


<div id="mytip">Move mouse over here!</div>
 <script type="text/javascript">new Tooltip({element:"mytip", text:"Tooltip message.<br/>You can use HTML tags here."});</script>

And you can set the width of tooltip box by passing "width" parameter. For example:


new Tooltip({element:"mytip", text:"Tooltip message.<br/>You can use HTML tags here.", width:250});

Don't hesitate to comment if you have any questions.

PECL :: uploadprogress

Posted on 5th December 2006 by Nio in AJAX, 程序人生

uploadprogress 已经正式放入 PECL 了,早些时候是在作者的 blog 上,叫做“Upload Progress Meter”。从名字上估计大家都能知道这是用于上传文件时,通过 AJAX 方式获取文件信息,然后在浏览器中显示上传进度条的。可以在此处看到 demo。不过这个扩展只能用于 PHP 5.2 或以上版本。

AJAX in CakePHP 序列文章第二篇 - Sortable

Posted on 26th November 2006 by Nio in AJAX, CakePHP, 程序人生

前一段有个不认识的朋友来信,询问如何在 CakePHP 中使用 sortable 拖曳排序,因为空闲时间不多,所以我也就简单的回了几封信,不知道这位朋友现在是否已经明白。不管怎样,今天还是抽空写了《AJAX in CakePHP (2) - Sortable》,希望对正在使用或将要使用 CakePHP AjaxHelper 的同学有所帮助。 之后还会抽时间争取把这个序列的文章完成 ;)

用 JSON 处理缓存

Posted on 11th November 2006 by Nio in AJAX, Cache, 程序人生

来自 IBM developerWorks 的《用 JSON 处理缓存》:

数据验证是每个企业 Web 应用程序中最富于挑战性、日新月异的部分。通常验证元数据会使 JavaScript 模块中混入服务器端代码。在本文中,您将了解如何在服务器代码的帮助下将元数据缓存在客户端的优秀方法,服务器代码将提供 JSON(JavaScript Object Notation)形式的字符串化元数据。这种方法还允许以类似 Ajax 的方式来处理多值和多组属性。