我尝试安装时出错 npm install --save-dev optimize-css-assets-webpack-plugin
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: webpack@1.0.0
npm ERR! Found: webpack@5.33.2
npm ERR! node_modules/webpack
npm ERR! dev webpack@"^5.33.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from optimize-css-assets-webpack-plugin@5.0.4
npm ERR! node_modules/optimize-css-assets-webpack-plugin
npm ERR! dev optimize-css-assets-webpack-plugin@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with …Run Code Online (Sandbox Code Playgroud) 我刚刚完成编码评估,但在按照它们的方式对数组进行排序时遇到了麻烦。每个组应包含一组索引(i、j等),使得相应的数组(a[i]、a[j]等)都具有相同的平均值。
例如:
let a = [[3,3,4,2],
[4,4],
[4,0,3,5],
[3,3]
]
function sortMean(a) {
let newArr = a.sort(function (a, b) {
let sum1 = a.reduce(function (c, d) {
return c + d;
});
let sum2 = b.reduce(function (c, d) {
return c + d;
});
let mean1 = sum1 / a.length;
let mean2 = sum2 / b.length;
return mean1 - mean2;
});
sortMean(a)
expected output: [[0,2,3],[1]]
Run Code Online (Sandbox Code Playgroud)
到目前为止,我可以按它们的方式进行排序,但在将它们分组为数组及其索引时遇到问题。
我最近从 Positive ssl 购买了个人 ssl 证书。在我通过激活和验证解决了所有问题后,我终于能够下载证书文件了。
我得到的文件是:
www.niknet.ddns.net.ca-bundle
www.niknet.ddns.net.crt
www.niknet.ddns.net.p7b
Run Code Online (Sandbox Code Playgroud)
在我只使用.keyand之前.crt
,它工作得很好,但现在我正在使用.ca-bundleand 该.crt文件,这是我用来将这些文件包含到 Node js 中的 ssl 库中的代码
var httpPort = process.env.PORT || 80;
var httpsPort = process.env.PORT || 443;
var server = http.createServer(app).listen(httpPort);
var server = https.createServer({
secureProtocol : 'TLSv1_2_server_method',
ciphers : "AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH",
honorCipherOrder : true,
ca: fs.readFileSync(__dirname + '/niknet_ddns_net.ca-bundle'),
cert: fs.readFileSync(__dirname + '/niknet_ddns_net.crt')
},app).listen(httpsPort);
var io = require('socket.io').listen(server);
Run Code Online (Sandbox Code Playgroud)
但我一生都无法获得正常工作的证书。我刚刚收到这个错误
ERR_SSL_VERSION_OR_CIPHER_MISMATCH
Run Code Online (Sandbox Code Playgroud)
我一直在阅读其他帖子并尝试添加他们的代码但没有任何效果。我还在某处读到,node.js 的 ssl 或 tls 库已过时,并且我的证书可能太新。如果这是真的,我还可以使用其他第三方 ssl 库吗?
对于课堂上的作业,我正在一个名为student()的类中创建对象。它涉及用户输入学生信息,然后以一种不错的格式输出学生信息。但是,控制台窗口中的每一行都会打印出“无”字样,并要求用户输入。我不确定为什么要打印出来,我想解决这个问题。
我相信问题出在我在定义函数init(自我)的地方,我在其中分配数据成员,但是我已经以多种方式更改了代码,但还没有运气。
class student():
def __init__(self):
self.name = input(print('What is the Student Name?: '))
self.address = input(print('What is the Student address?: '))
self.city = input(print('In which city does the Student reside?: '))
self.state = input(print('In which state does the Student reside?: '))
self.zip = input(print('In which zip code does the student reside?: '))
self.id = input(print('What is the Student ID?: '))
self.gpa = input(print('What is the Student GPA?: '))
return
def formatInfo(list):
for student in list:
print('Student Name: …Run Code Online (Sandbox Code Playgroud)