小编Ant*_*yrd的帖子

需要帮助使用RVM设置乘客

我正试图用rvm设置乘客.我一直收到这个错误

您的RVM包装器脚本太旧了.请先运行'rvm update --head && rvm reload && rvm repair all'来更新它们.

我做到了同样的问题

  • GNU C++编译器...在/ usr/bin/g ++中找到
  • 发现了支持SSL的卷曲开发标题
  • 找到OpenSSL开发头文件
  • 找到了Zlib开发头文件
  • 发现了Ruby开发头文件
  • OpenSSL支持Ruby ...找到了
  • RubyGems ......找到了

您的RVM包装器脚本太旧了.

请先运行'rvm update --head && rvm reload && rvm repair all'来更新它们.

我正在使用Fedora 14,Ruby 1.9.2,Rails 3.0.7 RVM是为多用户安装的

当我'乘客开始'时,我也会收到此错误

无法执行'/home/antarr/.passenger/standalone/3.0.7-x86_64-ruby1.9.2-linux-gcc4.5.1-1002/support/helper-scripts/prespawn http://0.0.0.0:3000 ':权限否认(13)

fedora rvm ruby-on-rails-3 ruby-1.9.2

12
推荐指数
1
解决办法
5131
查看次数

.xcscheme文件中的XML元素有何功能

我正在创建一个rake exe来为xcode项目增加覆盖率.我正在使用Gem xcodeproj.我需要为版本控制创建一些方案并运行覆盖脚本.

我一直在建立自己的计划,而且进展缓慢.如果我理解这些元素的含义,我觉得我能够更快地调试.

<?xml version="1.0" encoding="UTF-8"?>
   <Scheme
    LastUpgradeVersion = "0500"
  version = "1.3">
  <BuildAction
    parallelizeBuildables = "YES"
  buildImplicitDependencies = "YES">
     <BuildActionEntries>
     <BuildActionEntry
        buildForTesting = "YES"
        buildForRunning = "YES"
        buildForProfiling = "YES"
        buildForArchiving = "YES"
        buildForAnalyzing = "YES">
        <BuildableReference
           BuildableIdentifier = "primary"
           BlueprintIdentifier = "7B80F18918187FA5005578A0"
           BuildableName = "TestProj.app"
           BlueprintName = "TestProj"
           ReferencedContainer = "container:TestProj.xcodeproj">
        </BuildableReference>
     </BuildActionEntry>
  </BuildActionEntries>
  </BuildAction>
   <TestAction
  selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
  selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
  shouldUseLaunchSchemeArgsEnv = "YES"
  buildConfiguration = "Coverage">
  <Testables>
     <TestableReference
        skipped = "NO">
        <BuildableReference
           BuildableIdentifier = "primary" …
Run Code Online (Sandbox Code Playgroud)

xml xcode

12
推荐指数
1
解决办法
2725
查看次数

如何在pytest中设置环境变量

我有一个使用环境变量的巴巴处理程序。我如何使用 pytest 设置该值?我收到错误

tests/test_kinesis.py:3: in <module>
    from runner import kinesis
runner/kinesis.py:6: in <module>
    DATA_ENGINEERING_BUCKET = os.environ["BUCKET"]
../../../../../.pyenv/versions/3.8.8/lib/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'BUCKET'
7:03
Run Code Online (Sandbox Code Playgroud)

我尝试在测试中这样设置

tests/test_kinesis.py:3: in <module>
    from runner import kinesis
runner/kinesis.py:6: in <module>
    DATA_ENGINEERING_BUCKET = os.environ["BUCKET"]
../../../../../.pyenv/versions/3.8.8/lib/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'BUCKET'
7:03
Run Code Online (Sandbox Code Playgroud)
class TestHandler(unittest.TestCase):
    @mock_s3
    @mock_lambda
    def test_handler(monkeypatch):
        monkeypatch.setenv("BUCKET", "test-bucket")
        actual = kinesis.handler(kinesis_stream_event, "")
        expected = {"statusCode": 200, "body": "OK"}
        assert actual == expected
Run Code Online (Sandbox Code Playgroud)

python pytest

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

无法连接到heroku上的redis

我在rails应用程序中使用sidekiq和active_job.该作业当前有效,但在部署到heroku时无法连接到Redis.在heroku中,我有RedisToGo插件.当推送到heroku时,我收到以下错误.

错误

/app/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:331:in `rescue in establish_connection': Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) (Redis::CannotConnectError)
Run Code Online (Sandbox Code Playgroud)

配置/ application.rb中

config.after_initialize do
  PasswordAgingJob.perform_later
  SetOffCallJob.perform_later
end
Run Code Online (Sandbox Code Playgroud)

配置/初始化/ redis.rb

uri = URI.parse(ENV["REDISTOGO_URL"] || "redis://localhost:6379/" )
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
Run Code Online (Sandbox Code Playgroud)

配置/初始化/ active_job.rb

ActiveJob::Base.queue_adapter = :sidekiq
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails heroku redis sidekiq

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

无法启动mongodb

我正在尝试在我的7号机器上安装mongodb.当尝试使用mongod命令启动它时,我收到此错误.dbpath(\ data\db)不存在.我按照教程中的步骤进行操作.所有文件夹都存在C:\mongodb\log,C:\mongodb\data and C:\mongodb\data\db. 在此输入图像描述

mongodb windows-7

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

将RSS转换为JSON

我正在尝试将RSS转换为JSON但是当我在Chrome中使用控制台时,我收到此错误

XMLHttpRequest无法加载 http://www.blastcasta.com/feed-to-json.aspx?feedurl=http://www.startalkradio.net/?page_id=354.Access-Control-Allow-Origin不允许使用null.

jQuery的:

$(document).ready(function() {
    var rss_url = "http://www.blastcasta.com/feed-to-json.aspx?feedurl=http://www.startalkradio.net/?page_id=354";

    $.ajax({
        type : 'GET',
        url : rss_url,
        succces : function(data) {
            $.each(data.rss, function(i, item) {
                $("#results").append('<ul>' + item.channel.item.description + '</ul>');

            });
        },
        dataType : 'json',
        async : true
    });

    function fetchRss(data) {
        $.each(data.rss, function(i, item) {
            $("#results").append('<ul>' + item.channel.item.description + '</ul>');

        });
    }

});
Run Code Online (Sandbox Code Playgroud)

jquery json

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

将照片上传到MVC 4应用程序

我正在尝试创建一个控制器来上传我的MVC4应用程序中的照片.但我一直收到这个错误.输入不是有效的Base-64字符串,因为它包含非基本64个字符,两个以上的填充字符或填充字符中的非空白字符.

PhotosController.cs

 public class PhotoController : Controller
    {
        public ActionResult Index()
        {
            using (var ctx = new BlogContext())
            {
                return View(ctx.Photos.AsEnumerable());
            }
        }

        public ActionResult Upload()
        {
            return View(new Photo());
        }

        [HttpPost]
        public ActionResult Upload(PhotoViewModel model)
        {
            var photo = Mapper.Map<PhotoViewModel, Photo>(model);
            if (ModelState.IsValid)
            {
                PhotoRepository.Save(photo);
                return RedirectToAction("Index");
            }
            return View(photo);
        }
    }
Run Code Online (Sandbox Code Playgroud)

Photo.cs

public class Photo
    {
    public int Id { get; set; }

    public Byte[] File { get; set; }

    public string Name { get; set; }

    public …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc controller file-upload view

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

无法启动wcf服务主机

我正在尝试为我的WCF应用程序创建服务主机.当我启动应用程序时,我收到错误消息

该服务无法启动.此服务没有定义端点.请在配置文件中为服务添加至少一个端点,然后重试.

我按照PluralSight上的教程进行操作,这是我提出的代码

using System.ServiceModel;
using FreedomService;

namespace ConsoleHost
{
    class Program
    {
        static void Main(string[] args)
        {
            var host = new ServiceHost(typeof(PeopleService));
            host.AddServiceEndpoint(typeof (IPeopleService), new BasicHttpBinding(),
                                    "http://localhost:8080/people/basic");
            host.AddServiceEndpoint(typeof(IPeopleService), new WSHttpBinding(), 
                                    "http://localhost:8080/people/ws");
            host.AddServiceEndpoint(typeof(IPeopleService), new NetTcpBinding(), 
                                    "net.tcp://localhost:8081/people");
            try
            {
                host.Open();
                PrintServiceInfo(host);
                Console.ReadLine();
                host.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                host.Abort();
            }
        }

        static void PrintServiceInfo(ServiceHost host)
        {
            Console.WriteLine("{0} is up and running with these endpoints:",host.Description.ServiceType);
            foreach (var endpoint in host.Description.Endpoints)
            {
                Console.WriteLine(endpoint.Address);
            }
        }

    }
}
Run Code Online (Sandbox Code Playgroud)

IPeopleService.cs

[ServiceContract]
public interface IPeopleService …
Run Code Online (Sandbox Code Playgroud)

.net c# wcf servicehost visual-studio-2012

6
推荐指数
1
解决办法
8318
查看次数

如何防止我的Ackerman函数溢出堆栈?

有没有办法保持我的Ackerman函数不会创建一个堆栈溢流是对相对较小的数字,即(4,2).这是错误

{无法计算表达式,因为当前线程处于堆栈溢出状态.}

private void  Button1Click(object sender, EventArgs e)
        {
            var t = Ackermann(4,2);
            label1.Text += string.Format(": {0}", t);
            label1.Visible = true;
        }

        int Ackermann(uint m, uint n)
        {
            if (m == 0)
                return  (int) (n+1);
            if (m > 0 && n == 0)
                return Ackermann(m - 1, 1);
            if (m > 0 && n > 0)
                return Ackermann(m - 1, (uint)Ackermann(m, n - 1));
            else
            {
                return -1;
            }
        }
Run Code Online (Sandbox Code Playgroud)

c# stack-overflow recursion

5
推荐指数
1
解决办法
3804
查看次数

使用枚举时修改simple_form输入中显示的文本

我正在使用simple_form来管理我的用户.为了选择用户角色,我使用输入为:: radio_button.

该集合来自用户模型的枚举.如何修改文本以显示特定的内容,如"超级管理员"而不是super_admin?

_form.html.slim

= form.input :role, collection: User.roles, as: :radio_buttons, item_wrapper_class: 'btn btn-default', checked: User.roles[user.role], required: true
Run Code Online (Sandbox Code Playgroud)

user.rb

  enum role: [:super_admin, :admin, :generic]
Run Code Online (Sandbox Code Playgroud)

forms enums ruby-on-rails simple-form

5
推荐指数
1
解决办法
908
查看次数