while-loop

jQuery only affects the last result in a while loop: MySQL

你说的曾经没有我的故事 提交于 2019-12-11 18:08:34
问题 I am trying to make the background color change for each checked item in a row in a while loop. Currently the jQuery only works on the last row. I did put an $i variable in the input id, but to be honest, I'm not sure what to do beyond it. I tried this, the .each function, and a bunch of answers on Stack Overflow, but I can't figure out how to take care of this. Here is the jQuery: $(document).ready(function(){ $('#org[$i]').change(function(){ if(this.checked){ $(this).siblings('table')

How do I stop at a particular point in a file *stream and scan in some values?

笑着哭i 提交于 2019-12-11 17:47:52
问题 I have a file called test.txt the file contains: <this is a test = 1> <more tests = 42 and more "34"> <start>10.213123 41.21231 23.15323</start> <random stuff = "4"> <blah 234> When I see <start> I want to scan in the 3 numbers after into a double like this: x = 10.213123 y = 41.21231 z = 23.15323 I'm sort of confused because here, fgets scans the entire line, how can I scan in the 3 numbers into a double? Because the numbers can be of various lengths? I made this to print out what it reads

Picking up and Matching Multiple Values from Array-Shell Scripting

空扰寡人 提交于 2019-12-11 17:39:32
问题 I am working on media management script for my environment in which I want that I should pick values from file or array for different pool and libraries, run the commands based on those inputs and mail the output based on those commands to a different people. like, run command based on First pool, first library and then mail to the first person in file/array. or it will be great if it can match the things and need not to depend on serial order. code is : pool=(apple Mango Banana) library=

Creating a Bash File With a Looped Menu (Linux)

浪尽此生 提交于 2019-12-11 17:31:03
问题 *Edited to update status I am trying to make a bash file that will allow you to select an option, output the answer and then loop back to the menu selection. As of right now, the code I have is: #!/bin/sh echo off echo "........................................." echo "Select the process you would like to run." echo. echo "1 - Free Disk Space Available" echo "2 - List Directories" echo "3 - Show Running Processes" echo "4 - TCP Connection" echo "5 - Network Interfaces" echo "6 - List

How do I iterate over a list of chars while still being able to skip in the iteration?

若如初见. 提交于 2019-12-11 17:22:34
问题 I have the following piece of code: let mut lex_index = 0; let chars = expression.chars(); while lex_index < chars.count() { if(chars[lex_index] == "something") { lex_index += 2; } else { lex_index += 1; } } I use a while loop here since I sometimes need to skip a char in chars . However, this gives me the following error: error[E0382]: use of moved value: `chars` --> src/main.rs:23:15 | 23 | while i < chars.count() { | ^^^^^ value moved here in previous iteration of loop | = note: move

using while_loop over the tensor for creating a mask in tensorflow

狂风中的少年 提交于 2019-12-11 17:20:57
问题 I want to create a mask with iterating over the tensor. I have this code: import tensorflow as tf out = tf.Variable(tf.zeros_like(alp, dtype=tf.int32)) rows_tf = tf.constant ( [[1, 2, 5], [1, 2, 5], [1, 2, 5], [1, 4, 6], [1, 4, 6], [2, 3, 6], [2, 3, 6], [2, 4, 7]]) columns_tf = tf.constant( [[1], [2], [3], [2], [3], [2], [3], [2]]) I want to iterate through rows_tf and accordingly columns_tf to create a mask over the out . for example, it will mask the index at [1,1] [2,1] and [5,1] in the

Restarting while loop in c without integers

我的未来我决定 提交于 2019-12-11 17:09:25
问题 I'm trying to get this code to work, but I have no idea how to restart the inner while loop. How would I do it? /* * Return a pointer to the first occurrence of any character in <stop> * in the given <string> or NULL if the <string> contains no characters * in <stop>. ***** * YOU MAY *NOT* USE INTEGERS OR ARRAY INDEXING. ***** */ char *find_any_ptr(char *string, char* stop) { char *newstring = (char*)0; while(*stop != '\0'){ while(*string != '\0') { if(*string == *stop){ if(newstring < string

The correct way of waiting for strings to become equal

老子叫甜甜 提交于 2019-12-11 17:06:34
问题 In a Swing app a method should continue only after user enters a correct answer. The correct answer is stored in a String with user answer being set by a listener to another String . So, the code is while (!correctAnswer.equals(currentAnswer)) { // wait for user to click the button with the correct answer typed into the textfield } // and then continue Is everything fine with this approach or would you somehow refactor it? Doesn't it impose extra penalty on CPU? Here's a somewhat similar

Swift: Incrementing label with delay

久未见 提交于 2019-12-11 16:54:36
问题 My app freezes when it reaches this part of the code. I am attempting to increment a number with a half of a second delay, then printing that to the screen. So the label text would turn into a 1, then a 2, then a 3, etc. I threw this code into playground and the DispatchQueue seems to infinitely go up. Thanks. var percentage = 0 func incrementLabel (amount: Int){ var count = 0 while count <= amount{ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: { percentage += 1 count += 1 })

Trying to create multiple folders with VBScript

给你一囗甜甜゛ 提交于 2019-12-11 16:52:19
问题 I need to create A set of empty folders, starting at 10, going to 180. This is the script I'm trying to use, but it just creates 10, and nothing else. Option Explicit Dim objFSO, objFolder, strDirectory, i strDirectory = "\path\to\main\folder" Set objFSO = CreateObject("Scripting.FileSystemObject") i = 180 While i < 180 Set objFolder = objFSO.CreateFolder(strDirectory & i) i = i+1 WScript.Quit Wend I'm pretty new to VBScript, so maybe the problem is obvious, but I just don't see it. I also