By default RAILS_RELATIVE_URL_ROOT
is used only for asset pipeline.
To namespace your rails routes you need to wrap run MyApp::Application
with map
in your config.ru:
map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do
#!/bin/bash | |
################################################################################## | |
# 1 - Create the base container | |
SUITE=squeeze | |
RELEASE=$SUITE | |
sudo lxc-create -n ${RELEASE}-base -t debian | |
rootfs="/var/lib/lxc/${RELEASE}-base/rootfs" |
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
# 有关 Fiber 的解释: (按照数据流的方向分为两部分) | |
# 在 `主线程' 中使用 resume 方法来启动(或继续执行)一个 `纤程'. | |
# 1. 第一次调用 fiber.resume, 会启动一个纤程, | |
# 如果 resume 调用时提供了实参, 会作为代码块形参传入代码块. | |
# 2. 如果非第一次调用 fiber.resume, 即, `恢复' 一个纤程, 会做两件事: | |
# - 从上次离开纤程的那个位置(调用 Fiber.yield 离开纤程的那个位置), 恢复纤程的执行. |
Y组合子是Lambda演算的一部分,也是函数式编程的理论基础。 | |
它是一种方法/技巧,在没有赋值语句的前提下定义递归的匿名函数。 | |
即仅仅通过Lambda表达式这个最基本的“原子”实现循环/迭代。 | |
颇有道生一、一生二、二生三、三生万物的感觉。 | |
虽然Y组合子在理论上很优美,但在实际开发中并不会真的用到。 | |
想要了解Y组合子是什么,请参见维基百科:http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator | |
或者知乎上的回答:http://www.zhihu.com/question/20115649 |
As of version 3.3, python includes the very promising concurrent.futures
module, with elegant context managers for running tasks concurrently. Thanks to the simple and consistent interface you can use both threads and processes with minimal effort.
For most CPU bound tasks - anything that is heavy number crunching - you want your program to use all the CPUs in your PC. The simplest way to get a CPU bound task to run in parallel is to use the ProcessPoolExecutor, which will create enough sub-processes to keep all your CPUs busy.
We use the context manager thusly:
with concurrent.futures.ProcessPoolExecutor() as executor:
#ruby '2.1.0' | |
source 'https://rubygems.org' | |
gem 'rack', '~>1.5.2' | |
gem 'actionpack', '~> 4.1.0.beta1' | |
gem 'railties', '~> 4.1.0.beta1' |
# file: config/initialize/httparty.rb | |
require 'httparty' | |
module HTTParty | |
class Request | |
alias_method :_original_perform, :perform | |
def perform(&block) | |
payload = { | |
method: http_method.const_get(:METHOD), | |
url: uri |
NOTE: This package is not supported by VMWare and may cause problems in some cases like updating ESXi. So it is recommended to uninstall the VIB prior to major system changes. NOTE: NUT has its own official IANA port: 3493/TCP.