<br />当用户按ENTER键时,如何只在div满足?我必须在发送后以XML格式管理该div的内容,但有些浏览器会将新行翻译为<p>,有些(例如Google Chrome)<div>.
好的解决方案是强制在所有浏览器(仅限<p>或仅<div>)中使新行相同.
PS:我正在使用jQuery和PHP.
我正在尝试连接基于Java netty的服务器,它自动为自己生成证书(服务器人告诉我,现在接受来自客户端的任何证书).
我的任务是将TcpSocket连接迁移到Tls加密连接.
首先,我将TcpSocket转换为NetworkStream:
using (var client = new NetworkStream(connection.TcpSocket))
{
if (client.CanRead)
{
client.BeginRead(recvState.DataBuffer, 0, recvState.DataBuffer.Length, ReceiveCallback,
recvState);
}
}
Run Code Online (Sandbox Code Playgroud)
这是完美的.那么,我决定构建SslAuthentication - 就像这里:
using (var client = new NetworkStream(connection.TcpSocket))
using (var sslStream = new SslStream(client, false, App_CertificateValidation))
{
var clientCertificate = new X509Certificate2("client.pfx");
var clientCertificateCollection = new X509Certificate2Collection(new[] { clientCertificate });
sslStream.AuthenticateAsClient("MyServer", clientCertificateCollection, SslProtocols.Tls, false);
if (sslStream.CanRead)
{
sslStream.BeginRead(recvState.DataBuffer, 0, recvState.DataBuffer.Length, ReceiveCallback,
recvState);
}
}
Run Code Online (Sandbox Code Playgroud)
哪里client.pfx是没有密码随机证书,如在项目中的文件,并导入到Current User Certificates > Personal > Certificates的certmgr.msc.
问题是AuthenticateAsClient抛出一个 …
我需要将这个片段从Java翻译成.NET(而不是C#,但我也知道Visual Basic).这是代码:
typeStrings = new Dictionary<Int16, String>();
Field[] fields = Type.class.getDeclaredFields();
for (Field field : fields) {
try {
typeStrings.put(field.getInt(null), field.getName());
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
第一行(Dictionary类)来自.NET(我的翻译尝试;)).我知道Field类来自java.lang.reflect.Field,但我找不到.NET等价物.亲切的问候!
c# ×2
.net ×1
equivalent ×1
html ×1
java ×1
javascript ×1
jquery ×1
sockets ×1
ssl ×1
translation ×1