当我尝试运行xdebug分析(从命令行)时,脚本立即死亡.我没有收到任何反馈.(如果我在关闭xdebug profiling的情况下运行脚本,那么脚本就会像我期望的那样执行.)我在Centos 6中运行php 5.4.13.
我尝试了两种不同的方法来启用分析:编辑php.ini,并在执行脚本时使用-d标志.
我的php.ini的相关部分如下所示:
[xdebug]
zend_extension="/usr/lib64/php/modules/xdebug.so"
xdebug.remote_enable = 1
xdebug.default_enable = 0
xdebug.profiler_output_dir = "/tmp/profiling"
# xdebug.profiler_enable = 1 # I uncomment this line to try to profile my script
Run Code Online (Sandbox Code Playgroud)
我使用这两个命令之一调用脚本(并确保ini文件行被注释掉(或不符合)).
$> /usr/bin/php scripts/daemon/PostProcess.php -c 4
Run Code Online (Sandbox Code Playgroud)
要么
$> /usr/bin/php -d xdebug.profiler_enable=1 scripts/daemon/PostProcess.php -c 4
Run Code Online (Sandbox Code Playgroud)
我确信正在正确解释设置.
$> php -d xdebug.profiler_enable=1 --info | grep profile | less
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => On => On
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_output_dir => /tmp/profiling …Run Code Online (Sandbox Code Playgroud) 该游戏+ Java的+ CRUD激活具有下列route文件,我不明白是什么->在它的作用.
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
# Home page
GET / controllers.Application.index()
# CRUD Controllers and REST API
-> / play.crud.Routes
Run Code Online (Sandbox Code Playgroud) 当我在bash中执行以下命令时,我得到一个与我想要的正则表达式匹配的文件列表:
$> ls *-[0-9].jtl
benchmark-1422478133-1.jtl benchmark-1422502883-4.jtl benchmark-1422915207-2.jtl
Run Code Online (Sandbox Code Playgroud)
但是,当我在fish shell中运行相同的命令时,我会得到不同的结果:
$> ls *-[0-9].jtl
fish: No matches for wildcard '*-[0-9].jtl'.
ls *-[0-9].jtl
^
Run Code Online (Sandbox Code Playgroud)
怎么会?
我试图转换看起来像这样的数据:
val inputData =
Seq(("STUDY1", "Follow-up", 1),
("STUDY1", "Off Study", 2),
("STUDY1", "Screening", 3),
("STUDY1", "Treatment", 4),
("STUDY2", "Follow-up", 5),
("STUDY2", "Off Study", 6),
("STUDY2", "Screening", 7),
("STUDY2", "Treatment", 8));
Run Code Online (Sandbox Code Playgroud)
到看起来像这样的数据:
val desiredData =
Seq(Seq(1,2,3,4),
Seq(5,6,7,8));
Run Code Online (Sandbox Code Playgroud)
我得到的最接近的是:
val result: Map[String, Seq[Int]] =
data.groupBy(i => i._1)
.mapValues(j => j.map(k => k._3))
.mapValues(_.toArray)
result.values.toSeq
Run Code Online (Sandbox Code Playgroud)
这会产生:
res0: Seq[Seq[Int]] = Stream(WrappedArray(1, 2, 3, 4), ?)
Run Code Online (Sandbox Code Playgroud)
最后一个问号是让我循环.
编辑
未来的互联网旅行者来到这里:我的代码确实有效......我的困惑源于了解?所有内容.来自下面的人的答案帮助我看到了mapValues懒惰的评价,而这?只是意味着.