loops

Looping through specific columns with VBA

流过昼夜 提交于 2020-02-02 16:32:14
问题 I know we can loop through columns in VBA by doing this: For j = 3 To 6 but I want to loop through specific columns only, say For j = 3, 5, 6, 7 , 8, 9 to 12 but this does not seem workable. Does anyone have any idea how I could achieve this outcome? Thank you in advance! Update: The code for the workbook, I changed the part where to Mikku's suggestion to loop through the columns. So I changed it to this: Private Function MissingEntries() As Boolean Dim i As Integer Dim atLeastOneLine As

Extracting columns with constant numbers in R data.frames

情到浓时终转凉″ 提交于 2020-02-01 08:51:25
问题 In data.frame DATA , I have some columns that are constant numbers across the unique rows of the first column called study.name . For example, columns ESL and prof are constant for all rows of Shin.Ellis and constant for all rows of Trus.Hsu and so on. Including Shin.Ellis and Trus.Hsu , there are 8 unique study.name rows. BUT after my split.default() call below, how can I obtain only one data-point for all rows under a unique study.name (e.g., one for Shin.Ellis , one for Trus.Hsu etc.) for

Java: while loop not working

假装没事ソ 提交于 2020-01-30 13:26:29
问题 I want to check the users input when a new game is created, and see if it is y, n, or neither. For some reason it skips the while loop all together and just outputs "Welcome to Questions." import java.util.Scanner; public class Questions { public static final Scanner INPUT = new Scanner(System.in); private boolean ans; public Questions() { while (ans = false) { System.out.print("Do you want to start a new game (y/n)?: "); String input = INPUT.nextLine(); if (input == "y"){ ans = true; //some

Java: while loop not working

我的梦境 提交于 2020-01-30 13:26:09
问题 I want to check the users input when a new game is created, and see if it is y, n, or neither. For some reason it skips the while loop all together and just outputs "Welcome to Questions." import java.util.Scanner; public class Questions { public static final Scanner INPUT = new Scanner(System.in); private boolean ans; public Questions() { while (ans = false) { System.out.print("Do you want to start a new game (y/n)?: "); String input = INPUT.nextLine(); if (input == "y"){ ans = true; //some

php chunk arrays into batches

人盡茶涼 提交于 2020-01-30 12:57:29
问题 I have an array with say 400 (but could be anything) names i want to send to an API, but the API only receives a max of 200 requests per time, how do i chunk my array so that for every 200th item, i perform an action? Here's what i have so far, rather than making my API request, i'm just trying to output the array's to the page. <?php for ($i = 0; $i <= $smsListLimit; $i++) { if ($i <= 199) { array_push($newarray, $smsList[$i]); if ($i == 199) { echo “ < pre > “; var_dump($newarray); echo “ <

php chunk arrays into batches

走远了吗. 提交于 2020-01-30 12:57:09
问题 I have an array with say 400 (but could be anything) names i want to send to an API, but the API only receives a max of 200 requests per time, how do i chunk my array so that for every 200th item, i perform an action? Here's what i have so far, rather than making my API request, i'm just trying to output the array's to the page. <?php for ($i = 0; $i <= $smsListLimit; $i++) { if ($i <= 199) { array_push($newarray, $smsList[$i]); if ($i == 199) { echo “ < pre > “; var_dump($newarray); echo “ <

How to find files in multilevel subdirectories

南楼画角 提交于 2020-01-30 11:21:05
问题 Suppose I have a directory that contains multiple subdirectories: one_meter = r"C:\Projects\NED_1m" Within the directory one_meter I want to find all of the files that end with '.xml' and contain the string "_meta". My problem is that some of the subdirectories have that file one level donw, while others have it 2 levels down EX: one_meter > USGS_NED_one_meter_x19y329_LA_Jean_Lafitte_2013_IMG_2015 > USGS_NED_one_meter_x19y329_LA_Jean_Lafitte_2013_IMG_2015_meta.xml one_meter > NY_Long_Island>

How to optionally repeat a program in python

匆匆过客 提交于 2020-01-30 11:13:05
问题 I'm learning python and had a quick question. I have to write a code to find the cube root, which I've done. I want to give the user the option of calculating another cube root, or quitting. Here's what I have come up with: x = int(raw_input('Enter an integer: ')) ## start guessing with 0 ans = 0 while ans*ans*ans < abs(x): ans = ans + 1 print 'current guess =', ans print 'last guess = ', ans print 'ans*ans*ans = ', ans*ans*ans ##if its a perfect cube if ans*ans*ans == abs(x): ## perfect, but

Loop with a defined ggplot function over multiple dataframes

依然范特西╮ 提交于 2020-01-30 08:25:13
问题 I would like to make a loop to plot data from multiple dataframes in R, using a a pre-existing ggplot function called myplot. My ggplot function is defined as myplot and the only things I'd like to extract are titles. I know there are similar posts, but none provides a solution for a pre-existing ggplot function. df1 <- diamonds[1:30,] df2 <- diamonds[31:60,] df3 <- diamonds[61:90,] myplot <- ggplot(df1, aes(x = x, y = y)) + geom_point(color="grey") + labs(title = "TITLE") list <- c("df1",

Loop through wordpress' the_post_navigation() function

老子叫甜甜 提交于 2020-01-30 08:22:06
问题 Is it possible to loop through the the_post_navigation() function? Now, when I am at the end of the post loop, the 'next post' button simply disappears. I want this button to stay, and to navigate to the first post. This way, the navigation keeps looping through the posts. This is the code btw: <div class="case-nav hidden-xs"> <?php the_post_navigation( array( 'prev_text' => __( 'Previous post'), 'next_text' => __( 'Next post'), )); ?> </div> EDIT Here is the source code: http://www.codesend