loops

Count Var in Windows Batch

一曲冷凌霜 提交于 2020-01-24 15:28:26
问题 In my batch file I have the following variables: set collection=collection1 set environment=oracleDev set processChain1=-help,-startimport %environment% %collection% As you can see, my process chain contains two strings that are separated with a ",". Now I want to count the two strings (later it could be more then one string). I tried it with: Set count=0 For %%j in (%%processChain1%%) Do Set /A count+=1 echo %count% But there is the first mistake. It prints out 1 and not 2. Why? After

Count Var in Windows Batch

感情迁移 提交于 2020-01-24 15:28:21
问题 In my batch file I have the following variables: set collection=collection1 set environment=oracleDev set processChain1=-help,-startimport %environment% %collection% As you can see, my process chain contains two strings that are separated with a ",". Now I want to count the two strings (later it could be more then one string). I tried it with: Set count=0 For %%j in (%%processChain1%%) Do Set /A count+=1 echo %count% But there is the first mistake. It prints out 1 and not 2. Why? After

Get all days from tomorrow and two months forward and loop through them [duplicate]

谁说我不能喝 提交于 2020-01-24 14:24:06
问题 This question already has answers here : Get all days between tomorrow and 60 days forward then loop through them (3 answers) Closed 5 years ago . I need to take tomorrow, add 60 days to it and loop over it day by day. Just wondering what would be the appropriate way of doing this? This is what I tried Calendar startCalemder = Calendar.getInstance(); startCalemder.setTime(new Date()); startCalemder.add(Calendar.DATE, 1); Calendar endCalendar = Calendar.getInstance(); endCalendar.setTime(new

Get all days from tomorrow and two months forward and loop through them [duplicate]

Deadly 提交于 2020-01-24 14:23:49
问题 This question already has answers here : Get all days between tomorrow and 60 days forward then loop through them (3 answers) Closed 5 years ago . I need to take tomorrow, add 60 days to it and loop over it day by day. Just wondering what would be the appropriate way of doing this? This is what I tried Calendar startCalemder = Calendar.getInstance(); startCalemder.setTime(new Date()); startCalemder.add(Calendar.DATE, 1); Calendar endCalendar = Calendar.getInstance(); endCalendar.setTime(new

How to loop list value of a specific column in pandas?

爷,独闯天下 提交于 2020-01-24 14:17:50
问题 I have a pandas dataframe, which the first column are list values. I want to loop each str value of each list, and the values of next columns will be in included together. For example: tm = pd.DataFrame({'author':[['author_a1','author_a2','author_a3'],['author_b1','author_b2'],['author_c1','author_c2']],'journal':['journal01','journal02','journal03'],'date':pd.date_range('2015-02-03',periods=3)}) tm author date journal 0 [author_a1, author_a2, author_a3] 2015-02-03 journal01 1 [author_b1,

Bash array as argument inside of screen

故事扮演 提交于 2020-01-24 14:07:06
问题 The below code is is not working as I expect it to. I might be because I am doing this all wrong but I think it may be a quoting issue. #!/bin/bash IFS=$'\n' fortune_lines=($(fortune | fold -w 30)) Screen_Session=$(mainscreen) Screen_OneLiner=$(screen -p 0 -S ${Screen_Session} -X stuff "`printf "say ${fortune_lines[@]}\r"`") for var in "${Screen_OneLiner[@]}" do echo "${var}" done I think I am not quoting something correctly because when I attempt to execute this. I get.. line 5: mainscreen:

Arguments inside sed loop

若如初见. 提交于 2020-01-24 12:48:27
问题 Im trying to understand sed command and loops. I need to take part of the text (20 lines) and append it to the csv with the file name. here is my code for i in ~/mspl/*.doc do catdoc "$i" > auto.txt sed -e '1,20!d' auto.txt > auto1.txt sed -e '1s/^/"$i" ;/' auto1.txt > auto2.txt sed -e '20s/$/~/' auto2.txt > auto3.txt cat auto3.txt >> lines.csv done the problem is that my second "i" argument doesn't convert to the file name in csv. in the line sed -e '1s/^/"$i" ;/' auto1.txt > auto2.txt

R or Python - loop the test data - Prediction validation next 24 hours (96 values each day)

人盡茶涼 提交于 2020-01-24 12:29:47
问题 I have a large dataset, below the training and test datasets train_data is from 2016-01-29 to 2017-12-31 head(train_data) date Date_time Temp Ptot JFK AEH ART CS CP 1 2016-01-29 2016-01-29 00:00:00 30.3 1443.888 52.87707 49.36879 28.96548 6.239999 49.61212 2 2016-01-29 2016-01-29 00:15:00 30.3 1410.522 49.50248 49.58356 26.37977 5.024000 49.19649 3 2016-01-29 2016-01-29 00:30:00 30.3 1403.191 50.79809 49.04253 26.15317 5.055999 47.48126 4 2016-01-29 2016-01-29 00:45:00 30.3 1384.337 48.88359

How to for loop in reverse?

↘锁芯ラ 提交于 2020-01-24 12:24:10
问题 I'm making a water simulation program, and I need it to do a for loop through y, x. But I need it to check the most bottom y first, then up. This is my lvl: lvl = [[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] I need it to check lvl[4] and then lvl[3], lvl[2], etc. Please help! NB: I'm using nested for loops, so I can check y, x. 回答1: You can use the reversed built-in method to reverse the ordering of your list of lists: for li in reversed(lvl): print li

How to for loop in reverse?

允我心安 提交于 2020-01-24 12:24:06
问题 I'm making a water simulation program, and I need it to do a for loop through y, x. But I need it to check the most bottom y first, then up. This is my lvl: lvl = [[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] I need it to check lvl[4] and then lvl[3], lvl[2], etc. Please help! NB: I'm using nested for loops, so I can check y, x. 回答1: You can use the reversed built-in method to reverse the ordering of your list of lists: for li in reversed(lvl): print li