为什么find . -name "*.xml" | xargs grep FOO
返回与文件名匹配,而find . -name "*.xml" | xargs -i -sh -c "grep FOO {}"
不是?
说,我们可以这样写:
zipWith (,) [1,2,3] [4,5,6]
Run Code Online (Sandbox Code Playgroud)
如果我们想要列出3个列表,我们可以写:zipWith3(,,)[1,2,3] [4,5,6] [7,8,9]
我们也可以使用 zipWith4 (,,,) zipWith5(,,,,)
等等.
现在,我想做同样的事情,但使用添加而不是逗号运算符.有没有办法以相同的简洁方式定义它,而不是像使用lambda那样
zipWith3 (\a b c -> a + b + c) [1, 2, 3] [4, 5, 6] [7, 8, 9]
Run Code Online (Sandbox Code Playgroud)
提前感谢您的回答.
有人能告诉我清楚,完整,100%的工作方式将字符串类型的字段设置为grails中的ID吗?我已阅读文档,然后在网上阅读所有类似的咆哮,但未能创建一个工作原型.
这是我尝试让你相信我不只是懒得等待某人做这项工作的尝试之一)))
class User {
String login
static hasMany = [apps : Application]
static constraints = {
}
static mapping = {
id generator: 'assigned', name: "login"
}
Run Code Online (Sandbox Code Playgroud)
}
在我记忆中,在纯W3C事件模型中(也就是说,使用addEventListener),无法保证将按照已附加的顺序调用事件处理程序.
怎么样的jQuery事件模型.我可以依赖附加事件的顺序吗?回答时要小心,因为实际上这里有三个选项,而不是两个:
我希望Chef cookbook network_interfaces
为每个节点提供ip地址,netmasks等的动态值.对我有用的是:
db_role.rb(block1):
override_attributes(
"network_interfaces" => {
:device => 'eth0',
:address => '123.123.123.123',
}
)
Run Code Online (Sandbox Code Playgroud)
但这不是很有活力.我的想法是将ip地址(,网络掩码等)提交给每个节点knife bootstrap
.
然后该节点看起来像这样(块2):
{
"normal": {
"network_interfaces" => {
"device" : "eth0",
"address" : "123.123.123.123"
}
},
"name": "foobar",
"run_list": [
"recipe[zsh]",
"role[networking_interfaces]"
]
}
Run Code Online (Sandbox Code Playgroud)
不幸的network_interfaces
是,默认情况下,食谱不会提取这些值.我的想法是在角色定义中引用block2中显示的节点特定属性,如下所示:
override_attributes(
"network_interfaces" => {
:device => node['network_interfaces']['device'],
:address => node['network_interfaces']['address'],
}
)
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为它显然不是json,而Chef无法处理角色文件中动态分配的值.
如何运行network_interfaces
配方并将特定于节点的值传递给它?
如果你能帮助我找出这个问题,我会很愉快的.
当我使用maven < assembly >插件将项目构建到.zip时.
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dev</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${basedir}</directory>
<includes>
<include>/environments/dev/**/*.sh</include>
<include>/environments/dev/**/*.jil</include>
<include>/environments/dev/**/*.properties</include>
<include>/environments/dev/**/log4j2.xml</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
Run Code Online (Sandbox Code Playgroud)
我收到以下文件结构:
build.zip----> environments__
|_DEV_
|_bin
|_properties
|_....
Run Code Online (Sandbox Code Playgroud)
我的目标是:
要在maven构建之后获得以下文件结构:
build.zip---->
|_bin
|_properties
|_....
Run Code Online (Sandbox Code Playgroud)
没有环境和DEV文件夹.
我已经阅读了maven文档(http://maven.apache.org/plugins/maven-assembly-plugin/advanced-descriptor-topics.html),我们可以排除一些文件目录.这条路:
<assembly>
....
<fileSets>
<fileSet>
<directory>${basedir}</directory>
<includes>
....
</includes>
<excludes>
<exclude>/environments/dev</exclude>
</excludes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
但它没有帮助.我还有以前的文件结构.
我希望有机会将commit/changeset中的*.java文件列表传递给预提交钩子,该钩子将检查这些java文件的代码样式.
我试过使用maven-checkstyle-plugin,但看起来不可能将任意文件列表传递给它.此外,运行mvn site
构建报告不应该像人类可读的实体一样使用,因此在python脚本中使用此报告并不是一件容易的事情(基本上是mercurial钩子).
所以问题是:如何在命令行中检查样式*.java文件的任意列表(就像我们用pep8检查任意python文件列表,或者用jshint/jslint检查javascript文件)?
通过样式检查我的意思不仅是打印报告到stdout而且以某种方式返回最终结果 - 文件是否已经通过了指南.
谁能告诉我如何使用 JavaPoet 向字段添加注释?
到目前为止,我设法探索的所有示例都是关于向类和方法添加注释。
看起来我在这里遗漏了一些非常简单的东西。
我可以将一些静态数据加载到Ext.data.TreeStore
实例吗?对于Ext.data.Store来说非常简单 - 我们所要做的就是将数据参数添加到配置中.
但我无法看到Ext.data.TreeStore这样的东西.
这个想法是有一个自包含的项目(好吧,至少对于开发)而不需要配置外部tomcat - 但是使用tomcat7-maven-plugin的问题,如果我错了就纠正我,嵌入式版本tomcat不包含"manager"应用程序 - 我只是不想每次都重新运行整个服务器.
所以问题是,将经理webapp合并到嵌入式tomcat的最佳方法是什么?
java ×2
maven ×2
bash ×1
checkstyle ×1
chef-infra ×1
extjs ×1
extjs4 ×1
grails ×1
grails-orm ×1
grep ×1
groovy ×1
haskell ×1
javapoet ×1
javascript ×1
jquery ×1
maven-plugin ×1
pointfree ×1
ruby ×1
tomcat ×1
tomcat7 ×1
xargs ×1