摘要: 最近常用到mongo. 看朋友这篇命令挺全的就转来了。如果想查看当前连接在哪个数据库下面,可以直接输入db> dbAdmin想切换到test数据库下面> use testswitched to db test> dbTest想查看test下有哪些表或者叫collection,可以输入> show collectionssystem.indexesuser想知道mongodb支持哪些命令,可以直接输入help> helpHELP show dbs show database names show collections ... 阅读全文
posted @ 2013-07-08 16:55 群叔 阅读(272) 评论(0) 推荐(0) 编辑
摘要: MongoDB语法MySql语法db.test.find({'name':'foobar'}) select * from test where name='foobar'db.test.find() select *from testdb.test.find({'ID':10}).count() select count(*) from test where ID=10db.test.find().skip(10).limit(20) select * from test limit 10,20db.test.find({ 阅读全文
posted @ 2013-07-07 23:55 群叔 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 案例一: 1 15 string(12) "abcdef123456"16 }17 array(2) {18 [0]=>19 string(12) "abcdef123456"20 [1]=>21 string(1) "6"22 }23 array(2) {24 [0]=>25 string(12) "abcdef123456"26 [1]=>27 string(1) "6"28 }29 ------------------------------------------ 阅读全文
posted @ 2013-07-07 20:29 群叔 阅读(439) 评论(0) 推荐(0) 编辑
摘要: 代码在ubuntu下无缝运行OK转到我的win7 64位 期间 学习机上 报错:Call to undefined function curl_init()因为用到curl 远程抓取数据。所以谷歌之:总结,win7 64解决方法与win2003不同:1.extension=php_curl.dll2.extension=php_openssl.dll //取消php.ini前面的这2个 注释3.确保php安装目录下 这libeay32.dll ssleay32.dll 2个DLL动态库, 已经被复制到 %System%目录下面。 32为就是c:\windows\system32 64为是... 阅读全文
posted @ 2013-07-07 15:21 群叔 阅读(441) 评论(0) 推荐(0) 编辑
摘要: 1. 简单例子 有助回忆基本知识点 1 define("DIR",dirname(__FILE__)); 2 require_once(DIR."/libs/Smarty.class.php");//引用smarty相对路径 3 4 $smarty = new Smarty(); 5 $smarty->template_dir(DIR."/templates");//模板路径 6 $smarty->complie_dir(DIR."/templates_c");//编译模板的路径 7 $smarty-& 阅读全文
posted @ 2013-07-07 11:20 群叔 阅读(554) 评论(0) 推荐(0) 编辑
摘要: gzipgzip xxx文件 压缩文件xxx,后缀.gz 并且删除原来文件gzip -tv xxx.gz 测试压缩文件压完整性压缩当前文件夹所有文件: zip -r ./1.zip ./* -r递归解压:unzip 1.zipunrarunrar x aa.rarunrar e aa.rarx参数 是解压到一个文件夹里 e参数是把所有文件解压到当前目录下 注意这个命令比较特殊参数之前不能加-unzip用法tar:压缩 tar –cvf jpg.tar *.jpg //将目录里所有jpg文件打包成tar.jpg tar –czf jpg.tar.gz *.jpg //将目录里所有jpg... 阅读全文
posted @ 2013-07-05 21:41 群叔 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 写的很全了, 我就直接转载朋友的过来了:liuzhoulong数据导出 mongoexport假设库里有一张user 表,里面有2 条记录,我们要将它导出> use my_mongodbswitched to db my_mongodb> db.user.find();{ "_id" : Objec... 阅读全文
posted @ 2013-07-05 20:58 群叔 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 命令模式(command mode)、插入模式(Insert mode)和底行模式(last line mode)1.进入插入模式 按「i」切换进入插入模式「insert mode」,按“i”进入插入模式后是从光标当前位置开始输入文件; 按「a」进入插入模式后,是从目前光标所在位置的下一个位置开始输入文字; 按「o」进入插入模式后,是插入新的一行,从行首开始输入文字。2.常用退出编辑的命令: w filename (输入 「w filename」将文章以指定的文件名filename保存): wq (输入「wq」,存盘并退出vi): q! (输入q!, 不存盘强制退出vi)回复上一次操作... 阅读全文
posted @ 2013-07-04 23:08 群叔 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 莫名其妙的,ubuntu 无法访问外网。ping www.taobao.com www.baidu.com 提示无效的主机名但是ping 外网ip 都是可以PING通的。所以断定是 dns问题解决:sudo vi /etc/resolv.confnameserver 8.8.8.8 (谷歌DNS)sudo /etc/init.d/networking restart 阅读全文
posted @ 2013-07-04 23:04 群叔 阅读(3525) 评论(0) 推荐(0) 编辑
摘要: 1. redis-cli 命令行进入redisset,get,setex,给键值设置过期时间 setex name 10 DOG //设置name键 为 DOG 10秒后过期。setnx,判断值是否存在,如果存在就不更新键值。如果不存在,则赋值。 (nx :not exist)getset,设置一个新值,并返回key的旧值。mset,批量设置键值。msetnx,mget,setrange,替换值串部分。 客户端测试:redis 127.0.0.1:6379> set email test@gmail.comOKredis 127.0.0.1:6379> setrange email 阅读全文
posted @ 2013-07-03 23:49 群叔 阅读(1135) 评论(0) 推荐(0) 编辑