APE – Ajax Push Engine

ajax No Comments »

APE is an open source technology allowing to exchange data between thousands of users through a web browser, without reloading.

APE是前面有讲到的通过长连接实现的Ajax服务推,它包括两个部分:
1,APE服务端,一个用C写的支持HTTP协议的简单的服务器,实现了GET和POST方法,可通过module进行扩展。文中提到这个服务器不能代替应用服务器,但是可以和APACHE等协同工作。
2,APE的JSF,客户端的JS框架,核心使用MOOTOOLS。

Link: APE
Demo: Demo 它的主页里也有一个很Cool的DEMO
Download: 这个东西下载有点麻烦,需要从GIT版本控制中下载

APE Server
git://github.com/APE-Project/APE_Server.git

APE JavaScript Framework
git://github.com/APE-Project/APE_JSF.git

  • Share/Bookmark

Prototype 1.6.1 RC2

ajax, javascript No Comments »

第一个接触的JS lib,现在转向jQuery,用得比较少了。这个版本主要是对 Internet Explorer 8 进行了一些兼容方面的优化。

更新如下:

  • Full compatibility with Internet Explorer 8. Juriy has spearheaded the effort to replace most of our IE “sniffs” into outright capability checks — making it far easier to support IE8 in both “super-standards” mode and compatibility mode.
  • Element storage, a feature announced previously. Safely associate complex metadata with individual elements.
  • mouseenter and mouseleave events — simulating the IE-proprietary events that tend to be far more useful than mouseover and mouseout.
  • An Element#clone method for cloning DOM nodes in a way that lets you perform “cleanup” on the new copies.

一些改进:

  • Better housekeeping on event handlers in order to prevent memory leaks.
  • Better performance in Function#bind, Element#down, and a number of other often-used methods.
  • A number of bug fixes.

Links: prototype Download: prototype 1.6.1 RC2 API: api doc

  • Share/Bookmark

Server-driven Rich Web Applications in Pure Java – IT Mill Toolkit

ajax, java No Comments »

从文章题目可以看出,这个是基于Java的服务器端驱动的RIA框架。用到了Google的GWT。

文章中提到Write Java, Nothing Else,如果不相信看下面经典的HelloWorld

import com.itmill.toolkit.ui.*;

public class HelloWorld extends com.itmill.toolkit.Application {

    public void init() {
        Window main = new Window("Hello window");
        setMainWindow(main);
        main.addComponent(new Label("Hello World!"));
    }
}

这个对于那些对JS不熟或不屑的Java开发人员,应该是个不错的选择。

Link: IT Mill Toolkit 5 Demo: Demo List Downlaod: Version5.3

  • Share/Bookmark

jQuery UI 1.7

ajax, javascript No Comments »

基于jQuery的jQuery UI 1.7发布,修复了一系列的Bug,几个重要的更新列表如下:

 

  • 兼容jQuery1.3, jQuery1.3性能上有很大的提高。
  • 修复和优化Plugins,增加了一个新的progress bar
  • CSS框架,一个强大的CSS框架,不仅支持jQuery UI自己的plugins同时支持用户自定义的plugins
  • Themeroller v2 ,为CSS框架和Widget全新设计的Themeroller
  • Demos & Documentation,把Demos和Document合并成统一的Demos & Documentation
  • 完整的离线文档,下载development bundle
  • 重大的页面改进
  • CSS框架和Themes放在GoogleCode上,支持通过Google Ajax Libraries API 调用.使用方法
  • Themes打包, 可打包下载所有Themes  jquery-ui-themes-1.7.zip
  • 新的专用Blog, http://blog.jqueryui.com/

详细的Changlog

Link:  jQueryUI1.7         Download: jQueryUI1.7(你可以有选择的下载你需要的组件)

  • Share/Bookmark

Comet: ajax server push

ajax, java No Comments »

1、什么是Comet?

了解Comet首先说明一下服务器推技术,由于受HTTP协议天生的缺陷——无状态,客户端无法像基于Socket的C/S程序一样实现监听,只能是客户端主动发出请求,服务器应答。而服务器不能及时把数据主动返回给客户端。为了解决这个问题Philip McCarthy提出了Comet这种技术解决方案。在文章中作者把这种通过长链接,服务器端及时推送数据给客户端,即文中的Low Latency Data for the Browser(针对浏览器低潜伏期数据)的技术称为Comet。

它可应用于一些对数据及时性要求较高的系统性

  • 监控系统:后台硬件热插拔、LED、温度、电压发生变化;
  • 即时通信系统:其它用户登录、发送信息;
  • 即时报价系统:后台数据库内容发生变化;
  • 最近比较热门的Web游戏等式

2、分析Comet

首先针对在B/S中上能实现类似功能的技术进行一下介绍:

a、Flash+Javascript:由于Flash能使用XMLSocket,且Javascript可以调用它的接口与服务器端的套接口进行通信。

b、Java Applet:Java小程序,相当于页面中的Java程序,使用Socket和服务器通信当然也是没问题的。

c、Ajax Poll:通过轮询循环对服务器发请求,根据服务器应答判断是否数据变动。

d、Comet:建立长连接,服务器及时推送数据。其中又分为Ajax长轮询和iframe流方式。

接下来我们对这几种技术进行一个对比

Flash+Javascript JavaApplet Ajax Poll Comet
协议类型 Socket HTTP
支持环境[1] 安装Flash Player插件 安装JRE
端口限制 非80端口,受系统及防火墙限制 80端口,基本无限制
线程限制 受系统可用端口数限制 受浏览器线程限制,IE默认同一域最大线程为2,所以然推荐长连接线程最好不超过1个
其它 无法自动穿墙面 JS无法使用JavaApplet返回的结果来更新HTML 非长轮询,由于为定时请求,不能判断服务器端是否有更新,频繁请求,返回过多无用应答,浪费服务器资源。受轮询间隔时间限制,可能影响数据的及时性。 长时间占用服务器线程(已有针对该方案的服务器端解决方式,如Jetty6容器,最新的Tomcat6也进行了优化),使用iframe流方式时浏览器进度显示为一直在加载。(Google工程师已有解决IE加载问题的对应ActiveX)

[1]除JavaApplet外都需要浏览器中对JS的支持。

3、实现Comet
开源pushlet框架、DWR2使用Dojo与容器Jetty6/Tomcat6结合,具体实现见下面参考文档

4、Comet实例

5、参考文档
Comet:基于 HTTP 长连接的“服务器推”技术

Ajax for Java developers: Write scalable Comet applications with Jetty and Direct Web Remoting中文

Tomcat 6 -Advanced IO and Tomcat6

前两篇IBM技术文章后面也有大量参考资料

  • Share/Bookmark

3 reasons why you should let Google host jQuery for you

ajax, javascript No Comments »

作者鼓励大家使用 Google AJAX Libraries 来加载jQuery这样的JS包。

以前的

<script type="text/javascript" src="/js/jQuery.min.js"></script>

改成这样,方法一

<script type="text/javascript"
        src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
  // You may specify partial version numbers, such as "1" or "1.2",
  //  with the same result. Doing so will automatically load the 
  //  latest version matching that partial revision pattern 
  //  (i.e. both 1 and 1.2 would load 1.2.6 today).
  google.load("jquery", "1.2.6");

  google.setOnLoadCallback(function() {
    // Place init code here instead of $(document).ready()
  });
</script>

方法二(推荐)

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
  $(document).ready(function() {
    // This is more like it!
  });
</script>

Read the rest of this entry »

  • Share/Bookmark

Safely parsing JSON in JavaScript

ajax, javascript No Comments »

Link: Safely parsing JSON in JavaScript

在JSON转换的安全方面作者认为, eval() is an extremely bad idea, 可能会导致注入攻击.作者同时推荐了这篇文章 Douglas Crockford’s “JSON and Browser Security”.

而在转换中作者推荐使用的是json.org上的一个 a handy library .它提供了两个方法:JSON.parse()和JSON.stringify()字符串和JSON对象的互转.其中JSON.parse()使用的是正则方式而非eval()来进行转换.

而目前很多Ajax lib都使用的eval方式,文中以jQuery为例,说了几个作者的原则:

  1. 绝不使用 $.getJSON()
  2. 绝不设置Ajax请求的type选项为‘json.’

作者把type设置为text, 避免jQuery的自动转换, 把数据以文本格式取回来之后再使用上面的JSON.parse()对数据进行转换.

PS: 好长时间没有更新了, 囧zn

  • Share/Bookmark

14 AJAX, JavaScript & DHTML Datagrids

ajax No Comments »

Link: 14 AJAX, JavaScript & DHTML Datagrids

作者在文中列出了14种Datagrid的实现,以及简短的介绍和链接。

只是有一点,不知道为什么Dojo的Datagrid没有列上去,这里帮作者加上,嘿嘿

15.dojo datagrid

  • Share/Bookmark
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in