小编Dhe*_*rik的帖子

如何使用 VBA 编辑电源查询的源?

我正在尝试使用 VBA 编辑我的查询之一的源。这是我到目前为止所拥有的:

 Dim mFormula As String

 mFormula = _

 "let Source = Excel.Workbook(File.Contents(wbname), null, true) in Source"

 query1 = ActiveWorkbook.Queries.Add("LATEST", mFormula)
Run Code Online (Sandbox Code Playgroud)

我wbname之前在代码中设置过。“LATEST”已经添加,而不是删除它并阅读它,我只想更改源。这可能吗?

excel vba powerquery

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

无法停止和删除 docker 容器

我试图停止并删除我的机器上的一些 docker 容器,但这里发生了一些非常奇怪的事情。

我试图阻止:

docker stop $(docker ps -a -q)
Run Code Online (Sandbox Code Playgroud)

这暂时有效,因为docker ps显示没有容器正在运行。但几秒钟后,图像再次出现,并带有新的容器 ID。

我尝试停止(最后一个命令)然后删除:

docker rm $(docker ps -a -q)
Run Code Online (Sandbox Code Playgroud)

但我收到一个错误:

错误:没有这样的容器:0f57644645eb

重复停止命令后,我还在正在运行的容器上尝试了此命令:

docker update --restart=no container-id
Run Code Online (Sandbox Code Playgroud)

命令成功,但容器仍在重新启动。

我尝试在停止后删除所有图像:

docker stop $(docker ps -a -q)
docker rmi $(docker images -q)
Run Code Online (Sandbox Code Playgroud)

但我收到另一个错误:

Error response from daemon: conflict: unable to delete 0f57644645eb (cannot be forced) - image is being used by running container dcef9cdb703c
Run Code Online (Sandbox Code Playgroud)

我在这里缺少什么?我想停止并删除这些容器,让 Docker 保持全新安装后的状态。

我使用的是 Windows 10 和 Docker 版本 17.12.0-ce-win47 (15139)。

docker

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

如何在我的测试中共享 @MockBeans 和模拟方法而不继承?

我有一个基本测试场景,将由其他集成测试使用。此场景包括一些@MockBean用于外部集成的模拟 bean ( )。

今天,我在集成测试课上有这样的内容:

@SpringBootTest
@WebAppConfiguration
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
@RunWith(SpringRunner.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class OrderIT {
Run Code Online (Sandbox Code Playgroud)

以及准备集成测试的字段和注释:

private MockMvc mockMvc;

@Autowired
private WebApplicationContext wac;

@Autowired
private ObjectMapper mapper;

@MockBean
private SomeGateway someGateway;

@MockBean
private SomeRabbitMqService someRabbitMqService ;

@MockBean
private AnotherRabbitMqService anotherRabbitMqService;

@MockBean
private SomeIntegrationService someIntegrationService ;

@MockBean
private Clock clock;

@Before
public void setup() {
    //some methods mocking each service above, preparing mockMvc, etc
}
Run Code Online (Sandbox Code Playgroud)

此场景对于使用MockMvc和创建系统中的主要功能 my是必要的Order。这Order是通过调用 Rest API 中的 POST 方法创建的,并将其保存 …

inheritance junit spring integration-testing mocking

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

@RunWith(MockitoJUnitRunner.class) 和 @RunWith(SpringJUnit4ClassRunner.class) 有什么区别?什么时候合适使用它?

@RunWith(MockitoJUnitRunner.class)和 和有什么区别@RunWith(SpringJUnit4ClassRunner.class)?什么时候合适使用它?

java junit mockito

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

Http 基本身份验证不适用于 Spring WS 和 WebServiceTemplate 凭据

我尝试使用 Spring(-WS) 将 HTTP Basic Auth 凭据添加到我的 SOAP-Request 中。请求本身有效,但未提交任何凭据。HTTP 标头应如下所示:

[...]
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Authorization: Basic mybase64encodedtopsecretcredentials=
Run Code Online (Sandbox Code Playgroud)

但最后一行并没有丢失。在 MyConfig.java 中,我配置 Bean(无 XML):

@Bean
public WebServiceTemplate webServiceTemplate() {
    WebServiceTemplate template = new WebServiceTemplate();
    try {
        template.setMarshaller(marshaller());  //Jaxb2Marshaller
        template.setUnmarshaller(marshaller());

        // proxy for tcpmon inspection
        template.setDefaultUri("http://127.0.0.1:29080/target/webservice.php");
        String username = environment.getProperty("config.username");
        String password = environment.getProperty("config.password");
        Credentials credentials = new UsernamePasswordCredentials(username, password);
        HttpComponentsMessageSender sender = new HttpComponentsMessageSender();
        sender.setCredentials(credentials);
        sender.afterPropertiesSet();
        template.setMessageSender(sender);
    } catch (Exception e) {
        // @todo: handle me
    }
    return template; …
Run Code Online (Sandbox Code Playgroud)

java spring soap web-services spring-ws

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

IntelliJ IDEA表示<configuration />中不允许使用<systemProperties />元素

我在使用Jetty的maven中使用插件.

在这个插件中,我需要进行一个配置来设置maxFormContentSize:

<plugin>
    <groupId>com.organization.example</groupId>
    <artifactId>maven-example-plugin</artifactId>
    <version>${example.version}</version>
    <dependencies>
        <!-- -->
    </dependencies>
    <configuration>
        <systemProperties>
            <systemProperty>
            <name>org.mortbay.jetty.Request.maxFormContentSize</name>
                <value>500000</value>
            </systemProperty>
        </systemProperties>
        <script>${example.script}</script>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

问题是Intellij IDEA说这里不允许使用systemProperties元素:

Element systemProperties is not allowed here
Run Code Online (Sandbox Code Playgroud)

IntelliJ IDEA的正确配置是什么不显示此错误?我已经对这个主题进行了研究,但似乎是唯一可能的配置.

我正在使用maven 2.2.1和IntelliJ IDEA 2017.1.4.Jetty版本是7.6.8.v20121106.

jetty intellij-idea maven

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

Kubernetes 作业和回退限制值:该值是重试次数还是分钟数?

我正在阅读有关 jobs 和 retries 的 Kubernetes 文档。我找到了这个:

在某些情况下,由于配置中的逻辑错误等,您希望在一定数量的重试后使 Job 失败。为此,请设置 .spec.backoffLimit 以指定在将 Job 视为失败之前的重试次数。退避限制默认设置为 6。与作业关联的失败 Pod 由作业控制器重新创建,指数退避延迟(10 秒、20 秒、40 秒……)上限为 6 分钟。如果在 Job 的下一次状态检查之前没有出现新的失败 Pod,则会重置回退计数。

我对上面的报价有两个问题:

  1. 回退限制值是分钟还是重试次数?使用值6(六)的文档示例令人困惑,因为他最初确认该值是重试次数,但之后说“上限为六分钟”。
  2. 有没有办法定义回退延迟时间?据我了解,这种行为(10 秒、20 秒、40 秒……)是默认设置,无法更改。

jobs kubernetes kubernetes-cronjob

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

从Java中的String创建字节类型

我有这个字符串11110000,代表一个byte.

我想byte从该字符串创建一个,但我找不到任何在线示例.

有人可以帮帮我吗?

java byte

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

liquibasechangeset顺序在后续更新中是否会更改?

liqibase中的CHANGESET执行是否取决于它在xml中的位置?例如,如果我有一个liquibase脚本,如下所示

<changeSet id="20140211_001" author="test">
    <createTable tableName="alarm_notification_archive">
        <column name="id" type="bigint">
            <constraints nullable="false" />
        </column>

        <column name="event_timestamp" type="timestamp" defaultValue="0000-00-00 00:00:00">
            <constraints nullable="false" />
        </column>
    </createTable>
</changeSet>

<changeSet id="20140210_001" author="test">
    <sql>ALTER TABLE `notification_archive` ADD COLUMN
        `is_Alarm_Outstanding` BOOLEAN DEFAULT FALSE</sql>
    <rollback>
        <sql>ALTER TABLE notification_archive DROP COLUMN
            is_Alarm_Outstanding
                </sql>
    </rollback>
</changeSet>
Run Code Online (Sandbox Code Playgroud)

我的理解是changeset排序是:

  1. 20140211_001
  2. 20140210_001

如果我现在在1和2之间添加另一个变更集

<changeSet id="20140211_001" author="test">
    <createTable tableName="alarm_notification_archive">
        <column name="id" type="bigint">
            <constraints nullable="false" />
        </column>

        <column name="event_timestamp" type="timestamp" defaultValue="0000-00-00 00:00:00">
            <constraints nullable="false" />
        </column>
    </createTable>
</changeSet>

<changeSet id="20140212_001" author="test">
    <sql>ALTER TABLE …
Run Code Online (Sandbox Code Playgroud)

mysql liquibase

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

spring 集成测试启动缓慢。原因?无法禁用 RabbitMQ

我的集成测试在启动时遇到了性能问题。

我正在尝试模拟系统的消息传递。为此,我基本上@MockBean在我的网关上使用并使用@EnableAutoConfiguration(exclude = {RabbitAutoConfiguration.class}). 例子:

@RunWith(SpringRunner.class)
@SpringBootTest(classes = MyApplication.class)
@WebAppConfiguration
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
@ActiveProfiles("test")
@EnableAutoConfiguration(exclude = {RabbitAutoConfiguration.class})
public class MyTestIT {
Run Code Online (Sandbox Code Playgroud)

这两个配置很好地完成了这项工作,我的测试运行没有问题,并且与某些外部 RabbitMQ 没有任何依赖关系。

但是spring boot的启动时间非常非常慢。这是大约两分钟只有在这部分配置SimpleMessageListenerContainer,AmqpInboundChannelAdapter,EventDrivenConsumer,RabbitExchangeQueueProvisioner,等。

日志有一些关于问题所在的提示(我剪了很多消息,这是一个示例):

2018-02-09 14:26:37.784  INFO [ms-project-name-service,,,] 13804 --- [           main] o.s.integration.channel.DirectChannel    : Channel 'ms-project-name-service:test:-1.channel2-output' has 1 subscriber(s).

2018-02-09 14:26:54.110  INFO [ms-project-name-service,,,] 13804 --- [           main] c.s.b.r.p.RabbitExchangeQueueProvisioner : declaring queue for inbound: channel1-input.anonymous.417FtxKTTce7-_IR0tGuNA, bound to: channel1-input

2018-02-09 14:27:00.147  INFO [ms-project-name-service,,,] 13804 --- [           main] …
Run Code Online (Sandbox Code Playgroud)

spring integration-testing rabbitmq spring-boot spring-boot-test

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