loops

Cannot breakout of foreach loop in scala

依然范特西╮ 提交于 2021-01-29 08:22:42
问题 i have this below code > .foreach("${plist}", "newshole") { > exec( > http("get the user id") > .get("${newshole}/jcr:content.1.json") > .headers(headers_2) > .check(bodyString.saveAs("Res1")) > ) > exec(session => { > var mynewshole = session("Res1").as[String] > if (!mynewshole.contains("testingInProgress")) { > println("Doesn't contain: " + mynewshole) > (http("post the user id") > .post("${newshole}/jcr:content") > .headers(headers_2) > .formParam("testingInProgress", session.userId)) >

Repeat loop 100 times adding regression lines to same plot for each iteration

半腔热情 提交于 2021-01-29 05:40:33
问题 I have a while loop that requires a sampling process be repeated until values of the sample column value are less than columns rep1:rep4 . I would like to repeat this loop a set number of times, let's say 100. For each successful loop, I would like to add regression lines to two separate plots. In this example, the value column would be providing data for the x axis, and data for the y axis would be coming from y1 and y2 . I've included the additional y column because there might be a number

Loop to graph into a Dict Python MATPLOTLIB

六眼飞鱼酱① 提交于 2021-01-29 05:23:36
问题 What i'm trying to do here is to make a loop to create multiple graphs of dicts. I looped to execute univariate rolling window regressions and I stored the COEFS and the R_SQ of each variable in a DICT. the DICT itsel got 23 sub DICT each containing my a series of coefficients and rsquareds from 2008 to 2020 (4580 obs.) It goes like this (for visualisation): data1 BE10USD params - const & coef r_sq BE30CAD params - const & coef r_sq SWAP1YUSD params - const & coef r_sq And on, my dict is

Looping through Angular QueryList

流过昼夜 提交于 2021-01-29 05:18:13
问题 So I want to get all the images in my component in an array, so I am using Angular's @ViewChildren which returns a QueryList of ElementRef : @ViewChildren('img', { read: ElementRef }) images: QueryList<ElementRef>; However, when ever I try to loop through the list am can't ever seem to get hold of the nativeElement . I am calling this in ngAfterViewInit() this.images.forEach((img, index) => console.log("Image", img.nativeElement)); I don't get anything in the console.log , no error nothing.

Stylus create mixins via loop

懵懂的女人 提交于 2021-01-29 04:54:00
问题 My goal is create a group of mixins via array. My idea is apply code as follows: f_colors = (f1 f2 f3 f4 f5) for $i in 0..length(f_colors) v = f_colors[$i] num = $i+1 f{num}cl() color v f{num}bg() background-color: v // and use to generate css body h1 color: white f5bg '' where in f_colors i've stored a colors list. With thi example, i would obtain an output as body h1 { background-color: #00f; // f5 color color: white; } is it possible, or my best could be use mixins as follows: fbg(num)

Stylus create mixins via loop

扶醉桌前 提交于 2021-01-29 04:50:44
问题 My goal is create a group of mixins via array. My idea is apply code as follows: f_colors = (f1 f2 f3 f4 f5) for $i in 0..length(f_colors) v = f_colors[$i] num = $i+1 f{num}cl() color v f{num}bg() background-color: v // and use to generate css body h1 color: white f5bg '' where in f_colors i've stored a colors list. With thi example, i would obtain an output as body h1 { background-color: #00f; // f5 color color: white; } is it possible, or my best could be use mixins as follows: fbg(num)

Loop through various data subsets in lm() in R

夙愿已清 提交于 2021-01-29 04:48:00
问题 I would like to loop over various regressions referencing different data subsets, however I'm unable to appropriately call different subsets. For example: dat <- data.frame(y = rnorm(10), x1 = rnorm(10), x2 = rnorm(10), x3 = rnorm(10) ) x.list <- list(dat$x1,dat$x2,dat$x3) dat1 <- dat[-9,] fit <- list() for(i in 1:length(x.list)){ fit[[i]] <- summary(lm(y ~ x.list[[i]], data = dat))} for(i in 1:length(x.list)){ fit[[i]] <- summary(lm(y ~ x.list[[i]], data = dat1))} Is there a way to call in

How can I make a program loop back to the start if else is true? C#

会有一股神秘感。 提交于 2021-01-29 04:31:22
问题 Couldn't find any other answer on the site that covers this. If else is run and an error message is displayed, is it possible to restart the program by looping back to the start instead of restarting the console? class Program { static void Main(string[] args) { int User; int Array; StreamWriter outfile = new StreamWriter("C://log.txt"); Console.WriteLine("Input an number between 1 and 100"); User = Convert.ToInt32(Console.ReadLine()); if (User < 101 && User > 0) { for (Array = 1; Array <=

Add unique Id to list of numbers - VBA

a 夏天 提交于 2021-01-29 03:38:54
问题 I have a list of numbers (50,000+) and I need to add a Id to the end of each unique group. The Id is in a format of "-###". 151022 151022 151020 150922 150715 150911 151014 151021 151020 151019 151019 151019 151020 I need it to print like this 151022-001 151022-002 151020-001 150922-001 150715-001 150911-001 151014-001 151021-001 151020-002 151019-001 151019-002 151019-003 151020-002 I currently have this code that I found and modified slightly. If I could get it to start counting unique

save files into a specific subfolder in a loop in R

只谈情不闲聊 提交于 2021-01-29 03:07:06
问题 I feel I am very close to the solution but at the moment i cant figure out how to get there. I´ve got the following problem. In my folder "Test" I´ve got stacked datafiles with the names M1_1; M1_2 , M1_3 and so on: /Test/M1_1.dat for example. No I want to seperate the files, so that I get: M1_1[1].dat, M1_1[2].dat, M1_1[3].dat and so on. These files I´d like to save in specific subfolders: Test/M1/M1_1[1]; Test/M1/M1_1[2] and so on, and Test/M2/M1_2[1], Test/M2/M1_2[2] and so on. Now I