草庐IT

hadoop - Pig & Cassandra & DataStax 拆分控制

全部标签

ruby - 在 Ruby + Chef 中检查现有目录失败

这是我在ChefRecipe中的一blockRuby:#ifdatadirdoesn'texist,moveoverthedefaultoneif!File.exist?("/vol/postgres/data")execute"mv/var/lib/postgresql/9.1/main/vol/postgres/data"end结果是:Executingmv/var/lib/postgresql/9.1/main/vol/postgres/datamv:inter-devicemovefailed:`/var/lib/postgresql/9.1/main'to`/vol/post

ruby-on-rails - 无法捆绑安装 'open-uri'

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。关于您编写​​的代码问题的问题必须在问题本身中描述具体问题—并且包括有效代码以重现它。参见SSCCE.org寻求指导。关闭8年前。Improvethisquestion我是Rails的新手。我正在制作一个网络应用程序,我在其中使用nokogiri搜索不同的网站以从中提取文本。所以在Gemfile中,我写了require'nokogiri'和'open-uri',但是当我捆绑安装时我得到这个错误:Couldnotfindgem'open-uri(>=0)ruby'inthegemsavailableon

ruby-on-rails - rails:为#<StateMachine::Machine:0xba3014ec> 调用了 protected 方法 `around_validation'

我正在尝试实现state_machinegem,在我的rails项目中,我安装了gem,然后我将“state”列添加到我的account_entries模型中:defchangeadd_column:account_entries,:state,:stringend然后在我的account_entries模型中,我添加了状态机初始方法,如下所示:state_machine:state,:initial=>:submitteddoend然后在我看来我显示时间进入状态:account_entry.state但是当我尝试从我的应用程序创建一个account_entry时,我得到了这个错误:p

ruby-on-rails - 获取 ActionController::RoutingError(当尝试使用 AngularJS 将数据发布到 Rails 服务器时,没有路由匹配 [OPTIONS] "/users"

尝试从我的AngularJS端将数据发布到Rails服务器时出现问题。服务器错误:ActionController::RoutingError(Noroutematches[OPTIONS]"/users"):actionpack(4.1.9)lib/action_dispatch/middleware/debug_exceptions.rb:21:in`call'actionpack(4.1.9)lib/action_dispatch/middleware/show_exceptions.rb:30:in`call'railties(4.1.9)lib/rails/rack/logg

ruby-on-rails - RVM、Ruby 1.9.2、Rails 2.3.8、Passenger 和 "invalid byte sequence in US-ASCII"

我刚刚开始从Ruby1.8.7升级到Ruby1.9.2(使用RVM)。我的所有应用程序都使用“脚本/服务器”(或“rails服务器”)和1.9.2运行,但是,只有Rails3.0.0RC应用程序可以与Passenger一起使用。Rails2.3.8应用给出的错误信息是:invalidbytesequenceinUS-ASCII我猜这是一个Passenger问题。我使用找到的RVM指南安装了Passenger2.2.15here.任何想法如何修复这个错误?谢谢。我已更新以包含堆栈跟踪:/Users/kevin/.rvm/gems/ruby-1.9.2-p0/gems/actionpack

ruby-on-rails - factory_girl/rspec2 场景中的未定义方法 `each'

我正在尝试制作与投票相关的帖子。这样Post.votes就会生成与之关联的投票。Factory.define:voted_post,:parent=>:post,:class=>Postdo|p|p.association:votes,:factory=>:voteend我的rspec2相对简单:describe"votescores"doit"shouldshowmethetotalvotescore"do@post=Factory(:voted_post)@post.vote_score.should==1endend那么为什么会返回这个错误:Failures:1)Postvote

ruby - 在不添加 "end"的情况下编写 Ruby 的任何方法?

按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visitthehelpcenter指导。关闭11年前。Ruby是一种美丽的语言,但有一个我讨厌写很多次的关键词“结束”。有什么方法可以写出简洁的代码而不用每次都写“end”吗?

ruby-on-rails - Rails 'rake task' 使用 nohup 在 ‘RAILS_ENV=production' 中执行

我有rake任务需要持续激活。每当我通过命令运行它时RAILS_ENV=productionrakejobs:abc它工作正常,但是当我关闭终端时rake作业停止了。所以我通过使用nohup在后台运行它找到了其他解决方案。我执行命令:nohupRAILS_ENV=productionrakejobs:work&但它给出了错误:nohup:failedtoruncommand‘RAILS_ENV=production’:Nosuchfileordirectory请建议在生产环境中执行rake任务。 最佳答案 在nohup命令之前设置环

ruby - 如何在 Ruby 中使用 "fake"C# 样式属性?

编辑:我稍微更改了规范,以更好地符合我的想象。好吧,我真的不想伪造C#属性,我想将它们合而为一并支持AOP。给定程序:classObjectdefObject.profile#magiccodehereendendclassFoo#Thisisthefakeattribute,itprofilesasinglemethod.profiledefbar(b)putsbenddefbarbar(b)puts(b)endcomment("thisreallyshouldbefixed")defsnafu(b)endendFoo.new.bar("test")Foo.new.barbar("t

ruby - 类型错误 : can't convert String into Integer

我有代码:classScenedefinitialize(number)@number=numberendattr_reader:numberendscenes=[Scene.new("one"),Scene.new("one"),Scene.new("two"),Scene.new("one")]groups=scenes.inject({})do|new_hash,scene|new_hash[scene.number]=[]ifnew_hash[scene.number].nil?new_hash[scene.number]当我启动它时出现错误:freq.rb:11:in`[]'