用过139邮箱的都知道139邮箱有一个"邮件到达通知"服务,而且是免费服务哦(我的最爱哈)。我们如果把邮件到达通知与其他服务整合一下,就可以实现更加实用的功能了。
1.其他邮箱的到达提醒
比如我常用的是Gmail邮箱,那么只要在Gmail中设置转发到我的139邮箱,那么我的Gmail有新邮件到达时收到短信了。另外,还可以在Gmail中创建一个过滤器将指定符合条件(如发件人、收件人、主题和所含字词等)的邮件发送到我的139邮箱,就可以有选择地收到到达提醒了,比如我设置了yo2发送到Gmail的邮件转发给139邮箱,每当有新评论时,我就可以以最快的速度收到提醒了。
至于为什么不直接使用139邮箱,而用Gmail,一是Gmail的强大是139邮箱远不能及的;另外,我可不希望收到的短信是垃圾邮件......
2.监测、收取RSS订阅
用139邮箱注册一个RSS2email邮件订阅服务,如Notifixious、xfruits、feedmailer(更多服务见RSS2email邮件订阅服务收集),导入想要订阅到RSS,就可以监测和收取新闻、博客等更新了。要注意的是,要想阅读Feed,需要设置短信提醒方式为"长短信直接阅读方式",不过最多只能显示350字。如果你愿意,可以出0.3元每条收取最多2万字的彩信- -#。另外,如果输出的RSS不是全文输出,可以参考小众软件的《RSS摘要输出轻松全文》使用まるごとRSS,再把生成的Feed导入到RSS2email邮件订阅服务中。对于有邮件订阅的网站,那操作就更方便了。
3. 监测网页更新
利用"Follow That Page"服务,可以监测网页的更新,把更新发送到139邮箱。即使无法上网,也可以实时(每小时更新一次)了解网页的更新了。具体操作可以参考这里。特别适合那些没有RSS输出的网页。
4.获取天气预报
把ical格式的天气预报导入Google日历,设置这个日历的提醒方式为邮件,发送到139邮箱。(PS:更简单的方法--Google日历设置短信提醒;再简单点--Google天气短信提醒)
其实139邮箱的短信提醒功能还可以整合其他很多服务。只要你能够把文本信息以邮件形式发送到139邮箱,只要你的想象力足够丰富,那么就能随时随地以短信形式阅读了。
Tags: 139邮箱,短信
yhustc On
Web开发 @ 2009-04-18 17:12:10 |
没有评论
没有做特殊字符的输入,只有数字和字母,可能不太实用
主要是看通达信软件输入密码的键盘每次都可以随机变换,觉得挺好玩的,用JS实现了一下。
主要功能:大小写转换,随机生成软键盘。
基于jquery的随机软键盘



关闭再打开,会重新生成一个随机的软键盘

Tags: javascript,软键盘
yhustc On
Web开发 @ 2009-04-12 13:23:54 |
2条评论
很早就开始搞啊搞,做了一些小功能,比如什么TP项目中支持正则的全文搜索一类的,但是因为都没花时间搞,所以一直拖,搞啊搞的不少代码都不知道搞哪去了。
今天花了点时间把工具箱升级一下,可以当项目管理器使,项目新建与浏览激活后进行管理。Model生成的内容更加详细,给定Model可以选择对应的数据表字段生成自动填充与校验的规则等。
其他的就没啥了,全文搜索就不加了,推荐一个工具,search and replace,相当好使。
查看flash演示请移步至 http://www.yhustc.com/TPToolBox/
下载地址
TPToolBox.rar
Tags: thinkphp,工具箱
yhustc On
Web开发 @ 2009-03-28 19:01:28 |
7条评论
想给BLOG的单篇日志加一个上一篇下一篇的链接,网上搜了一下,可以用wp自己提供的previous_post_link和next_post_link这两个函数,可是链接往哪里加呢?index.php好像是单篇日志跟首页共用的,在某些地方做了判断是单页还是首页。
php代码
- <div class="comments">
- <!--p wp_link_pages();-->
- <!--p comments_popup_link(__('No Comments'), __('1 Comment'), __('% Comments'));-->
- </div>
comments_popup_link这个函数是首页上用的,显示有几条评论。在单个页面上,该函数不输出任何东西。wp_link_pages函数好像没见到有输出,想查一下是干什么的,用VISTA的搜索在文件内容中查找,居然告诉我没有结果。汗死,就算找不到函数原型,起码在这个模板页面里面是出现了啊,无语。还是百度硬盘搜索和GOOGLE的桌面搜索强大啊。我没有给VISTA的搜索编制索引,不过按理说索引应该是影响查找速度,查找精度方面裸查一次跟用索引查应该差不多啊。估计是VISTA默认没有检索PHP文件的原因。因为我试过TXT文件是可以搜索文件内容的,VISTA可能会把不认识的文件(比如PHP文件)忽略掉,即使它的确是以文本方式存储的。
不管了,跳过这个函数,直接跟WP的源文件吧,一路跟下来,跟到了wp-includes\classes.php,里面有这么一段
php代码
- function register_globals() {
- global $wp_query;
-
- foreach ($wp_query->query_vars as $key => $value) {
- $GLOBALS[$key] = $value;
- }
- $GLOBALS['query_string'] = & $this->query_string;
- $GLOBALS['posts'] = & $wp_query->posts;
- $GLOBALS['post'] = & $wp_query->post;
- $GLOBALS['request'] = & $wp_query->request;
-
- if ( is_single() || is_page() ) {
- $GLOBALS['more'] = 1;
- $GLOBALS['single'] = 1;
- }
- }
OK,现在知道了如果是显示单篇日志的话,全有一个$GLOBALS['single'] == 1,自己到模板中想要显示上下篇日志链接的地方加上这么一段就O了,CSS嘛,自己定义吧。我的.floatleft和.floatright只是简单的float:left和float:right
php代码
- <!--p if($GLOBALS['single'])-->
- <div class="floatleft"><!--p previous_post_link('« %link')--></div>
- <div class="floatright"><!--p next_post_link('%link »')--></div>
- <!--p endif-->
Tags:
yhustc On
Web开发 @ 2008-07-13 18:00:05 |
没有评论
昨天有个网友问我thinkphp中的自动验证问题,给他解答了一下,他说按照我的方法不管用。我问他验证函数写在Common.php还是写在Model类中,他说写在Model类中。我就纳闷了,Model对数据进行验证,使用自己的成员函数作为验证函数是理所当然的啊,当然,Common.php中的函数作用域是全局的,放在这里当然也是可以的,为什么放在Model中却不行呢?
把源代码找出来看,恍然大悟
php代码
- case 'function':
- if(function_exists($val[1]) && !$val[1]($data[$val[0]])) {
- return false;
- }
- break;
注意函数的调用方式,决定了它只能放在Common.php中,因为如果作为成员函数调用,必须用$this->来调用。也就是下面这个样子。
php代码
- case 'function':
- if(function_exists($this->{$val[1]}) && !$this->{$val[1]}($data[$val[0]])) {
- return false;
- }
- break;
平时都没关心过这些事情,看来以后对成员变量和成员函数使用,尤其是写C++和JAVA的时候,要养成使用this指针的习惯。
Tags: php
yhustc On
Web开发 @ 2008-07-09 10:40:46 |
没有评论
1、如何搬家
wordpress.org.cn汇总了一些BLOG程序搬家到wordpress的方法。我自己写了两个工具,详见这里
2、如何显示中文验证码
首先下载这个中文验证码程序到你的wordpress根目录,然后准备开始改wordpress。
第一,编辑主题的comment.php文件,在website下面加上如下内容(为了大家看得更明白一点,我把website的input也包含进来了,大家用的时候把这一段去掉)
php代码
- <input id="url" size="22" name="url" value="<?php echo $comment_author_url; ?>" type="text" />
- <script type="text/javascript">
- <!--
- function fleshVerify() {
- var timenow = new Date().getTime();
- document.getElementById("verifyImg").src="/verify.php?ts="+timenow;
- }
-
- </script>
-
- <img id="verifyImg" alt="" onclick="fleshVerify()" src="/verify.php" /> <small>* 点击图片刷新验证码</small>
-
- <input id="verify" size="22" name="verify" type="text" /> <label for="verify"><small>验证码 </small></label>
第二,编辑wp-comments-post.php文件,$comment_type = '';后面加上以下内容(注意:因为这里面写的中文字符没有使用语言包,所以如果你的wordpress使用utf-8字符集,请在修改wp-comments-post.php后以utf-8编码保存,否则会出现乱码)
php代码
- $comment_type = '';
- session_start();
- if(md5($_POST["verify"]) != $_SESSION["verify"] && !$user->ID )
- wp_die('错误: 你填写的确证码不正确!');
Tags:
yhustc On
Web开发 @ 2008-07-06 11:02:57 |
2条评论
今天在群里遇到一个人,说到web方面的server push的功能。当时无法理解,搜了搜资料。贴过来给大家看看。原贴里面图片连接失效了,我搜了一个,不知道是不是这个图。
Comet is a programming technique that enables web servers to send data to the client without having any need for the client to request it. This technique will produce more responsive applications than classic AJAX. In classic AJAX applications, web browser (client) cannot be notified in real time that the server data model has changed. The user must create a request (for example by clicking on a link) or a periodic AJAX request must happen in order to get new data fro the server.
I will now explain how to implement Comet with PHP programming language. I will demonstrate it on two demos which uses two techniques: the first one is based on hidden <iframe> and the second one is based on classic AJAX non-returning request. The first demo will simply show the server date in realtime on the clients and the second demo will display a mini-chat.
Comet with iframe technique : server timestamp demo
We need:
- A PHP script that will handle the persistent http request (backend.php)
- A HTML file that will load Javascript code and that will show the data coming from the server (index.html)
- The prototype library that will help us to write simple JS code
To understand how it works this schema should help:
The backend script (PHP)
This script will do an infinite loop and will return the server time as long as the client is connected. Call it backend.php:
php代码
- <?php
- header("Cache-Control: no-cache, must-revalidate");
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- flush();
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Comet php backend</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- </head>
- <body>
-
- <script type="text/javascript">
-
- var is_khtml = navigator.appName.match("Konqueror") || navigator.appVersion.match("KHTML");
- if (is_khtml)
- {
- var prototypejs = document.createElement('script');
- prototypejs.setAttribute('type','text/javascript');
- prototypejs.setAttribute('src','prototype.js');
- var head = document.getElementsByTagName('head');
- head[0].appendChild(prototypejs);
- }
-
- var comet = window.parent.comet;
- </script>
-
- <?php
- while(1) {
- echo '<script type="text/javascript">';
- echo 'comet.printServerTime('.time().');';
- echo '</script>';
- flush();
- sleep(1);
- }
- ?>
- </body>
- </html>
The client script (HTML)
This HTML document first load the prototype library in the tag, then it create the tag that will contains the server timer , and finally it create a comet javascript object that will connect the backend script to the time container tag.
The comet object will create some invisible iframe tags (depends on the web browser). These iframes are in charge to create the background persistent http connection with the backend script. Notice: this script do not handle possible connection problems between client and server.
xhtml代码
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
- <script type="text/javascript" src="prototype.js"></script>
- <div id="content">The server time will be shown here</div>
- <script type="text/javascript">
- var comet = {
- connection : false,
- iframediv : false,
-
- initialize: function() {
- if (navigator.appVersion.indexOf("MSIE") != -1) {
-
- // For IE browsers
- comet.connection = new ActiveXObject("htmlfile");
- comet.connection.open();
- comet.connection.write("<html>");
- comet.connection.write("<script>document.domain = '"+document.domain+"'");
- comet.connection.write("</html>");
- comet.connection.close();
- cometcomet.iframediv = comet.connection.createElement("div");
- comet.connection.appendChild(comet.iframediv);
- cometcomet.connection.parentWindow.comet = comet;
- comet.iframediv.innerHTML = "<iframe id='comet_iframe' src='./backend.php'></iframe>";
-
- } else if (navigator.appVersion.indexOf("KHTML") != -1) {
-
- // for KHTML browsers
- comet.connection = document.createElement('iframe');
- comet.connection.setAttribute('id', 'comet_iframe');
- comet.connection.setAttribute('src', './backend.php');
- with (comet.connection.style) {
- position = "absolute";
- left = top = "-100px";
- height = width = "1px";
- visibility = "hidden";
- }
- document.body.appendChild(comet.connection);
-
- } else {
-
- // For other browser (Firefox...)
- comet.connection = document.createElement('iframe');
- comet.connection.setAttribute('id', 'comet_iframe');
- with (comet.connection.style) {
- left = top = "-100px";
- height = width = "1px";
- visibility = "hidden";
- display = 'none';
- }
- comet.iframediv = document.createElement('iframe');
- comet.iframediv.setAttribute('src', './backend.php');
- comet.connection.appendChild(comet.iframediv);
- document.body.appendChild(comet.connection);
-
- }
- },
-
- // this function will be called from backend.php
- printServerTime: function (time) {
- $('content').innerHTML = time;
- },
-
- onUnload: function() {
- if (comet.connection) {
- comet.connection = false; // release the iframe to prevent problems with IE when reloading the page
- }
- }
- }
- Event.observe(window, "load", comet.initialize);
- Event.observe(window, "unload", comet.onUnload);
- </script>
Download it
Here is the tar.gz archive of this demo.
Online demo
Here is the online demo.
From: http://kerphi.zeitoun.net/articles/comet_and_php/
Tags:
yhustc On
Web开发 @ 2008-04-08 18:32:00 |
没有评论
最新评论