我的数据库中有大量文档,我想知道如何浏览所有文档并更新它们,每个文档都有不同的值.
我有两个函数,我正在异步运行.我想用瀑布模型来编写它们.问题是,我不知道怎么做..
这是我的代码:
var fs = require('fs');
function updateJson(ticker, value) {
//var stocksJson = JSON.parse(fs.readFileSync("stocktest.json"));
fs.readFile('stocktest.json', function(error, file) {
var stocksJson = JSON.parse(file);
if (stocksJson[ticker]!=null) {
console.log(ticker+" price : " + stocksJson[ticker].price);
console.log("changing the value...")
stocksJson[ticker].price = value;
console.log("Price after the change has been made -- " + stocksJson[ticker].price);
console.log("printing the the Json.stringify")
console.log(JSON.stringify(stocksJson, null, 4));
fs.writeFile('stocktest.json', JSON.stringify(stocksJson, null, 4), function(err) {
if(!err) {
console.log("File successfully written");
}
if (err) {
console.error(err);
}
}); //end of writeFile
} else {
console.log(ticker …
Run Code Online (Sandbox Code Playgroud) 我正在编写一个应该将网络驱动器映射到字母的脚本Z
,我正在使用该命令
net use z: \\path
,问题是如果用户已经在使用这封信我将无法映射它,有什么办法吗?检查此驱动器的存在性(z)以及是否存在以卸载它并将其安装到另一个字母仍然使用z
我的脚本所需的驱动器,这是安装的一部分,它应该在Z上驾驶.
我正在尝试将一个String参数添加到我的jenkins构建中,但是我找不到一个让它可选的选项,在Jenkins WIKI上我发现了一个screeshot并且有一个选项可以让它可选:https:// wiki .jenkins-ci.org/display/JENKINS/Parameterized + Build.
string build configuration-management jenkins jenkins-plugins
我有很多参数的复杂作业,有没有办法使用JavaScript表单验证或其他方法验证这些参数,如果用户的输入不正确,我将显示错误消息并禁用构建按钮.我已经尝试安装验证字符串参数插件,它似乎只显示错误
continuous-integration hudson hudson-plugins jenkins jenkins-plugins
我写了一个简单的脚本,它正在读取文件内容并在该文件中增加一个数字,然后我使用awk保持更改,当我尝试使用'>'重定向新的String时,整个字符串被重定向到一个线和不像原来的是4行.
#!/bin/bash -x
# This script is for Incrementing build numbers
path=/home/RND/abrodov
file=tst.txt
tst=`cat $path/$file`
printf "this is the content of the file before incrementing: \n $tst"
newexpr=`awk '/^Build Number/{$4=$4+1;}1' /home/RND/abrodov/tst.txt`
printf "\n the new content \n $newexpr"
echo $newexpr > $path/$file
Run Code Online (Sandbox Code Playgroud)
这是运行脚本之前的原始文件:
Major Release Number = 4
Minor Release Number = 1
Service Pack Release Number = 2
Build Number = 22
Run Code Online (Sandbox Code Playgroud)
这是我使用脚本后的内容:
Major Release Number = 4 Minor Release Number = 1 Service Pack Release Number = 2 …
Run Code Online (Sandbox Code Playgroud) 我有3个构建:A - 是控制流的主构建B- Anoter构建C-将在BI想要向A添加String参数后执行,因此用户将手动输入一些String,我不知道如何我可以将此参数路由到B.让我们说这是我的构建流程:
build("B")build("C")我不知道如何将参数传递给B,如果我从构建流程或B构建配置中执行此操作,我该怎么做.
先谢谢Alex
我有服务器A test-lx
和服务器B test2-lx
,我想将文件从服务器A传输到服务器B.虽然传输文件我只需要创建一个driectory,如果它不存在,我如何检查lftp期间是否存在目录conenction?如何在一个命令中输出多个文件而不是在两行中执行此操作.有没有选择使用find -maxdepth 1 -name DirName
这是我的代码:
lftp -u drop-up,1Q2w3e4R ftp://ta1bbn01:21 << EOF
cd $desFolder
mkdir test
cd test
put $srcFil
put $srcFile
bye
EOF
Run Code Online (Sandbox Code Playgroud) 我使用p4v
以下路径通过GUI创建了一个工作区:
/home/RND/abrodov/Perforce/abrodov_tlv-cc-32_93
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用这些p4
命令,例如我尝试过:
p4 sync -f
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Client 'tlv-cc-32' unknown - use 'client' command to create it.
Run Code Online (Sandbox Code Playgroud)
这是我用于的环境变量P4
:
export p4v=/opt/p4v-2014.2.973065/bin
export P4PORT=IP:PORT
export P4USER=$USER
export P4CLIENT=$HOSTNAME
alias p4v="p4v &"
export PATH=$p4v:$PATH
Run Code Online (Sandbox Code Playgroud) 我正在跑步prometheus
和telegraf
在同一台主机上。
我正在使用一些输入插件:
我已经配置到prometheus_client
输出插件向普罗米修斯发送数据
这是我的配置:
[[outputs.prometheus_client]]
## Address to listen on.
listen = ":9126"
## Use HTTP Basic Authentication.
# basic_username = "Foo"
# basic_password = "Bar"
## If set, the IP Ranges which are allowed to access metrics.
## ex: ip_range = ["192.168.0.0/24", "192.168.1.0/30"]
# ip_range = []
## Path to publish the metrics on.
path = "/metrics"
## Expiration interval for each metric. 0 == no expiration
#expiration_interval = "0s"
## …
Run Code Online (Sandbox Code Playgroud) jenkins ×3
bash ×2
build ×2
linux ×2
node.js ×2
asynchronous ×1
awk ×1
batch-file ×1
centos ×1
cmd ×1
hudson ×1
javascript ×1
mongodb ×1
mongoose ×1
monitoring ×1
npm ×1
perforce ×1
prometheus ×1
sed ×1
shell ×1
string ×1
telegraf ×1
unix ×1