Menu
  • HOME
  • TAGS

Calling Input Types in Code Behind

c#,html,input

<input type="text" name="username" id="username" t.... First one you can't call in code behind cause it's not a server side control. You can call only those control in your code behind which are defined as server side control with runat property. To call the first one in your code behind add...

How do you preview your c++ code in visual studio

c++,visual-studio-2013,input

It's kinda hard to see what exactly you are asking here. If you mean predicting code behaviour, that's not exactly possible, for many reasons. First and foremost, you're not dealing with a scripted language, but a relatively low-level programming language. Therefore, the output of your code is extremely hard to...

Using intent between activities, in reverse - Android

java,android,android-intent,input,android-studio

Source: Getting a Result from an Activity From Activity1: public static final String RESULT_REQUEST = 1; When you want to start Activity2: Intent intent = new Intent(this, Activity2.class); startActivityForResult(intent, RESULT_REQUEST); This will be called when Activity2 is finished: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Check...

How do I do user inputs on the same line in Lua?

input,io,lua

When called without arguments, io.read() reads a whole line. You could read the line and get the words using pattern matching: input = io.read() opr, txt = input:match("(%S+)%s+(%S+)") The above code assumes that there is just one word for opr and one word for txt. If there might be zero...

Css styling of initial default value of a text field

html,css,input,fonts

If you want to style only the *, you're out of luck. No way to do that in just CSS. There is, however, way of doing this with altering your DOM: <div class="input-container"> <input type="text" name="fName" class="inpField" size="20" value="First Name" /> <span class="input-addon">*</span> </div> Then, the CSS: .input-container { position:...

How can I set the value of an input (textbox) using jQuery?

jquery,html,input

This works perfect for me (see the jsfiddle): JS: var now = new Date(); var year = now.getFullYear(); $('#year').val(year); HTML: <input id="year"> If I were you, I would make sure that you've included jQuery either right before the closing </body> tag, or in the <head> (better in the body), and...

Dynamically Adjust HTML Text Input Width to Content

javascript,jquery,html,forms,input

Use onkeypress even see this example :http://jsfiddle.net/kevalbhatt18/yug04jau/7/ <input id="txt" placeholder="name" class="form" type="text" onkeypress="this.style.width = ((this.value.length + 1) * 8) + 'px';"></span> And for placeholder on load use jquery and apply placeholder size in to input $('input').css('width',((input.getAttribute('placeholder').length + 1) * 8) + 'px'); Even you can use id instead of...

input errors : split part of one entery

c++,input,io

You have to check for the '+' and the trailing 'i': istream &operator>>(istream &input, Complex &complex) { char plus,letter; if (input >> complex.realPart >> plus) { if (plus!='+' ) input.setstate(ios::failbit); else if (input >> complex.imaginaryPart>>letter) { if (letter!='i') input.setstate(ios::failbit); } } return input; } Live demo here Note that you...

Input value is not respecting padding and breaking container

html,css,input

Add CSS rule white-space: normal to the button. In browsers, <input> defaults to whitespace: pre whereas <button> defaults to white-space: normal.

Check if the number entered is in array, otherwise add to the array

java,arrays,validation,input,user

How about this? Checks if the value exists, otherwise the user needs to re-enter the number. public static void main(String[] args) { String holder = "", s; int size; s = JOptionPane.showInputDialog("Enter the size of the array"); size = Integer.parseInt(s); String array1[] = new String[size]; //declared and instantiated array1 for...

How can I submit disable input element in a form?

javascript,html,input

Try using readonly instead of disabled <input type="text" name="quantity" value="400" class="field left" readonly /> If you still want it grayed out, you can set a background color: <input type="text" name="quantity" value="200" style="background-color: #f0f0f0;" readonly /> ...

I want to check the content of textarea must contains previous inputs' words using javascript

javascript,jquery,html,input,textarea

I think I understand what it is you're trying to get done: You want the user to utilize the previously given input of 35 words which is retrieved from input fields, but also give the user the option to add more. This addition is optional. Check it out here To...

Powershell Data input [closed]

powershell,input,data

Try this: $PCname = Read-Host "Please enter the PC Name" $Userid = Read-Host "Please enter the Uder ID" Copy-Item -LiteralPath \\$PCname\C`$\Users\$UserID\AppData\Roaming\Nuance\NaturallySpeaking12\Dragon.log -Destination "\\Static PC\C`$\Users\MyName\Desktop\Dragon Logs" -Force $PCname and $Userid are examples of powershell variables. The values are to be entered when you run the script. The other answer is trying...

C++ using ofstream to write to file

c++,file,input,ofstream

Before C++11, the file stream classes did not accept std::string file names. So you can either pass a c-string: ofstream outfile(file1.c_str()); Or enable C++11, if your current gcc version supports it: g++ -std=c++11 assembler.cpp ...

How would I go about searching for a string of words across multiple lines

java,parsing,input,io,bufferedreader

I think that either you: Normalize your key phrases and names (represent "word\nplus\nword" as "line n has word, line n+1 has plus, line n+2 has word") Process newlines as part of the matching characters (process byte by byte instead of line by line) From your current strategy, option 1 would...

font-awesome to be inserted in value=“”>

spring,button,input,font-awesome

I have not tried it completely, but this should give you an idea. <form action="/someweb.html"> <button type="submit" class="btn btn-success"><i class='fa fa-list-ul fa-lg'></i><spring:message text="View List"/></button> </form> Here is a sample in codepen. http://codepen.io/anon/pen/yNXvZw...

how to style html5 date input, first element focus/active

css,html5,date,input,css-selectors

The first element goes blue to indicate that it is the active element (in case you want to update the date using the keyboard), you can style it by specifying that it should not have a background using the pseudo-elements: ::-webkit-datetime-edit-month-field ::-webkit-datetime-edit-day-field ::-webkit-datetime-edit-year-field Notice: you should style not only the...

is possible to make html input type number only show numbers which are multiple of 5

html,input

For HTML 5 only <input type="number" name="pax" step="5"> There are other javascript or regex solutions but they shouldn't be necessary. Further reading on type input: http://www.w3schools.com/html/html_form_input_types.asp Here is an example using some more popular attributes of number inputs. <input type="number" name="pax" min="0" max="100" step="5" value="0"> ...

Limit input to 0-100 value with HTML

html,input

Use the min and max attributes: <input type=number min=0 max=100> ...

How to perferm different action depending on user input

java,input,user

Misplaced brackets: I have removed end bracket } from the end and added one just before } else if (action.equals(heavy)) { Check this: import java.util.Scanner; public class Game1 { public static void main(String[] args) { int hp = 10, enemy_hp = 10; String attack = "attack"; String block = "block";...

storing array from user and accessing it

arrays,assembly,input,user,mips

Some mistake I found is: In GETLIST: sw $v0,0($a2) #store in array add $a0,$a0,4 #next number <= instead write 'add $a2,$a2,4' if you want don't want to overwrite it. Also the problem in printing list is that you are adding $a2 to store the number in the array. But, you...

Set focus for paper-input via radio button

input,radio-button,focus,polymer,paper-elements

You will need to bind a click event to radio1: <paper-radio-button name="radio1" on-click="_setInputFocus">Radio1Label</paper-radio-button> Then define the function _setInputFocus so that it selects the input and sets the focus to it: <script> Polymer({ is: 'the-name-of-your-element', _setInputFocus: function () { this.$$("input").focus(); } }); </script> ...

Laravel 5 getting input values that are arrays

php,laravel,input,laravel-5,laravel-form

The Request::get() method is implemented by Symfony\Component\HttpFoundation\Request which the Illuminate\Http\Request class extends. This method does not parse the string parameter passed using the dot notation as Laravel does. You should instead be using the Request::input which does: $adress = Request::input('representive.address_1'); As an alternative you can also use the Input facade...

Hide class when input value equals given value

jquery,input,hide

Here's what you're looking for: JavaScript: $('#acct_tier').on("change propertychange click keyup input paste", function() { var $input = $(this); if ($input.val() === 'standard') { $(".red").hide(); } else { $(".red").show(); } }); Demo: JsFiddle...

How can i tell my Program to “re-do” diffrent Actions (chosen by User-Input) after it is done, till the do-while Requirement is set?

c#,input,console,readline

You were very close, you need to move the input read into your loop like so: string Input; do { Input = Console.ReadLine(); if (Input == "1") { Console.WriteLine("You hit your Opponment for 10 Damage!"); enemyHealth = enemyHealth - 10; Console.WriteLine("Your Opponment hit you back for 10 Damage!"); playerHealth =...

Adding Thumbstick Input to a Queue in XNA

c#,input,xna

I'm going to assume that you a thumbstick can have two states "neutral" and "direction". So, your logic should look like this (warning, lots of pseudo-code): bool thumbstickActive = false; void CheckInput() { //Pseudo-code, fix to match how you are getting the position Vector2 currentPostiion = thumbstick1.Position; if (ThumbstickInDeadZone(currentPosition)) {...

Input Autofocus on type

javascript,jquery,html5,input,autofocus

Try something like I have below. Note the extra #form ID tag for <form id="form">. I think what you're trying to achieve is focus on any keypress when the input is not already focused, if so, $(document).on("keypress") should do the trick. $(function() { $(document).on("keypress", function() { $("#leitura_nim").focus(); }); $("#leitura_nim").on("keyup", function()...

If Input is focused trigger X else trigger Y

javascript,jquery,search,input

Use .focus() and .blur() like this instead $('input#edit-keys-2').on("focus", function(){ $('#zone-header ul#nice-menu-1').animate({opacity:0}, 300); }).on("blur", function(){ $('#zone-header ul#nice-menu-1').animate({opacity:1}, 300); }); $('input#edit-keys-2').on("focus", function(){ $('#nice-menu-1').animate({opacity:0}, 300); }).on("blur", function(){ $('#nice-menu-1').animate({opacity:1}, 300); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="text"...

C++ Reading tab-delimited input and skipping blank fields

c++,variables,input,format,tab-delimited

You've solved the issue with spaces in the fields in an elegant manner. Unfortunately, operator>> will skip consecutive tabs, as if they were one single separator. So, good bye the empty fields ? One easy way to do it is to use getline() to read individual string fields: getline (ss,...

Extract value of a input hidden DOMXpath php

php,xpath,input,hidden,nodevalue

this is your code using DOM xpath : $html='<input type="hidden" id="Lat" name="myMap" value="22.445575, -18.722164">'; $doc = new DOMDocument; $doc->loadHTML($html); $xpath = new DOMXpath($doc); $val= $xpath->query('//input[@type="hidden" and @name = "myMap"]/@value' ); $list=array(); foreach($val as $v){ $list[]=$v->nodeValue; } var_dump($list); ...

Defining a function inside the input of another function in C

c++,c,function,input,function-pointers

This is impossible in C. In C++, you can use a lambda-expression: exampleFunction([](){ std::cout << "Hello"; }); ...

Flask submit data outside of form input fields

python,forms,input,flask,args

I figured it out. I think. Not sure if this is the proper way to do it, but it works for me. jinja code {% for item in items %} <tr> <form id="adauga_{{ item.stoc_id }}" action="{{ url_for('adauga', denumire_med=item.denumire_med, producator=item.producator) }}" method="POST"> <td>{{ item.stoc_id }}</td> <td>{{ item.denumire_med }}</td> <td>{{ item.producator }}</td>...

Make the input wait for mouse or keyboard - Assembly Language

assembly,input,keyboard,mouse,simultaneous

Thanks for your advice knm241. The above program now works fine thanks to you. The only problem that occurred was that the keyboard buffer was not clearing and thus the program would get stuck in a loop. I fixed that by clearing the buffer and now everything works. I used...

File not found when using multiple scanners

java,file,input,java.util.scanner,scan

Try this code with the try-catch block and let me know if it worked or not. // sometimes the compiler complains if there was a scanner opened without a try-catch block around it try { final File FILE1 = new File("text1.txt"); //it is always a good thing to make a...

jQuery Code not updating after validation

javascript,jquery,validation,input

You forgot about removing classes: if (checkURL(url)) { $("#url").removeClass('red'); $("#url").addClass('green'); } else { $("#url").removeClass('green'); $("#url").addClass('red'); } You can find jsfiddle here: http://jsfiddle.net/bmkg56hd/...

Div positioning broken by input

html,css,input,positioning

There was simply a </div> missing after your input, which broke the layout. Here's the updated fiddle.

How to send a radio button value via AJAX?

javascript,jquery,ajax,input,radio-button

Radio buttons and checkboxes have a property checked. You should explicitly check for this, if the input element you are on is of that type. var data_array = $('#modal-content').find('*[data-array]').map(function(idx, elem) { if (elem.type === 'radio' || elem.type === 'checkbox') { return elem.checked && elem.value; } else { return elem.value.trim(); }...

Ignoring characters in the input

c++,input

If your input is always in the form of <str1> <op> <str2> = <str3> You can read all tokens and do nothing with the op and =, for example: std::string s1 op s2 eq s3; std::cin >> s1 >> op >> s2 >> eq >> s3; You can validate that...

How to make an input type text look like select dropdown?

jquery,html,css,input

I think this is when :after pseudoelement gets in handy. Wrap your input in DIV. #wrap:after { content:arrow icon image; } JSFiddle But there's no way you could use different CSS style sheet for different browser yet, so only one type of icon so far....

How to read from std.in if the length of the input is not define

java,input,java.util.scanner

You are doing everything right, but you are not adding the last pair to the list. You can fix this problem by adding this code after the loop: if (current == 2) { temp.add(couple); } Demo 1 Your approach is not ideal, though: rather than reading one integer at a...

Why are numbers and special characters inserted into spaces?

c++,input,getline

The reason why your encrypt inserts special characters is that the loop does not pay attention to spaces, shifting them by key code points in the same way as it does the regular characters. Adding a check to see if the character is a lowercase letter will fix the problem:...

How to make Javascript show me the current time when i ask for it in an input?

javascript,input

use for loop to iterate through an array value askForTime var command = document.getElementById("inputcommand"); var output = document.getElementById("output"); var showTime = function(){ var askForTime = ["What time is it?","Show me time","Time"]; for(var i=0; i<askForTime.length; i++) if(command.value == askForTime[i]){ output.innerHTML = Date(); } }; ...

Html5 input type number formatting

android,iphone,html5,windows-phone-8,input

When retrieving the value with jquery it is returned with a . decimal separator. Try this: <!DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> <meta charset="utf-8"> <title>JS Bin</title> </head> <body> <input type="number" name="myNum" id="myNum"> <button id="submit">Submit</button> <hr/> <code></code> <script> $("#submit").on("click",function() { var numericValue = $("#myNum").val();...

Synchronise Textboxes (Input in Form)

javascript,html,css,forms,input

You are experiencing 2 basic errors there: 1- you are not preventing the default action of the submit button and 2- you are not assigning properly the sync function to the button Like this: button.onclick = function() {sync();return false;} ...

Scala: load different files by input

file,scala,input

I tried to make this a bit more generic. To show how this can be helpful, I also created another command that you can call as "add 1 2" and it will print the sum of adding the two integers. If you are serious into making a CLI interactive application,...

jQuery and operation in real time

javascript,jquery,html,input

Use keyup event on the #field1 textbox. HTML <p> <label>Title 1</label> <span class="field"> <input type="text" name="field1" id="field1" class="width100" value="<?php echo $field1t; ?>" /> </span> </p> <p> <label>Title 2</label> <span class="field"> <input type="text" name="field2" id="field2" class="width100" value="<?php echo $field2t ?>" /> </span> </p> Javascript // On every keyup of textbox $('#field1').on('keyup',...

How to read propositional logic symbols as input using Java Scanner?

java,input,java.util.scanner

The problem is not with entering the character, but rather with printing it to console. Your console does not appear to support the code point \u2227 of ∧, so it prints a question mark instead. You should test if console lets you input ∧ correctly by printing the numeric representation...

How to push text from html input into AngularJS array?

javascript,arrays,angularjs,forms,input

I guess it's just a typo in your template, try {{todo}} instead of {{todo} Everything else looks fine Here is completed code: http://plnkr.co/edit/tRGw9UTRVhXvD51lxYjF?p=preview I've also added track by $index statement to allow duplicated todos....

How to Click All Inputs with the Same Class on Page Load

javascript,jquery,table,input,click

Remove document.onload, and simply do: $(document).ready(function() { $('.act_inv').click(); }); This assumes a click() handler has already been created for that class. Snippet $(document).ready(function() { $('.act_inv').click(function() { $(this).val('clicked'); }); $('.act_inv').click(); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input class="act_inv" type="text"> <input class="act_inv" type="text"> <input class="act_inv" type="text"> ...

Javascript switch statements for form input

javascript,forms,input,switch-statement

See here for corrections: https://jsfiddle.net/jetweedy/upvfgck2/2/ Several problems... (1) if/else blocks weren't properly formatted (you were closing with semicolon after the 'if' part, and then putting 'else' separately and not closing that off afterwards. (2) You had 'postcode' as an ID on a div as well as an input, so 'document.getElementById(...)'...

Scanner input through break-line

java,input

As Tom already pointed out this should be the code snippet you're looking for: if (scanner.hasNextLine()) { String line = scanner.nextLine(); System.out.println(line.isEmpty() ? "Nothing to print out" : "Your input was: " + line); } ...

How to deal with value of text input created dynamically?

javascript,jquery,dynamic,input

$('#submit') doesn't exist in your example. I replaced it with $('#itemform').submit() instead, and it seems to be logging a giant object. See the updated jfiddle here. $('#itemform').submit(function(e){ e.preventDefault(); var item = {}; $('input[type=text]').each(function(){ var key = $(this).attr('name'); var value = $(this).val(); item [key] = value; }); console.log(item) }); Also, if...

Check if an input field has focus in vanilla JavaScript

javascript,html,input,focus

This question was answered here: Javascript detect if input is focused Taken from the above answer: this === document.activeElement // where 'this' is a dom object ...

Input Tags and Submit form outside the

javascript,jquery,html,forms,input

To submit a form from outside the form: HTML <form id="theForm">...</form> <button id="submitTheForm">Click to Submit</button> jQuery $('#submitTheForm').on('click', function() { $('#theForm').submit(); }); To include external inputs in the form submission: HTML <form id="theForm">...</form> <button id="submitTheForm">Click to Submit</button> <input type="text" data-form="theForm" name="external-input-1"> <input type="text" data-form="theForm" name="external-input-2"> jQuery You...

:checked selector not working

html,css,input,radio,checked

You missed :before CSS: input[type=radio]:checked ~ label:before { content:""; background-image: url("../img/radio-btn-checked.png"); font-size: 30px; text-align: center; line-height: 18px; } ...

Keydown function to prevent letters - How to load function before key is entered

javascript,jquery,input,internet-explorer-8

You are not calling the function! Either call it on $(document).ready() like this: $(document).ready(function(){ numberValidation(); }); Or, give this in the $(document).ready() instead: $(document).ready(function () { $("#txtboxToFilter").keydown(function (e) { // Allow: backspace, delete, tab, escape, enter and . }); }); Snippet $(document).ready(function () { $("#txtboxToFilter").keydown(function (e) { // Allow: backspace,...

Ensure Dynamic inputs fill 50% of browser width

html,css,input,form-submit

Perhaps this may work for you: * { box-sizing: border-box; } h1 { font-family: Verdana, Tahoma, sans-serif; font-size: 150px; font-style: normal; font-weight: 400; line-height: 170px; letter-spacing: -8px; border: 10px solid #66004C; } input { margin: auto; padding: 25px; font: normal 15px Verdana, Tahoma, sans-serif; width: 100%; border-left: solid 5px #66004C;...

What does Scanner input = new Scanner(System.in) actually mean?

java,input,java.util.scanner

Alright, let's elaborate with some simplified explanation about the Scanner class. It is a standard Oracle class which you can use by calling the import java.util.Scanner. So let's make a basic example of the class: class Scanner{ InputStream source; Scanner(InputStream src){ this.source = src; } int nextInt(){ int nextInteger; //Scans...

I can't input the obelus(division symbol) in edittext android

android,input,android-edittext

Got to be an encoding issue. Try "\u00F7" Here's the docs: http://www.fileformat.info/info/unicode/char/00f7/index.htm...

How to get all input having the same class, id name in Controller - Laravel 5?

input,laravel-5

You can't, the ID and class aren't submitted and so aren't available in the PHP. What you can do is get results by the same name by turning them into an array. Change Form::text('answer1', to Form::text('answer1[]' so that you can submit multiple inputs with the same name. If you then...

Count amount of inputfields with the same name in PHP?

php,input,count

You set $termin_von only once before loop. $termin_counter = 1; while(true) { $termin_von = 'termin'.$termin_counter.'_von'; if(!isset($_POST[$termin_von])) break; echo $termin_counter++; } ...

Moving data (based on a class) from .py to a dictonary in another .py file

python,input,data

pickle would also work, for storing data between programs, or even between different runs of the same program:: from module 1: import pickle f = open(file_Name,'wb') pickle.dump(assignment_data, f) f.close() from module 2: import pickle f = open(file_Name,'rb') pickle.load(assignment_data, f) f.close() (more elegantly with 'with ......') pickle.load knows that it's getting...

How do I get rid of form input value cache in JavaScript?

javascript,jquery,html,forms,input

You could simply set the value to 0 on page load: $(function() { $("#increment").val('0'); }); ...

Need to find duplicates from an array in c++, and then put them in another array

c++,arrays,input,duplicates,output

To give you a better understanding of how to solve this, i'll try to show you what is going on via an example. Lets say you have just entered the 6 numbers you request via cin, and your a[] variable now looks like this in memory: a[] = { 5,...

full text search with multiple text input

sql,laravel,input,full-text-search,laravel-5

UPDATED: Try $products = DB::table('products') ->whereRaw('MATCH(HEX,RGB) AGAINST(? IN BOOLEAN MODE)', array("$hex $rgb") ->get(); "$hex $rgb" - no FTS operators means $hex OR $rgb "+$hex +rgb" - means $hex AND $rgb Here is a SQLFiddle demo Further reading: Boolean Full-Text Searches ...

jQuery: Clear input field if it is not filled in certain time? [closed]

javascript,jquery,input,time

Maybe you should link it to the keyup event like here: // ... somewhere in the ON DOM READY section, input has ID "a" $('#a').keyup(function(){var o=$(this);// o: jQuery object referring to the current input setTimeout(function(){ if (o.val().length<5) o.val('');},1000); }) see here: http://jsfiddle.net/1fjyezf7/ . I reduced the minimum length to 5...

Windows Forms C++: Replace dot with comma in textbox input

c++,winforms,input,textbox,c++-cli

You need to use the KeyPress event rather than the KeyDown event. This event uses KeyPressEventArgs and so rather than if (e->KeyCode == Keys::OemPeriod) { you need to use if (e->KeyChar == '.') { ...

How to display placeholder text on focus?

javascript,html5,input,focus,placeholder

You need to show .input-text-container, but your code works. Try this: $('.search.icon-search').on('click',function(e) { e.preventDefault(); $(".input-text-container").show(); $('#textSearch').focus() }); http://jsfiddle.net/3zkpgvj5/...

Is it possible to write a MATLAB script that can give command line input to a function?

matlab,testing,input

If you are looking for a non elegant solution. If you are looking for a potentially dangerous solution. Then you might try this: write a function named "input" as follows: function a=input(str) % THIS IS THE DUMMY VERSION OF THE % MATLAB BUILT-IN FUNCTION "input" global dummy_input disp('WARNING!!!') disp('MATLAB "input"...

Configuring inputs for a Multiple Input Fuzzy Controller in Labview?

input,controller,logic,labview,fuzzy

I have two nodes which give double values, which I then put into an array using the Build Array VI I assume you mean that they give 1D DBL arrays, because you can't get from scalars to a 2D array. Most likely you need to right click the BA...

HTML Input - already filled in text

html,input,placeholder

The value content attribute gives the default value of the input element. http://www.w3.org/TR/html5/forms.html#attr-input-value To set the default value of an input element, use the value attribute. <input type="text" value="default value"> ...

Use angular-ui timepicker as input form

angularjs,input,angular-ui-bootstrap,timepicker

The error in this case was caused by a error in the changed() function. With this function in the controller, all works fine: $scope.changed = function () { $scope.start_hour = { hour: $scope.hour.getHours(), min: $scope.hour.getMinutes() }; }; ...

Inputting integers in to an array Error?

java,arrays,input,value

input.nextInt() consumes the next integer in the stream. You need to do this: Scanner input = new Scanner (System.in); for (int j = 0; j < 5; j++) { System.out.printf("Student %s: ", j+1); int num = input.nextInt(); if (num >= 0 && num <= 100) studentGrade[j][1] = num; else {...

Python - input filters [duplicate]

python,string,input,keyword

Simple while: while True: try: msg = int(input("Enter: ")) except ValueError: print("Not Valid!") continue # do some validation like if msg.endswith('hi') and stuff like that ex: if msg > 40 or msg < 10: # fail if greater than 40 and smaller than 10 print("Not Valid!") continue break ...

Input boxes not lining up

html,css,text,input,form-submit

Add this CSS3 box-sizing Property in your stylesheet. * { box-sizing: border-box; } ...

Retrieve value from input next to a button using THIS selector

javascript,jquery,button,input,this

Pass this as parameter in deleteBandMember function as shown :- HTML :- <li> <input id="mem3" value="TestU4" disabled=""> <button id="del3" class="delmem" onclick="deleteBandMember(this);">remove</button> </li> jQuery :- function deleteBandMember(elem){ var mmbr = $(elem).prev("input").val(); } Demo...

Read graphs from file as fast as possible

c,input,graph,text-files

The first optimization is to read the whole file in memory in one shot. Accessing memory in the loops will be faster than calling fread. The second optimization is to do less arythmetic operations, even if it means more code. Third optimization is treating the data from file as characters...

angularjs -date input with ng-model in miliseconds

angularjs,date,input,angularjs-ng-model

Take a look at How to bind View Date to model milliseconds with Angularjs. As it explained; You can use the following, to change the data format dynamically during the binding: ngModel.$parsers.push(fromUser); ngModel.$formatters.push(toUser); ...

Trying to return one dataset from a function that prints from two functions

python,list,csv,input,data

Best part in Python is that creating new objects on the fly is very easy. You can make a method return a tuple of two values. def dataPrinter(): gen1 = headerBody(columns_no) gen2 = dataBody(columns_no) return gen1, gen2 And from the calling side, you can get them either as a single...

adding text after prompt for input

java,input,cmd,prompt

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...

javax.el.PropertyNotWritableException when using EL conditional operator in value of UIInput

jsf,input,el,placeholder,conditional-operator

Conditional statements in EL are indeed not writable. They are read-only. End of story. The same applies to method references in EL as in #{bean.property()}. It must really be a true value expression as in #{bean.property}. Your approach of using a (HTML5) "placeholder" is actually wrong. For that you should...

Java Append Key Input to String

java,string,input,keyboard,key

I think you can get the job done by using a KeyListener. This is basically a listener which sends events each time a key is typed, pressed and released. In a nutshell, I would listen to a keyPressed event and then I would not type that letter until I receive...

BufferedReader space separated input

java,input,bufferedreader

Try this, StringTokenizer tk = new StringTokenizer(input.readLine()); int m = Integer.parseInt(tk.nextToken()); String s = tk.nextToken(); this is faster than string.split(); ...

make java multithread wait until input given

java,multithreading,input,wait

You can use CyclicBarrier from java.util.concurrent package static CyclicBarrier b = new CyclicBarrier(nConnections); public void run() { // make the database connection b.await(); //threads will stop here untill nConnections are opened ... ...

How to make my output show only whats needed with my cheque generator program for c

c,input,output

You need to add conditionals around your printfs: if (a > 0) { printNum(a); //Printing is the variables are in the thousands, hundreds, tens or ones categories. printf("Thousand "); } ...

JQuery And JavaScript Search AutoComplete

javascript,jquery,search,input,autocomplete

The autocomplete function you are using is from jqueryUI.Have you included it?

Save user input from tkinter to a variable and check its content

python,input,tkinter,python-3.4

The simplest solution is to make string global: def printtext(): global e global string string = e.get() text.insert(INSERT, string) When you do that, other parts of your code can now access the value in string. This isn't the best solution, because excessive use of global variables makes a program hard...

Remove leading zeros from input type=number

javascript,html5,validation,input,numbers

just use a regular expression like this textboxText= textboxText.replace(/^0+/, '') ...

Take input without changing the line

python,input

Instead of print(), use input() to produce the prompt: x = input("Please Enter: ") From the input() function documentation: input([prompt]) If the prompt argument is present, it is written to standard output without a trailing newline. ...

Detect when input text change

javascript,jquery,html,input

Add your logic in the onlick $("#main-list li").bind("click", function() { $("#main").val($(this).html()); $("#main").css('background-color','#FC0'); $(this).parent().append('value changed'); }); http://jsfiddle.net/dshun/ud4r1p84/...

how to get user to pick inputs Java

java,if-statement,input

The Braces were missing for the parent if else, if (object.equals("1")) does not have any opening brace etc., now try this. I have highlighted the piece of code change for you. public class PostalTest{ public static void main(String args[]) { Scanner type = new Scanner(System.in); String object; Double weighte, weightl;...

Simplifying some jQuery code of keyup inputs

javascript,jquery,css,input,keyup

You can simplify your code like this. Bind the keyup event once by using the id starts with selector. var colors = ["3173d8", "416cd9", "5e5bdb", "8248dd", "a335df"] $("[id^=input]").each(function (i) { $(this).css('background', '#' + colors[i]); }); $("[id^=input]").keyup(function () { var index = $("[id^=input]").index(this); $("span[id^=span]").eq(index).html('[color=' + colors[index] + ']' + $(this).val() +...

onclick change value of next or previus div

jquery,input

This should work for you: $(function() { $('.buttonbundle.up').on('click',function(){ var input = $(this).next('input'); var x = parseInt(input.val()); input.val( x + 1 ); }); $('.buttonbundle.down').on('click',function(){ var input = $(this).prev('input'); var x = parseInt(input.val()); input.val( x - 1 ); }); }); DEMO EDIT Or wrapped in one function: $(function() { $('.buttonbundle').on('click',function(){ var input...

JavaScript: Add table values to input field on button click

javascript,input,data,datatable

I created the whole solution on codepen. This is the function used: var clicks = 0; function csv() { var box = document.getElementsByName('text')[0]; if(clicks === 0){ var newcsv = ""; var tds = document.getElementsByTagName("TD"); for(var i = 0; i < tds.length; i++) { newcsv += tds[i].innerHTML; if(i != tds.length-1) newcsv...

Java: How to print the next line of found string

java,input

You should modify this part of your code: while ((s=br.readLine())!=null) { if(s.contains(keyword)) System.out.println(s); } Here you're printing the line that contains the keyword. Since you want to print the next line, use the BufferedReader to read the next line again inside the if condition. Therefore, it would be something like...