Most Popular
1500 questions
1457
votes
22 answers
What is the difference between gravity and layout_gravity in Android?
I know we can set the following values to the android:gravity and android:layout_gravity properties:
center
center_vertical
center_horizontal, etc.
But I am confused regarding both of these.
What is the difference between the usage of…
Paresh Mayani
- 127,700
- 71
- 241
- 295
1456
votes
23 answers
Where does npm install packages?
Can someone tell me where can I find the Node.js modules, which I installed using npm?
trnc
- 20,581
- 21
- 60
- 98
1454
votes
19 answers
How to manually send HTTP POST requests from Firefox or Chrome browser
I want to test some URLs in a web application I'm working on. For that I would like to manually create HTTP POST requests (meaning I can add whatever parameters I like).
Is there any functionality in Chrome and/or Firefox that I'm missing?
Pascal Klein
- 23,665
- 24
- 82
- 119
1454
votes
27 answers
How do I check which version of Python is running my script?
How do I check which version of the Python interpreter is running my script?
carrier
- 32,209
- 23
- 76
- 99
1453
votes
13 answers
How to change the href attribute for a hyperlink using jQuery
How can you change the href attribute (link target) for a hyperlink using jQuery?
Brian Boatright
- 36,294
- 34
- 81
- 102
1452
votes
23 answers
LINQ's Distinct() on a particular property
I am playing with LINQ to learn about it, but I can't figure out how to use Distinct when I do not have a simple list (a simple list of integers is pretty easy to do, this is not the question). What I if want to use Distinct on a List on…
Patrick Desjardins
- 136,852
- 88
- 292
- 341
1451
votes
22 answers
What are these three dots in React doing?
What does the ... do in this React (using JSX) code and what is it called?
Thomas Johansen
- 14,837
- 3
- 14
- 21
1451
votes
16 answers
Ignoring any 'bin' directory on a git project
I have a directory structure like this:
.git/
.gitignore
main/
...
tools/
...
...
Inside main and tools, and any other directory, at any level, there can be a 'bin' directory, which I want to ignore (and I want to ignore everything under it…
Ben Hymers
- 25,586
- 16
- 59
- 84
1450
votes
14 answers
Why there are two ways to unstage a file in Git?
Sometimes git suggests git rm --cached to unstage a file, sometimes git reset HEAD file. When should I use which?
D:\code\gt2>git init
Initialized empty Git repository in D:/code/gt2/.git/
D:\code\gt2>touch a
D:\code\gt2>git status
# On branch…
Senthess
- 17,020
- 5
- 23
- 28
1449
votes
31 answers
Trigger a button click with JavaScript on the Enter key in a text box
I have one text input and one button (see below). How can I use JavaScript to trigger the button's click event when the Enter key is pressed inside the text box?
There is already a different submit button on my current page, so I can't simply make…
kdenney
- 18,343
- 4
- 31
- 27
1448
votes
16 answers
String formatting: % vs. .format vs. f-string literal
There are various string formatting methods:
Python <2.6: "Hello %s" % name
Python 2.6+: "Hello {}".format(name) (uses str.format)
Python 3.6+: f"{name}" (uses f-strings)
Which is better, and for what situations?
The following methods have…
NorthIsUp
- 17,502
- 9
- 29
- 35
1448
votes
27 answers
How can the default node version be set using NVM?
I have installed nvm (ubuntu with zsh shell) with two node version: v6.11.5 and v9.0.0 and the default version in nvm is the v9.0.0
Every time I need to change the node version
$ nvm list
v6.11.5
-> v9.0.0
system
default ->…
Pablo Ezequiel Inchausti
- 16,623
- 7
- 28
- 42
1448
votes
31 answers
Is there a built-in function to print all the current properties and values of an object?
So what I'm looking for here is something like PHP's print_r function.
This is so I can debug my scripts by seeing what's the state of the object in question.
fuentesjr
- 50,920
- 27
- 77
- 81
1448
votes
16 answers
How to remove remote origin from a Git repository
I just did git init to initialize my folder as Git repository and then added a remote repository using git remote add origin URL. Now I want to remove this git remote add origin and add a new repository git remote add origin new-URL. How can I do…
Om3ga
- 30,465
- 43
- 141
- 221
1447
votes
7 answers
Passing parameters to a Bash function
I am trying to search how to pass parameters in a Bash function, but what comes up is always how to pass parameter from the command line.
I would like to pass parameters within my script. I tried:
myBackupFunction("..", "...", "xx")
function…
stivlo
- 83,644
- 31
- 142
- 199