摘要: 网上搜索出来的方案:修改源码 func TestBeegoInit(ap string) { /* path := filepath.Join(ap, "conf", "app.conf") os.Chdir(ap) InitBeegoBeforeTest(path) */ os.Setenv("BEEGO_RUNMODE", "test") appC... 阅读全文
posted @ 2018-07-13 10:29 陈溜溜 阅读(1503) 评论(0) 推荐(0) 编辑
摘要: 每次在开发之前,我都会考虑写好单元测试,但是随着开发的进行,就会发现事情没有这么简单,因为更多时候项目中间夹杂着很多的数据库操作,网络操作,文件操作等等,每次涉及到有这些操作的单元测试,都要花费很大的代价取初始化各种环境,拖到最后单元测试只能不了了之,因此这里的一个重点是写出来的代码本身不可测试,因 阅读全文
posted @ 2018-07-13 10:22 陈溜溜 阅读(1484) 评论(0) 推荐(0) 编辑
摘要: 在 /etc/rc.local 下添加要启动的脚本 在exit 0 之前就可以了。如下代码: #!/bin/sh -e## rc.local## This script is executed at the end of each multiuser runlevel.# Make sure that the script will "exit 0" on success or any othe... 阅读全文
posted @ 2017-02-27 14:36 陈溜溜 阅读(2292) 评论(0) 推荐(0) 编辑
摘要: 最近新搭建了服务器,在安装XAMPP时,出现错误:################unable to realloc 83886080 bytes或者出现 系统自动kill pid ,找了好久才找到原因。可以用 swapon -s查看到底是不是swap 没有分区的问题。原因是 服务器端没有swap分区,而内存本身比较小(我的是512M内存),因此内存不足,无法为程序分配更多的... 阅读全文
posted @ 2017-02-23 15:26 陈溜溜 阅读(1254) 评论(0) 推荐(0) 编辑
摘要: If you want to run server in background, you can:$ nohup /path/to/server & Note this will redirect all logs generated by program to nohup.out. If you do not want logs to be saved, you can run:$ nohup ... 阅读全文
posted @ 2017-02-23 15:26 陈溜溜 阅读(253) 评论(0) 推荐(0) 编辑
摘要: adduser user1 新增用户sudo vim /etc/sudoers修改文件如下: 代码如下复制代码 # User privilege specification root ALL=(ALL) ALL user1 ALL=(ALL) ALL 保存退出,user1 用户就拥有了root权限。 阅读全文
posted @ 2017-02-23 15:25 陈溜溜 阅读(2487) 评论(0) 推荐(0) 编辑
摘要: 修改 /etc/issue 和 /etc/motd 就行了可cat 先看看当然 我的系统是Ubuntu 14.04 在 /etc/update-motd.d 下面的文件下修改 阅读全文
posted @ 2017-02-16 17:54 陈溜溜 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 红黑树学习笔记 红黑树是一种二叉查找树,接近平衡的,确保没有一条路径比其他路径长2倍。 性质: 1)每个结点要么是红的,要么是黑的。 2)根结点是黑的。 3)每个叶子结点,即空结点是黑的,叶子是NIL结点 4)如果一个结点是红的,那么他的两个孩子是黑的 5)对每个结点,从该结点到其子孙结点的所有路径包含相同数目的的黑结点 性质4暗示着任何一个简单路径上不能有两个毗连的红色节点,这样,最短的可能... 阅读全文
posted @ 2017-02-13 16:52 陈溜溜 阅读(202) 评论(0) 推荐(0) 编辑
摘要: mac 禁用自带键盘 然后发现下面的都没什么作用,连续按五次option就行了。 另外还可以用终端禁用,打开终端输入下面的代码就可以了: sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ 复制代码 恢复(后面有个换行符记... 阅读全文
posted @ 2017-02-13 16:50 陈溜溜 阅读(3282) 评论(0) 推荐(0) 编辑
摘要: c++ 常见函数运用 lower_bound(a,a+n,x)-a;//二分查找x tolower(ch);//小写化 在c++中判断map有没出现过该字符: if( ! map.count(s)) map[s] = 0; else map[s]++; map::iterator it; for(it=m.begin();it!=m.end();++... 阅读全文
posted @ 2017-02-13 16:49 陈溜溜 阅读(238) 评论(0) 推荐(0) 编辑
摘要: mac 显示隐藏文件 defaults write com.apple.finder AppleShowAllFiles -bool true 此命令显示隐藏文件 defaults write com.apple.finder AppleShowAllFiles -bool false 此命令关闭显示隐藏文件 命令运行之后需要重新加载Finder:快捷键option+command+esc,选... 阅读全文
posted @ 2017-02-13 16:48 陈溜溜 阅读(1202) 评论(0) 推荐(0) 编辑
摘要: defaults write com.apple.dock autohide-time-modifier -float 0.3;killall Dock有时候mac上 设置dock栏 隐藏显示时 它的反应速度 实在 太慢了,可以通过更改上面的值来 设置反应时间 阅读全文
posted @ 2017-02-13 16:47 陈溜溜 阅读(740) 评论(0) 推荐(0) 编辑
摘要: linux下解析域名 vi /etc/resolv.confnameserver 208.67.222.222 #opendnsnameserver 208.67.220.220sudo vim /etc/network/interfacesnull 阅读全文
posted @ 2017-02-13 16:44 陈溜溜 阅读(338) 评论(0) 推荐(0) 编辑
摘要: shell脚本内sudo无需输入密码 echo "password" | sudo -S sh -c "cat hosts.patch >> /etc/hosts"原理:管道null 阅读全文
posted @ 2017-02-13 16:43 陈溜溜 阅读(5702) 评论(0) 推荐(0) 编辑
摘要: ubuntu下更新java版本 1.在官网下要更新的java版本的jdk2.mov 到以前的安装路径下,如/usr/lib/jdk/3.改PATH,修改~/.bashrc 里JAVAHOME路径4.更新默认jdk# update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_05/bin/java 300# up... 阅读全文
posted @ 2017-02-13 16:42 陈溜溜 阅读(5149) 评论(0) 推荐(0) 编辑