草庐IT

how-to-change-the-android-emulato

全部标签

ruby-on-rails - 每当 gem : I set :output but the logfile doesn't show up where I'd expect it to

在我的schedule.rb文件中,我有以下几行:set:output,'/log/cron_log.log'every5.minutesdocommand'echo"hello"'end我按照这个问题Rails,usingwhenevergemindevelopment中的建议运行了whenever-w,并且我假设cronfile已编写并正在运行。(我也尝试重新启动Rails服务器。)当我运行$crontab-l时,我看到以下内容:0,5,10,15,20,25,30,35,40,45,50,55****/bin/bash-l-c'echo"hello">>/log/cron_log

ruby - 错误 : Failed to build gem native extension on Windows

我在安装“redcarpet”gem时遇到以下错误。它在我friend的机器上安装没有问题。(我想安装它来运行yard)ruby版本:1.9.3命令输出:D:\Learning\Common_POM_FW\SampleProjects>yard[error]:Missing'redcarpet'gemforMarkdownformatting.Installitwith`geminstallredcarpet`D:\Learning\Common_POM_FW\SampleProjects>geminstallredcarpetTemporarilyenhancingPATHtoinc

ruby-on-rails - Rails 和 MQTT : Subscribe to topic in background at server startup?

我想在服务器启动时在我的Rails应用程序中订阅一个mqtt主题,并保持订阅始终处于事件状态和运行状态。我正在使用这个mqttgem进行mqtt通信:https://github.com/njh/ruby-mqtt这是我现在拥有的:在application.rb中:config.after_initializedomqttSub=BackgroundMQTT.newmqttSub.runend后台MQTT类:classMQTTSubscriberdefrunThread.newdoMQTT::Client.connect(:host=>'localhost',:port=>1883,)

ruby - 使用 cucumber/aruba/timecop : How to inject the context 测试命令行应用程序

以下场景几乎概括了我的问题:Scenario:problemswithsubprocessesGiventhedateis01/01/201210:31WhenIrun`ruby-e"putsTime.now"`Thentheoutputshouldcontain"10:31"它归结为当我运行ruby​​-e"putsTime.now"时启动一个子进程,从而使我所有的Timecop.freezestub无效,因为他们只在主要过程中工作。我需要以某种方式将当前上下文“注入(inject)”到运行的命令中,但我似乎无法想出任何东西。我在这里尝试不可能的事情吗?步骤:require'time

ruby - 如何强制 Rack :session + sinatra to read "rack.session" from params instead of cookies

我正在处理oauth1.0(twitter和flickr)。网站工作在80端口,oauth服务器工作在8080端口算法:向oauth服务器发送ajax请求以检查用户是否有有效的access_token如果用户没有access_token或access_token已过期,则打开授权窗口在oauth服务器的用户session中保存access_token发送分享数据到oauth服务器它使用sinatra+rack:session+rack::session::sequel+sqlite来存储session。它在每个响应中发送Set-Cookie:rack.session=id我正在使用2种

ruby-on-rails - Rails 4.1.2 - to_param 转义斜杠(并破坏应用程序)

我在我的应用程序中使用to_param创建自定义URL(此自定义路径包含斜杠):classMachine问题是,自从Rails4.1.2行为发生变化并且Rails不允许在URL中使用斜线(当使用自定义URL时),所以它转义了斜线。我有这样的路线:Rails.application.routes.drawdoscope"(:locale)",locale:/#{I18n.available_locales.join("|")}/doresources:machines,except::destroydocollectiondoget:searchget'search/:ad_type(/

ruby-on-rails - Rails 设计 : "You need to sign in or sign up before continuing" instead of "You will receive an email with instructions.."

我已经安装了DeviseonRails4.2.0,一切似乎都在工作,我使用了以下指南:http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/我的设计模块是:devise:database_authenticatable,:registerable,:confirmable,:recoverable,:rememberable,:trackable,:validatable,:omniauthable唯一的问题是,如果我尝试通过转到注册页面创建一个新帐户,然后在输入我的电子邮

ruby - 如何通过 belongs_to 按外部 id 和本地属性进行过滤?

以下模型通过belongs_to链接:require'mongoid'classSensorincludeMongoid::Documentfield:sensor_id,type:Stringvalidates_uniqueness_of:sensor_idend...require'mongoid'require_relative'sensor.rb'classSensorDataincludeMongoid::Documentbelongs_to:sensorfield:date,type:Datefield:ozonMax1h,type:Floatfield:ozonMax8h

ruby - 如何获取适用于 ruby​​ 1.9.1 的 to_yaml 方法的格式化选项?

根据YAML文档,可以传递hashofoptions到.to_yaml方法。目前,当我按照文档中的建议传递选项时,它不起作用,哈希被忽略。irb(main):001:0>require'yaml'=>trueirb(main):002:0>user={"1"=>{"name"=>"john","age"=>44}}user.to_yaml=>"---\n\"1\":\nname:john\nage:44\n"现在,传递一些选项:irb(main):014:0>user.to_yaml(:Indent=>4,:UseHeader=>true,:UseVersion=>true)=>"--

ruby - Chef Ohai : how to use newly installed Ruby with gem_package

使用chef我有一个安装gem的简单方法,例如:gem_package"passenger"doversionnode['passenger']['version']end我还想用另一本说明书安装ruby​​,对于某些服务器可能是Ruby1.9.3,对于其他服务器可能是RubyEnterprise1.8.7。所以我想我可以使用gem_binary和ohai来做到这一点,就像这样:gem_package"passenger"doversionnode['passenger']['version']gem_binary"#{languages['ruby']['bin_dir']/gem}