- 浏览: 14247 次
- 性别:
- 来自: 北京
最新评论
文章列表
mongoid 多库
- 博客分类:
- mongo
#coding:utf-8
class Phone
include Mongoid::Document
set_database :phone
end
config:
defaults: &defaults
host: 127.0.0.1
development:
<<: *defaults
database: person_data
databases:
spider:
database: person_data
host: 127.0.0.1
port: 27017
p ...
s.split(/\d+|[a-zA-Z]|[[:punct:]]+/)
[[:punct:]]匹配标点符号
下载yaml-0.1.4.tar.gz, http://pyyaml.org/wiki/LibYAML
解压libyaml,然后编译安装
sudo aptitude install build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev
sudo apt-get install libssl-dev
sudo apt-get install firefox
sudo aptitude install xvfb
sudo gem install watir-webdriver --no-ri --no-rdoc
sudo gem install headless
require 'watir-webdriver'
require 'headless'
Headless.ly do
browser = Watir::Browser.new :ff
browser.goto "www.baidu.com"
puts browser.html
end
启动 sudo ./nginx
配置文件 conf / vhost 配置路径 端口
sudo gem install passenger
sudo ./passenger-install-nginx-module
sudo ldconfig
sudo ln -s /usr/local/lib/libpcre.so.1 /lib
--with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module
rails yaml error
yum install libxslt* ...
./mongorestore -h 192.168.1.1 -d db_name --directoryperdb ~/wenjianjia/db_data
mongodump -d db_name -o ~/wenjianjia
mysql utf8建表
- 博客分类:
- 新手
create table weibo_verifieds(id int not null primary key auto_increment,uid char(255),uname char(255),uimg char(255),url char(255)) charset default utf8;
requirt 'cgi'
def to_utf8(unicode_string)
unicode_string.gsub(/\\u\w{4}/) do |s|
str = s.sub(/\\u/, "").hex.to_s(2)
if str.length < 8
CGI.unescape(str.to_i(2).to_s(16).insert(0, "%"))
else
arr = str.reverse.scan(/\w{0,6}/).reverse.select{|a| ...
ruby转换中文html Unicod
- 博客分类:
- 新手
require 'htmlentities'
coder = HTMLEntities.new
str=coder.decode(str)
mysql 中文乱码
- 博客分类:
- 新手
create table xxxxx(id int not null primary key auto_increment,created_on datetime,updated_on datetime,weibo_name char(255),weibo_image char(255),weibo_type int,weibo_id char(255),app_id int,weibo_desp text,brand_id int) default charset 'utf8';
1.安装nginx
运行:
sudo apt-get intsall nginx
Ubuntu安装之后的文件结构大致为:
* 所有的配置文件都在/etc/nginx下,并且每个虚拟主机已经安排在了/etc/nginx/sites-available下
* 程序文件在/usr/sbin/nginx
* 日志放在了/var/log/nginx中
* 并已经在/etc/init.d/下创建了启动脚本nginx
* 默认的虚拟主机的目录设置在了/var/www/nginx-default
下面可以启动nginx来看看效果(请确保80端口没有其他服务在使用):
Ubuntu请运行:
sudo / ...
require 'rubygems'
require 'jcode'
$KCODE='u'
def main(str)
num=0
if str.to_s.match("亿")
str.to_s.match(/(.+)亿(.+)/)
num1=conv($1.to_s)*100000000
num2=conv($2.to_s)
num=num1+num2
else
num=conv(str.to_s)
end
return num
end
def conv( ...
一.MongoDB的配置
1下载解压:
curl http://downloads.mongodb.org/linux/mongodb-linux-x86_64-1.4.4.tgz > mongo.tgz
tar xzvf mongo.tgz
2.安装 MongoDB 到 /usr/local/mongodb 目录下:
mv mongodb-linux-x86_64-1.4.4 /usr/local/mongodb
3.创建软件连接
sudo ln -s /usr/local/mongodb/bin/mongod /usr/bin/mongod
4.创 ...
In Ubuntu you need to follow these steps:
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
sudo gem install nokogiri
sudo gem install mechanize
sudo gem install sanitize
sudo apt-get install imagemagick
sudo apt-get install libmagick9-dev
sudo apt-get install librmagick-ruby
sudo gem install rmagick --include-dependencies