小编Pra*_*K S的帖子

尽管我打电话给pyplot.show(),matplotlib也没有显示我的图画

matplotlib需要帮助.是的,我没有忘记调用pyplot.show().

$ ipython --pylab

import matplotlib.pyplot as p 
p.plot(range(20), range(20))
Run Code Online (Sandbox Code Playgroud)

matplotlib.lines.Line2D at 0xade2b2c作为输出返回.

p.show()
Run Code Online (Sandbox Code Playgroud)

没有任何事情发生.没有错误消息.没有新窗口.没有.我matplotlib使用pip 安装,我没有收到任何错误消息.

细节:

我用,

  • Ubuntu的
  • IPython v0.11
  • Python v2.6.6
  • matplotlib v1.0.1

python matplotlib tech-chat-ml

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

java.lang.NoSuchMethodError:javax.ws.rs.core.Application.getProperties()Ljava/util的/地图;

我无法通过以下链接找到答案

其中 两个

以下是我的pom.xml依赖项

<dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
            <version>1.11.41</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.2</version>
            <type>jar</type>
        </dependency> 

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>6.0.2</version>
        </dependency>

        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.0.1</version>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet</artifactId>
            <version>2.22</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.jvnet/mimepull -->
        <dependency>
            <groupId>org.jvnet</groupId>
            <artifactId>mimepull</artifactId>
            <version>1.6</version>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-jackson</artifactId>
            <version>2.22.1</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-server</artifactId>
            <version>2.22</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-common -->
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-common</artifactId>
            <version>2.22</version>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-multipart</artifactId>
            <version>2.22</version>
        </dependency>

        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
            <type>jar</type> …
Run Code Online (Sandbox Code Playgroud)

java jax-rs jersey-2.0

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

如何从python中的Dictionary数据中删除unicode字符

使用请求库后,我在response.json()中得到了dict

{u'xyz': {u'key1': None, u'key2': u'Value2'}}
Run Code Online (Sandbox Code Playgroud)

我想删除所有unicode字符并仅打印键值对而不使用unicode字符

我尝试过以下方法删除,但它显示格式错误的字符串

>>> import json, ast
>>> c = {u'xyz': {u'key1': None,u'key2': u'Value2'}}
>>> ast.literal_eval(json.dumps(c))
Run Code Online (Sandbox Code Playgroud)

获取'ValueError:格式错误的字符串'

关于如何做的任何建议?

python unicode json

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

kafka客户端可以扮演消费者和生产者的多重角色吗

我创建了一个场景,其中具有生产者角色的客户端在 kafka 集群中的主题中发布消息,而具有消费者角色的客户端订阅该主题并从日志中轮询消息。我的问题是,如果在此之后具有消费者角色的客户端也是一个进程(例如数据库处理)并且他想要发回一些数据,那么它必须扮演生产者角色,而另一个客户端从之前的生产者角色变成消费者。客户是否可以同时扮演消费者和生产者的角色?有其他解决方案吗?

performance apache-kafka kafka-consumer-api

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

如何用特定颜色填充使用引导网格系统分区的空 div?

考虑这个案例

<div class="row">
    <div class="col-md-3 col-sm-3 col-xs-3"></div>
    <div class="col-md-6 col-sm-6 col-xs-6"></div>
    <div class="col-md-3 col-sm-3 col-xs-3"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

在这种情况下,假设我需要用 #FF0000 的背景填充父 div 中的第一个 div(第一列),我该怎么做?如果我可以以常规方式执行此操作,即通过指定 style="background-color:red",则背景仅针对其中写入的内容进行更改。如果我在其中创建另一个 div 并将其高度和宽度设置为 100%,则不会发生任何情况。为什么会这样呢?我怎样才能以正确的方式做到这一点?

html css twitter-bootstrap

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

在Spring Boot中配置Amazon SQS队列名称

我正在使用AmazonSQS和Spring Boot(spring-cloud-aws-messaging).我已经配置了一个消息监听器来使用注释@SqsListener接收来自队列的消息.

@SqsListener(value = "indexerQueue", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS)
public void queueListener(String rawMessage) {
   ...
}
Run Code Online (Sandbox Code Playgroud)

这是一个非常简单的方法,但我没有找到从配置文件加载队列名称的方法,因为我有不同的环境.关于这方面的任何想法?

java amazon-sqs spring-boot spring-cloud-aws

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

C程序可以根据其值确定宏标识符/枚举名称吗?

假设我们将一些错误代码定义为宏 -

#define ERR_SUCCESS 0
#define ERR_BAD_INPUT 1
Run Code Online (Sandbox Code Playgroud)

...

或者作为枚举数据类型 -

enum err_t = { ERR_SUCCESS, ERR_BAD_INPUT, ...};
Run Code Online (Sandbox Code Playgroud)

其中一个id由以下函数返回 -

int foo(); /* if foo() returns 0, it means success, etc */
Run Code Online (Sandbox Code Playgroud)

调用者foo()可以确定哪个标识符/名称(ERR_SUCCESS,ERR_BAD_INPUT,...)链接到int返回值?

c macros enums

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

在Spring Boot应用程序中进行Spring Data Elastic搜索

我有一个Spring Boot应用程序,我想在其中使用独立的Elastic search 2.2.0(不是嵌入式服务器),我想使用Spring Data Elastic search,那么Spring Data支持的Elastic search版本是什么以及如何配置它连接到在localhost:9200中运行的elasticsearch实例吗?

实际上,我尝试将以下选项添加到我的application.properties文件中:

spring.data.elasticsearch.repositories.enabled=true
spring.data.elasticsearch.cluster-nodes=localhost:9200
Run Code Online (Sandbox Code Playgroud)

然后,我创建了这个配置类:

@Configuration
public class ElasticConfig {

    @Bean
    public ElasticsearchOperations elasticsearchTemplate() {
        return new ElasticsearchTemplate(client());
    }

    @Bean
    public Client client() {
        TransportClient client = new TransportClient();
        TransportAddress address = new InetSocketTransportAddress(
                "localhost",9200);
        client.addTransportAddress(address);
        return client;
    }
}
Run Code Online (Sandbox Code Playgroud)

我得到这个堆栈跟踪:

2016-04-28 00:03:52.246 INFO 25613 --- [restartedMain] org.elasticsearch.plugins:[Aardwolf]已加载[],网站[] 2016-04-28 00:04:01.356 INFO 25613 --- [ restartedMain] org.elasticsearch.client.transport:[Aardwolf]无法获取[#transport#-1] [fathi-HP-Pavilion-g6-Notebook-PC] [inet [localhost / 127.0.0.1:9200]]的节点信息],正在断开连接...

org.elasticsearch.transport.ReceiveTimeoutTransportException:[] [inet [localhost / 127.0.0.1:9200]] [cluster:monitor / nodes / info] request_id …

java spring elasticsearch spring-boot spring-data-elasticsearch

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

@PathVariable 和 @ModelAttribute 之间的区别

我对 SpringFramework 中的 @PathVariable 和 @ModelAttribute 感到困惑。我可以知道它们之间有什么区别吗?

spring spring-mvc

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

如何反转展开聚合?

考虑集合是

{ "_id" : 1, "item" : "ABC1", sizes: [ "S", "M", "L"] }
Run Code Online (Sandbox Code Playgroud)

放松后

{ "_id" : 1, "item" : "ABC1", "sizes" : "S" }
{ "_id" : 1, "item" : "ABC1", "sizes" : "M" }
{ "_id" : 1, "item" : "ABC1", "sizes" : "L" }
Run Code Online (Sandbox Code Playgroud)

如何将其反转为原始结构?

我想在不改变结构的情况下获取集合,但是我尝试了组聚合,它没有提供我所期望的。

实际上我的问题是,在执行展开和分组后我没有得到原始集合,我的输入集合是:

{
    "journeys" : {
        "_id" : "8",
        "originDate" : ISODate("2017-06-27T03:55:00.000Z"),
        "destinationDate" : ISODate("2017-06-27T08:55:00.000Z"),


        "dir" : "OUTBOUND",
        "proposals" : [ 
            {
                "_id" : "35",
                "price" : {
                    "posCurrencyPrice" : "SEK …
Run Code Online (Sandbox Code Playgroud)

mongodb

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

AWS 安装失败:IAM 实例配置文件已存在

我使用安装程序预配置基础设施 (IPI) 在我的 AWS 集群上安装 openshift 4.4.9,但未能成功在 AWS 上启动我的 openshift 集群。由于以下错误。

INFO Creating infrastructure resources...
ERROR
ERROR Error: Error creating IAM instance profile ocp4-925gm-bootstrap- 
 profile: EntityAlreadyExists: 
Instance Profile ocp4-925gm-bootstrap-profile already exists.
ERROR   status code: 409, request id: b6918967-774c-44c1-8b92-02ac7388f87c
ERROR
ERROR   on ../../../tmp/openshift-install-584826335/bootstrap/main.tf line 46, in resource 
"aws_iam_instance_profile" "bootstrap":
 ERROR   46: resource "aws_iam_instance_profile" "bootstrap" {

ERROR Error: Error creating IAM instance profile ocp4-925gm-worker-profile: EntityAlreadyExists: 
Instance Profile ocp4-925gm-worker-profile already exists.
ERROR   status code: 409, request id: 3b5d2b9c-28fe-4c95-b622-7a80af45dfb6
ERROR
ERROR   on ../../../tmp/openshift-install-584826335/iam/main.tf line …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services openshift aws-cli terraform terraform-provider-aws

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