我正在节点学校的研讨会下学习节点.研讨会的名称是learnyounode,问题编号8. HTTP COLLECT.
问题是:
编写一个程序,对作为第一个命令行参数提供给您的URL执行HTTP GET请求.收集服务器中的所有数据(不仅仅是第一个"数据"事件),然后将两行写入控制台(stdout).您编写的第一行应该是一个整数,表示从服务器接收的字符数.第二行应包含服务器发送的完整字符串.
我提交的答案如下.
var http = require('http');
var url = process.argv[2];
http.get(url,function(res){
var body = '';
res.on('error',function(err){
console.error(err);
})
res.on('data',function(chunk){
body+=chunk.toString();
});
res.on('end',function(){
console.log(body.length);
console.log(body);
});
});
Run Code Online (Sandbox Code Playgroud)
虽然他们提供的答案是,
var http = require('http')
var bl = require('bl')
http.get(process.argv[2], function (response) {
response.pipe(bl(function (err, data) {
if (err)
return console.error(err)
data = data.toString()
console.log(data.length)
console.log(data)
}))
})
Run Code Online (Sandbox Code Playgroud)
我想知道这两个代码之间的区别.并请解释http.get()和管道如何工作......
当我执行时git push,它显示以下输出
Counting objects: 214, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (213/213), done.
Writing objects: 26% (57/214), 27.44 MiB | 60.00 KiB/s
Run Code Online (Sandbox Code Playgroud)
由此可见,Git 使用了 delta 压缩方法。增量压缩如何工作?它也可以用于其他应用程序吗?如果是,请推荐此类应用程序。
我想绘制一个ROC曲线用于使用 RandomForestClassifier
我有两个numpy数组,一个包含预测值,一个包含真实值,如下所示:
In [84]: test
Out[84]: array([0, 1, 0, ..., 0, 1, 0])
In [85]: pred
Out[85]: array([0, 1, 0, ..., 1, 0, 0])
Run Code Online (Sandbox Code Playgroud)
如何在ipython中为此二进制分类结果移植ROC曲线并获得AUC(曲线下面积)?
我只是a使用容器类创建了一个数组。但是,VScode的IntelliSense显示错误。这是选择排序的实现。
该c_cpp_properties.json文件的内容如下
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.16299.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
Run Code Online (Sandbox Code Playgroud)
该代码将编译并成功运行。如何解决错误的IntelliSense错误?
c++ ×1
compression ×1
git ×1
github ×1
gitlab ×1
http ×1
ipython ×1
javascript ×1
node.js ×1
numpy ×1
scikit-learn ×1
windows ×1