这是一个基于Comet实现的聊天室Demo,功能类似于QQ群聊。聊天过程中如果有新想消息,那么就需要服务器推送消息到浏览器,所以这里可以使用Comet技术。
Comet一般有两种实现方式:长轮询(long-polling)、流(streaming)。而本文中的这个Demo的实现方式是基于流(streaming),前端使用了一个隐藏的iframe,这也是比较常用的一种方式。不过由于使用iframe流,导致浏览器上面的进度一直在转,这是因为iframe一直在加载的原因,先不要在意这些细节。
Tomcat提供了C...
分类:
其他好文 时间:
2014-08-11 10:09:52
阅读次数:
213
PHP怎么实现网站保存快捷方式
<?php
$Shortcut = "[InternetShortcut]
URL=http://blog.csdn.net/phpfenghuo/
IDList = [{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2";
Header("Content-type: application/octet-stream");
header("Content-Disposition: attachme...
分类:
Web程序 时间:
2014-08-11 00:32:11
阅读次数:
305
".*"="application/octet-stream"".001"="application/x-001"".301"="application/x-301"".323"="text/h323"".906"="application/x-906"".907"="drawing/907"".a...
分类:
其他好文 时间:
2014-08-09 21:20:09
阅读次数:
789
/***@author cody*@date 2014-08-09*@description copy text file* FILE *fopen(filename,openmode)* fclose(FILE *stream)* int fseek(stream,offset,whence)* ...
分类:
编程语言 时间:
2014-08-09 18:13:59
阅读次数:
271
相关的方法:int fputs(const char*s,FILE *stream);int gets(char *s,int size,FILE *stream);具体代码如下/***@author cody*@date 2014-08-09*@description copy text file...
分类:
其他好文 时间:
2014-08-09 18:09:58
阅读次数:
207
Input: Executing std::cin >> v discards any whitespace characters in the standard input stream, then reads from the standard input into variable v. It...
分类:
其他好文 时间:
2014-08-09 13:18:47
阅读次数:
198
开闭原则(Open Closed Principle)
开闭原则的核心是:对扩展开放,对修改关闭
白话意思就是我们改变一个软件时(比如扩展其他功能),应该通过扩展的方式来达到软件的改变,而不应爱修改原有代码来实现变化
开闭原则算是前5中原则的一个抽象总结,前五种是开闭原则的一些具体实现,所以如果使用开闭原则,其实有点虚,因为它没有一个固定的模式,但是最终保证的是提高程序...
分类:
其他好文 时间:
2014-08-09 11:40:18
阅读次数:
270
这是做的第一道BFS,很基础很简单的题目广度优先搜索算法如下:(用QUEUE)(1) 把初始节点S0放入Open表中;(2) 如果Open表为空,则问题无解,失败退出;(3) 把Open表的第一个节点取出放入Closed表,并记该节点为n;(4) 考察节点n是否为目标节点。若是,则得到问题的解,成功...
分类:
其他好文 时间:
2014-08-09 02:32:26
阅读次数:
307
Camel trading
Time Limit: 1 second
Background
Aroud 800 A.D., El Mamum, Calif of Baghdad was presented the formula 1+2*3*4+5, which had its origin in the financial accounts of a c...
分类:
其他好文 时间:
2014-08-08 18:21:52
阅读次数:
273