小编E-r*_*ich的帖子

XJC生成整数而不是int

以下模式应该intValue类中生成两个基本字段,而是int元素生成基,为属性生成java.lang.Integer.

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.example.com/test" xmlns:test="http://www.example.com/test"
    elementFormDefault="qualified">

    <xsd:element name="values">
        <xsd:complexType>
            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element ref="test:value" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="value">
        <xsd:complexType>
            <xsd:sequence>
                <!-- Is generated as primitive int -->
                <xsd:element name="element" type="xsd:int" />
            </xsd:sequence>
            <!-- Is generated as java.lang.Integer -->
            <xsd:attribute name="attribute" type="xsd:int" />
        </xsd:complexType>
    </xsd:element>

</xsd:schema>
Run Code Online (Sandbox Code Playgroud)

我已经查看了JAXB文档中的任何内容,表明属性和元素可能以不同的方式生成而且一无所获.

有谁能解释一下?是否有修复使属性生成为原语int

xsd code-generation jaxb xjc

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

安装charlock_holmes libicu时发生错误

我正在尝试按照此安装脚本安装Gitlab ,但遇到了charlock_holmes gem无法安装的问题.我不熟悉Ruby.我的charlock_holmes-0.6.8 gem_make.out文件在下面.

/home/gitlabuser/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for main() in -licui18n... no
which: no brew in (/home/gitlabuser/.rvm/gems/ruby-1.9.2-p290/bin:/home/gitlabuser/.rvm/gems/ruby-1.9.2-p290@global/bin:/home/gitlabuser/.rvm/rubies/ruby-1.9.2-p290/bin:/home/gitlabuser/.rvm/gems/ruby-1.9.2-p290/bin:/home/gitlabuser/.rvm/gems/ruby-1.9.2-p290@global/bin:/home/gitlabuser/.rvm/rubies/ruby-1.9.2-p290/bin:/home/gitlabuser/.rvm/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/gitlabuser/bin:/usr/lib64/qt4/bin/)
checking for main() in -licui18n... no


***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib …
Run Code Online (Sandbox Code Playgroud)

redhat rhel bundle-install gitlab

7
推荐指数
3
解决办法
6723
查看次数

cmake undefined对函数的引用

下面的项目结构是一个简化的例子.我试图将其归结为最少量的文件来重现我的问题.

.
??? CMakeLists.txt
??? subdir1
?   ??? CMakeLists.txt
?   ??? subsubdir1
?       ??? CMakeLists.txt
?       ??? Example.cpp
?       ??? Example.h
??? subdir2
    ??? CMakeLists.txt
    ??? main.cpp
    ??? subsubdir1
        ??? CMakeLists.txt
        ??? ExampleCreator.cpp
        ??? ExampleCreator.h
Run Code Online (Sandbox Code Playgroud)

./CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
project(test)

macro(add_sources)
    file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
    foreach (_src ${ARGN})
        if (_relPath)
            list (APPEND SRCS "${_relPath}/${_src}")
        else()
            list (APPEND SRCS "${_src}")
        endif()
    endforeach()
    if (_relPath)
        # propagate SRCS to parent directory
        set (SRCS ${SRCS} PARENT_SCOPE)
    endif()
endmacro()

add_subdirectory(subdir1)
add_subdirectory(subdir2)

add_executable(test ${SRCS})
Run Code Online (Sandbox Code Playgroud)

subdir1 …

cmake ld undefined-reference

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

在C#中编组C数组 - 简单的HelloWorld

在我的编组helloworld问题的基础上,我遇到问题,编组用C语言分配的数组到C#.我花了几个小时研究我可能出错的地方,但我尝试过的所有内容都会出现AccessViolationException等错误.

处理在C中创建数组的函数如下.

__declspec(dllexport) int __cdecl import_csv(char *path, struct human ***persons, int *numPersons)
{
    int res;
    FILE *csv;
    char line[1024];
    struct human **humans;

    csv = fopen(path, "r");
    if (csv == NULL) {
        return errno;
    }

    *numPersons = 0; // init to sane value
    /*
     * All I'm trying to do for now is get more than one working.
     * Starting with 2 seems reasonable. My test CSV file only has 2 lines.
     */
    humans = …
Run Code Online (Sandbox Code Playgroud)

c c# arrays pointers marshalling

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

适用于Git或TFS的常春藤定制解析器

我对Ivy很新,所以也许有一种我无法在文档中找到的直接方式或者我正在寻找的东西是不可能的,但是这里有.我希望能够指定源代码位于使用不同协议的本地和/或远程服务器上的依赖项.

具体来说,我有一些存储在本地网络TFS服务器上的项目依赖项,以及存储在远程Git服务器上的其他项目依赖项(更准确地说www.github.com).是否有可能让Ivy下载源代码并构建一个jar文件,然后将其用作依赖项?如果是这样,怎么样?

java git ant tfs ivy

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

'sizeof'无效应用于不完整类型'struct array []'

我试图通过将命令分成单独的文件来组织我的项目,以便于维护.我遇到的问题是尝试迭代编译时定义的命令数组.我创建了一个愚蠢的例子来重现我得到的错误.

.
??? CMakeLists.txt
??? commands
?   ??? CMakeLists.txt
?   ??? command.c
?   ??? command.h
?   ??? help_command.c
?   ??? help_command.h
??? main.c
Run Code Online (Sandbox Code Playgroud)

./CMakeLists.txt

PROJECT(COMMAND_EXAMPLE)

SET(SRCS main.c)
ADD_SUBDIRECTORY(commands)

ADD_EXECUTABLE(test ${SRCS})
Run Code Online (Sandbox Code Playgroud)

命令/的CMakeLists.txt

SET(SRCS ${SRCS} command.c help_command.c)
Run Code Online (Sandbox Code Playgroud)

命令/ command.h

#ifndef COMMAND_H
#define COMMAND_H

struct command {
    char* name;
    int   (*init)(int argc, char** argv);
    int   (*exec)(void);
};

extern struct command command_table[];

#endif
Run Code Online (Sandbox Code Playgroud)

命令/ COMMAND.C

#include "command.h"
#include "help_command.h"

struct command command_table[] = {
    {"help", help_init, help_exec},
};
Run Code Online (Sandbox Code Playgroud)

命令/ help_command.h

#ifndef HELP_COMMAND_H
#define HELP_COMMAND_H …
Run Code Online (Sandbox Code Playgroud)

c arrays sizeof

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

在bitbake配方中运行命令,就像在实时系统上一样

是否可以在配方中运行命令,就像它在实时系统上运行一样?如果是这样,怎么样?我想在创建图像之前将我的密钥导入gpg,因此在格式化SD卡后我不必登录系统.

openembedded bitbake yocto

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

Azure CLI - 硬链接失败

我正在尝试通过以下方式下载存储在 Azure DevOps 上的通用包:

az artifacts universal download --feed my-feed --name my-cool-package --version 1.0.0 --path Downloads
Run Code Online (Sandbox Code Playgroud)

该包内有一个文件my-file.dll。我收到的错误是:

Encountered an unexpected error.
System.IO.IOException: Hard linking failed!
 Status: Failed
 Path: Downloads\my-file.dll
   at Microsoft.VisualStudio.Services.BlobStore.WebApi.DedupStoreClient.DownloadToFileAsync(DedupNode node, String fullPath, Uri proxyUri, EdgeCache edgeCache, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.BlobStore.WebApi.DedupStoreClientWithDataport.DownloadToFileAsync(IDedupDataPort dataport, DedupNode node, String fullPath, Uri proxyUri, EdgeCache edgeCache, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.BlobStore.WebApi.DedupStoreClientWithDataport.DownloadToFileAsync(IDedupDataPort dataport, DedupIdentifier dedupId, String fullPath, UInt64 fileSize, GetDedupAsyncFunc dedupFetcher, Uri proxyUri, EdgeCache edgeCache, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.BlobStore.WebApi.DedupManifestArtifactClient.<>c__DisplayClass24_0.<<DownloadAsyncWithManifestPath>b__5>d.MoveNext()
--- End of stack trace …
Run Code Online (Sandbox Code Playgroud)

azure azure-devops azure-artifacts

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

指定 Java 本地化文件

我正在尝试使用 ResourceBundle 类为我的应用程序检索特定于语言环境的文本,但遇到了一些错误。

java.lang.ClassCastException: org.project.MyClass cannot be cast to ResourceBundle

java.util.MissingResourceException: Can't find bundle for base name org.project.MyClass, locale en_US
Run Code Online (Sandbox Code Playgroud)

我用来创建 ResourceBundle 的代码如下:

static final ResourceBundle i18ln = ResourceBundle.getBundle("org.project.MyClass", Locale.getDefault());
Run Code Online (Sandbox Code Playgroud)

我已经搜索了大约一个小时关于如何指定资源文件的位置但没有成功。我的项目设置如下:

项目文件夹/
    来源/
        组织/
            项目/
                我的类
    测试/
    库/
    资源/
        图片/
        组织/
            项目/
                MyClass.properties

我的项目结构与 Java ResourceBundle 的结构不兼容吗?有谁知道我怎样才能让它发挥作用?

java localization directory-structure internationalization

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

Gradle Not Resolving Maven Repo on localhost

我使用默认配置在localhost上设置了Archiva实例.我尝试了几种不同的Gradle配置来解析archiva实例,但似乎都没有.

  1. 使用mavenRepo
  2. 行家
  3. 使用常春藤,只指定工件模式(当我使用常春藤时工作)

的build.gradle

subprojects {
    apply plugin: 'java'
    apply plugin: 'maven'

    repositories {
        mavenRepo url: 'http://localhost:8080/archiva', artifactUrls: [
            'http://localhost:8080/archiva/repository/internal',
            'http://localhost:8080/archiva/repository/snapshot'
        ]
        maven { url 'http://localhost:8080/archiva' }
        ivy {
            artifactPattern 'http://localhost:8080/archiva/repository/internal/[organisation]/[artifact]/[revision]/[artifact](-[revision]).[ext]'
        }
        mavenCentral()
    }

    dependencies {
        testCompile group: 'junit', name: 'junit', version: '4.10'
    }
}

dependsOnChildren()
Run Code Online (Sandbox Code Playgroud)

我认为它不是任何/所有子项目gradle文件的相关内容,但如果你认为有必要,我可以.

这里有什么我想念的吗?gradle是否以不同于localhost的方式处理localhost url(因为mavenCentral正在解析依赖项)?我需要做些什么才能让Gradle解析为Maven仓库的本地实例?

编辑: @Peter Niederwieser

:/> gradle build
> Loading > Resolving dependencies ':projects:project-plugin-framework:classpat
:projects:compileJava UP-TO-DATE
:projects:processResources UP-TO-DATE
:projects:classes UP-TO-DATE
:projects:jar UP-TO-DATE
:projects:assemble UP-TO-DATE
:projects:compileTestJava UP-TO-DATE
:projects:processTestResources UP-TO-DATE …
Run Code Online (Sandbox Code Playgroud)

localhost archiva gradle maven

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

错误预期';' 在实例之前

快速概述我是如何做到这一点的.

  1. 创建了结构
  2. 创建.cpp文件
  3. 使用CMake创建Make文件
  4. 使接收的错误

我正在尝试编译以下代码:

#include <iostream>
using namespace std;

enum UnitType { Meter, Inch };
class Meter {
    double value;

    public:
        Meter(double value) : value(value) {}
        double convertTo(UnitType unit) {
            if (unit == Inch) {
                return value * 39.3700787;
            }   
        };  
};

int main (int argc, char *argv[])
{
    try 
    {   
        Meter meter(1.0);
    }
    catch (int e) {
        cout << "exception " << e << endl;
    }

    return 0;
} …
Run Code Online (Sandbox Code Playgroud)

c++

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

cmake在windows上找到sqlite3库

我遇到的麻烦比我希望让CMake sqlite3.dll在Windows 7上找到这个库(64位,如果这很重要).我已下载并将最新文件sqlite3.dllsqlite3.def文件放入C:\Windows\System32.我正在使用以下FindSqlite3.cmake模块:

IF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
    SET(SQLITE3_FIND_QUIETLY TRUE)
ENDIF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )

FIND_PATH( SQLITE3_INCLUDE_DIR sqlite3.h )

FIND_LIBRARY(SQLITE3_LIBRARY_RELEASE NAMES sqlite3 )

FIND_LIBRARY(SQLITE3_LIBRARY_DEBUG NAMES sqlite3 sqlite3d HINTS /usr/lib/debug/usr/lib/ C:/Windows/System32/ )

IF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
SET( SQLITE3_FOUND TRUE )
ENDIF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )

IF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
# if the generator supports configuration types then set
# optimized and debug …
Run Code Online (Sandbox Code Playgroud)

windows sqlite cmake

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