loops

bash stdout redirection in a for loop

走远了吗. 提交于 2021-01-28 11:10:13
问题 Possible duplicate Hello, I'm struggling with output redirection within a bash for loop. I have several similar bash scripts, each scripts being launched on a different input file. The scripts called a tool with a few arguments. The bash scripts are like this : my_tool --input input_file --arg1 arg1_name --arg2 arg2_name > output_dir/result_X.dat X being a string which is unique for each script. I run all of them in a for loop : for script in scripts_dir/*.sh do bash $script done However, the

How to return blank or zero when 'On Error Resume Next' leaves previous value in variable?

醉酒当歌 提交于 2021-01-28 11:01:58
问题 I have VBA code that gets the stock price in a loop. There are stock symbols not found in this API source. It will result to error for those stocks. I'm using On Error Resume Next so the VBA code will continue to the next symbol. My problem is the symbol in error will return a stock price of the last stock symbol not in error. I would like to make the result blank or zero for the stock symbols in error. Current Result - the italicized symbols are those that are in error. Stock Symbol Price

Run Snakemake rule one sample at a time

痞子三分冷 提交于 2021-01-28 10:36:27
问题 I'm creating a Snakemake workflow that will wrap up some of the tools in the nvidia clara parabricks pipelines. Because these tools run on GPU's, they typically can only handle one sample at a time, otherwise the GPU will run out of memory. However, Snakemake shoves all the samples through to Parabricks at one time - seemingly unaware of the GPU memory limits. One solution would be to tell Snakemake to process one sample at a time, thus the question: How do I get Snakemake to process one

Run Snakemake rule one sample at a time

你。 提交于 2021-01-28 10:34:03
问题 I'm creating a Snakemake workflow that will wrap up some of the tools in the nvidia clara parabricks pipelines. Because these tools run on GPU's, they typically can only handle one sample at a time, otherwise the GPU will run out of memory. However, Snakemake shoves all the samples through to Parabricks at one time - seemingly unaware of the GPU memory limits. One solution would be to tell Snakemake to process one sample at a time, thus the question: How do I get Snakemake to process one

Run Snakemake rule one sample at a time

十年热恋 提交于 2021-01-28 10:33:48
问题 I'm creating a Snakemake workflow that will wrap up some of the tools in the nvidia clara parabricks pipelines. Because these tools run on GPU's, they typically can only handle one sample at a time, otherwise the GPU will run out of memory. However, Snakemake shoves all the samples through to Parabricks at one time - seemingly unaware of the GPU memory limits. One solution would be to tell Snakemake to process one sample at a time, thus the question: How do I get Snakemake to process one

Is it possible to have a progress bar without a loop?

本秂侑毒 提交于 2021-01-28 10:10:13
问题 I am using FFmpeg to do some video editing. I would like to have a progress bar but there is not a loop in my code. I've tried tqdm and putting my code in a loop with a range of 1 but that will only display the progress bar at 100%. Maybe there is another way to accomplish this? This is the code I'm using: import subprocess inmovie=mymovie.mp4 speed=str(4.0) outmovie=newmovie.mp4 print('Converting file.......') subprocess.call('ffmpeg -i '+inmovie+' -filter:v "setpts= '+speed+' *PTS" '

pandas - How to load data from nested dictionary into dataframe?

一曲冷凌霜 提交于 2021-01-28 08:10:52
问题 I'm tryping to create a dataframe with closingprices for stocks and have found a free api that returns JSON-data in the form of nested dicts with the data, looking like this: {'name': 'AAPL', 'history': {'2019-01-04': {'open': '144.53', 'close': '148.26', 'high': '148.55', 'low': '143.80', 'volume': '58607070'}, '2019-01-03': {'open': '143.98', 'close': '142.19', 'high': '145.72', 'low': '142.00', 'volume': '91312195'}, '2019-01-02': {'open': '154.89', 'close': '157.92', 'high': '158.85',

Looping with infinite data set

北城以北 提交于 2021-01-28 07:45:24
问题 I am trying to create a VBA but I keep getting stuck, if anyone can help that would be appreciated. So based on the picture I would like for each animal to be copied to each Set/# (and for the outcome to be on Sheet 2). The issue is that it won't always be a set of 14 it can vary based on the data but the Animals would stay the same (no more then 4). Below is what i currently have ganted it is not based on the picture. that's is just an example. Example of Goal for VBA updated VBA Example Sub

Javascript async/await execution order problem in for…of, for await…of and Promise.all

邮差的信 提交于 2021-01-28 07:34:59
问题 For each object (product) in an array (products), I'm getting the price from a mongoose database. That value (prodDB.price) is summed to the "amount" variable initialized as 0 before the loop. I tried 3 solutions explained in other questions, with: for of for await of Promise.all --- for of --- let amount = 0; for (const product of products) { await Product.findById(product._id).exec((err, prodDB)=> { amount += product.count * prodDB.price; console.log("Current amount", amount); }); };

PHP - populate an array with variables by loop

谁说我不能喝 提交于 2021-01-28 07:11:43
问题 I want to put my variables (the value of these variables) into an array. I have similar variable names, so I try to find a loop-based solution that gives the same output like that: $str1 = "one"; $str2 = "two"; $str3 = "three"; $arr = array($str1, $str2, $str3); foreach ($arr as $key => $value){ echo "[", $key, "] = ", $value, "<br/>"; } For the loop -based solution I tried this way but it doesn't let insert values into the array: $str1 = "one"; $str2 = "two"; $str3 = "three"; function