小编Cha*_*uis的帖子

Java套接字:Socket.close()在Windows和Mac上终止不同的连接?

情况如下:我有一个Java应用程序,它通过TCP与具有TCP堆栈的微控制器通信.控制器上的堆栈工作正常,我可以解决这个问题.

问题是:当我终止与Controller的连接时,我只是使用socket.close()并且连接终止,没问题.在我的Mac上,这也有效,但是当我检查Wireshark时,会有常规的终止过程[FIN,ACK]- [ACK]但后面跟着一个[TCP Dup ACK]数据包,因为Wireshark声称属于我的[FIN,ACK]数据包.这只发生在Mac上,并且不会发生在我的Mac或我的上网本上的VM上的Windows机器上...

我是否可以使用任何调整来不让这个Dup-ACK数据包被传输?它实际上通过声称关闭的会话仍然处于活动状态并且在连接到控制器10次后,堆栈中没有更多空间来接受新连接,从而使控制器中的堆栈猛然抬起.

如果有人能给我一个暗示,我真的很感激!

java sockets macos duplicates

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

TypeError:$(...).masonry不是一个函数

我想加载一些图像的砌体视图但发生错误:

TypeError: $(...).masonry is not a function
Run Code Online (Sandbox Code Playgroud)

HTML代码:

<div data-masonry-options="{&quot;columnWidth&quot;: 105, &quot;itemSelector&quot;:&quot;.item&quot;}" class="img-container js-masonry" style="position: relative; height: 381.417px;">
    <div class="item">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/889/88940833.jpg">
    </div>
    <div class="item">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/907/90775901.jpg">
    </div>
    <div class="item">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/294/29489326.jpg">
    </div>
    <div class="item ">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/100/100656385.jpg">
    </div>
    <div class="item ">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/889/88940839.jpg">
    </div>
    <div class="item ">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/111/111773987.jpg">
    </div>
    <div class="item ">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/146/146371016.jpg">
    </div>
    <div class="item">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/103/10313578.jpg">
    </div>
    <div class="item ">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/554/55473337.jpg">
    </div>
    <div class="item ">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/537/53727259.jpg">
    </div>
    <div class="item ">
        <img src="https://s3.amazonaws.com/clarifai-img/demo/111/111246515.jpg">
    </div> …
Run Code Online (Sandbox Code Playgroud)

jquery html5 jquery-masonry

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

PowerShell 中“无法识别 svn”错误

我尝试从 Windows PowerShell 访问 SVN,但无法。例如,如果我输入svn help我得到:

svn :术语“svn”不被识别为 cmdlet、函数、脚本文件或可操作程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。

我在计算机上安装了 TortoiseSVN,据我所知,它应该允许我使用svn命令。

当我尝试使用Gource时,我也遇到了同样的问题。

svn powershell gource

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

如何使用 Ant 执行 JUnit 5 @Tag 测试?

如何使用 Ant 运行带有 注释的 JUnit 5 测试@Tag

例如:

class Tax {
    @Test
    @Tag("taxes")
    void testingTax() {
    }
}
Run Code Online (Sandbox Code Playgroud)

在 Maven 中,我可以执行以下操作来包含或排除。但是我不知道如何让它在 Ant 中工作。

<properties>
    <includeTags>taxes</includeTags>
    <excludeTags>Promo</excludeTags>
</properties>
Run Code Online (Sandbox Code Playgroud)

好心提醒。

ant junit ant-junit junit5

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

连接建立后,为什么在第一个TCP请求中ACK = 1而不是2?

在3次握手之后,我对TCP数据包中的ACK和SEQ数字感到困惑.我认为ACK编号是下一个预期的SEQ编号.因此,当我在Wireshark中分析TCP连接时,它说

TCP SYN with SEQ=0  
TCP SYN ACK with SEQ 0, ACK=1 (clear, server expects SEQ 1 in next packet)  
TCP ACK with SEQ 1, ACK=1 (clear, sender expects SEQ 1 in next packet)  

HTTP Request: TCP PSH ACK with SEQ 1, ACK=1
Run Code Online (Sandbox Code Playgroud)

最后一行不清楚.我会说发送者希望下一个SEQ = 2,所以它应该是ACK = 2?服务器上已经有一个带有SEQ = 1的数据包,为什么发送者想要另一个呢?

谁可以给我解释一下这个?

connection networking tcp

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

如果没有做客户确认会怎么样?

我有:

  • 一个hornetq-2.2.14-final独立服务器
  • 客户端应用程序C1,它将消息发送到队列A.
  • 消耗来自队列A的消息的客户端应用程序C2

C1使用jmstemplate在CLIENT_ACKNOWLEDGE模式下发送消息:

<bean name="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="sessionAcknowledgeModeName" value="CLIENT_ACKNOWLEDGE" />
    <property name="sessionTransacted" value="true" />
</bean>
Run Code Online (Sandbox Code Playgroud)

所以C2应该手动确认消息:

@Override
@Transactional
public void onMessage(Message message) 
{
    try 
    {
        messageHandlerService.handleReceivedMessage(message);
        message.acknowledge();
    } 
    catch (DeserializeXmlException e) 
    {
        // TODO log
        e.printStackTrace();
    }   
    catch (InvalidMessageException e) 
    {
        //TODO log
        e.printStackTrace();
    }
    catch (JMSException e) 
    {
        //TODO log
        e.printStackTrace();
    }   
}
Run Code Online (Sandbox Code Playgroud)

我的问题:

  • 当客户端C2收到该消息但在确认之前崩溃时,消息会发生什么?
  • 有没有超时机制?如果是,确认的默认超时是多少?我怎么修改它?

java jms hornetq

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

同时迭代两个文件的行

我试图在两个文件之间连接片段特定的行.这样我想从file2中的第2行添加一些东西到file1的第2行.然后从第6行从file2到文件1的第6行,依此类推.有没有办法同时迭代这两个文件来做到这一点?(知道输入文件大约为15GB可能会有所帮助).

这是一个简化的例子:

档案1:

Ignore
This is a
Ignore
Ignore
Ignore
This is also a
Ignore
Ignore
Run Code Online (Sandbox Code Playgroud)

文件2:

Ignore
sentence
Ignore
Ignore
Ignore
sentence
Ignore
Ignore
Run Code Online (Sandbox Code Playgroud)

输出文件:

Ignore
This is a sentence
Ignore
Ignore
Ignore
This is also a sentence
Ignore
Ignore
Run Code Online (Sandbox Code Playgroud)

python python-2.x

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

边框可绘制Android中的视图,左侧或右侧有边距

我需要有一个边框可绘制视图..我做如下.但是我还需要在左/右侧有一些边距.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item>
        <shape android:shape="rectangle">
            <solid android:color="@android:color/transparent"/>
        </shape>
    </item>

    <item
        android:left="-2dp"
        android:right="-2dp"
        android:top="-2dp">
        <shape>
            <stroke
                android:width="2dp"
                android:color="@color/border_color"/>
        </shape>
    </item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)

我已尝试插入,但无法获得所需的结果.

我怎么做?

android android-drawable

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

安装Jenkins插件时出现“服务器返回的HTTP响应代码:403”错误

尝试为Jenkins安装插件时,看到以下错误。

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\tech>cd C:\Program Files (x86)\Jenkins

C:\Program Files (x86)\Jenkins>java -jar jenkins-cli.jar -s http://localhost:8081/ install-plugin ant.hpi -deploy -restart

Exception in thread "main" java.io.IOException: No X-Jenkins-CLI2-Port among [null, X-Required-Permission, X-Jenkins,
X-You-Are-In-Group, X-Hudson, Content-Length, Expires, X-You-Are-Authenticated-As, X-Permission-Implied-By, Set-Cookie,
Server, X-Content-Type-Options, Date, X-Jenkins-Session, Content-Type]
        at hudson.cli.CLI.getCliTcpPort(CLI.java:290)
        at hudson.cli.CLI.<init>(CLI.java:133)
        at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)
        at hudson.cli.CLI._main(CLI.java:474)
        at hudson.cli.CLI.main(CLI.java:389)
        Suppressed: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8081/cli
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
                at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:78)
                at hudson.cli.CLI.connectViaHttp(CLI.java:163)
                at hudson.cli.CLI.<init>(CLI.java:137) …
Run Code Online (Sandbox Code Playgroud)

ant cmd jenkins jenkins-plugins

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

Ant Design 错误:“‘[..]/.babelrc’ 中指定了未知插件‘导入’”

我已将以下内容放入我的 .babelrc 中:

{
  "plugins": [
    ["import", { libraryName: "antd", style: "css" }] // `style: true` for less
  ]
}
Run Code Online (Sandbox Code Playgroud)

这是错误:“[..]/.babelrc”中指定的未知插件“导入”

此外,从文档中我不清楚是否必须导入 CSS:

  1. 每个组件(例如 DatePicker)或
  2. 如果 antd/dist/antd.css 包含所有内容。

对于 1. 的情况,最好将 CSS 路径作为示例的一部分。

如果是 2. 我应该将其放在 App.js 中的什么位置?

这些是我安装的 babel 软件包:

"babel-core": "^6.24.0",
"babel-eslint": "^7.2.1",
"babel-loader": "^6.4.1",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.24.0",
"babel-preset-react": "^6.23.0",
"babel-preset-stage-0": "^6.22.0",
Run Code Online (Sandbox Code Playgroud)

这是我的 webpack.config.js:

const webpack = require('webpack');
const path = require('path');
const nodeModulesPath = path.resolve(__dirname, 'node_modules');

const config = {

  // Render source-map file …
Run Code Online (Sandbox Code Playgroud)

css webpack babeljs antd

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