Most Popular

1500 questions
3011
votes
23 answers

What does ** (double star/asterisk) and * (star/asterisk) do for parameters?

What do *args and **kwargs mean? def foo(x, y, *args): def bar(x, y, **kwargs):
Todd
  • 31,410
  • 4
  • 21
  • 13
3011
votes
15 answers

I ran into a merge conflict. How can I abort the merge?

I used git pull and had a merge conflict: unmerged: _widget.html.erb You are in the middle of a conflicted merge. I know that the other version of the file is good and that mine is bad so all my changes should be abandoned. How can I do this?
Gwyn Morfey
  • 31,311
  • 6
  • 24
  • 21
3002
votes
34 answers

How can you find out which process is listening on a TCP or UDP port on Windows?

How can you find out which process is listening on a TCP or UDP port on Windows?
readonly
  • 326,166
  • 107
  • 202
  • 204
3000
votes
7 answers

Understanding Python super() with __init__() methods

Why is super() used? Is there a difference between using Base.__init__ and super().__init__? class Base(object): def __init__(self): print "Base created" class ChildA(Base): def __init__(self): Base.__init__(self) …
Mizipzor
  • 48,671
  • 21
  • 94
  • 137
2987
votes
40 answers

Should I use the datetime or timestamp data type in MySQL?

Would you recommend using a datetime or a timestamp field, and why (using MySQL)? I'm working with PHP on the server side.
Gad
  • 39,904
  • 13
  • 53
  • 78
2984
votes
52 answers

Is there a unique Android device ID?

Do Android devices have a unique ID, and if so, what is a simple way to access it using Java?
Tyler
  • 30,437
  • 8
  • 20
  • 22
2970
votes
12 answers

What does cherry-picking a commit with Git mean?

Recently, I have been asked to cherry-pick a commit. So what does cherry-picking a commit in git mean? How do you do it?
Rahul
  • 42,073
  • 24
  • 68
  • 100
2963
votes
27 answers

How do you set, clear, and toggle a single bit?

How do you set, clear, and toggle a bit?
JeffV
  • 50,397
  • 31
  • 100
  • 123
2960
votes
39 answers

How can I know which radio button is selected via jQuery?

I have two radio buttons and want to post the value of the selected one. How can I get the value with jQuery? I can get all of them like this: $("form :radio") How do I know which one is selected?
juan
  • 77,330
  • 50
  • 158
  • 193
2955
votes
28 answers

Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter) This morning I navigated to my work's codebase in the Command Line on my MacBook pro, typed in "git status" in the…
dustbuster
  • 70,146
  • 4
  • 18
  • 37
2937
votes
15 answers

How do I delete a file or folder in Python?

How do I delete a file or folder?
Zygimantas
  • 29,675
  • 5
  • 17
  • 23
2918
votes
3 answers

Why is printing "B" dramatically slower than printing "#"?

I generated two matrices of 1000 x 1000: First Matrix: O and #. Second Matrix: O and B. Using the following code, the first matrix took 8.52 seconds to complete: Random r = new Random(); for (int i = 0; i < 1000; i++) { for (int j = 0; j < 1000;…
Kuba Spatny
  • 25,968
  • 9
  • 36
  • 62
2911
votes
24 answers

How to store objects in HTML5 localStorage

I'd like to store a JavaScript object in HTML5 localStorage, but my object is apparently being converted to a string. I can store and retrieve primitive JavaScript types and arrays using localStorage, but objects don't seem to work. Should…
Kristopher Johnson
  • 79,268
  • 55
  • 237
  • 302
2891
votes
26 answers

Deleting an element from an array in PHP

Is there an easy way to delete an element from an array using PHP, such that foreach ($array) no longer includes that element? I thought that setting it to null would do it, but apparently it does not work.
Ben
  • 63,484
  • 36
  • 83
  • 107
2891
votes
30 answers

How to append something to an array?

How do I append an object (such as a string or number) to an array in JavaScript?
interstar
  • 24,498
  • 34
  • 108
  • 169