Most Popular
1500 questions
1215
votes
16 answers
How do I get the value of text input field using JavaScript?
I am working on a search with JavaScript. I would use a form, but it messes up something else on my page. I have this input text field:
And this is my…

user979331
- 11,039
- 73
- 223
- 418
1214
votes
14 answers
Alternatives for returning multiple values from a Python function
The canonical way to return multiple values in languages that support it is often tupling.
Option: Using a tuple
Consider this trivial example:
def f(x):
y0 = x + 1
y1 = x * 3
y2 = y0 ** y3
return (y0, y1, y2)
However, this quickly gets…

saffsd
- 23,742
- 18
- 63
- 67
1214
votes
64 answers
You need to use a Theme.AppCompat theme (or descendant) with this activity
Android Studio 0.4.5
Android documentation for creating custom dialog boxes: http://developer.android.com/guide/topics/ui/dialogs.html
If you want a custom dialog, you can instead display an Activity as a dialog instead of using the Dialog APIs.…

ant2009
- 27,094
- 154
- 411
- 609
1213
votes
15 answers
Should I put #! (shebang) in Python scripts, and what form should it take?
Should I put the shebang in my Python scripts? In what form?
#!/usr/bin/env python
or
#!/usr/local/bin/python
Are these equally portable? Which form is used most?
Note: the tornado project uses the shebang. On the other hand the Django project…

treecoder
- 43,129
- 22
- 67
- 91
1213
votes
11 answers
How to convert a string to lower or upper case in Ruby
How do I take a string and convert it to lower or upper case in Ruby?

Heat Miser
- 19,438
- 7
- 35
- 38
1212
votes
28 answers
In Node.js, how do I "include" functions from my other files?
Let's say I have a file called app.js. Pretty simple:
var express = require('express');
var app = express.createServer();
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.get('/', function(req, res){
res.render('index',…

TIMEX
- 259,804
- 351
- 777
- 1,080
1212
votes
12 answers
Propagate all arguments in a Bash shell script
I am writing a very simple script that calls another script, and I need to propagate the parameters from my current script to the script I am executing.
For instance, my script name is foo.sh and calls bar.sh.
foo.sh:
bar $1 $2 $3 $4
How can I do…

Fragsworth
- 33,919
- 27
- 84
- 97
1212
votes
19 answers
How can I pad an integer with zeros on the left?
How do you left pad an int with zeros when converting to a String in java?
I'm basically looking to pad out integers up to 9999 with leading zeros (e.g. 1 = 0001).

Omar Kooheji
- 54,530
- 68
- 182
- 238
1212
votes
16 answers
Use of PUT vs PATCH methods in REST API real life scenarios
First of all, some definitions:
PUT is defined in Section 9.6 RFC 2616:
The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD…

Dmitry Kudryavtsev
- 16,354
- 4
- 25
- 32
1212
votes
38 answers
How do I display an alert dialog on Android?
I want to display a dialog/popup window with a message to the user that shows "Are you sure you want to delete this entry?" with one button that says 'Delete'. When Delete is touched, it should delete that entry, otherwise nothing.
I have written a…

UMAR-MOBITSOLUTIONS
- 77,236
- 95
- 209
- 278
1211
votes
20 answers
How to prevent buttons from submitting forms
In the following page, with Firefox the remove button submits the form, but the add button does not.
How do I prevent the remove button from submitting the form?
function addItem() {
var v = $('form :hidden:last').attr('name');
var n =…

Khanpo
- 12,129
- 3
- 17
- 5
1211
votes
14 answers
Returning IEnumerable vs. IQueryable
What is the difference between returning IQueryable vs. IEnumerable, when should one be preferred over the other?
IQueryable custs = from c in db.Customers
where c.City == ""
select c;
IEnumerable custs = from c in…

stackoverflowuser
- 22,212
- 29
- 67
- 92
1211
votes
19 answers
How do I install a Python package with a .whl file?
I'm having trouble installing a Python package on my Windows machine, and would like to install it with Christoph Gohlke's Window binaries. (Which, to my experience, alleviated much of the fuss for many other package installations). However, only…

e9t
- 15,534
- 5
- 23
- 25
1211
votes
23 answers
How do I import other Python files?
How do I import files in Python? I want to import:
a file (e.g. file.py)
a folder
a file dynamically at runtime, based on user input
one specific part of a file (e.g. a single function)

Tamer
- 12,137
- 3
- 16
- 4
1211
votes
25 answers
Git replacing LF with CRLF
On a Windows machine, I added some files using git add.
I got warnings saying:
LF will be replaced by CRLF
What are the ramifications of this conversion?

mrblah
- 99,669
- 140
- 310
- 420