The problem is that the input is outside the loop: import sys def inputSomething(prompt, errorMessage = 'Atleast one character must be used'): while True: value = input(prompt) Response = value.strip() if Response: print ('Valid') return Response else: print(errorMessage, file=sys.stderr) something = inputSomething('Enter str: ') Note that an empty string equates...
javascript,function,if-statement,prompt
If I understand correctly, you want the prompt to jump when the page is loaded, and then execute the code in "clickMe" (without the prompt) once the user has input a value? In that case, you need to run the prompt after the page has loaded. You can see an...
javascript,string,function,split,prompt
You are calling longestWord with string as a parameter, which is undefined. <script> function longestWord() { string = prompt("Enter a string of at least 5 words separated by spaces:") ; var str = string.split(" "); var longest = 0; str.forEach(function(str) { if (longest < str.length) { longest = str.length; word...
Inside else, you need to set i>0. That will do it. Although, it's quite confusing here. What do you want to do? A simpler version would be, while(true){ //It will repeat indefinitely unlesss you break out of it var ounces = prompt("Enter number of Ounces: " , "0"); if (ounces...
The .jar files are Java "libraries". What you need is something like: > javac ClassName.java > java -cp Library1.jar:Library2.jar ClassName.class The first line (javac) compiles the Java code into a class file. The second line runs the compiled class. The '-cp' option sets the CLASSPATH (makes the code in the...
You need multiple rounds of expansion. See How does the Windows Command Interpreter (CMD.EXE) parse scripts? for an explanation as to why the following work: From the command line: call set "data=%%CURR%%" Or if delayed expansion has been enabled by cmd /v:on, then: set "data=!%CURR%!" From within a batch script:...
Taken from @Jubobs' answer: basename is just a Unix utility; it's not associated to a particular shell, and should work equally well in Bash and Fish. It appeared I was using basename in the wrong context, and without a suffix. This was solved by using the following: function fish_prompt echo...
Usually yes, window.prompt === prompt. Yet it does depend on your scope, someone might have declared window or prompt variables with different values than those in the global scope. For further details have a look at Is window really global in Javascript?. You (and your teacher) also might be interested...
Store your numbers in a collection, such as a list. Then you can check if new numbers are already in the collection before adding more. integers = [] while len(integers) < 10: a = input("Enter an integer: ") if a in integers: print("Sorry, that number was already entered.") else: integers.append(a)...
Your <script> type was your main problem. Remove type="javascript" and that is fixed. Also, the if statement should use == instead of =. Fix those two things and it'll work just fine. <script> var pass = prompt("What is the password") if (pass == "hack") { confirm("welcome"); } else { window.close();...
You can run run.sh in the background using &. In start.sh, you would invoke the script via /path/run.sh &. Now, start.sh will exit without waiting for run.sh to finish (which is running in the background).
Take a look at the pexpect module: https://pexpect.readthedocs.org/en/latest/
If you want a temporary solution(since you are talking about a screencast), you can set your PS1 variable to change the prompt. For example, if you want your prompt to be: $ then set your PS1 variable as follows on the terminal: export PS1='$' Likewise, you can have it to...
windows,loops,batch-file,cmd,prompt
You can't do this directly because of the way the FOR loop is processed. You can do it indirectly though. Look for the call-command: echo off setlocal for %%i in (*) do call :Bar %%i goto :eof :Bar @echo %1 goto :eof :eof endlocal ...
javascript,if-statement,prompt,capitalization,capitalize
convert the user input userChoice to lower/upper case and then compare with a lower cased string like var userChoice = prompt("Choose either Rock, Paper, or Scissors.").toLowerCase(); if (userChoice !== "rock") { alert("Invalid response."); } ...
javascript,validation,switch-statement,conditional-statements,prompt
loop: while(true){ var sport = prompt("What sport do you play? (Baseball, Football, Soccer, or Track)").toLowerCase(); switch (sport) { case "baseball": field = "Field 1"; break loop; case "football": field = "Field 2"; break loop; case "soccer": field = "Field 3"; break loop; case "track": field = "Field 4"; break loop;...
assembly,command,prompt,16-bit
Nevermind, I figured it out. Totally not a fault of the code (hence the obvious confusion), it's the program -- it has a limit for how far you can jump in the byte indexes. Thanks, user.1, for answering, though.
The sqlite3 shell just waits for the end of the command, which would be indicated with a semicolon. It might also be necessary to close a string with ', or a trigger body with END;....
A general solution is expect command. But for your task, it's an overkill. The ftp reads commands from a standard input. So just do: ftp -n < command.txt The -n prevents the automatic prompts for username/password. We provide these explicitly using user command below. The commands.txt file will look like:...
java,arrays,loops,while-loop,prompt
Don't do while (isValid = false). You're setting it to false! Instead do while (!isValid) { } Also, don't do while (isValid == false) -- that's ugly code. Next, change isValid inside the loop. while (!isValid) { // get input from user in here // test input and check if...
shell,command-prompt,zsh,prompt,ansi-escape
After doing some additional research, the ZSH Prompt Expansion docs indicate that escape literals need to be enclosed in %{...%}. This is bothersome since now I have to output those conditionally if I want the prompt program to work in other shells, but it seems to correct the behavior shown...
You should search the documentation for your terminal for the option that sets the command that will be run on terminal startup. For example, for xterm it is -e, so to run a command from Java code in xterm you would do, for example: Runtime.getRuntime().exec("xterm -e ls;read"); // read is...
angularjs,syntax,prompt,confirmation
You should provide an expression inside ngClick directive, no need to interpolate it with {{}}: ng-click="confirmClick(lang.shopping_cart.clear_sc_prompt) && deleteShoppingCart()" ...
To do it with only one prompt: var numbers = prompt("Enter two numbers separated by a semi-colon: ", ""); var a = numbers.split(";")[0]; var b = numbers.split(";")[1]; function calc(a,b) { return parseFloat(a) + parseFloat(b); } alert ("The addition of " + numbers + " is = " + calc(a,b)); ...
javascript,validation,null,prompt
Your syntax is a bad here: if (T == false | T == "null") null shouldn't be a string, or is || not |. You also want to be checking if PetName is null, not the result of the regex. The line should look like this: if (!T || !PetName)...
c#,multithreading,events,console-application,prompt
It sounds like you are searching for gnu readline functionality. You can use LineEditor from mono as described here: http://tirania.org/blog/archive/2008/Aug-26.html.
You will need to be more specific, but I think what your getting at is something like this? var alert = prompt("Something in here"); But to get the best answers, be more specific and give some sample code (even if it doesn't work, it helps a lot)...
Change your opening body tag to this: <body onload="placeName();"> Then, your JS file should look like this: function placeName(){ var name = prompt("Enter name"); if (name != null){ var greeting = "Hello " + player + "!"; document.getElementById("demo").innerHTML = greeting; } } You also need to make sure that you...
In my opinion it would be better to move Scanner to main: public static void main(String[] args) { Ordinals number = new Ordinals(); Scanner input = new Scanner(System.in); while(true){ System.out.println("Enter an integer between 0 to 10: "); int i = input.nextInt(); System.out.println(i+number.Ordinals(i)); } } and then add to Ordinals: int...
Something like $emailAddress = Read-Host "Enter address:" Get-Recipient -Identity $emailAddress | Get-MailPublicFolder | Get-PublicFolder There's also a great resource here: http://waynes-world-it.blogspot.co.nz/2013/04/exchange-powershell-commands.html if that doesnt do it for you...
There are two missing pieces to your solution. First, you need to store the value of the cell before it changed. Second, you need to connect to an event that tells you when the cell contents have changed. ' This is where you store the value before it was changed...
r,plot,prompt,interactive,sequential
Just set par(ask=TRUE) before calling plot(). You might want to set it after your first plot, so the user doesn't have to wait for that one. To be nice, set par(ask=FALSE) after your last plot.
There's no need for a Gulp plugin, actually the package those two wrap around -- inquirer -- does anything you need: var inquirer = require('inquirer'); gulp.task('default', function(done) { inquirer.prompt([{ type: 'confirm', message: 'Do you really want to start?', default: true, name: 'start' }], function(answers) { if(answers.start) { gulp.start('your-gulp-task'); } done();...
android,cordova,passwords,hide,prompt
I found my answer on this thread. Set inputType for an EditText? Turns out you just need to add one line in App Name\platforms\android\src\org\apache\cordova\dialogs\Notification.java promptInput.setInputType(0x00000081); ...
sql-server,variables,command-prompt,prompt
In case you can not do an application, you have no developers etc etc, you have one way - make a stored proc: create stored procedure spDoSomeJob @amon VARCHAR(2), @invdate DATE as begin ~~ rest of the code ~~ declare @sumA numeric(25, 5), @sumB numeric(25, 5), @ratio numeric(25, 5) select...
Looks like you're including your $git_branch part in a non-printing-chars block (\[...\]).
From what I can see, the MySQL loop is irrelevant to the problem at hand, and the value of the variable j in appendTo("#div"+ j++) is scoped outside the loop, so is not what you expect by the time the onclick function is fired. So, a single loop is used...
windows,cmd,automation,registry,prompt
You could create a Yes.bat file with something like the following: @echo off for /L %%X in (1,1,77) do echo Yes (Replace 77 with some sufficiently large number) Then just run Yes.bat | YourCommand.bat It seems OK to have the Yes.bat command output more Yes's than required by YourCommand.bat. On...
gdb manages command input by using the readline package. The way to tell readline that a character sequence in a prompt string doesn't actually move the cursor when output to the screen is to surround it with the markers RL_PROMPT_START_IGNORE (currently '\001' in readline's C header file) and RL_PROMPT_END_IGNORE (currently...
In Preferences, there should be an option under General: 'Update links when moving files:' Change this to 'Never'. I believe this is what you're after....
javascript,node.js,asynchronous,synchronization,prompt
You need to pass the scope of ageTotal into the prompt.get callback: var ageTotal = function(){ this.resultAge = 0; this.getUserAge = function(){ var that = this; prompt.start(); prompt.get(["age"], function(err, result){ that.resultAge += result.age }); } } ...
javascript,jquery,javascript-events,prompt
Put your promt inside a while loop and continue asking for input until user gives any. do{ input = prompt("Give input"); }while(input == null || input == "" ); console.log(input); jsFiddle [Note : It's a way to fulfill your requirement that I won't suggest as it may annoy user. You...
There are a few gems which can do what you want - one of them is password: Ruby/Password is a collection of password handling routines for Ruby, including an interface to CrackLib for the purposes of testing password strength. require 'password' # Define and check a password in code pw...
This is what I got: animation() { S="\033[s" U="\033[u" POS="\033[1000D\033[2C" while [ : ] do eval echo -ne '${S}${POS}\>\ \ ${U}' sleep 0.3 eval echo -ne '${S}${POS}\ \>\ ${U}' sleep 0.3 eval echo -ne '${S}${POS}\ \ \>${U}' sleep 0.3 done } PS1='[ ] : [ \u @ \h ] >...
All non-printing segments in the must be surrounded by \[...\] and all printing segments must not be surrounded by those. You have at least one space inside \[...\] near the end. You also have a large number of unclosed \[ (count your matched pairs). Using variables for the color codes...
javascript,phantomjs,casperjs,prompt
You can easily solve this by using a Filter in CasperJS. The appropriate one is page.prompt: // put somewhere before the prompt appears casper.setFilter("page.prompt", function(msg, currentValue) { if (msg === "What's your name?") { return "Chuck"; } }); Such a dialog is called a prompt (window.prompt()) which is distinct from...
python,python-3.x,input,passwords,prompt
try this: import sys max_tries = 3; current_tries = 0 password=input("Enter password:") while password != 'cat': if current_tries > max_tries: print "too many tries" sys.exit(0) print ("password is wrong, try it again") password= input ("Enter your password:") current_tries +=1 print ("Password correct be happy") ...
windows,command-line,navigation,folder,prompt
There's not really a simple command for this. Like you suggested, the best solution, and what I would do, is cdspaceTab. Strictly speaking, there is a command that satisfies your requirements, but it's not exactly easy under the fingers. for /d %I in (*) do cd "%I" which would loop...
Check out Text Prompt for a flexible solution. You can control when prompt is displayed (always, focus gained or focus lost). You can also customize the style of the text....
var x='PROMPT \"Page\" '; document.getElementById("demo").innerHTML = x ; <p id="demo"></p> Check the code and adjust according to that...
I think that the best way would be to create a UserForm with 2*2 comboboxes (1 for workbooks (here Cb_Wb) and one for sheets (here Cb_Ws), 2 times : source and destination) With that code : Private Sub Cb_Wb_Change() Me.Cb_Ws.Clear On Error Resume Next For Each ws In Workbooks(Me.Cb_Wb.Value).Worksheets Me.Cb_Ws.AddItem...
You are missing a closing bracket on your if statement: if(user_password == password(checkFor)) <<<<< I recommend checking your javascript code with something like http://www.jshint.com if your debugger/IDE isnt picking it up....
applescript,prompt,privileges,administrator
If you make your AppleScript an application (in Script Editor, go File>Save as…>Type "Application"), you can then set an icon and a user-friendly name. Save the application with the name that you want to appear in the alert window (replacing "osascript). Set an icon by opening the new application's package,...
It seems like vim (or some vim startup script) is trying to figure out what type of terminal you are using. The ^[[?1;2c, with the last few characters left in the input buffer, is almost certainly part of your terminal emulator's response to a DA (Device Attributes) query. You can...
I forgot to add the user agent to the two php Pages. I just deleted the comment option from the two script. This solved my problem
bash,echo,command-prompt,prompt,cat
You just need to use: apt-cache search nano > search There is no need to use echo and command substitution which is stripping newlines to a space due to absence of quotes around your command....
javascript,alert,prompt,fizzbuzz
the logical order of your if statements and loop is incorrect for what you are trying to achieve. you want to first check if this number is a number, then you want to check if tis a whole number, then you want to enter the for loop if it passes...
Some information about the logic I have followed: This code doesn't save anything, if you need to store some information just with JS, so on the client computer and this will depend on the cache, you can use the cookie(the information are temporary since rely on cookies that can be...
We can use \r in a tricky way: import java.util.Scanner; public class JavaApplication2 { public static void main(String[] args) { int i=0; Scanner s = new Scanner(System.in); System.out.print("Enter num: __kg\r"); System.out.print("Enter num: "); i = s.nextInt(); System.out.println("\n"+i); } } How it works: we print Enter num: __kg and \r to...