user-input

PL/SQL: how do i prompt user input in a procedure?

。_饼干妹妹 提交于 2019-11-29 22:26:49
问题 This is a question about a small part of a large project I'm doing. I tried the following but I just get the two errors below it: SET SERVEROUTPUT ON CREATE OR REPLACE PROCEDURE HELLO AS DECLARE variable1 NUMBER(1); variable2 CHAR(1); BEGIN DBMS_OUTPUT.PUT_LINE('Hello World'); variable1 := &please_enter_1_or_0; variable2 := &please_enter_y_or_n; END; / Error(2,5): PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following: begin function pragma procedure subtype type

How do I drop a pin with MapKit?

走远了吗. 提交于 2019-11-29 21:48:20
I would like to allow the user of my app to pick a location in the map. The native map has a "drop pin" feature where you can locate something by dropping a pin. How can I do this in MapKit? RedBlueThing You need to create an object that implements the MKAnnotation protocol and then add that object to the MKMapView : @interface AnnotationDelegate : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString * title; NSString * subtitle; } Instantiate your delegate object and add it to the map: AnnotationDelegate * annotationDelegate = [[[AnnotationDelegate alloc] initWithCoordinate

Lightweight GNU readline alternative

耗尽温柔 提交于 2019-11-29 18:25:39
问题 I am looking for a GNU readline alternative. It comes with a lot of features but only couple of them are useful to me as explained below - I am working on a interactive command prompt application (display prompt and accept next user command to be run). I want to implement some editing and history feature for the prompt. So when the user presses UP key it should show the last run command. Also, user should be able to navigate using arrow keys if he need to edit any typo or command switches etc

Python getting user input errors

孤者浪人 提交于 2019-11-29 18:11:36
I have a simple program that prompts user to enter number between 1-9 and if the number has been entered previously it will ask the user to enter another number. The user has 10 tries or attempts. This is only part of what I wanted to do but I am having problems passing the parameter from the getNum method to the method that calls it. If I enter the number between 1-9, it has no problem. The problem starts when I entered the number previously entered and the prompts ask for another number. def getNum(numList): num = input("Pick your number: ") if num <= 0 or num >9: print 'Invalid number.

Force input to be positive numbers only with error handling in C

雨燕双飞 提交于 2019-11-29 18:05:56
I have a trivial question to ask. My program should take postive integers only. If there is anything illegal, the user should be prompted to input a number again. The code I have for now is: #include<stdio.h> int main(){ int reads; int num=0; char a; while(num<=0){ printf("Please Enter positive integer: "); while(((reads = scanf("%d%c", &num, &a)) != 2 && reads != EOF) || a != '\n' ){ do { printf("Please Enter positive integer: "); reads = scanf("%c", &a); }while(reads != EOF && a != '\n'); } } printf("Num is: %d", num); } The code above almost did what I want; however, when the input is

JUnit test for console input and output

戏子无情 提交于 2019-11-29 16:50:58
I have only one method main. How to check System.out.println() and replace Scanner to input values automatically using JUnit? P.S. Please, provide some solutions... public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int[] arr = new int[4]; for (int i = 0; i < arr.length; i++) { arr[i] = scanner.nextInt(); } for (int i = 0; i < arr.length; i++) { int res = 0; int k = 0; int num = arr[i]; /*.....*/ System.out.println(num); } } Ideally, extract the awkward dependencies so that you can test without them. Change main to simply: public static void main(String[] args)

Android link navigation and box input on internet

别说谁变了你拦得住时间么 提交于 2019-11-29 16:49:16
How can I get android to "navigate" through links on website? Say the first activity in my app allows the user to input their username and password, which would then be stored into Strings. Then the app would "enter" the strings into the username and password boxes and "click" the login button on the website. This "filling" and "clicking" would be done in the background, while the user sees a loading screen. This is the basic idea. So how would I get the app to "fill" in the username and password boxes and "click" the login button? Also, I do not own the website that I'm logging into. My app

Python: How do I get user input in the middle of a sentence (fill-in-the-blank style) using the input function?

[亡魂溺海] 提交于 2019-11-29 16:41:38
I am trying to create a program that calculates sales tax. I first ask the user what was the total cost of their meal. I then ask them what is the sales tax of their area in the form of: y = input('What is the sales tax of your area? ') I want to have a percent sign "%" at the end of the question so that the users sees the question as: What is the sales tax of your area?_% , where the user can enter a number between the question and the percent sign (denoted by the underline). This is what I have tried: x = float(input("What is the cost of your meal? ")) y = input("What is the sales tax in

Android: custom view onClickEvent with X & Y locations

僤鯓⒐⒋嵵緔 提交于 2019-11-29 15:44:17
I've got a custom view and I want to get the X and Y coordinates of a user click. I've found that I can only get the coordinates from the onTouchEvent and an onClickEvent won't fire if I have an onTouchEvent. Unfortunately the onTouchEventfires when the user drags the screen as well as clicking. I've tried to differentiate between the two, but I still get the code firing when I'm dragging: public boolean onTouchEvent(MotionEvent event) { int action = event.getAction(); if (action == MotionEvent.ACTION_DOWN) { //fires on drag and click I've had a look at this but as I mentioned above I don't

Input handling in WinForm

南楼画角 提交于 2019-11-29 14:55:50
What is the best way to block certain input keys from being used in a TextBox with out blocking special keystrokes such as Ctrl-V/Ctrl-C? For example, only allowing the user to enter a subset of characters or numerics such as A or B or C and nothing else. I would use the keydown-event and use the e.cancel to stop the key if the key is not allowed. If I want to do it on multiple places then I would make a user control that inherits a textbox and then add a property AllowedChars or DisallowedChars that handle it for me. I have a couple of variants laying around that I use for time to time, some