yyyyyyyyyyyyyyyyyyyy

博客园 首页 新随笔 联系 订阅 管理
上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 367 下一页

2017年7月22日 #

摘要: 一次修复MySQL数据库的经历 实验室服务器的硬盘满了,结果导致一个线上服务的MySQL数据库的两个表坏了。具体症状是desc cdb_searchindex显示 ERROR 1017 (HY000): Can't find file: 'cdb_searchindex' (errno: 2) 这是 阅读全文
posted @ 2017-07-22 13:20 xxxxxxxx1x2xxxxxxx 阅读(134) 评论(0) 推荐(0)

摘要: Python中的动态类 有这样一个需求,我有SegmentReader、PostagReader、ConllReader这三个Reader,他们都继承于一个Reader类。在程序运行中,由用户通过segment、postag或conll决定读入哪一种数据,所以XReader的实例化也由用户决定。当然 阅读全文
posted @ 2017-07-22 13:19 xxxxxxxx1x2xxxxxxx 阅读(203) 评论(0) 推荐(0)

摘要: R语言中动态安装库 在一个R脚本中,我们使用了某些library,但是发现运行环境中没有这个library,如果能检测一下有没有这个包,没有就自动安装该多好。而R中非常方便地支持这些,只要联网。 代码如下: site<-"http://cran.r-project.org" if (!require 阅读全文
posted @ 2017-07-22 13:19 xxxxxxxx1x2xxxxxxx 阅读(324) 评论(0) 推荐(0)

摘要: Apache负载均衡 Apache也是可以实现负载均衡的。Apache的负载均衡主要是通过mod_proxy_balancer实现的。那么,apache负载均衡的配置方法是什么样的? 在apache的配置文件httpd.conf中加入 ProxyPass / balancer://proxy/ #注 阅读全文
posted @ 2017-07-22 13:18 xxxxxxxx1x2xxxxxxx 阅读(182) 评论(0) 推荐(0)

摘要: Python中将dict转换为kwargs 我们都知道kwargs是变长kv参数,能否将dict转换成kwargs。 在python调用函数的时候func(**{'type'='event'}),可以将dict转化为kwargs。 参考 Converting Python dict to kwarg 阅读全文
posted @ 2017-07-22 13:18 xxxxxxxx1x2xxxxxxx 阅读(735) 评论(0) 推荐(0)

摘要: Matlab求三重积分 求 \(\int_0^1 \int_0^1 \int_0^1 sin(\pi x_1 x_2 x_3) dx_1 dx_2 dx_3\) 代码是: triplequad(@(x,y,z)sin(pi*x*y*z), 0,1,0,1,0,1) 求 \(\int_0^1 \int 阅读全文
posted @ 2017-07-22 13:17 xxxxxxxx1x2xxxxxxx 阅读(1033) 评论(0) 推荐(0)

摘要: Python codecs小Tips 用codecs.open读进来的字符串都是unicode表示的。 用codecs.open读进来的字符串都是unicode表示的。 阅读全文
posted @ 2017-07-22 13:17 xxxxxxxx1x2xxxxxxx 阅读(168) 评论(0) 推荐(0)

摘要: Python module中的全局变量 我想要实现一个python module,这个module中有一些配置项,这些配置项可以被读取,被修改。一个可行的方案是把这些配置项写到一个叫settings.py的文件中。 现在我有一个叫zz的module,它的文件结构是这样的: __init__.py _ 阅读全文
posted @ 2017-07-22 13:15 xxxxxxxx1x2xxxxxxx 阅读(547) 评论(1) 推荐(0)

摘要: Python的变长参数 def foo1(*args): for arg in args: print arg def foo2(**kargs): for key in kargs: print key, kargs[key] def foo3(*args, **kargs): print "ar 阅读全文
posted @ 2017-07-22 13:15 xxxxxxxx1x2xxxxxxx 阅读(194) 评论(0) 推荐(0)

摘要: Python sorted list的实现 具体思路是用二分保list有序+插入 class SortedList(list): K = -1 def __init__(self, K=-1): list.__init__(self) if K != -1: self.K = K def appen 阅读全文
posted @ 2017-07-22 13:14 xxxxxxxx1x2xxxxxxx 阅读(575) 评论(0) 推荐(0)

上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 367 下一页