小编Kil*_*átó的帖子

在C中使用带有命名空间的C++

在Linux上使用Eclpse我已经定义了一个名为ABC(ABC.hpp)的C++类:

#ifndef ABC_HPP_
#define ABC_HPP_

#include <stdio.h>

// namespace my {            <---- COMMENTED OUT

class ABC {
private:
    int m_number;
public:
    ABC(int p_number);
    void doSomething();
    virtual ~ABC();
};

// } /* namespace my */      <---- COMMENTED OUT

#endif /* ABC_HPP_ */
Run Code Online (Sandbox Code Playgroud)

它的实现是(ABC.cpp):

#include "ABC.hpp"

// using namespace my;       <---- COMMENTED OUT

ABC::ABC(int p_number) {
    this->m_number = p_number;
}

ABC::~ABC() {
    this->m_number = -1;
}

void ABC::doSomething() {
    printf("doing something (%d)\n", this->m_number);
}
Run Code Online (Sandbox Code Playgroud)

要在C程序中使用此类,我创建了一个包含这些方法的层(ABCwrapper.h):

typedef void CABC;

#ifdef __cplusplus
extern "C" …
Run Code Online (Sandbox Code Playgroud)

c c++ namespaces

7
推荐指数
2
解决办法
3488
查看次数

JBoss 7 CLI用于查询所有已部署的应用程序

使用JBoss 7的jboss-cli我可以查询已部署的应用程序:

[standalone@localhost:9999 /] deployment-info --headers=
NAME                 RUNTIME-NAME         PERSISTENT ENABLED STATUS
jboss-ejb-in-ear.ear jboss-ejb-in-ear.ear true       true    OK
singleton_in_war.war singleton_in_war.war true       true    OK
Run Code Online (Sandbox Code Playgroud)

以编程方式,我可以查询以/开头的任何CLI查询,例如:

/path=jboss.server.log.dir:read-attribute(name=path)
Run Code Online (Sandbox Code Playgroud)

地址在哪里

/path=jboss.server.log.dir
Run Code Online (Sandbox Code Playgroud)

而且操作是

read-attribute(name=path)
Run Code Online (Sandbox Code Playgroud)

我的问题是,对于CLI查询

deployment-info --headers=
Run Code Online (Sandbox Code Playgroud)

地址是什么,操作是什么?

最好的问候,SK

jboss command-line-interface

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

Sonatype Nexus - 无法找到所请求目标的有效证书路径

我正在使用当地的Sonaty Nexus,我在其中代理几个外部Maven存储库.到目前为止仅代理了http存储库,但对于一些工件,我不得不介绍Camunda.使用Nexus远程内容浏览器,我可以浏览其内容,但Nexus不会下载其索引.更重要的是,在nexus日志中出现以下错误:

2014-01-08 11:44:27 WARN  [xy-3-thread-218] - org.sonatype.nexus.proxy.maven.maven2.M2Repository - Remote peer of proxy repository "Camunda Secure" [id=camunda.secure] threw a org.sonatype.nexus.proxy.RemoteStorageException exception. Connection/transport problems occured while connecting to remote peer of the repository. - Cause(s): Transport error while executing GET method [repositoryId="camunda.secure", requestPath="/", remoteUrl="https://app.camunda.com/nexus/content/groups/public/"] > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target > unable to find …
Run Code Online (Sandbox Code Playgroud)

security https nexus maven camunda

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

Perl DBI 连接可以工作,但不适用于 Catalyst

我正在使用 Perl,并且我可以使用此代码连接到本地 PostgreSQL 9.3 服务器

#!/usr/bin/perl
use DBI;
use strict;
my $dbh = DBI->connect("dbi:Pg:dbname=postgres;host=127.0.0.1;port=5432", "postgres", "postgres", { RaiseError => 1 }) or die $DBI::errstr;
$dbh->disconnect();
print "Done\n";
Run Code Online (Sandbox Code Playgroud)

现在,按照有关 PostgreSQL 的 Catalyst 文档,我尝试生成 Catalyst 模型。

我使用这个 shell 命令

script/myapp_create.pl model DB DBIC::Schema MyApp::Schema \
create=static components=TimeStamp,EncodedColumn \
'dbi:Pg:dbname=postgres,host=127.0.0.1,port=5432' 'postgres' 'postgres' '{ AutoCommit => 1 }'
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

DBIx::Class::Storage::DBI::catch {...} (): 
DBI Connection failed: 
DBI connect('dbname=postgres,host=127.0.0.1,port=5432','postgres',...) failed: 
FATAL:  database "postgres,host=127.0.0.1,port=5432" does not exist at 
/usr/local/share/perl/5.18.2/DBIx/Class/Storage/DBI.pm line 1487. at 
/usr/local/share/perl/5.18.2/Catalyst/Helper/Model/DBIC/Schema.pm line 637
Run Code Online (Sandbox Code Playgroud)

perl catalyst dbi postgresql-9.3

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

使用MOJO build-helper-maven-plugin为MAVEN添加更多源文件夹

我更多地讨论了如何向MAVEN添加更多源文件夹,我选择使用MOJO的build-helper-maven-plugin插件.该pom.xml的是这样的:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>my.maven.tests</groupId>
  <artifactId>helper</artifactId>
  <version>1.0</version>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>add-gen-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
               <source>src-gen/gen/java</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-extra-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/extra/java</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
          <encoding>UTF-8</encoding>
          <includes>
            <include>src/main/java/**/*.java</include>
            <include>src-gen/gen/java/**/*.java</include>
            <include>src/extra/java/**/*.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
Run Code Online (Sandbox Code Playgroud)

使用该命令mvn clean compile,构建完成正常,没有错误,但不生成任何类.

我确信我做错了但我无法弄明白.

plugins compilation helper maven

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

Maven Artifact.getFile()在多模块项目中返回NULL

我正在一个多模块项目中开发一个Maven插件,我想在稍后的同一个项目中使用它.这是项目的布局:

sk:a:1.0:pom
   |
   --sk:a0:1.0:jar (the custom plugin)
   |
   --sk:a1:1.0:pom
   |  |
   |  --sk:a11:1.0:jar (a simple JAVA jar)
   |  |
   |  --sk:a12:1.0:jar (a simple JAVA jar)
   |
   sk:a2:1.0:pom
Run Code Online (Sandbox Code Playgroud)

sk:a2:1.0依赖于sk:a11:1.0和sk:a12:1.0和插件sk:a0:1.0:

<project>
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>sk</groupId>
    <artifactId>a</artifactId>
    <version>1.0</version>
  </parent>
  <artifactId>a2</artifactId>
  <dependencies>
    <dependency>
      <groupId>sk</groupId>
      <artifactId>a11</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>sk</groupId>
      <artifactId>a12</artifactId>
      <version>1.0</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>sk</groupId>
        <artifactId>a0</artifactId>
        <version>1.0</version>
        <executions>
        ...
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
Run Code Online (Sandbox Code Playgroud)

来自sk:a0:1.0的自定义插件在其execute()中调用

Set<Artifact> artifacts = project.getDependencyArtifacts();
Run Code Online (Sandbox Code Playgroud)

方法并迭代所有工件,包括:

for(Iterator<Artifact> iterator = artifacts.iterator(); iterator.hasNext();)
{
   Artifact artifact = iterator.next();
   getLog().info((artifact.getFile() == null …
Run Code Online (Sandbox Code Playgroud)

plugins dependencies maven

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

查找文件并移动文件夹

我在Debian Linux上有大量的文件文件,组织在一个大文件夹树中.我需要的是找到具有特定名称模式的所有文本文件,然后将包含文件夹移动到目标.

例:

/home/spenx/src/a12/a1a22.txt
/home/spenx/src/a12/a1a51.txt
/home/spenx/src/a12/a1b61.txt
/home/spenx/src/a12/a1x71.txt

/home/spenx/src/a167/a1a22.txt
/home/spenx/src/a167/a1a51.txt
/home/spenx/src/a167/a1b61.txt
/home/spenx/src/a167/a1x71.txt
Run Code Online (Sandbox Code Playgroud)

命令:

find /home/spenx/src -name "a1a2*txt"
mv /home/spenx/src/a12 /home/spenx/dst
mv /home/spenx/src/a167 /home/spenx/dst
Run Code Online (Sandbox Code Playgroud)

结果:

/home/spenx/dst/a12/a1a22.txt
/home/spenx/dst/a167/a1a22.txt
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助.

SK

linux shell find pattern-matching

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