Jquery flash 自动复制控件 zclip

zclip版本:v1.1.1
zclip官方
Demo预览
不知道为什么,点击input触发zclip,在包含了很多html dom初始化zclip js报未知的错,这里我在最外层定义了一个div用css定位到input上方;也不能使用本地路径去测试;
实例demo下载:(这里我加了一个设置title的设置属性)

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>zclip</title>
</head>
<body>
<div>
<input type="text" value="zclip test" id="val" />
<a href="javascript:;" id="click">点击复制</a>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="http://www.amiore.com/demo/zclip/zclip/jquery.zclip.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	$("a#click").zclip({
		path: "http://www.amiore.com/demo/zclip/zclip/ZeroClipboard.swf",
		title: 'zclip title',
		copy: function(){
				return $(this).prev().val();
		},
		beforeCopy: function() {
			//复制前
			$(this).prev().select();
		},
		afterCopy: function() {
			//复制后
			alert('ok');
		}
	});
});
</script>
</body>
</html>

javascript setAttribute来设置属性IE6、IE7不兼容

var newImgX = document.createElement("span");
newImgX.setAttribute("onMouseOver", "$(this).addClass(\"nor\")");
newImgX.setAttribute("onMouseOut", "$(this).removeClass(\"nor\")");

不支持用setAttribute设置某些属性,例如对象属性、集合属性、事件属性!为什么?!我也不知道!

使用以下形式代替

var newImgX = document.createElement("span");
newImgX.onmouseover = function() {
    $(this).addClass('nor');
}

newImgX.onmouseout = function() {
    $(this).removeClass('nor');
}

memcached for php

32位 memcached for php5.3.8 下载
32位 memcached for php5.3.9 下载
php 5.3.9 membcache 64位操作系统php_memcache.dll扩展
安装方法

命令行安装命令:
C:\{$path}\memcached.exe -d install
Windows下的Memcache安装:
1. 下载memcache的windows稳定版,解压放某个盘下面,比如在c:\memcached
2. 在终端(也即cmd命令界面)下输入 ‘c:\memcached\memcached.exe -d install’ 安装
3. 再输入: ‘c:\memcached\memcached.exe -d start’ 启动。NOTE: 以后memcached将作为windows的一个服务每次开机时自动启动。这样服务器端已经安装完毕了。
4.下载php_memcache.dll,请自己查找对应的php版本的文件
5. 在C:\winnt\php.ini 加入一行 ‘extension=php_memcache.dll’
6.重新启动Apache,然后查看一下phpinfo,如果有memcache,那么就说明安装成功!
memcached的基本设置:

-p 监听的端口
-l 连接的IP地址, 默认是本机
-d start 启动memcached服务
-d restart 重起memcached服务
-d stop|shutdown 关闭正在运行的memcached服务
-d install 安装memcached服务
-d uninstall 卸载memcached服务
-u 以的身份运行 (仅在以root运行的时候有效)
-m 最大内存使用,单位MB。默认64MB
-M 内存耗尽时返回错误,而不是删除项
-c 最大同时连接数,默认是1024
-f 块大小增长因子,默认是1.25
-n 最小分配空间,key+value+flags默认是48
-h 显示帮助

Memcache环境测试:
运行下面的php文件,如果有输出This is a test!,就表示环境搭建成功。开始领略Memcache的魅力把!
< ?php
$mem = new Memcache;
$mem->connect(’127.0.0.1′, 11211);
$mem->set(‘key’, ‘This is a test!’, 0, 60);
$val = $mem->get(‘key’);
echo $val;
?>

PHP统一计算UTF-8字符长度函数

尼玛,UTF8汉字三个字节,英文一个字节…必须统一!于是找了个这

function utf8_strlen($str) {
    $count = 0;
    for($i = 0; $i < strlen($str); $i++){
        $value = ord($str[$i]); //返回字符的ASCII值
        if($value > 127) {
            $count++;
            if($value >= 192 && $value <= 223) $i++;
            elseif($value >= 224 && $value <= 239) $i = $i + 2;
            elseif($value >= 240 && $value <= 247) $i = $i + 3;
            else die('Not a UTF-8 compatible string');
        }
        $count++;
    }
    return $count;
}

Sublime text2空格替换tab键

想换几个空格就敲几个空格键

sublime text配置快键键

sublime text配置快键键

{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} },
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "    ", "exact": false},
"context":
[
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
]
},
{ "keys": ["tab"], "command": "reindent", "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": "    " },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true },
{ "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }
]
},

MySQL5.5即将面世,MySQL进入Oracle产品体系!

MySQL进入Oracle产品体系,获得了更多研发投入,新一代MySQL产品—MySQL5.5即将面世,较之之前的5.1版本,将获得诸多特性方面的提升,简单总结如下:

1. 默认存储引擎更改为InnoDB

InnoDB作为成熟、高效的事务引擎,目前已经广泛使用,但MySQL5.1之前的版本默认引擎均为MyISAM,此次MySQL5.5终于做到与时俱进,将默认数据库存储引擎改为InnoDB,并且引进了Innodb plugin 1.0.7。此次更新对数据库的好处是显而易见的:InnoDB的数据恢复时间从过去的一个甚至几个小时,缩短到几分钟(InnoDB plugin 1.0.7,InnoDB plugin 1.1, 恢复时采用红-黑树)。InnoDB Plugin 支持数据压缩存储,节约存储,提高内存命中率,并且支持adaptive flush checkpoint, 可以在某些场合避免数据库出现突发性能瓶颈。

Continue reading