小编Ric*_*ich的帖子

Gradle:强制自定义任务始终运行(无缓存)

我编写了一个自定义Gradle任务来处理文件系统上的一些依赖项解析,其中路径是可配置的.我希望这种类型的任务始终运行.虽然它们只运行一次,但我猜是因为输入似乎永远不会改变.

我知道使用configurations { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' }有效地禁用缓存,但我只希望它适用于非常具体的任务.也知道--rerun-tasks命令行提示符,这也是类似的.既不是最好的解决方案,也必须有一种方法在自定义任务定义中正确设置它.

以下是我目前的实施情况.我还有一个版本,前3个def String语句是@Input带注释的String声明.

class ResolveProjectArchiveDependency extends DefaultTask {
    def String archiveFilename = ""
    def String relativeArchivePath = ""
    def String dependencyScope = ""

    @OutputFile
    File outputFile

    @TaskAction
    void resolveArtifact() {
        def arcFile = project.file("dependencies/"+dependencyScope+"/"+archiveFilename)
        def newArcFile = ""

        if(project.hasProperty('environmentSeparated') && project.hasProperty('separatedDependencyRoot')){
            println "Properties set denoting the prerelease environment is separated"
            newArcFile = project.file(project.ext.separatedDependencyRoot+relativeArchivePath+archiveFilename)
        }   else {
            newArcFile = project.file('../../'+relativeArchivePath+archiveFilename)
        }

        if(!newArcFile.isFile()){
            println "Warn: Could not find the latest copy of …
Run Code Online (Sandbox Code Playgroud)

groovy build gradle

28
推荐指数
1
解决办法
2万
查看次数

如何在独立群集模式下为每个工作人员分配更多执行程序?

我在一个包含36个内核和58GB内存的5个工作节点的集群中使用Spark 1.3.0.我想配置Spark的Standalone集群,每个worker有很多执行程序.

我已经看到合并的SPARK-1706,但是如何实际配置多个执行器并不是很明确.

以下是群集的最新配置:

spark.executor.cores = "15"
spark.executor.instances = "10"
spark.executor.memory = "10g"
Run Code Online (Sandbox Code Playgroud)

这些设置是SparkContext在将Spark应用程序提交到群集时设置的.

apache-spark

12
推荐指数
1
解决办法
3万
查看次数

Akka cluster-sharding:Entry actor可以拥有动态道具

Akka Cluster-Sharding看起来与用例匹配得很好我必须在Akka节点上创建有状态持久性actor的单个实例.

我不清楚是否有可能有一个Entry actor类型需要参数来构造它.或者我可能需要重新考虑Entry actor如何获取此信息.

Object Account {
  def apply(region: String, accountId: String): Props = Props(new Account(region, accountId))
}

class Account(val region: String, val accountId: String) extends Actor with PersistentActor { ... }
Run Code Online (Sandbox Code Playgroud)

ClusterSharding.start单个Props实例用于创建所有Entry actor.

来自akka cluster-sharding:

val counterRegion: ActorRef = ClusterSharding(system).start(
  typeName = "Counter",
  entryProps = Some(Props[Counter]),
  idExtractor = idExtractor,
  shardResolver = shardResolver)
Run Code Online (Sandbox Code Playgroud)

然后它解析了根据您如何定义idExtractor接收消息的Entry actor.从分片的源代码可以看出它使用id作为给定Entry actor实例的名称:

def getEntry(id: EntryId): ActorRef = {
val name = URLEncoder.encode(id, "utf-8")
context.child(name).getOrElse {
  log.debug("Starting entry [{}] in shard [{}]", …
Run Code Online (Sandbox Code Playgroud)

scala akka akka-cluster

10
推荐指数
1
解决办法
2515
查看次数

运行axis2客户端版本1.5

所以我试图让客户端连接到我正在通过axis2运行的SOAP服务.

我尝试了两种方法,一种是使用wsdl2java来构建存根和关联的客户端类,然后编写一个Client类来构建请求消息并通过Stub发送它们.另一种方法是使用ServiceClient连接..

两者都以自己的方式失败了..

选项#1,每次通过存根发送消息时我都会回复:

org.apache.axis2.AxisFault: The input stream for an incoming message is null.
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:87)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
Run Code Online (Sandbox Code Playgroud)

选项#2,每次我运行它我得到这个例外:

org.apache.axis2.deployment.DeploymentException: org.apache.axis2.transport.local.LocalTransportSender
Run Code Online (Sandbox Code Playgroud)

选项#2来源:

import javax.xml.stream.XMLStreamException;
import org.apache.axiom.om.OMAbstractFactory; 
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.Constants;
import org.apache.axis2.client.ServiceClient;

public class loyaltyClient {

    private static EndpointReference targetEPR = 
         new EndpointReference(
           "http://localhost:8080/axis2/services/service");

    public static OMElement verifyCustomer(String customer_id) {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://localhost/", "service");
        OMElement method = fac.createOMElement("VerifyCustomer", …
Run Code Online (Sandbox Code Playgroud)

java client soap axis2 exception

6
推荐指数
2
解决办法
1万
查看次数

为Primefaces添加自定义属性(HTML5)支持(3.4)

在尝试在我的JSF/Primefaces Web应用程序中实现简单的html5属性"autofocus"时,我被提醒的事实是组件没有将所有未知属性传递给最终标记.我可以理解这个的原因,因为组件可能是html标记的复杂组合,如果属性尚未由组件定义,则不清楚放置属性的位置.

但对我来说最好的解决方案是支持自动对焦(以及我可能希望在我的应用程序中支持的任何其他可能类型的属性,这些属性尚未定义).

我已经看到为JSF 2.0 UIInput组件添加自定义属性(HTML5)支持,但这似乎适用于基本的JSF组件,并不适用于PrimeFaces组件.

如何扩展Primefaces的组件/渲染以支持此功能?

jsf html5 primefaces

6
推荐指数
1
解决办法
6087
查看次数

在Tapestry中构建Web应用程序的良好资源

我目前正在为我的公司研究Tapestry,并试图决定我是否认为我们可以将已有的专有Web应用程序移植到更好的位置.目前我们正在运行Tomcat并使用JSP作为我们自己的框架支持的前端,最终使用JDBC连接到Oracle数据库.

我已经完成了Tapestry教程,这个教程非常简洁,让我感兴趣,但现在我面临着一个常见的文档问题.在我准备完全承诺之前,我需要确保有很多事情可以确保我可以用Tapestry完成.有没有人有任何好的资源,无论是书籍或网络文章还是其他任何东西,除了Tapestry教程解释之外还有更详细的内容?

我也在考虑与Hibernate集成,并且已经阅读了一些关于Spring的内容.我仍然很难理解Spring如何比Tapestry更加繁琐,因为它们似乎有很多重叠的功能.我读过的一个例子似乎是使用Spring来连接Hibernate,然后使用Tapestry连接到Spring,但我认为Tapestry与Hibernate的集成程度相同.我所说的资源是
http://wiki.apache.org/tapestry/Tapstry5First_project_with_Tapestry5,_Spring_and_Hibernate.我感兴趣的是因为我之前没有在其他任何地方找到有关如何通过Tapestry应用程序维护用户级别和会话的信息,但是在示例中不需要使用Spring.

resources tapestry

5
推荐指数
1
解决办法
400
查看次数

什么是在部署中设置Cache-Control no-cache,no-store?

我有一个问题,我的应用程序部署总是返回响应标头:

Cache-Control: no-cache
Cache-Control: no-store
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:no-cache
Run Code Online (Sandbox Code Playgroud)



我正在使用:

春季3.1.2.RELEASE

Primefaces JSF 3.4.1

Spring Webflow 2.3.0.RELEASE

JBoss AS 7.0.1



我已经尝试了几乎我可以找到的应用程序方面的所有解决方案:

  1. 配置WebContentInterceptor(尝试了它的各种排列)开箱即用的缓存控制头过滤器?
  2. 编写自定义拦截器,添加不同的Cache-Control标头(使用Cache-Control:private测试)
  3. 编写添加HTTP响应参数的客户过滤器.使用Cache-Control配置它:private作为web.xml中的init-params
  4. 使用context.xml文件(在META-INF /和WEB-INF /中都尝试过)来禁用JBoss/Tomcat中的Cache-Control http://daveharris.wordpress.com/2007/07/09/how-to-配置高速缓存控制功能于tomcat的/

在所有上述情况中,响应头从未结束不同,总是没有缓存,没有存储,1970年到期,pragma:no-cache

我的想法已经不多了,有人知道在我的响应中设置这些标头是什么,所以我可以定位适当的部署组件来解决这个问题吗?

java jboss spring spring-webflow primefaces

4
推荐指数
1
解决办法
7943
查看次数

Gradle:如何在包装中排除编译范围文件依赖关系?

我有一个多模块gradle项目,具有以下基本结构:

root
  core
  c-interface
  m-interface
Run Code Online (Sandbox Code Playgroud)

c接口和m接口都依赖于核心项目:

compile project(':root:core')
Run Code Online (Sandbox Code Playgroud)

c-interface和m-interface使用WAR插件,但核心没有,只是一个jar.

在核心项目中,我将通过以下方式提取一些文件系统依赖项.其中一个依赖项我不能打包在由c-interface和m-interface生成的WAR中.以前我在nexus maven存储库中有这种依赖关系,所以我可以在c-interface和m-interface中的providedRuntime配置中按组,名称,版本排除它.

我无法弄清楚如何对文件依赖性做同样的事情.gradle依赖项任务不列出文件依赖项,因此我不知道我将在provideRuntime中放入什么.

我阅读了http://issues.gradle.org/browse/GRADLE-471但是尝试使用这个想法似乎没有从我的包中删除存档.这是我目前正在定义的内容(在核心的build.gradle中):

compile fileTree(dir: 'dependencies/compile/archive', include: '*.jar', exclude: 'management.jar')
compile(files('dependencies/compile/archive/management.jar')){ notPackaged = true  } // Excludes it from all publications
Run Code Online (Sandbox Code Playgroud)

更新

提供没有war插件的编译看起来像是一种可能性.我在核心build.gradle中设置它并且编译得很好,但是c-interface和m-interface在编译时也需要依赖.在c-interface和m-interface中包含作为providedCompile(甚至是带有compile的健全性检查)的文件并没有修复与缺少management.jar依赖关系相关的编译时错误.我的推测是因为它已经作为核心中的compile作用,以便在c-interface和m-interface中忽略新的声明.

核心/的build.gradle:

configurations { providedCompile }

dependencies {
    providedCompile files('dependencies/compile/archive/management.jar')
}

sourceSets.main.compileClasspath += configurations.providedCompile
sourceSets.test.compileClasspath += configurations.providedCompile
sourceSets.test.runtimeClasspath += configurations.providedCompile
Run Code Online (Sandbox Code Playgroud)

C-接口/的build.gradle:

providedCompile files('dependencies/compile/archive/management.jar')
Run Code Online (Sandbox Code Playgroud)

dependencies build gradle

4
推荐指数
1
解决办法
2万
查看次数

Visual C++错误C2143:语法错误:在'常量'之前缺少')'

我在Visual C++中遇到错误,这让我很难过.

错误是错误c2143读取:语法错误:在'常数'之前缺少')'

我的代码行是:

coefficient[i] = (1 - (2 * depth)) + ((t - floor( t + 0.5 ) + 1 ) 2 * depth); 
Run Code Online (Sandbox Code Playgroud)

我在文件的开头有#include,它应该定义floor(double)函数.

对变量的更多解释.

double depth是可以在其中找到此行的类的成员变量
.int i是递增索引值.
double t是递增值.

他们所做的事实上并不重要,但我想澄清一下,这三者都已被定义为基本类型的变量.

我已经完成并验证所有括号都匹配.关于编译器所指的"常量",我有点不知所措.有任何想法吗?

c++ syntax-error visual-studio

3
推荐指数
3
解决办法
2万
查看次数

beginner c ++:基类中的虚函数

我正在编写一些代码,我定义了以下基类.

class Chorus{
  public:

    //Destructor
    virtual ~Chorus();

    //callback function
    virtual int callback( void *outputBuffer, void *notUsed, unsigned int 
       nBufferFrames, double streamTime, RtAudioStreamStatus status, void *userData );

    virtual void initializeDelayBuffer(void);

    virtual void destroyDelayBuffer(void);
};
Run Code Online (Sandbox Code Playgroud)

我想将它用作基类,而不是实际上对它自己做任何事情.所以我有两个单独的类,它们来自这个类Chorus.我想这样做只是简单地提供一些基本约束,以确定任何派生的Chorus类必须被认为在我的程序中可用.

当我构建我的项目(Visual Studio 2008)时,我在此Chorus类的所有虚函数上得到了未解析的外部符号错误.我猜这是典型的错误,我没有做出这些函数的前向声明.但是,由于它们是虚拟的,我不希望它们实际被定义为在导出类中定义之前做任何事情,我该怎么做才能解决这个问题?

c++ virtual unresolved-external visual-studio-2008

3
推荐指数
1
解决办法
2133
查看次数