小编sim*_*imo的帖子

链接到容器时如何使用主机网络?

在我的docker-compose中:

laravel:
    image: trackware
    links:
        - postgis:postgis
    ports:
        - "80:80"
        - "3306:3306"
        - "443:443"
        - "220:22"
        - "8000:8000"
    net: "host"
    restart:  always
    volumes:
        - C:/H/repositories/pubnub:/share
    container_name: laravel

postgis:
    image: mdillon/postgis
    env_file: .postgis_env
    ports:
        - "9090:9000"
        - "54320:5432"
    container_name: postgis
Run Code Online (Sandbox Code Playgroud)

如果我跑,docker-compose up -d我得到这个错误:

Conflicting options: host type networking can't be used with links. This would result in undefined behavior
Run Code Online (Sandbox Code Playgroud)

那么,net: "host"在链接到postgis容器时我将如何使用?laravel容器需要运行pubnub客户端,这需要高性能的网络来实现实时消息处理,还需要链接到postgis容器来访问db.

那么,有什么建议吗?我正在使用docker 1.10.2

laravel docker docker-compose

11
推荐指数
1
解决办法
9222
查看次数

Rails 3.1,为什么我得到ActiveRecord :: UnknownAttributeError:spec测试中的未知属性?

我试图Student在测试中创建一个记录,如下所示:

student= Student.create!(:work_phone => "1234567890")
Run Code Online (Sandbox Code Playgroud)

但我得到这个错误:

ActiveRecord::UnknownAttributeError: unknown attribute: work_phone
Run Code Online (Sandbox Code Playgroud)

但是,work_phoneStudent模型中定义并进行迁移.

这是Student模型:

class Student < ActiveRecord::Base

  validates_length_of :work_phone, :is => 10, :message => 'must be 10 digits, excluding special characters such as spaces and dashes. No extension or country code allowed.', :if => Proc.new{|o| !o.work_phone.blank?}

  attr_accessible:work_phone

end
Run Code Online (Sandbox Code Playgroud)

任何的想法?

activerecord rspec2 ruby-on-rails-3

10
推荐指数
1
解决办法
1万
查看次数

Drupal 7:未调用模块启用后添加的Hooks

我注意到,如果在模块启用后向模块添加了新的挂钩,则不会调用新的挂钩.

我正在尝试添加hook_node_view,以控制我的模块中的内容类型的视图,我正在使用我正在解决的内容类型的基本名称:lesson_node_view

有人可以向我解释一下吗?以及如何解决这个问题?

谢谢

drupal-7

8
推荐指数
1
解决办法
2728
查看次数

构建capybara-webkit时出错

我想在ubuntu 12.04上安装capybara-webkit,但是我收到了这个错误:

$ gem install capybara-webkit -v '1.0.0'
Building native extensions.  This could take a while...
ERROR:  Error installing capybara-webkit:
    ERROR: Failed to build gem native extension.

    /home/samir/.rvm/rubies/ruby-2.1.0/bin/ruby extconf.rb
Command 'qmake -spec linux-g++' not available

Makefile not found

Gem files will remain installed in /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/capybara-webkit-1.0.0 for inspection.
Results logged to /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/extensions/x86-linux/2.1.0/capybara-webkit-1.0.0/gem_make.out
Run Code Online (Sandbox Code Playgroud)

任何的想法?

capybara-webkit ubuntu-12.04

8
推荐指数
1
解决办法
6894
查看次数

如何在Cassandra中获取最后一行?

我想在Cassandra表中获取最后一行.怎么弄?任何的想法?

我正在开发一个项目,我用cassandra替换mysql.我想摆脱所有的SQL查询并将它们全部写在cassandra中.

cql cassandra

8
推荐指数
2
解决办法
5982
查看次数

为什么我在UTF-8中得到无效的字节序列

为什么我会收到此错误?

invalid byte sequence in UTF-8
Run Code Online (Sandbox Code Playgroud)

用于加载图像:

= image_tag 'features_home/show1.png'
Run Code Online (Sandbox Code Playgroud)

编辑

我注意到这个问题发生在我之后bundle update,任何图像都会出现错误..我会尝试在这里添加详细信息:

堆栈跟踪:

  Rendered home/home.html.haml within layouts/application (229.9ms)
Completed 500 Internal Server Error in 1047ms
invalid byte sequence in UTF-8 excluded from capture: DSN not set

ActionView::Template::Error (invalid byte sequence in UTF-8):
    81:           / Carousel items
    82:           .carousel-inner
    83:             .active.item
    84:               = image_tag 'features_home/show1.png'
    85:               -#.carousel-caption
    86:               -#  %h4
    87:               -#  %p
  app/views/home/home.html.haml:84:in `block in _app_views_home_home_html_haml__623651309533727079_70331260863620'
  app/views/home/home.html.haml:33:in `_app_views_home_home_html_haml__623651309533727079_70331260863620'
  lib/rack/seoredirect.rb:20:in `call'


  Rendered /Users/Apple/.rvm/gems/ruby-2.2.2@myapp/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (115.6ms)
  Rendered /Users/Apple/.rvm/gems/ruby-2.2.2@myapp/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (23.1ms)
  Rendered …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails ruby-on-rails-4

8
推荐指数
1
解决办法
623
查看次数

为什么我得到ElasticBeanstalk :: ExternalInvocationError?

我的应用程序构建在RubyOnRails上,并使用乘客部署为弹性beanstalk应用程序,我正在尝试将标头添加到nginx服务器并重新启动它,这是我的配置文件,来自aws弹性beanstalk的.ebextensions文件夹中的脚本:

packages: 
    yum:
        nginx: [] 

files:
    "/etc/nginx/conf.d/webapp.conf" :
        mode: "000644"
        owner: root
        group: root
        content: |
            server {

                location /assets {
                  alias /var/app/current/public/assets;
                  gzip_static on;
                  gzip on;
                  expires max;
                  add_header Cache-Control public;
                }

                location /public {
                  alias /var/app/current/public;
                  gzip_static on;
                  gzip on;
                  expires max;
                  add_header Cache-Control public;
                }

            }

# This reloads the server, which will both make the changes take affect and makes sure the config is valid when you deploy
container_commands:
  01_reload_nginx:
    command: "sudo service nginx reload"
Run Code Online (Sandbox Code Playgroud)

但是我收到了这个错误: …

nginx amazon-web-services amazon-elastic-beanstalk

8
推荐指数
1
解决办法
1740
查看次数

FactoryGirl,为什么我已经注册或未初始化不变?

我正在尝试为我的模型做一个简单的测试Course,我写了这个工厂:

FactoryGirl.define do
  factory :course do
    name 'How to be happy ?'
    end
end
Run Code Online (Sandbox Code Playgroud)

course_spec.rb:

require "rspec"
require 'factory_girl_rails'
describe "When a course is created" do

  it "can't be deleted if any student is enrolled to it" do
    FactoryGirl.find_definitions
    course = FactoryGirl.build(:course)

    student= Student.create!
    course.students << student
    course.destroy
    course.name.should !=nil
  end
end
Run Code Online (Sandbox Code Playgroud)

但是,我达到了这条线

course = FactoryGirl.build(:course)
Run Code Online (Sandbox Code Playgroud)

我收到错误:

FactoryGirl::DuplicateDefinitionError: Factory already registered: course
Run Code Online (Sandbox Code Playgroud)

如果我在工厂评论:课程定义,我得到:

NameError: uninitialized constant Course
Run Code Online (Sandbox Code Playgroud)

有什么好主意吗?

这是我的Gem Envioronment:

RubyGems Environment:
RUBYGEMS VERSION: 1.8.10
RUBY VERSION: 1.9.3 …
Run Code Online (Sandbox Code Playgroud)

tdd ruby-on-rails-3 ruby-on-rails-3.1 factory-bot

7
推荐指数
1
解决办法
9886
查看次数

为什么我得到正方形而不是文字?

我尝试在我的WPF应用程序中安装和使用字体,但我得到的是这样的: 在此输入图像描述

这是我尝试使用该字体的代码:

richtext1.FontFamily = "SH_Roq'a";
Run Code Online (Sandbox Code Playgroud)

预期的结果是:(从MS Word快照) 在此输入图像描述

如果我尝试将字体文件添加到项目文件夹,并将其用作资源,如下所示:

richtext1.FontFamily = "./#SH_Roq'a";
Run Code Online (Sandbox Code Playgroud)

我不会得到方形结果,但是,我也没有预期的字体!我得到的是Tahoma字体:

在此输入图像描述

这不是目标字体,请在下载目标字体文件进行实验

任何帮助表示赞赏!

编辑

上述捕获文本的纯文本是:

???? ????
Run Code Online (Sandbox Code Playgroud)

因此对于那些使用字体的专家来说,他们可以进行实验.

.net wpf fonts font-family

7
推荐指数
1
解决办法
1098
查看次数

&lt;Psych::SyntaxError: 解析块映射时没有找到预期的键

当我启动服务器时,出现此错误:

I18n::InvalidLocaleData
can not load translations from /Users/Apple/myapp-website-freelance/config/locales/fr.yml: #<Psych::SyntaxError: (/Users/Apple/myapp-website-freelance/config/locales/fr.yml): did not find expected key while parsing a block mapping at line 2 column 3>
Run Code Online (Sandbox Code Playgroud)

虽然,yaml 文件在第 2 行第 3 列看起来很正常:

fr:
  Electronics_Circuits_Simulator_Realistic_Interface: "Simulateur de circuits electroniques. Interface reelle."
Run Code Online (Sandbox Code Playgroud)

任何的想法?

yaml ruby-on-rails-4

7
推荐指数
1
解决办法
1万
查看次数