Most Popular

1500 questions
1447
votes
29 answers

Deleting array elements in JavaScript - delete vs splice

What is the difference between using the delete operator on the array element as opposed to using the Array.splice method? For example: myArray = ['a', 'b', 'c', 'd']; delete myArray[1]; // or myArray.splice (1, 1); Why even have the splice…
lYriCAlsSH
  • 57,436
  • 10
  • 26
  • 20
1447
votes
66 answers

How to remove old Docker containers

This question is related to Should I be concerned about excess, non-running, Docker containers?. I'm wondering how to remove old containers. The docker rm 3e552code34a lets you remove a single one, but I have lots already. docker rm --help doesn't…
qkrijger
  • 26,686
  • 6
  • 36
  • 37
1447
votes
3 answers

How do I create a copy of a directory in Unix/Linux?

I want to recursively create a copy of a directory and all its contents (e.g. files and subdirectories).
user2080656
  • 14,579
  • 3
  • 13
  • 4
1446
votes
9 answers

Local Storage vs Cookies

I want to reduce load times on my websites by moving all cookies into local storage since they seem to have the same functionality. Are there any pros/cons (especially performance-wise) in using local storage to replace cookie functionality except…
Gio Borje
  • 20,314
  • 7
  • 36
  • 50
1443
votes
12 answers

How can I know if a branch has been already merged into master?

I have a git repository with multiple branches. How can I know which branches are already merged into the master branch?
hectorsq
  • 74,396
  • 19
  • 43
  • 46
1441
votes
3 answers

How can I use grep to show just filenames on Linux?

How can I use grep to show just file-names (no in-line matches) on Linux? I am usually using something like: find . -iname "*php" -exec grep -H myString {} \; How can I just get the file-names (with paths), but without the matches? Do I have to use…
cwd
  • 53,018
  • 53
  • 161
  • 198
1441
votes
8 answers

Hex transparency in colors

I'm working on implementing a widget transparency option for my app widget although I'm having some trouble getting the hex color values right. Being completely new to hex color transparency I searched around a bit although I couldn't find a…
SweSnow
  • 17,504
  • 10
  • 36
  • 49
1441
votes
28 answers

offsetting an html anchor to adjust for fixed header

I am trying to clean up the way my anchors work. I have a header that is fixed to the top of the page, so when you link to an anchor elsewhere in the page, the page jumps so the anchor is at the top of the page, leaving the content behind the fixed…
Matt Dryden
  • 14,465
  • 3
  • 16
  • 13
1441
votes
19 answers

How can I get the full object in Node.js's console.log(), rather than '[Object]'?

I have this object: const myObject = { "a":"a", "b":{ "c":"c", "d":{ "e":"e", "f":{ "g":"g", "h":{ "i":"i" } } } } }; But when I try to show it…
user1372449
1439
votes
17 answers

How to calculate difference between two dates (number of days)?

How can one calculate the number of days between two dates in C#?
leora
  • 188,729
  • 360
  • 878
  • 1,366
1438
votes
27 answers

What is Gradle in Android Studio?

Gradle is a bit confusing to me, and also for any new Android developer. Can anyone explain what Gradle in Android Studio is and what its purpose is? Why is it included in Android Studio?
1436
votes
214 answers

What is the single most influential book every programmer should read?

If you could go back in time and tell yourself to read a specific book at the beginning of your career as a developer, which book would it be? I expect this list to be varied and to cover a wide range of things. To search: Use the search box in the…
NotMyself
  • 29,209
  • 17
  • 56
  • 74
1435
votes
57 answers

Removing duplicates in lists

How can I check if a list has any duplicates and return a new list without duplicates?
Neemaximo
  • 20,031
  • 12
  • 32
  • 40
1435
votes
40 answers

How do I set distance between flexbox items?

To set the minimal distance between flexbox items I'm using margin: 0 5px on .item and margin: 0 -5px on container. This seems like a hack. Is there another property or method intended to accomplish this goal? #box { display: flex; width:…
Sasha Koss
  • 15,129
  • 4
  • 20
  • 27
1434
votes
5 answers

Best way to convert string to bytes in Python 3?

TypeError: 'str' does not support the buffer interface suggests two possible methods to convert a string to bytes: b = bytes(mystring, 'utf-8') b = mystring.encode('utf-8') Which method is more Pythonic? See Convert bytes to a string for the…
Mark Ransom
  • 299,747
  • 42
  • 398
  • 622