http://www.cnblogs.com/shihao/archive/2013/01/25/2876727.html
-
Physical machine 192.168.10.168 ubuntu 13.04
- alway as master db
-
virtual machine 192.168.10.167 ubuntu 13.04
# http://stackoverflow.com/questions/4397412/read-edit-and-write-a-text-file-line-wise-using-ruby | |
# files = Dir.glob(File.dirname(__FILE__)+"/../app/**/*.rb") | |
files = Dir[Rails.root.join("app", "**/*.rb")] | |
files.each do |f_name| | |
# puts f_name | |
File.open(f_name, "r+") do |f| | |
old_pos = 0 | |
f.each do |line| |
http://www.cnblogs.com/shihao/archive/2013/01/25/2876727.html
Physical machine 192.168.10.168 ubuntu 13.04
virtual machine 192.168.10.167 ubuntu 13.04
To begin using the MongoDB Monitoring Service:
To install dalli in your Rails 3 app, simply add the following to your Gemfile
and run bundle install.
# Gemfile
gem "dalli", "~> 2.6.4", :platforms => :ruby
To setup Rails to use the Dalli client for production, add the following to config/environments/production.rb:
/*** | |
* 获得当前时间 | |
*/ | |
function getCurrentDate(){ | |
return new Date(); | |
}; | |
//今年以来的起止时间段 | |
function getThisYear(){ | |
//起止日期数组 |
#No such file to load -- devise/confirmations_controller | |
#resque worker devise not eager loading | |
require File.expand_path('../config/application', __FILE__) | |
require 'rake/dsl_definition' | |
require 'resque/tasks' | |
Askjane::Application.load_tasks | |
task "resque:setup" => :environment do |
## rails runner script/generate_source_tracker_link.rb | |
#eg: version_number: 20130116-1-1 #data-1(早)/2(晚)-1(article_number) | |
class GeneraterSourceTracker | |
#include ActionView::Helpers | |
#include ActionView::Helpers::UrlHelper | |
include Rails.application.routes.url_helpers | |
delegate :url_helpers, to: 'Rails.application.routes' | |
delegate :helpers, to: 'ActionController::Base' | |
def tracker_url(source_tracker) |
Git 比较不同版本文件差异的常用命令格式:
git diff 查看尚未暂存的文件更新了哪些部分
git diff filename 查看尚未暂存的某个文件更新了哪些
git diff –cached 查看已经暂存起来的文件和上次提交的版本之间的差异
git diff –cached filename 查看已经暂存起来的某个文件和上次提交的版本之间的差异
Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels. Slow clients should only be served by placing a reverse proxy capable of fully buffering both the the request and response in between Unicorn and slow clients.