我最近通过pear安装程序在我的服务器上安装了phpunit.
当我去运行测试时,我收到以下错误:
PHP警告:require_once(PHPUnit/Util/Filter.php):无法打开流:第44行/ usr/bin/phpunit中没有此类文件或目录
PHP致命错误:require_once():在44行/ usr/bin/phpunit中打开所需的'PHPUnit/Util/Filter.php'(include_path ='.:/ usr/bin/php')失败
在做了一些搜索之后,我尝试对服务器上的php.ini文件中的include_path进行一些修改.但这没有做到.
知道可能导致这种情况的原因吗?
在elasticsearch中,指定可以执行匹配的值的数量的最大限制是多少?我在某处读到它是1024,但也是可配置的.真的吗?它如何影响性能?
curl -XPOST 'localhost:9200/my_index/_search?pretty' -d '{
"query": {
"filtered": {
"filter": {
"not": {
"ids": {
"type": "my_type",
"values": ["1", "2", "3"]
}}}}}}'
Run Code Online (Sandbox Code Playgroud)
我可以在此数组中指定多少个值?限制是多少?如果可配置,对增加限制的性能影响是什么?
我正在创建一个Word类,我收到一个错误:
TypeError:类Word的超类不匹配
这是irb代码:
irb(main):016:0> class Word
irb(main):017:1> def palindrome?(string)
irb(main):018:2> string == string.reverse
irb(main):019:2> end
irb(main):020:1> end
=> nil
irb(main):021:0> w = Word.new
=> #<Word:0x4a8d970>
irb(main):022:0> w.palindrome?("foobar")
=> false
irb(main):023:0> w.palindrome?("level")
=> true
irb(main):024:0> class Word < String
irb(main):025:1> def palindrome?
irb(main):026:2> self == self.reverse
irb(main):027:2> end
irb(main):028:1> end
TypeError: superclass mismatch for class Word
from (irb):24
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands/console.rb:47:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands/console.rb:8:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Run Code Online (Sandbox Code Playgroud) 我想创建一个 for 循环,以1-length(Matrix$Index)随机顺序循环遍历数字。请注意,每个数字只能被访问一次。
我怎样才能实现这个目标?
我需要一次解压缩多个文件并将其添加为 R 仪表板中的数据框。
我目前正在使用此代码:
zipF<- "/Users/sahilverma13/Desktop/chat_data_2017-01-30_IST.zip"
outDir<-"/Users/sahilverma13/Desktop"
unzip(zipF,exdir=outDir)
Run Code Online (Sandbox Code Playgroud)
但是我必须分别为每个文件执行此操作。
zipF <- list.files(pattern="*.zip")
Run Code Online (Sandbox Code Playgroud)
我尝试使用通配符,但它不起作用。
请帮忙。
注意:这不是重复的问题,因为标题可能会说
如果我有一个list列表,则需要从中获取所有组合并进行替换。
import itertools
l = [[1,2,3] ,[1,2,3], [1,2,3]]
n = []
for i in itertools.product(*l):
if sorted(i) not in n:
n.append(sorted(i))
for i in n:
print(i)
[1, 1, 1]
[1, 1, 2]
[1, 1, 3]
[1, 2, 2]
[1, 2, 3]
[1, 3, 3]
[2, 2, 2]
[2, 2, 3]
[2, 3, 3]
[3, 3, 3]
Run Code Online (Sandbox Code Playgroud)
感谢@RoadRunner和@Idlehands。
上面的代码完美,有两个问题:
对于较大的列表,itertools.product引发MemoryError。当l具有18个3个长度的子列表时,给出的合并数约为4亿。
订单很重要,因此sorted无法解决我的问题。对于某些人可能会造成混淆,因此请在下面的示例中进行说明。
l = [[1,2,3], [1], [1,2,3]]
在这里,我有2个独特的群组:
组1:元素0、2具有相同的值[1,2,3]
第2组:元素1,其值为[1]
因此,我需要的解决方案是:
[1,1,1]
[1,1,2]
[1,1,3]
[2,1,2]
[2,1,3]
[3,1,3]
Run Code Online (Sandbox Code Playgroud)
因此位置1 …
我的数据就像sdf:
s = c("aa", "bb", "cc","cc","cc","cc","aa", "bb", "cc", "bb", "bb", "bb", "bb")
sdf = data.frame(s)
Run Code Online (Sandbox Code Playgroud)
我想要做的是生成一个从1到1的列,但是对于每个重复的字符,数字都不会改变.我可以得到以下序列:
sdf$wrongseq<-seq(1:nrow(sdf))
Run Code Online (Sandbox Code Playgroud)
但是我如何得到如上所述的序列:
rightseq<- c(1, 2, 3,3,3,3,4,5, 6, 7, 7, 7, 7)
sdf = cbind(sdf,rightseq)
Run Code Online (Sandbox Code Playgroud) 我无法改进以下内容:
这是我到目前为止所尝试的:
library(shiny)
controls <- list(tags$div(align = 'left',
class = 'multicol',
checkboxGroupInput(inputId = 'modules',
label = "Step 1 : Select the modules to be executed",
choices = c(process_names),
selected = "",
inline = FALSE)))
shinyUI(fluidPage(
tags$style(type='text/css', "label {font-size: 22px; } # controls the text of check-boxes
.form-group {margin-top: 5px; margin-bottom: 5px;}
.nav-tabs {font-family:'arial';font-size:20px}
#sidebar {background-color: #5C97BF;}
#mainbar {background-color: #5C97BF;}
body { background-color: #002B55;}
input[type=checkbox] {transform: scale(2);}
.multicol {height: 200px; -webkit-column-count: 4;
-moz-column-count: 4; /* …Run Code Online (Sandbox Code Playgroud) 我正在使用facet_wrap并且还能够绘制次要y轴.然而,标签没有在轴附近绘制,而是绘制得非常远.我意识到如果我理解如何操纵凹槽的gtable(t,b,l,r)的坐标系,它将全部解决.有人可以解释他们实际描绘的方式和内容 - t:r = c(4,8,4,4)意味着什么.
辅助y轴与ggplot有许多链接,但是当nrow/ncol大于1时,它们会失败.那么请教我网格几何和grobs位置管理的基础知识.
编辑:代码
this is the final code written by me :
library(ggplot2)
library(gtable)
library(grid)
library(data.table)
library(scales)
# Data
diamonds$cut <- sample(letters[1:13], nrow(diamonds), replace = TRUE)
dt.diamonds <- as.data.table(diamonds)
d1 <- dt.diamonds[,list(revenue = sum(price),
stones = length(price)),
by=c("clarity", "cut")]
setkey(d1, clarity, cut)
# The facet_wrap plots
p1 <- ggplot(d1, aes(x = clarity, y = revenue, fill = cut)) +
geom_bar(stat = "identity") +
labs(x = "clarity", y = "revenue") +
facet_wrap( ~ cut) +
scale_y_continuous(labels = …Run Code Online (Sandbox Code Playgroud) 我需要在R中创建一个具有以下要求的Vector:
向量中总共12个元素.第一个元素的值为100.剩余元素比前一个元素增加5%.
所以输出要求:
c(100, 105, 110.25, 115.76, 121.55, 127.63, 134.01, 140.71, 147.75, 155.13, >162.89, 171.03).
Run Code Online (Sandbox Code Playgroud)
例如.
105=100 X 1.05
110.25=105 X 1.05
115.76=110.25 X 1.05等等.
我应该先创建一个空向量,然后用for循环迭代每个向量组件吗?