小编Jes*_*gui的帖子

将现有的c ++项目导入Xcode IDE

我试图在XCode中打开一个现有的C++开源库,用我自己的修改/添加来发布它.该库是Tesseract-OCR,不包含.xcodeproj文件.

由于XCode可以作为IDE运行,是否可以在XCode中将一堆文件作为单个项目打开?有没有简单的方法来生成XCode项目?

c++ import xcode

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

使用Gradle的多个启动脚本

我有一个有效的Maven构建(如下所示),它准备了几个可执行文件作为两个独立的进程启动.

虽然这很好用,但如何使用Gradle完成?我看到Gradle提供了一个名为的插件application,但我很难找到一个很好的例子来告诉它在输入时:gradle stage它应该创建2个可执行文件.

现在当我调用stage它时,它只在我的gradle脚本中定义的"root"主类上提供了一个可执行文件:

apply plugin: 'java'
apply plugin: 'application'

mainClassName = 'SpringLauncher'
applicationName = 'foo'
compileJava.options.encoding = 'UTF-8'
targetCompatibility = '1.7'
sourceCompatibility = '1.7'

task stage(dependsOn: ['clean', 'installApp', 'hello'])
Run Code Online (Sandbox Code Playgroud)

和Maven构建:

<build>
<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
      <artifactId>appassembler-maven-plugin</artifactId>
      <version>1.1.1</version>
      <configuration> 
        <assembleDirectory>target</assembleDirectory> 
        <programs>
            <program>
                <mainClass>foo.bar.scheduler.SchedulerMain</mainClass>
                <name>scheduler</name>
            </program>
            <program>
                <mainClass>SpringLauncher</mainClass>
                <name>web</name>
            </program>
        </programs>
      </configuration>
      <executions>
          <execution>
              <phase>package</phase><goals><goal>assemble</goal></goals>
          </execution>            
      </executions>
  </plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)

gradle maven

8
推荐指数
1
解决办法
2509
查看次数

Robolectric 2.1和Eclipse

Robolectric似乎是一个非常有趣的替代Android应用程序测试,但我无法正确地将它与我的Eclipse环境集成.

使用最新的robolectric版本2.1和android sdk 8,我遵循robolectric网站上描述的Eclipse设置步骤,但没有运气.当我运行新创建的运行配置时,测试将停止以下错误.

我不知道为什么我的pakpak .R类无法找到,什么是ro.build.date.utc?症状或问题?

WARNING: no system properties value for ro.build.date.utc
java.lang.RuntimeException: java.lang.ClassNotFoundException: com.googlecode.pakpak.android.R
    at org.robolectric.AndroidManifest.getRClass(AndroidManifest.java:102)
    at org.robolectric.AndroidManifest.getResourcePath(AndroidManifest.java:275)
    at org.robolectric.AndroidManifest.getIncludedResourcePaths(AndroidManifest.java:280)
    at org.robolectric.AndroidManifest.getIncludedResourcePaths(AndroidManifest.java:282)
    at org.robolectric.RobolectricTestRunner.createAppResourceLoader(RobolectricTestRunner.java:590)
    at org.robolectric.RobolectricTestRunner.getAppResourceLoader(RobolectricTestRunner.java:582)
    at org.robolectric.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:66)
    at org.robolectric.RobolectricTestRunner.setUpApplicationState(RobolectricTestRunner.java:392)
    at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:232)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:181)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: com.googlecode.pakpak.android.R
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at …
Run Code Online (Sandbox Code Playgroud)

testing android robolectric

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

由于org.junit.Test的CNF异常,Android代码覆盖率失败

当我使用ant运行以下代码覆盖率测试时出现以下错误:

ant emma debug install test
Run Code Online (Sandbox Code Playgroud)

我从Ubuntu 12.10终端运行它.JUnit4库已正确添加到我的eclipse测试项目中.测试项目是一个简单的Android测试项目.我不明白为什么我得到"没有在路径上找到类org.junit.test ..."我是否需要添加指定更多,以便构建知道还在生成的测试APK中包装junit?

    -post-build:

debug:

install:
     [echo] Installing /home/jes/IDTest/bin/StartupActivityTest-debug.apk onto default emulator or device...
     [exec] 1017 KB/s (37974 bytes in 0.036s)
     [exec]     pkg: /data/local/tmp/StartupActivityTest-debug.apk
     [exec] Success

-set-mode-check:

-set-instrumented-mode:

install:
     [echo] Installing /home/jes/android/bin/StartupActivity-instrumented.apk onto default emulator or device...
     [exec] 1171 KB/s (9168346 bytes in 7.642s)
     [exec]     pkg: /data/local/tmp/StartupActivity-instrumented.apk
     [exec] Success

installi:

-check-env:
 [checkenv] Android SDK Tools Revision 21.1.0
 [checkenv] Installed at /home/jes/Development/sdk

-setup:
     [echo] Project Name: StartupActivityTest
  [gettype] Project Type: Test Application

-test-project-check:

test:
[getlibpath] …
Run Code Online (Sandbox Code Playgroud)

ant instrumentation android eclemma

5
推荐指数
0
解决办法
521
查看次数

运行gradle测试时找不到属性文件

我正在使用gradle来构建和测试我的应用程序.我用这个命令

gradle test
Run Code Online (Sandbox Code Playgroud)

但是,当使用gradle运行时,在eclipse中运行时运行良好的测试失败.我的测试定义如下,它找不到的属性文件位于以下文件夹中:

/ home/user/Development/git/myproject/src/main/java/com/mycompany/config/home/user/Development/git/myproject/src/test/resources

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {      ApplicationConfig.class })
public class WebImportTest {
    @Resource
    private Environment env;

    @Autowired
    private JestClient jestClient;
Run Code Online (Sandbox Code Playgroud)

我的java配置如下所示:

@Configuration
@ComponentScan({ "com.mycompany" })
@PropertySource("classpath:/com/mycompany/config/myproject.properties")
@Import(PersistenceConfig.class)
public class ApplicationConfig {

    @Resource
    private Environment env;
Run Code Online (Sandbox Code Playgroud)

我没有足够的经验来弄清楚这是什么原因

:myproject is getting tests from [task ':test']
:compileJava
Note: /home/user/Development/git/myproject/src/main/java/com/mycompany/entities/generated/Keys.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:processResources UP-TO-DATE
:classes
:instrument SKIPPED
:copyCoberturaDatafile SKIPPED
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test

com.mycompany.myProject.DBConnectionTest > initializationError FAILED …
Run Code Online (Sandbox Code Playgroud)

java junit gradle

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

wagon-git和Gradle

这个漂亮的小工具承诺帮助我将工件上传到私人Bitbucket仓库.

http://synergian.github.io/wagon-git/bitbucket.html

我在Gradle构建中使用本指南时遇到了麻烦......

我发现了这个简短有限的例子, https://github.com/UniconLabs/ssl-utils/blob/master/build.gradle

对我来说最不清楚的是这部分关于如何在我的maven home中准备settings.xml.我应该使用我的.gradle文件夹,因为我使用Gradle?

Bitbucket私人存储库

以相同的方式继续,但在Maven settings.xml中添加基本身份验证(通常位于$ MAVEN_HOME目录中,请查看 http://maven.apache.org/settings.html以获取完整指南).

<settings>
        ...
        <servers>
                <server>
                        <id>your-repo-id</id>
                        <username>yourbitbucketusername</username>
                        <password>yourbitbucketpassword</password>
                </server>
                ...
        </servers>
        ...
</settings>
Run Code Online (Sandbox Code Playgroud)

git gradle maven

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

Spring集成中限制jsch的输出

我试图限制 Spring Boot 应用程序中 com.jcraft.jsch 包的输出。我的应用程序使用 Spring Intgration 并具有定义以下日志级别的 log4j.properties 文件

# Root logger option
log4j.rootLogger=DEBUG
log4j.category.com.jcraft.jsch=ERROR
log4j.category.org.springframework.integration.file=ERROR
Run Code Online (Sandbox Code Playgroud)

尽管如此,我还是从该包中收到了大量信息级别的消息......我希望它能将其过滤掉。我按照此链接底部的简短说明进行操作

任何知道为什么我仍然被通讯淹没的人。jsch 的详细信息?

2015-05-21 11:12:55.750  INFO 10684 --- [ask-scheduler-1] com.jcraft.jsch                          : aes256-cbc is not available.
2015-05-21 11:12:55.750  INFO 10684 --- [ask-scheduler-1] com.jcraft.jsch                          : aes192-cbc is not available.
2015-05-21 11:12:55.750  INFO 10684 --- [ask-scheduler-1] com.jcraft.jsch                          : CheckKexes: diffie-hellman-group14-sha1
2015-05-21 11:12:55.770  INFO 10684 --- [ask-scheduler-1] com.jcraft.jsch                          : SSH_MSG_KEXINIT sent
2015-05-21 11:12:55.770  INFO 10684 --- [ask-scheduler-1] com.jcraft.jsch                          : SSH_MSG_KEXINIT received
Run Code Online (Sandbox Code Playgroud)

我使用 log4j.1.2.17 和 …

log4j jsch spring-integration slf4j

5
推荐指数
2
解决办法
3265
查看次数

执行Leptonica图像处理库中的代码示例

我正在尝试编译然后执行Leptonica示例程序 colorquant_reg.c

事实:

  • 操作系统: Ubuntu

  • 地点: leptonlib-1.67/src/colorquant_reg.c

    (我把它移到src因为我到现在也没怎么跟那个失踪的编译器allheaders.h库文件位于/src而不是在原来的位置colorquant_reg.cleptonlib-1.67/prog)

  • 我尝试了什么: gcc -I. colorquant_reg -o out

  • 预期结果:我可以用来对我的.tif文件进行颜色量化的可执行文件.

  • 错误:

    /temp/cckdQZcM.o: In function main':
    colorquant_reg.c:(.text+0x37: undefined reference to regTestSetup
    colorquant_reg.c:(.text+0xa5: undefined reference to regTestCleanup
    /tmp/cckdQZcM.o: In function TestImage'
    colorquant_reg.c:(.text+0xe0: undefined reference to pixRead
    
    Run Code Online (Sandbox Code Playgroud)
  • 问题1:我如何进行编译该程序?

  • 问题2:未定义的引用是否因为我缺少进一步包含的内容而突然出现?

干杯

c linker compilation

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

Spring 集成元数据存储

我在 spring boot + spring 集成应用程序中添加了一个名为 metadataStore 的 bean,并希望即使在服务器重新启动后,ftp 同步也会保持不变。尽管如此,我的早期测试表明并非如此。如果我启动服务器并让它拾取并处理 3 个测试文件,然后重新启动服务器,那么将再次拾取和处理这 3 个相同的文件 - 就好像根本没有定义持久性 metadataStore 一样。

我想知道我在设置数据存储时是否遗漏了一些配置细节......

@Configuration
public class MetadataStoreConfiguration {

    @Bean
    public PropertiesPersistingMetadataStore metadataStore() {
        PropertiesPersistingMetadataStore metadataStore = new PropertiesPersistingMetadataStore();
        return metadataStore;
    }
}
Run Code Online (Sandbox Code Playgroud)

另外,我在 spring-integration 参考手册中看到了一个关于如何设置幂等接收器和元数据存储的简短示例。这是我的实现所缺乏的吗?

如果是这样,如果我必须像示例中那样设置它,我应该在哪里定义我的 metadataStore.get 和 metadataStore.put 调用?我正在使用的出站适配器没有为我提供表达式属性......这是我在这方面的幼稚和不完整的尝试:

<int-file:inbound-channel-adapter id="inboundLogFile"
                                  auto-create-directory="true"
                                  directory="${sftp.local.dir}"
                                  channel="fileInboundChannel"
                                  prevent-duplicates="true">
    <int:poller fixed-rate="${setup.inbound.poller.rate}"/>
</int-file:inbound-channel-adapter>


<int:filter id="fileFilter" input-channel="fileInboundChannel"
                output-channel="idempotentServiceChannel"
                discard-channel="fileDiscardChannel"
                expression="@metadataStore.get(payload.name) == null"/>
Run Code Online (Sandbox Code Playgroud)

这是示例中使用的出站适配器:

<int:outbound-channel-adapter channel="idempotentServiceChannel" expression="@metadataStore.put(payload.name, '')"/>
Run Code Online (Sandbox Code Playgroud)

在我的 ftp 出站适配器中,我无法插入上述表达式 :(

<int-ftp:outbound-channel-adapter id="sdkOutboundFtp"
                                      channel="idempotentServiceChannel"
                                      session-factory="ftpsCachingSessionFactory"
                                      charset="UTF-8"
                                      auto-create-directory="true"
                                      use-temporary-file-name="false"
                                      remote-file-separator="/" …
Run Code Online (Sandbox Code Playgroud)

spring-integration

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

在Play Framework视图中使用JSON的示例

我试图在控制器中进行切换,将JPA检索到的项目作为List发送到模板引擎,现在将它们作为JSON发送.

我更喜欢使用flexJSON库来完成任务.

我有一个应用程序控制器与方法:

public static Result index() {

        ... Processing ...

    flash("success", "Items have been processed");
    return ok(index.render(Item.all()));
}
Run Code Online (Sandbox Code Playgroud)

和一个视图index.scala.html喜欢这个:

@(items: List[Item])

@import helper._

@main("Item list") {

    <h1>@items.size() items(s)</h1>

    <ul>
        @for(item <- items) {
            <li>
                @item.title                
            </li>
        }
    </ul>
}
Run Code Online (Sandbox Code Playgroud)

这些可以完美地显示所有已处理项目的未编号列表.

现在,如果我将控制器更改为使用flexJSON,如下所示:

public static Result getItems() {
        List<Item> items = Item.all();

        String s = new JSONSerializer().exclude("*.class", "description").serialize(items);

        flash("success", "Messages have been processed");
        return ok(index.render(s));
    }
Run Code Online (Sandbox Code Playgroud)

我如何编程我的模板以消耗json字符串项?我试图在这个问题上关注这个博客,http://www.jamesward.com/2011/12/11/tutorial-play-framework-jpa-json-jquery-heroku,但是如何消费json in我的模板视图......任何代码示例都将非常感激.

json playframework playframework-2.0 flexjson

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