小编ber*_*ing的帖子

为什么Java在最新的JDK更新后无法连接到MySQL 5.7,应该如何修复?(ssl.SSLHandshakeException:没有合适的协议)

在四月2021(最新更新到JDK 11.0.11+9-0ubuntu2~18.04),用于支持TLSv1TLSv1.1被放弃了,可能是因为2021年3月份以来的版本不再支持。从java.security文件中的差异可以看出这一点:

前:

jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, DH keySize < 1024, \
    EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
    include jdk.disabled.namedCurves
Run Code Online (Sandbox Code Playgroud)

后:

jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
    DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
    include jdk.disabled.namedCurves
Run Code Online (Sandbox Code Playgroud)

这也在这篇 SO 帖子中进行了讨论:SSLHandShakeException No Appropriate Protocol。在该线程中,自更新的 JDK 版本以来的最后几天还出现了更多答案。

这次更新JDK后,我们收到错误

java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
Run Code Online (Sandbox Code Playgroud)

c3p0.

切换到后,hikari …

java mysql tls1.2

25
推荐指数
3
解决办法
8163
查看次数

fastapi/uvicorn 如何并行化请求?

我用 fastapi 和 uvicorn 进行了一项实验,但我不明白其结果。

关于代码

@app.get('/loadtest')
def root():
    time.sleep(1)
    return {'message': 'hello'}
Run Code Online (Sandbox Code Playgroud)

在 docker 中运行

CMD ["uvicorn", "app.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"]
Run Code Online (Sandbox Code Playgroud)

我进行了以下测试:

ab -c 100 -n 1000 localhost/loadtest
Run Code Online (Sandbox Code Playgroud)

这给了我结果:

bersling-2:cas bersling$ ab -c 100 -n 1000 localhost/loadtest
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed …
Run Code Online (Sandbox Code Playgroud)

python parallel-processing fastapi uvicorn

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

单击iframe时,页面跳转到顶部

点击iframe后,当我嵌入这个gdrive iframe时,我的页面会跳到顶部:

<iframe height="400px" frameborder="0" width="600px" src="https://docs.google.com/document/d/1u9NFjTPBd-9mucQUPvkqLP84iV6uaEcJNF5vQdHmYh8/edit?usp=sharing&rm=embedded"></iframe>
Run Code Online (Sandbox Code Playgroud)

JSFiddle:https://jsfiddle.net/0qpe53os/

问题:为什么会这样做?如何防止它这样做?

我试着preventDefault没有任何运气.非常感谢您的帮助.

iframe

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

复制S3 Bucket包括版本

有没有办法复制包含对象版本的S3存储桶?

我读到一种复制存储桶的方法是使用命令行工具

aws s3 sync s3://<source> s3://<dest>
Run Code Online (Sandbox Code Playgroud)

但是,在源桶中,我有:

在此输入图像描述

在同步桶中我有:

在此输入图像描述

如您所见,版本ID为"null".有没有办法制作100%完全相同的副本,包括版本ID?这对我们的备份/开发服务器很重要,因为我们的应用程序依赖于版本ID.编辑:如果我在同步之前打开版本控制我得到的版本ID与null不同.但是版本ID与原始版本中的版本不同,目标是保留版本ID.我也尝试了cp命令,它产生了相同的结果.上述结果也记录在这里:

如果在目标存储桶上启用版本控制,Amazon S3会为要复制的对象生成唯一的版本ID.此版本ID与源对象的版本ID不同.Amazon S3在响应中的x-amz-version-id响应标头中返回复制对象的版本ID.

如果您未在目标存储桶上启用版本控制或挂起,则Amazon S3生成的版本ID始终为null.

所以看起来aws没有提供保存版本ID的方法?如果是这样,是否有解决方法或第三方软件?

copy version amazon-s3 amazon-web-services

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

脚本应该放入 angular.json 还是放入 index.html?

使用 Angular,您有两个选项来加载脚本(js 和 css):

  1. index.html<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
  2. angular.json"styles": ["node_modules/font-awesome/css/font-awesome.css"]

每个选项的优势是什么?据我了解,其中的内容angular.json捆绑在一起,而链接的脚本index.html则是动态加载的。所以它归结为讨论是使用预捆绑脚本还是从 CDN 加载它们更好?或者将脚本放入angular.json例如组织性质中是否还有其他好处?出于某种原因它“更干净”吗?

angular

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

if / else if / else 会在某个时刻成为 typescript / javascript 中的表达式吗?

我真的很喜欢 Kotlin 中的这个功能:

在 Kotlin 中,if 是一个表达式,即它返回一个值。

// As expression 
val max = if (a > b) a else b
Run Code Online (Sandbox Code Playgroud)

(来自https://kotlinlang.org/docs/reference/control-flow.html

这也计划用于打字稿/JavaScript 吗?

更新:

在回复三元运算符的建议时,我当然也指带有 else if 的情况:

val bla = if ( 5 == 6) {
    7
} else if (5 == 7) {
    8
} else {
    9
}

println(bla) // prints 9
Run Code Online (Sandbox Code Playgroud)

javascript typescript

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

TypeORM不创建表,列等

我已经使用typeorm(https://github.com/typeorm/typeorm)和NEST(https://github.com/nestjs/nest)设置了系统,但是TypeORM并未创建表或列。我的设置是这样的:

import {UserPassword} from '../user/user-password.entity';
import {User} from '../user/user.entity';

createConnection({
    type: 'mysql',
    host: 'typeorm2.cn32tstd6wqk.eu-central-1.rds.amazonaws.com',
    port: 1234,
    username: 'username',
    password: 'password',
    database: 'dbname',
    entities: [
      // __dirname + '/../**/*.entity{.ts,.js}'
      UserPassword,
      User
    ]
  })
Run Code Online (Sandbox Code Playgroud)

实体是:

import {Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn} from 'typeorm';

@Entity()
export class UserPassword {

  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  hash: string;

  @Column()
  algorithm: string;

}
Run Code Online (Sandbox Code Playgroud)

import {Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn} from 'typeorm';
import {UserPassword} from './user-password.entity';

@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: …
Run Code Online (Sandbox Code Playgroud)

typeorm

7
推荐指数
6
解决办法
7537
查看次数

将 HTML 字符串转换为文本字符串的 Angular 方法

目前我正在使用

htmlToText(html: string) {
    const tmp = document.createElement('DIV');
    tmp.innerHTML = html;
    return tmp.textContent || tmp.innerText || '';
}
Run Code Online (Sandbox Code Playgroud)

为了任务。Angular 的做法是什么?或者这样做完全没问题吗?像这样直接访问会document导致问题吗,例如使用移动应用程序?

注意:有一个AngularJS 相关问题,但我正在寻找 Angular2+ 答案。另外,我不确定接受的答案中的正则表达式是否是正确的方法?

angular

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

Set-Cookie 标头中可以有尾随分号吗?

MDN 中有关如何设置 cookie 的示例如下Set-Cookie

Set-Cookie: <cookie-name>=<cookie-value>; Domain=<domain-value>; Secure; HttpOnly
Run Code Online (Sandbox Code Playgroud)

在我见过的大多数地方,末尾都没有分号。我想知道,尾随分号可以吗?像这样的东西:

Set-Cookie: <cookie-name>=<cookie-value>; Domain=<domain-value>; Secure; HttpOnly;
Run Code Online (Sandbox Code Playgroud)

我只是好奇,RFC 说了些什么,不同的浏览器如何处理它,它们都接受它吗?

cross-browser

6
推荐指数
0
解决办法
375
查看次数

Automatically resizing textarea in bootstrap

I found the following very simple way to automatically adjust a textarea to the text height in this jsfiddle http://jsfiddle.net/tovic/gLhCk/:

function expandTextarea(id) {
    document.getElementById(id).addEventListener('keyup', function() {
        this.style.overflow = 'hidden';
        this.style.height = 0;
        this.style.height = this.scrollHeight + 'px';
    }, false);
}

expandTextarea('txtarea');
Run Code Online (Sandbox Code Playgroud)
body {
  padding:50px;  
}

textarea {
  margin:0px 0px;
  padding:5px;
  height:16px;
  line-height:16px;
  width:96%;
  display:block;
  margin:0px auto;    
}
Run Code Online (Sandbox Code Playgroud)
<textarea id="txtarea" spellcheck="false" placeholder="Statusku..."></textarea>
Run Code Online (Sandbox Code Playgroud)

However, I'm using bootstrap in my project and this introduces problems.

  1. The textarea is only 4px high instead …

css textarea twitter-bootstrap

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