Most Popular
1500 questions
3239
votes
31 answers
How do I concatenate two lists in Python?
How do I concatenate two lists in Python?
Example:
listone = [1, 2, 3]
listtwo = [4, 5, 6]
Expected outcome:
>>> joinedlist
[1, 2, 3, 4, 5, 6]

y2k
- 65,388
- 27
- 61
- 86
3237
votes
14 answers
What does cherry-picking a commit with Git mean?
What does git cherry-pick do?

Rahul
- 44,892
- 25
- 73
- 103
3234
votes
22 answers
How do I disable the resizable property of a textarea?
I want to disable the resizable property of a textarea.
Currently, I can resize a textarea by clicking on the bottom right corner of the textarea and dragging the mouse. How can I disable this?

user549757
- 32,962
- 4
- 19
- 20
3233
votes
24 answers
How do I clone a list so that it doesn't change unexpectedly after assignment?
While using new_list = my_list, any modifications to new_list changes my_list every time. Why is this, and how can I clone or copy the list to prevent it?

aF.
- 64,980
- 43
- 135
- 198
3232
votes
69 answers
How can I merge properties of two JavaScript objects dynamically?
I need to be able to merge two (very simple) JavaScript objects at runtime. For example I'd like to:
var obj1 = { food: 'pizza', car: 'ford' }
var obj2 = { animal: 'dog' }
obj1.merge(obj2);
//obj1 now has three properties: food, car, and…

JC Grubbs
- 39,191
- 28
- 66
- 75
3228
votes
27 answers
How do I check if a list is empty?
For example, if passed the following:
a = []
How do I check to see if a is empty?

Ray
- 187,153
- 97
- 222
- 204
3228
votes
44 answers
How to add images to README.md on GitHub?
Recently I joined GitHub. I hosted some projects there.
I need to include some images in my README File. I don't know how to do that.
I searched about this, but all I got was some links which tell me to "host images on web and specify the image path…

Midhun MP
- 103,496
- 31
- 153
- 200
3228
votes
14 answers
event.preventDefault() vs. return false
When I want to prevent other event handlers from executing after a certain event is fired, I can use one of two techniques. I'll use jQuery in the examples, but this applies to plain-JS as well:
1. event.preventDefault()
$('a').click(function (e) {
…

RaYell
- 69,610
- 20
- 126
- 152
3223
votes
44 answers
Add a column with a default value to an existing table in SQL Server
How can I add a column with a default value to an existing table in SQL Server 2000 / SQL Server 2005?

Mathias
- 33,351
- 7
- 26
- 33
3221
votes
45 answers
JavaScript closure inside loops – simple practical example
var funcs = [];
// let's create 3 functions
for (var i = 0; i < 3; i++) {
// and store them in funcs
funcs[i] = function() {
// each should log its value.
console.log("My value:", i);
};
}
for (var j = 0; j < 3; j++) {
// and now…

nickf
- 537,072
- 198
- 649
- 721
3215
votes
34 answers
How do I find out which process is listening on a TCP or UDP port on Windows?
How do I find out which process is listening on a TCP or UDP port on Windows?

readonly
- 343,444
- 107
- 203
- 205
3201
votes
49 answers
Detecting an undefined object property
How do I check if an object property in JavaScript is undefined?

Matt Sheppard
- 116,545
- 46
- 111
- 131
3196
votes
102 answers
How do you disable browser autocomplete on web form field / input tags?
How do you disable autocomplete in the major browsers for a specific input (or form field)?

Brett Veenstra
- 47,674
- 18
- 70
- 86
3189
votes
59 answers
How do I test a class that has private methods, fields or inner classes?
How do I use JUnit to test a class that has internal private methods, fields or nested classes?
It seems bad to change the access modifier for a method just to be able to run a test.

MattGrommes
- 11,974
- 9
- 37
- 40
3183
votes
13 answers
How do I make a time delay?
How do I put a time delay in a Python script?

user46646
- 153,461
- 44
- 78
- 84