08 2011 档案
摘要:测试条件:Windows+MongoDB 1.8.2先插入测试数据:for(var i=1; i<20; i++){ var num=i%6; db.test.insert({_id:i,name:"user_"+i,age:num});}1.普通分组查询db.test.group({key:{age:true},initial:{num:0},$reduce:function(doc,prev){ prev.num++}});db.runCommand({group: { ns:"test", key:{age:true}, initial:{n
阅读全文
摘要:测试环境:PHP5.3 +mongo-1.1.4-php5.3vc6ts的php_mongo.dll使用mongostat观察发现:1.mongostat本身也占用一个数据库连接2.PHP的mongo扩展默使用短连接,类似如此代码:new Mongo("mongodb://192.168.1.108/test"),这种短连接一般在超出变量作用域后会自己关闭3.PHP也可以使用长连接:for($i=0;$i<100;$i++){//mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db //
阅读全文
摘要:<?php$db = new Mongo ();$res = $db->wq->post->find ();foreach ( $res as $key => $val ) { echo "$key => "; EchoArray ( $val ); echo "<br/>";}function EchoArray($ele) { if (is_array ( $ele )) { echo "["; $i = 0; $count = count ( $ele ); foreach ( $
阅读全文
摘要:假设httpd.conf里的 DocumentRoot 为 DocumentRoot "D:/Apache3W"使用<Directory>指令设置url重写,在httpd.conf写如下内容<Directory "D:/Apache3W"> RewriteEngine on RewriteRule ^([^\.]+)$ $1.php Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all</Directory>&l
阅读全文
摘要:火狐:ClientWidth和ClientHeight:包括width,height和对应的paddingoffsetWidth和offsetHeight:包括width,height和对应的padding,以及对应的borderscrollWidth和scrollHeight:包括width,height和对应的padding,以及对应的borderchrome:ClientWidth和ClientHeight:包括width,height和对应的paddingoffsetWidth和offsetHeight:包括width,height和对应的padding,以及对应的borderscro
阅读全文
摘要:<html xmlns="http://www.w3.org/1999/xhtml"><head> <title>JavaScript实现的可以拖动排版可以关闭的DIV层丨芯晴网页特效丨CsrCode.Cn</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <style type="text/css"> body { margin: 0p
阅读全文
摘要:下载zlib(因为php的memcache扩展模块使用了函数»zlib 来支持数据压缩,因此安装此模块需要安装Zlib模块。):http://sourceforge.net/projects/libpng/files/zlib/1.2.5/zlib-1.2.5.tar.gz/download 下载memcache的php扩展:http://pecl.php.net/get/memcache-3.0.6.tgz由于Ubuntu11.04默认没有安装zlib,所以首先安装 zlibtar-xzvfzlib-1.2.5.tar.gzcdzlib-1.2.5./configure--pref
阅读全文
摘要:pecl的memcache扩展(注意,不是memcache的扩展,两者不同)中连接memcache服务器有两种方式:1.短连接(Memcache::connect)使用方法 Memcache::connect()打开的连接在脚本执行结束后会自动关闭。当然,你也可以使用方法 Memcache::close()来主动关闭2.长连接(Memcache::connect)这个连接不会在脚本执行结束后或者Memcache::close()被调用后关闭,持久化连接仅仅会在web服务器关机/重启时关闭。memcache的分布式是通过Memcache::addServer这个方法实现的,下面在windows.
阅读全文
摘要:转自http://edu.codepub.com/2011/0426/31119.phpifexists(select*fromdbo.sysobjectswhereid=object_id(N'[dbo].[p_exporttb]')andOBJECTPROPERTY(id,N'IsProcedure')=1)dropprocedure[dbo].[p_exporttb]GOcreateprocp_exporttb@sqlstrsysname,--查询语句,如果查询语句中使用了orderby,请加上top100percent,注意,如果导出表/视图,用上面的存
阅读全文
摘要:Ubuntu 安装wu-ftpd1.报错 make: yacc:命令未找到sudo apt-get install bison2.make的时候报错make[1]: *** [ftpcmd.c] 错误 1 make[1]:正在离开目录 `/home/ly/Tool/wu-ftpd-2.6.2/src'cd /home/ly/Tool/wu-ftpd-2.6.2/srcsed -e "s/=[ "$'\t'"][ "$'\t'"]*{/'=' {/" ftpcmd.y.orig &
阅读全文
摘要:首先进入mysql命令行1.添加用户权限 --表示添加一个用户名和密码都为sa的用户,此用户可以在局域网内登陆,并且拥有mysql除GRANT OPTION之外的所有简单权限GRANT ALL ON *.* TO 'sa'@'192.168.1.%' IDENTIFIED BY 'sa';2.删除用户权限revoke all on *.* from 'sa'@'192.168.1.%';drop user 'sa'@'192.168.1.%'; //如果不执行这一句,那么sa这个用户
阅读全文
摘要:数组能够传递引用:functionfun($arr){echovar_dump($arr);$arr[0]=99;$arr[1]=100;}$a=123;$b=456;fun(array(&$a,&$b));echo"$a,$b<br/>";PHP5.3.0新增了闭包支持:functionfuntest(){$a=18;$b="Ly";$fun=function($num,$name)use(&$a,&$b){//echo"\$a:$a,\$b:$b<br/>";//输出$a=$
阅读全文
浙公网安备 33010602011771号