小编FGr*_*reg的帖子

公共ssh密钥无效

尝试按照github上的说明为Windows 生成SSH密钥.

我运行ssh-keygen -t rsa -C "my@email.com",输入密码,似乎SSH密钥正确生成.

但是,当尝试在GitHub上"添加SSH密钥"时,它会给我错误

密钥无效.它必须以'ssh-rsa'或'ssh-dss'开头.检查您是否正在复制密钥的公共部分

Windows生成的公钥如下所示:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "2048-bit RSA, my@email.com"
*public key*
---- END SSH2 PUBLIC KEY ----
Run Code Online (Sandbox Code Playgroud)

最值得注意的是,它不是以'ssh-rsa'或'ssh-dss'开头的.我试过复制该*public key*部分并在其前面添加'ssh-rsa',但我在GitHub上得到了同样的错误.我有什么想法我做错了吗?

windows git ssh github

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

适用于kie-maven插件的M2E连接器?

我正在使用BPM Suite 6来创建一个git存储库和shell项目.然后我在Eclipse IDE中连接到git repo.

由BPM Suite Web GUI创建的Pom文件包含kie-maven-plugin.但是Eclipse抱怨这个"插件执行没有被生命周期配置覆盖".

从谷歌搜索这个错误我已经明白,这意味着Eclipse不知道何时在Eclipse的构建过程中执行这个插件.修复此问题的"最佳"方法似乎是为插件安装m2e连接器.

这样的连接器是否存在?

eclipse drools maven kie

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

Collections.toArray()JavaDoc中"安全"的含义是什么?

当我阅读java源代码时,我发现在集合界面中,将是安全的

返回的数组将是"安全的",因为没有对它的引用由此集合维护.(换句话说,即使此集合由数组支持,此方法也必须分配一个新数组.)因此调用者可以自由修改返回的数组.

我不明白这个意思,你能为我提供一个例子吗?

java

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

通过合并元组元素获取元组列表的产品?

我有一个元组列表,我试图通过合并各个元组元素来获得其结果。

例如:

lists = [
    [(1,), (2,), (3,)],
    [(4,), (5,), (6,)]
]
p = itertools.product(*lists)
for product in p:
    print product
Run Code Online (Sandbox Code Playgroud)

这产生了一堆元组:

((1,), (4,))
((1,), (5,))
((1,), (6,))
((2,), (4,))
((2,), (5,))
((2,), (6,))
((3,), (4,))
((3,), (5,))
((3,), (6,))
Run Code Online (Sandbox Code Playgroud)

我想要的是这样的元组列表:

(1,4)
(1,5)
(1,6)
(2,4)
(2,5)
(2,6)
(3,4)
(3,5)
(3,6)
Run Code Online (Sandbox Code Playgroud)

我还需要使用它来容纳任意数量的元组初始列表。

因此,对于3:

lists = [
    [(1,), (2,), (3,)],
    [(4,), (5,), (6,)],
    [(7,), (8,), (9,)]
]
p = itertools.product(*lists)
for product in p:
    print product
Run Code Online (Sandbox Code Playgroud)

我想要:

(1, 4, 7)
(1, 4, …
Run Code Online (Sandbox Code Playgroud)

python tuples list python-itertools python-2.7

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

查找未知形状的 numpy ndarray 的第一个元素

如果您不知道数组的形状,是否有一种简单的方法可以提取 ndarray 的第一项?

例如。给定以下数组:

arr = np.array([[[1,2,3,4], [5,6,7,8], [9,10,11,12]]])

>>> [[[ 1  2  3  4]
      [ 5  6  7  8]
      [ 9 10 11 12]]]
Run Code Online (Sandbox Code Playgroud)

我不想1假设我知道这个数组的形状是 1*3*4。

我还对最小化解决方案的内存和 CPU 要求感兴趣。

python arrays numpy python-2.7

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

JobLauncherCommandLineRunner不会在作业完成时退出

我不确定我JobLauncherCommandLineRunner是否正确使用.我正在开发一个批处理作业,它将通过命令行调用,运行完成,然后停止.它从命令行获取1个参数,我正在使用:

  • spring-boot 1.5.9
  • 春季批次3.0.8

当我通过命令行调用它时,例如:

java -Dspring.profiles.active=solr,cassandra -Dspring.config.location=/path/to/job.yml -jar myjob.jar jobParam=/path/to/file.csv
Run Code Online (Sandbox Code Playgroud)

应用程序似乎"永远"运行(至少在作业完成时).有没有配置可以在工作完成时关闭上下文?

目前我main很简单,我想保持这种方式.但也许我需要自定义逻辑来在作业完成后停止上下文?

@SpringBootApplication
public class MyJob {
    public static void main(String[] args) {
        SpringApplication.run(MyJob.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

java spring spring-batch

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

Groovy如何从一个GString中的char []转换为String?

我试图找出Groovy如何将a char[]转换为Stringa GString.

例:

char[] pchar = ['p', 'a', 's', 's']
println "$pchar"
Run Code Online (Sandbox Code Playgroud)

结果:

通过

起初我假设它会在char [](http://groovy.codehaus.org/groovy-jdk/primitive-types/char [] .html#toString())上使用toString()方法.但运行以下代码的结果似乎暗示:

char[] pchar = ['p', 'a', 's', 's']
println "$pchar"

pchar.class.metaClass.toString = {->
    "****"
}

println pchar.toString()
println "$pchar"
Run Code Online (Sandbox Code Playgroud)

结果:

通过

****

通过

我也试过压倒invokeMethod()试图搞清楚无济于事:

char[] pchar = ['p', 'a', 's', 's']
println "$pchar"

pchar.class.metaClass.toString = {->
    "****"
}
pchar.class.metaClass.invokeMethod = {String methodName, Object arguments ->
    println("Method called on ${delegate.class}: $methodName, $arguments")
    def metaMethod = delegate.metaClass.getMetaMethod(methodName)
    return …
Run Code Online (Sandbox Code Playgroud)

groovy tostring gstring

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

找到不以83个连续逗号结尾的行

我有一个大型的csv文件,我正在使用Notepad ++搜索.

寻找正则表达式(或其他方法)来查找不以83个连续逗号结尾的行.

我在想这样的事情:

[^,]{83}$

regex notepad++

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

使用Spring的JMS命名空间时,侦听器容器的id是多少?

根据JMS命名空间标记的Spring文档(即<jms:listener-container>),元素没有id属性<jms:listener-container>.

如果没有id,那么如何从其他bean定义中引用监听器容器bean ?

例如,假设我定义了以下Listener容器:

<jms:listener-container acknowledge="auto"
    connection-factory="queueConnectionFactoryBean"
    container-type="default"
    destination-resolver="jndiDestinationResolver"
    destination-type="queue"
    message-converter="myConverter">

    <jms:listener ref="myListenerPOJO" id="myQueueListener"
        method="processThePOJO" destination="${myQueueListener.queue.jndiName}" />

</jms:listener-container>
Run Code Online (Sandbox Code Playgroud)

我想定义一个使用上述容器的入站网关.我将使用什么作为container入站网关定义的属性?

例:

<int-jms:inbound-gateway 
    request-channel="inboundChannel"
    id="messageChannelAdapter"
    container="**What Goes Here?**"
    reply-channel="outboundChannel" />
Run Code Online (Sandbox Code Playgroud)

或者我误解了监听器容器和网关之间的关系?

java spring spring-integration spring-jms

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

当我只指定一个时,为什么Spring Boot会加载所有xml文件?

我有一个非常基本的Spring Boot应用程序.

@SpringBootApplication该项目有2个:

ApplicationA:

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ImportResource;

/**
 * Created on 2/16/16.
 */
@SpringBootApplication
@ImportResource("classpath:run-app-a-context.xml")
public class ApplicationA {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(ApplicationA.class, args);

        System.out.println(context.getBean("helloA"));
        System.out.println(context.getBean("helloB"));
    }
}
Run Code Online (Sandbox Code Playgroud)

ApplicationB:

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ImportResource;

/**
 * Created on 2/16/16.
 */
@SpringBootApplication
@ImportResource("classpath:run-app-b-context.xml")
public class ApplicationB {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(ApplicationB.class, args);

        System.out.println(context.getBean("helloA"));
        System.out.println(context.getBean("helloB")); …
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot

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