小编LSt*_*ike的帖子

Java 8 lambda从对象列表创建字符串列表

我有以下qustion:

如何将以下代码转换为Java 8 lambda样式?

List<String> tmpAdresses = new ArrayList<String>();
for (User user : users) {
    tmpAdresses.add(user.getAdress());
}
Run Code Online (Sandbox Code Playgroud)

不知道并开始以下内容:

List<String> tmpAdresses = users.stream().map((User user) -> user.getAdress());
Run Code Online (Sandbox Code Playgroud)

java arraylist java-8 java-stream

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

如何使用apache vfs2 for sftp with public-private-key and without password

目前我正在使用apache vfs2从sftp下载文件.对于身份验证,我使用用户名和密码.

有没有办法只使用vfs2与public-private-keys和没有密码?

我想我已经使用了这个功能,但是怎么样?将其设置为"是"?

SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(options, "no");
Run Code Online (Sandbox Code Playgroud)

这是我目前的代码(片段):

private boolean downloadFile(){

    StandardFileSystemManager sysManager = new StandardFileSystemManager();

    //download der Datei
    try {
        sysManager.init();

        FileObject localFile = sysManager.resolveFile(localFilePath);

        FileObject remoteFile = sysManager.resolveFile(createConnectionString(host, user, password, fileName, port),createDefaultOptions());

        //Selectors.SELECT_FILES --> A FileSelector that selects only the base file/folder.
        localFile.copyFrom(remoteFile, Selectors.SELECT_FILES);


    } catch (Exception e) {
        logger.error("Downloading file failed: " + e.toString());
        return false;
    }finally{
        sysManager.close();
    }
    return true;
}
Run Code Online (Sandbox Code Playgroud)

private FileSystemOptions createDefaultOptions() throws FileSystemException{

    //create options for sftp
    FileSystemOptions options = new FileSystemOptions();
    //ssh …
Run Code Online (Sandbox Code Playgroud)

java sftp public-key-encryption apache-commons-vfs

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

声纳数据库结构和声纳api指标

我有两个关于声纳的问题:

  1. 我看了一下声纳数据库.我想知道声纳存储每个测量结果的位置?

    我只找到了表格measure_data,但是现场数据看起来像是有价值的.谁能告诉我声纳存储所有测量数据的位置?

    是的我知道,最好使用REST API,我会这样做,但我也想知道,声纳本身如何使用数据库.

  2. 有没有办法使用API​​获取所有使用指标的完整列表?

java sonarqube

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

Magento用soap v2创建类别

我想通过Web服务请求(soap v2)在Magento中创建类别.我使用Magento 1.4.2.0,正如我所说的magent的肥皂api v2.

如果我发送请求,我会收到以下错误作为响应:

<?xml version="1.0" encoding="UTF-8" ?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
 <SOAP-ENV:Body>
 <SOAP-ENV:Fault>
  <faultcode>103</faultcode> 
  <faultstring>Attribute "include_in_menu" is required.</faultstring> 
  </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)

问题是,请求中没有xml标记"include_in_menu".如果我手动添加此标记,它将被忽略.

如果我不想使用soap v.1,我该怎么办?

问候LStrike

PS:这是我的要求:

<?xml version="1.0" encoding="UTF-8"?><?xe.source ../../../Common/Data/login_response.xml#Envelope?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" media-type="text/xml"></xsl:output>
  <xsl:template match="/">
    <soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:urn="urn:Magento" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Header></soapenv:Header>
      <soapenv:Body>
        <urn:catalogCategoryCreate soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          <sessionId xsi:type="xsd:string">
            <xsl:value-of select="soapenv:Envelope/soapenv:Body/urn:loginResponse/loginReturn"></xsl:value-of>
          </sessionId>
          <parentId xsi:type="xsd:int">
            <xsl:value-of select="'3'"></xsl:value-of>
          </parentId>
          <categoryData xsi:type="urn:catalogCategoryEntityCreate">
            <!--You may enter the following 19 items in any order-->
            <!--Optional:-->
            <name xsi:type="xsd:string">
              <xsl:value-of select="'TestKategorie'"></xsl:value-of>
            </name>
            <!--Optional:-->
            <is_active xsi:type="xsd:int">
              <xsl:value-of select="'1'"></xsl:value-of> …
Run Code Online (Sandbox Code Playgroud)

xml soap web-services magento

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

为每个子类创建单独的 hibernate 搜索索引

我刚刚开始玩休眠搜索。我该如何解决以下问题。

我所有的 java 实体都是从超类继承的:

@SuppressWarnings("rawtypes")
@MappedSuperclass
@Indexed
public abstract class BaseEntity{

        private Integer id;
   private Integer jpaVersion;
   private Date creaDate;
   private Date modDate;
   private String creaUser;
   private String modUser;


        @Id
   @Column(name = "ID", unique = true, nullable = false, precision = 22, scale = 0)
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   public Integer getId() {
     return this.id;
   }

   public void setId(Integer id) {
     this.id = id;
   }   
   .....
Run Code Online (Sandbox Code Playgroud)

例如我必须(还有更多)子类:

@Entity
@Indexed
@Table(name = "BASE_PERSON", schema = "MYSCHEMA")
public class Person extends extends BaseEntity{ …
Run Code Online (Sandbox Code Playgroud)

java hibernate jpa hibernate-search java-ee-6

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

Informix datetime:如何减去15分钟

如何在IBM Informix中执行此MySQL语句?

select type, channel, teilnr, starttime, endtime, usedtime, host 
from online_time 
where starttime < DATE_SUB(NOW(),INTERVAL 15 MINUTE)
order by starttime desc 
Run Code Online (Sandbox Code Playgroud)

我在Informix中尝试了这个,但它给出了语法错误.

select type, channel, teilnr, starttime, endtime, usedtime, host 
from online_time 
where starttime < subdate(CURRENT, INTERVAL "15" MINUTES)
order by starttime desc 
Run Code Online (Sandbox Code Playgroud)

informix datetime intervals

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

AS400 jt400获取RAM使用率

我只是试验jt400.jar从一个接收系统信息AS400.

我想通过使用类SystemStatus和如何阅读如何连接以及如何接收值SystemValues.(只需找到这些值的解释,给我任何提示?)

任何人都可以告诉我,哪些功能SystemStatus可以让我使用RAM或者接收这些信息?

private static void getSystemStatus() throws AS400SecurityException, ErrorCompletingRequestException,
            InterruptedException, IOException, ObjectDoesNotExistException, RequestNotSupportedException {
        //Connect to AS400
        AS400 as400 = new AS400("myAs400", "myUser", "myPassword");

        //Reading SystemStatus like CPU usage and hdd usage
        SystemStatus systemStatus = new SystemStatus(as400);
        System.out.println(systemStatus.getPercentProcessingUnitUsed());
        System.out.println(systemStatus.getActiveJobsInSystem());

        //Reading SystemValues
        SystemValueList sysValList = new SystemValueList(as400);
        Vector<SystemValue> sysValVec = new Vector<SystemValue>();
        sysValVec = sysValList.getGroup(SystemValueList.GROUP_ALL);

        System.out.println("<<<<  SystemValues >>>>");
        for (SystemValue systemValue : sysValVec) {
            String sysValName = systemValue.getName();
            systemValue.getValue();
            System.out.println("Value: …
Run Code Online (Sandbox Code Playgroud)

java memory ram jt400 ibm-midrange

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