loops

Watir: How to retrieve all HTML elements that match an attribute? (class, id, title, etc)

我与影子孤独终老i 提交于 2020-02-07 01:47:08
问题 I have a page that is dynamically created and displays a list of products with their prices. Since it's dynamic, the same code is reused to create each product's information, so they share the tags and same classes. For instance: <div class="product"> <div class="name">Product A</div> <div class="details"> <span class="description">Description A goes here...</span> <span class="price">$ 180.00</span> </div> </div> <div class="product"> <div class="name">Product B</div> <div class="details">

How to loop only first value from checkbox with insert query

情到浓时终转凉″ 提交于 2020-02-07 01:27:39
问题 i have checkbox with two values like <input type="checkbox" name="analysis[]" value="'.$rows['name'].'_'.$rows['cost'].'"> i want loop only the first value (name) with insert query that is my code , working but it only insert one record every time . loop not working $allAnalysis = $_REQUEST['analysis']; foreach($allAnalysis as $analysis) { $analysis = explode("_", $analysis); $analysis_name = $analysis[0]; $analysis_insert = "INSERT INTO analysis ( analysis_id , analysis_name ) VALUES ( NULL

How to loop only first value from checkbox with insert query

|▌冷眼眸甩不掉的悲伤 提交于 2020-02-07 01:24:05
问题 i have checkbox with two values like <input type="checkbox" name="analysis[]" value="'.$rows['name'].'_'.$rows['cost'].'"> i want loop only the first value (name) with insert query that is my code , working but it only insert one record every time . loop not working $allAnalysis = $_REQUEST['analysis']; foreach($allAnalysis as $analysis) { $analysis = explode("_", $analysis); $analysis_name = $analysis[0]; $analysis_insert = "INSERT INTO analysis ( analysis_id , analysis_name ) VALUES ( NULL

Extract digits from a long number in C

拈花ヽ惹草 提交于 2020-02-06 07:58:07
问题 I'm trying to extract the digits from a number n , with: 00000000000 ≤ n ≤ 99999999999 using the following code: #include <stdio.h> int main() { int N; int power=1; scanf("%d",&N); while(N>power) power*=10; power/=10; while(N != 0) { int digit = N/power; printf("%d\n", digit); if(digit!=0) N=N-digit*power; if(power!=1) power/=10; } return 0; } It works well for a range of values, but for an 11 digit number, I get an error. Any tips on how to fix it to handle the n range? 来源: https:/

Extract digits from a long number in C

守給你的承諾、 提交于 2020-02-06 07:57:30
问题 I'm trying to extract the digits from a number n , with: 00000000000 ≤ n ≤ 99999999999 using the following code: #include <stdio.h> int main() { int N; int power=1; scanf("%d",&N); while(N>power) power*=10; power/=10; while(N != 0) { int digit = N/power; printf("%d\n", digit); if(digit!=0) N=N-digit*power; if(power!=1) power/=10; } return 0; } It works well for a range of values, but for an 11 digit number, I get an error. Any tips on how to fix it to handle the n range? 来源: https:/

React component not rendering inside .map with if statement

≡放荡痞女 提交于 2020-02-05 14:54:10
问题 Please help. I have a component that I am trying to load if list.display = true. I am able to do a console log confirming when the list should be displayed and it works properly. However, the component does not load. If I take the component out of the .map loop it works perfectly. Thank you return ( <div className="container"> <h1>To Do App</h1> <p>Create a list:</p> <form> <label htmlFor="list"> <input type="text" name="list" id="list" onChange={e => setInputListName(e.target.value)}/>

Python: While Statement = Statement Print associated Values

半世苍凉 提交于 2020-02-05 09:10:18
问题 In Python I currently have a Dictionary with a composite Key. In this dictionary there are multiple occurences of these keys. (The keys are comma-separated): (A,B), (A,C), (A,B), (A,D), (C,A), (A,B), (C,A), (C,B), (C,B) I already have something that totals the unique occurrences and counts the duplicates which gives me a print-out similar to this: (A,B) with a count of 4 , (A,C) with a count of 2 , (B,C) with a count of 6 , etc. I would like to know how to code a loop that would give me the

Appending user input to a list in a loop

て烟熏妆下的殇ゞ 提交于 2020-02-04 00:47:13
问题 I'm new to python programming and I'm doing some experiments with it. Hoping my question is not too silly: I'm writing a little program that adds inputs to a list and print it when the input equals to 4, using a while loop. the problem is it never stops to add inputs and print the list. My code is: S=input() L=[] while S!=4: L.append(S) if S==4: break print(L) 回答1: You've created an infinite loop in your code. You're not changing the value of S after you enter the loop. You should add get an

Python Selenium create loop to click through links on a page and press button on each new page

*爱你&永不变心* 提交于 2020-02-03 07:53:05
问题 I'm fairly new to Python and Selenium, but starting to pick it up. I've been googling how to solve this coding issue, but can't find the exact solution. What I'm trying to accomplish is click all of the username links on a page, click the follow button on the page that I'm taken to, then return to the original page and do the same for rest of the username links. Basically, I want to create a loop that does this: click on the first username click on the follow button go back to the previous

Looping through specific columns with VBA

我只是一个虾纸丫 提交于 2020-02-02 16:32:50
问题 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