Describe linux/sysctl.conf limits.conf here.
vi /etc/security/limits.conf {{{ soft nproc 2047 hard nproc 16384 soft nofile 65536 hard nofile 65536 soft memlock unlimited hard memlock unlimited }}}
vi /etc/sysctl.conf {{{ kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 fs.file-max = 6815744 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core ...
more ...Describe python/PIL decoder jpeg not available here.
{{{#!highlight bash apt-get install libjpeg-dev
pt-get install libfreetype6-dev }}}
Ubuntu11.10上,libjpeg.so、libz.so和libfreetype.so都在路径/usr/lib/x86_64-linux-gnu下,在/usr/lib下为这3个包创建软链接后执行ldconfig
在路径/usr/lib和/usr/local下查找PIL相关文件和目录,全部删除
Ubuntu11.10上,libjpeg.so、libz.so和libfreetype.so都在路径/usr/lib/x86_64-linux-gnu下,在/usr/lib下为这3个包创建软链接后执行ldconfig
删除PIL解压后的安装包Imaging-1.1.7,重新解压,并修改setup.py,或者pip安装 {{{#!highlight bash rm ...
more ...Describe python/scrapy error TypeError: __init__() got an unexpected keyword argument ‘_job’ here.
{{{ 2012-12-28 05:57:33+0800 [Launcher,29590/stderr] main() File “/usr/local/lib/python2.7/dist-packages/scrapyd/runner.py”, line 36, in main execute() File “/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py”, line 131, in execute _run_print_help(parser, _run_command, cmd, args, opts) File “/usr/local/lib/python2.7 ...
more ...Describe python/scrapy及PIL安装 here.
{{{ aptitude install python-setuptools python2.7-dev easy_install pip aptitude install libxslt-dev aptitude install libxml2-dev
pip install scrapy
pip instlal sqlalchemy
pip install PIL
}}} Ubuntu11.10上,libjpeg.so、libz.so和libfreetype.so都在路径/usr/lib/x86_64-linux-gnu下,在/usr/lib下为这3个包创建软链接后执行ldconfig
more ...Scrapy imagePipelines 图片保存路径重写
只需要重写image_key方法即可 {{{#!highlight python from scrapy.contrib.pipeline.images import ImagesPipeline import hashlib from datetime import datetime class MyImagesPipeline(ImagesPipeline): def image_key(self, url): image_guid = hashlib.sha1(url).hexdigest() #return 'full/%s.jpg' % (image_guid) path = datetime.now().strftime("%Y/%m/%d") return '%s/%s.jpg' % (path, image_guid)
}}}
more ...smb.conf
{{{
Sample configuration file for the Samba suite for Debian GNU/Linux.
This is the main Samba configuration file. You should read the
smb.conf(5) manual page in order to understand the options listed
here. Samba has a huge number of configurable options most of which
are not shown in ...
more ...drupal安装模块上传错误
装好drupal7后,安装模块时出现了这样的错误: {{{
WARNING: You are not using an encrypted connection, so your password will be sent in plain text. Learn more.
To continue, provide your server connection details
Connection method
FTP CONNECTION SETTINGS .....
etc }}}
以前wordpress安装插件时也出现过类似的错误,我觉得可能是权限的问题,于是我给了整个module目录777的权限,再试,错误还在。
于是上网找解决方法,发现有一个外国朋友的解决方案,如下:
{{{
I had the same problem with drupal 7rc4 ...
more ...在这里详述 linux/把内存虚拟成硬盘给代码加速。
在linux下, 挂载一块内存是相当的简单, 也很方便。
首先,创建一个文件用来挂载内存块 {{{ mkdir /tmp/sdk }}} 接下来,挂载 {{{ mount -t tmpfs -o nosuid,mode=1777,size=10m,rw tmpfs /tmp/sdk }}} 这样, 就成了,把频繁读写的文件方在/tmp/sdk下, 等于是直接读取内存了。
注意,重启的话,/tmp/sdk下面的数据会丢失。
也可以加到/etc/fstab里面,让它自动挂载。 {{{ tmpfs /tmp/sdk tpmfs nosuid,mode=1777,size=10m,rw 0 0 }}}
tmpfs是一种虚拟内存文件系统正如这个定义它最大的特点就是它的存储空间在VM里面 ...
more ...pgsql忘记密码 postgresql
找到数据库簇目录,里面有pg_hba.conf文件,打开编辑,你将看到类似以下的一行: {{{ host all all 127.0.0.1/32 md5 }}} 后面的也许不是md5,也许是别的. 将最后的一项改为trust,即如下: {{{ host all all 127.0.0.1/32 trust }}} 重新启动数据库服务器. 进入PostgreSQL安装目录的bin目录.执行命令. {{{ psql -d template1 -U pgsql -c "alter role pgsql password 'liuyou@163.com1';" }}} 如果服务器响应"ALTER ROLE",说明成功. 然后把pg_hba.conf恢复原样. 重新启动数据库服务器 ...
more ...sql语句分组
比如数据如下
字段为 id ,v_name,v_value {{{ v_name v_value aa aa1 aa aa2 aa aa3 bb bb1 bb bb2 bb bb3 }}} 按v_name分组 如aa这一组,假设aa3为最新 bb这一组,假设bb1为最新 怎么样查询后使得记录为 {{{ aa aa3 bb bb1 }}} {{{ select t.v_name, (select v_value from test where v_name=t.v_name ORDER BY id DESC limit 1) as v_value FROM (select ...
more ...