while-loop

javascript, while loop

血红的双手。 提交于 2019-12-13 06:49:04
问题 i'm trying to get my script to wait for user input (click of a button) before continuing, this is v feasible in other languages, but seems impossible in js. basically, i want the user to select an option within a given time frame, if the user selects the wrong option, they're told..script then conts...otherwise, if after a certain amount of time theres no response...script just continues again sowing them the correct ans, but there seems to be nothing in js to make the script wait for that

Order list/ while loop php issue

蹲街弑〆低调 提交于 2019-12-13 06:29:57
问题 I have put together a basic order list for admin users in php for checking order contents placed by logged in users. The aim of this script is to retrieve the order details (item, quantity, price) as well as the user’s first name and surname (where ‘Order for:’ is). The script below does everything ok in that it retrieves the order (and orders if there are more than one) and it’s/their item, quantity and price. However, it doesn’t display the user’s name and surname. I know the problem is

PHP while loop and table header only showing if a db value is set

余生颓废 提交于 2019-12-13 06:28:10
问题 Here is my code. <table border="1" style="width:800px"> <?php $schedule_db = mysql_query("SELECT * FROM schedule WHERE '00:00' is not null and '01:00' is not null and '02:00' is not null and '03:00' is not null and '04:00' is not null and '05:00' is not null and '06:00' is not null and '07:00' is not null and '08:00' is not null and '09:00' is not null and '10:00' is not null and '11:00' is not null and '12:00' is not null and '13:00' is not null and '14:00' is not null and '15:00' is not

JQuery setTimeOut while loop

前提是你 提交于 2019-12-13 06:05:55
问题 My brain its going to explode.. why this dont work? im trying to animate a few divs with time interval and trying to write less code but this dont work var cargaCont = function(){ o = 1; var animacion = function(i){ $('#page2txt'+i).animate({ height:'20' },200,function(){ $('#page2img'+i).animate({ left:'0', right:'0' },200,function(){ i++; return i; }); }); } while(o < 3){ setTimeout(function(){o = animacion(o);},200); } } 回答1: The problem with this code: while(o < 3){ setTimeout(function()

Ruby on Rails: nested each loop within while loop generates error

那年仲夏 提交于 2019-12-13 06:01:56
问题 I get a syntax error, when I execute the following code within the rails console: "syntax error, unexpected $end, expecting keyword_end" range = 2 my_array = Array.new(range) a = [1] i = 0 while i < range do a.each do |b| puts "test" end i += 1 end Does anyone know what I am doing wrong? The strange thing is, that the code is working on my server within a ruby file. Thanks a lot! tuxware 回答1: If you're executing it in IRB, it's likely that, as Beerlington said, it's linebreak issues. It'd

How to infinite loop numbers in while loops? (Unity3D- unityscript)

我的梦境 提交于 2019-12-13 05:44:03
问题 function OnMouseDown () { rotationNumber +=1; } function Update () { while (rotationNumber == 1) { gameObject.GetComponent(SpriteRenderer).sprite = leftArrow; return; } while (rotationNumber == 2) { gameObject.GetComponent(SpriteRenderer).sprite = upArrow; return; } while (rotationNumber == 3) { gameObject.GetComponent(SpriteRenderer).sprite = rightArrow; return; } while (rotationNumber == 4) { gameObject.GetComponent(SpriteRenderer).sprite = upArrow; rotationNumber = 1; return; } } I want to

while (scanner.hasNext()) loop not working twice? Java

拈花ヽ惹草 提交于 2019-12-13 05:27:58
问题 I have made a program which is like a vending machine! My code is similar to: public static void main (String [] args) { Scanner sc = new Scanner (System.in); while(sc.hasNext()) { String string = sc.next(); sum = generateSum(sum) ..... } } public static int generateSum(int sum) { Scanner sc = new Scanner (System.in); while (sc.hasNext()) { .... } return sum; } Sorry for simplifying my code, but the normal one is very long! However, the problem is that I use while (sc.hasNext()) loop twice.

How to jump to the beginning of the code? [closed]

半腔热情 提交于 2019-12-13 05:13:19
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I am making a program that asks a user to put a input. If the user puts in the input it will show is input and then finish the program. How do I make the program start from the beginning? my code is built like this: (just showing the build not the code itself) please enter user input: while (x != y

Find A->B strings multiples times with a while loop

混江龙づ霸主 提交于 2019-12-13 05:12:52
问题 Hello I'm on a project who require me to find a string interval multiples times (from display_url to display_resources ) in a .txt file. For now I have my code like this but when I'm running it, it never break . The goal of this code is to : Search the strings from the le1 / le2 index as starting point. Update the new found index from the dat / det variables to le1 / le2 [to go to the next string interval in the .txt file (in my test they are four of them)] Add the le1 & le2 variables to the

Perl: foreach line, split, modify the string, set to array. Opendir, next if files=modified string. Unlink files

人走茶凉 提交于 2019-12-13 04:54:55
问题 I'm having issues with the following block of code: Where $output is netstat -lnt | grep ":::60". Specifically the section under the comment #Create filename format my @lines = split /^/, $output; foreach my $line (@lines) { my ($garb, $long_ports) = (split /\s*:::\s*/, $line); #Get the last 2 digits of the 60XX port number my ($garb2, $ports) = (split /60/, $long_ports); #Split values to numbers 0-9 for correct filename format if ($ports < 10) { my ($garb3, $ports2) = (split /0/, $ports);