今天运行我的rspec测试,每当测试中的某个地方出现`page.execute_script'调用时,我都会收到以下错误.
Selenium::WebDriver::Error::JavascriptError:
waiting for evaluate.js load failed
# [remote server] file:///tmp/webdriver-profile20130807-3105-fpynb7/extensions/fxdriver@googlecode.com/components/driver_component.js:8360:in `r'
# [remote server] file:///tmp/webdriver-profile20130807-3105-fpynb7/extensions/fxdriver@googlecode.com/components/driver_component.js:392:in `fxdriver.Timer.prototype.runWhenTrue/g'
# [remote server] file:///tmp/webdriver-profile20130807-3105-fpynb7/extensions/fxdriver@googlecode.com/components/driver_component.js:386:in `fxdriver.Timer.prototype.setTimeout/<.notify'
Run Code Online (Sandbox Code Playgroud)
在上面路径的/ resources目录(而不是组件)中有一个文件evaluate.js,就像在其他机器上一样.
这是在从22更新到Firefox 23之后发生的.我还没有能够回滚确认返回22确实解决了问题,但是我相信这一切都已经改变了.
有没有人见过这个问题?
运行Kubuntu 12.04,Capybara 1.1.4,selenium-webdriver gem 2.33.0
我尝试将Capybara更新为2.whatever和selenium-webdriver到2.34.0,没有变化.
我正在与一个团队合作,我们正在进行功能分支和拉取请求.
我创建了一个分支,对它进行了一些工作,同时也对master做了很少的工作.
然后,我将分支重新对抗主人.现在我想做拉取请求.
但是,在GitHub中,pull请求显示了我第一次创建分支和现在之间发生的所有提交 - 我在此功能分支上执行的提交,以及在两者之间发生的提交.
这是嘈杂的混乱 - 我做错了什么?我希望pull请求只显示我所做的提交,因为其他提交已经在master和我的分支上,没有区别.
我看到的唯一建议就是根据最新的上游主人和樱桃采摘提交另一个分支.
我正在使用thin作为我的Sinatra应用程序的服务器.它开始如此:
thin -C config/environment.yml -R config/config.ru start
Run Code Online (Sandbox Code Playgroud)
environment.yml
瘦东西在哪里,config.ru
你可以在一个rackup文件中找到一般的东西.
我希望能够守护进程(使用瘦配置文件很容易)并像使用apache/tomcat/etc一样停止并重新启动.
当我尝试thin stop
或重启或其他各种事情时,我得到:
Can't stop process, no PID found in tmp/pids/thin.pid
实际上,没有这样的文件.我已经尝试/tmp/thin.pid
在瘦配置yml中为各种不同的地方指定一个pid文件和位置(例如,很容易).所有这一切都是更改"no PID found in"
消息中目录的位置,仍然没有创建pid文件.
有任何想法吗?
在开发或生产中,我无法从控制台看到缓存中的任何内容。
对于开发,我打开了缓存并将其设置为内存存储,在生产中我使用 Heroku 上的 dalli gem 和 Memcachier。
我尝试的每个键都归零。
但是,在开发过程中,如果我在binding.pry
之前的某个地方放入a Rails.cache.fetch
,我可以在Rails.cache.read
那里执行 a并看到返回的内容,如果是这样,则执行不会进入fetch
's 块。
在控制台中,如果我尝试Rails.cache.read
使用刚刚在pry
断点控制台中返回缓存结果的相同键,我将一无所获。好像控制台有一个单独的缓存,仿佛从控制台我Rails.cache.write("whatever", "blah")
和Rails.cache.read("whatever")
我得到的回报“嗒嗒”,符合市场预期。
有没有办法从控制台试验正在运行的服务器的缓存?
首先,我在Puma上使用Rails 3.2(但是使用MRI),并且我没有手动执行任何显式线程.
我在使用该execute
方法的地方,MyModel.connection.execute
或者我知道ActiveRecord::Base.connection.execute
可以做同样的事情,因为现在所有连接都是针对我的同一个DB.
我最近开始看到
DEPRECATION WARNING: Database connections will not be closed automatically, please close your database connection at the end of the thread by calling `close` on your connection. For example ActiveRecord::Base.connection.close
Run Code Online (Sandbox Code Playgroud)
这似乎是不言自明的,但我可以在网上找到很少的信息,主要是关于将ActiveRecord与Sinatra一起使用(前ActiveRecord连接警告.(数据库连接不会自动关闭)).
我看了这个:
http://blog.daniel-azuma.com/archives/216
这表明,只要数据库执行事务在控制器中完成(如果我理解正确的话),Rack中间件就能为我完成.这是否意味着在其他地方完成的事务(例如模型或装饰器 - 它们在许多地方都很有用,所以我不想将它们放在单个控制器中)必须明确关闭?即使它是从控制器调用它的模型方法,例如:
class MyController
def show
MyModel.do_execute_sql_stuff
end
end
class MyModel
def self.do_execute_sql_stuff
connection.execute("WHATEVER;")
end
end
Run Code Online (Sandbox Code Playgroud)
我需要在这里明确关闭吗?如果是这样,我应该使用MyModel.connection.close
或MyModel.clear_active_connections!
正如文章建议的那样?也许是因为英语不是我的第一语言,但这种方法听起来很危险!我该怎么办呢?
conn = MyModel.connection
result = conn.execute("STUFF")
do_stuff_with(result)
conn.close |or| MyModel.clear_active_connections!
Run Code Online (Sandbox Code Playgroud)
像那样?
使用时find_by_sql
怎么样?它会返回到池的连接,还是我必须明确地这样做? …
我使用的是Ruby 1.9.2.
我有一个运行的线程,它定期调用数据库.调用可能很长,有时(由于各种原因)数据库连接消失.如果它确实消失了,那么线程就会一直默默地挂在那里.
所以,我想在超时中包装它以处理这个问题.问题是,在第二次应该调用超时(总是第二次)时,它仍然只是挂起.超时永远不会生效.我知道这个问题存在于1.8中,但我认为timeout.rb工作在1.9.
t = Thread.new do
while true do
sleep SLEEPTIME
begin
Timeout::timeout(TIMEOUTTIME) do
puts "About to do DB stuff, it will hang here on the second timeout"
db.do_db_stuff()
process_db_stuff()
end
rescue Timeout::Error
puts "Timed out"
#handle stuff here
end
end
end
Run Code Online (Sandbox Code Playgroud)
知道为什么会这样,我能做些什么呢?
我正在继承一个通过轮胎进行弹性搜索的项目.
搜索正在进行中,但通过它进行了重点调整.搜索"this"需要返回"thís"和"thiš".
我已阅读此轮胎文档:http://karmi.github.com/tire/
以及:http://railscasts.com/episodes/306-elasticsearch-part-1?view = ascicast
其中提到大多数弹性搜索选项都可用于轮胎.
搜索忽略重音,asciifolding不断出现,但弹性搜索就是这样说的:
http://www.elasticsearch.org/guide/reference/index-modules/analysis/asciifolding-tokenfilter.html
另外我发现了一些关于过滤器/重音/等的东西,比如:
https://github.com/elasticsearch/elasticsearch/issues/890
https://gist.github.com/2142635
但他们都使用裸弹性搜索选项.
当我尝试在我的ruby代码中使用asciifolding过滤器时,我收到一个错误,没有为"asciifolding"定义过滤器.
以下是我的代码中搜索的内容 - 我如何修改它以进行不区分重音的搜索.是asciifolding,如果是,我该如何在这里声明?
result = tire.search(:load => true,page: params[:page], per_page: params[:per_page] ) do
query { string "#{params[:term]}", :default_operator => 'and' } if params[:term].present?
filter :missing, :field => 'original_media_id' #see above
#asciifolding?
sort { by :updated_at, :desc } if params[:term].present?
facet 'files' do
terms 'indexed_files.file.id'
end
end
Run Code Online (Sandbox Code Playgroud)
编辑:或者它应该在映射/索引中完成?然后重新运行索引器.这是映射,我尝试过:filter =>"asciifolding"到某些索引,但这似乎不起作用(也没有生成任何错误输出):
tire.mapping do
indexes :id, :index => :not_analyzed
indexes :name, :filter => "asciifolding" …
Run Code Online (Sandbox Code Playgroud) 我.gitignore
在几个目录中有一个文件(例如log/
),其中包含以下内容:
* " Ignore everything in this directory
!.gitignore " Except this file
Run Code Online (Sandbox Code Playgroud)
尽管如此,如果该目录中有一个文件,git status
则向我显示它是新的但未跟踪.
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# log/blah.log
nothing added to commit but untracked files present (use "git add" to track)
Run Code Online (Sandbox Code Playgroud)
我发现stackoverflow上的其他帖子建议在第一行和各种其他形式或随机伏都教上发表评论,但没有任何效果.
简单地说,我想在我的仓库中存在一个tmp/
和log/
目录,但是空的.我不希望任何人被骚扰将他们的日志和tmp文件添加到这些目录.
我看过上面的问题,但我还是不明白.
例如,文档中的示例也不起作用.
mainParser = do{ whiteSpace
; ds <- many (lexeme digit)
; eof
; return (sum ds)
}
Run Code Online (Sandbox Code Playgroud) 我正在读这个:
http://devskypers.blogspot.fr/2014/02/logging-flow-activity.html
并且想要尝试.
一个简单的cabal install monad-journal
告诉我,我有基础4.6.0.1但是monad-journal需要4.5.*.
我希望沙箱可以提供帮助,但是沙盒似乎只适用于我自己的包装,即便如此,我也不太明白它是如何管理的.我尝试为空包创建一个简单的cabal文件并获取注释:
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
是否有任何简单的方法可以说"在我的本地沙箱中安装此软件包及其所有依赖项,以便我可以使用它,忽略我可能在全球安装的任何其他内容"?我按照这里的建议尝试了--shadow-installed-packages ,但是我得到了同样的错误.