user-input

Parsing formatted user input in C++

故事扮演 提交于 2019-12-25 08:58:31
问题 For a project I need to implement a solution to the graph coloring problem. However, the input is required to have specific syntax with which I have no idea on how to parse through in order to access the data needed to store in variables. The input constraints are to first enter the number of colors, then the number of vertices, followed by a sequence of edges. The edges should be entered in the format (v1 v2) . The sequence is terminated with v1 = -1. So, (-1 0) , (-1 -1) , etc. So the input

Difficulty in editable GtkTreeView

丶灬走出姿态 提交于 2019-12-25 05:51:13
问题 I am writing a piece of software where my user should be able to add data to a table-like editing widget, which I managed to render by using a GtkTreeView . I was able to render my cell editable by setting its editable property via this call g_object_set(content_renderer, "editable", TRUE, NULL); However, my GtkTreeView not only doesn't retain values entered as it's not even showing the data I've added before rendering. I saw a few examples in the web where the developer manually set the user

Reading inputs in java

旧巷老猫 提交于 2019-12-25 03:56:25
问题 import java.io.*; public class inputting { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("number??"); String str; int i=0; while (i<5) { str=br.readLine(); int n = Integer.parseInt(str); System.out.println(n); i++;} } } if i want to read 5 integers how do i do that? what extra code i need to write? 回答1: You

ASP.NET Multiline textbox allowing input above UTF-8

倾然丶 夕夏残阳落幕 提交于 2019-12-25 02:08:55
问题 In my web.config I have <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="de-DE" /> In my page directive I have ResponseEncoding="utf-8" Yet for some reason an ASP TextBox with the TextMode="MultiLine" allows inputs of characters outside of UTF-8. When I paste the following line of text into an ASP TextBox that is not MultiLine “test” the non UTF-8 characters are replaced, but not when I use a MultiLine TextBox. Any ideas why? EDIT

Python in Linux: Put user input asynchronously into queue

浪子不回头ぞ 提交于 2019-12-25 01:44:01
问题 I am trying to run a program that takes in input as a job is getting done. I have looked through several forms, and looked into the documentation. I'm running this in Debian, and I understand that I can use this getch function to receive characters without hitting the return key. To break it down, this is what I am trying to implement in my infinite while loop Take in input (threading didn't work here for me Put input into Queue If there are no running jobs, start the job with the item in

When I run my code twice (after a While/DoWhile), the scanf does not work as intended. (Im Using Visual C++ Windows Console Application)

こ雲淡風輕ζ 提交于 2019-12-25 00:53:17
问题 I'm new to programming and I was trying to make a calculator and I'm adding a while loop, so that if you want to repeat you just type "1" and the program repeats. The problem is if I repeat it the scanf() breaks and no longer allows me to type something into the command line. (I am using Visual C++ Windows Console Application) I was trying to use fflush(stdin) to clear the keyboard buffer, this did not work either. #include "pch.h" #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include

How to return from shell 'read' command passed in expect script?

萝らか妹 提交于 2019-12-24 15:12:19
问题 I am really new to using expect, and a bit confused regarding passing commands to an expect script, so please bear with me... I have searched numerous forums, but cannot seem to find an example of an expect script that uses the read command to get user input. In my Korn shell script, I call an expect script (expectssh.exp) to ssh login to another host and get user input regarding that host's network configuration (network interface card number and subnet mask information). I pass four

Input box limit in VB

折月煮酒 提交于 2019-12-24 12:19:19
问题 a simple question: can I set the limit for an input through an input box in vb? When the user inserts a string larger than the database corresponding field, that's a problem obviously. Like the textBoxes have a MaxLength, is there a way to set a similar restriction to an inputBox? Thanks 回答1: Little easier than creating a custom class... Instead why not create a temporary string variable and assign it by your input box. . . then check the count in a do until loop... EX. Dim str As String =

Using SendMessage for Simulating User Mouse Clicks

家住魔仙堡 提交于 2019-12-24 11:06:05
问题 I need to use SendMessage fro simulating user clicks in a target program as SendMessage blocks until the event that it triggers is finished processing. The reason for this is that this blocking gives opportunity to detect if any dialogs have opened up as a result of the clicking. My problem currently is that although I can get the click to work using WM_LBUTTONDOWN and WM_LBUTTONUP messages consecutivly on a button in a mocked up form which opens a model dialog, I cannot get it to work on

How to pass urls as user input to invoke through Selenium and Python?

非 Y 不嫁゛ 提交于 2019-12-24 11:03:50
问题 Every time I run my script I want it to ask me what is the targeted url using input() so it can store it as a variable and use it in a function but every time I input the url the script won't continue and pressing enter causes it to open the url on my default browser as a tab instead of a new chrome object. def function1(targeturl): driver = webdriver.Chrome() driver.get(targeturl) print('What is the website?') webPage = input() function1(webPage) I'm not sure whether the IDE is important but