while-loop

Syntax Error at the end of a while loop

删除回忆录丶 提交于 2019-12-25 18:26:15
问题 EDIT: This question was ask at the start of my learning process for python. The Syntax Error was produced by pythons IDLE with no trackback to speak of. This was the main cause of the problem and confusion when people asked for the full error. I am working on a simple note recall program. I am not 100% sure why I keep getting a syntax error if anyone can assist. Note: The error was only "Syntax Error". There was no other information displayed with the error. The error is showing up at the end

Bash text database file read in loop

帅比萌擦擦* 提交于 2019-12-25 17:39:31
问题 Can anyone see the last syntax error I have made here? The issue is with incrementing the DB"X"FIELDS array. In a way, I'm simulating a mutlidimensional array by storing all records from each database into its own array so they can be called later. I can't figure out the syntax through to declare the DB array using an embedded variable that increments. Maybe I just need to Set the name first (including the variable, then declare the array. function DATABASE.READ { cd databases DBARRAY=(*) cd

VBA Run Code non-stop

心已入冬 提交于 2019-12-25 16:39:09
问题 I am trying to write a program that runs indefinitely, till I stop it. For some reason it exited this while loop early (after 6 hours). A co-worker thinks it is because an error in the cpu, and I should use a Boolean flag instead of a string (less chance for the error). Is there any other suggestions? If CommandButton1.Caption = "Start" Then CommandButton1.Caption = "Stop" Else CommandButton1.Caption = "Start" End If While CommandButton1.Caption = "Stop" pause 1 Range("C1").Value = Range("C1"

WHILE loop in Teradata procedure

孤街醉人 提交于 2019-12-25 12:50:35
问题 I'm trying to write a procedure that concatenates all rows in a table in the case in which the row number is unknown. I have this code but it is not working. CREATE PROCEDURE Test (OUT r VARCHAR(3000)) BEGIN DECLARE RowCnt INT; DECLARE CurrRow INT ; SET CurrRow = 1, r = 'SELECT ', RowCnt = (SELECT COUNT(*) FROM tableWithSQLStmnts ) WHILE CurrRow <= RowCnt DO BEGIN SET r = r + CASE WHEN CurrRow = 1 THEN 'MAX( CASE Seq WHEN ' + CAST( CurrRow AS VARCHAR ) + ' THEN SqlStmnt ELSE SPACE(0) END ) +

PHP: letting your own function work with a while loop

妖精的绣舞 提交于 2019-12-25 10:25:33
问题 $qVraagGroepenOp = "SELECT * FROM $tabele WHERE $where"; $rVraagGroepenOp = mysql_query ( $qVraagGroepenOp ); $aVraagGroepenOp = mysql_fetch_assoc ( $rVraagGroepenOp ) and I converted that to a function vraagOp("testtable","testtable_ID = $id"); function vraagOp($table,$where) { $qVraagOp = "SELECT * FROM $table WHERE $where"; $rVraagOp = mysql_query( $qVraagOp ); $aVraagOp = mysql_fetch_assoc( $rVraagOp ); return $aVraagOp; } only the problem is when i need more then one row i need to use a

Python: trying to use 'count' to limit the amount of lines “print” will output

自古美人都是妖i 提交于 2019-12-25 09:41:06
问题 I have a script that will walk a system directory, and get the files sizes in that directory. it then sorts by the file size(descending), takes two arguments. The first arg is the system path and the second arg is an integer to limit the output to that integer count. I'm using a while loop to limit the print output but its getting stuck in a infinite loop.... obviously, something is wrong but i cant see it. #!/usr/bin/python import sys import os #Grab arguments mydir = sys.argv[1] mycnt = sys

How to resolve IndexError: list assignment index out of range using array inside loop in Python

两盒软妹~` 提交于 2019-12-25 09:40:07
问题 I'm new to python. I'm creating 2 arrays file_name (stores name of the files) and path (stores paths of files). Values of path array are assigned inside while loop. But I'm getting the error: IndexError: list assignment index out of range in Python I had already wasted several hours on this one, but haven't got the output as I expected. So, can you please let me know where I have made the mess? Any help will be highly appreciated. Thanks in advance. My Code: file_name = ['abc','xyz','pqr',

While loop - Only one input from many others is sending a value through POST

北慕城南 提交于 2019-12-25 09:06:09
问题 This is the code where I get my input names and values from a table called optionale and doing something with these: <form role="form" autocomplete="off" action="includes/functions/fisa-init.php" method="POST"> <?php connectDB(); $query = mysqli_query($mysqli, "SELECT * FROM `optionale`") or die(mysqli_error($mysqli)); while($row = mysqli_fetch_array($query)) { ?> <span><?php echo $row['denumire']; ?></span> <input type="text" name="nrBucati"> <input type="hidden" value="<?php echo $row['cod'

Thread -while loop- [Android]

坚强是说给别人听的谎言 提交于 2019-12-25 08:58:56
问题 So in my further attempts to implement a while loop in android I have come up with the code below : private boolean connected = false; private Thread loop = new Thread() { public void run() { Looper.prepare(); while (connected) { do_Something(); } Looper.loop(); } }; onCreate() { //..... ok = (Button) findViewById(R.id.button1); ok.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (connected) { try { loop.start(); } catch (Exception e)

Combine two Bash while loop statements

[亡魂溺海] 提交于 2019-12-25 08:37:47
问题 I am trying to combine 2 different logical statements in a single while loop, but having trouble getting the logic correct so that 2 different checks can be evaluated in the same loop. For example, I have the following 2 logical statements. Logic 1 Determine if the entered username is blank and if it is ask the user to re-enter a different username. echo -ne "User Name [uid]$blue:$reset " read USERNAME USERNAME=$(echo "$USERNAME" | tr "[:upper:]" "[:lower:]") while [[ -z "$USERNAME" ]]; do