Highest scored questions

Filter by
Sorted by
Tagged with
3751 votes
63 answers
1.9m views

Is there a (Unix) shell script to format JSON in human-readable form? Basically, I want it to transform the following: { "foo": "lorem", "bar": "ipsum" } ... ...
3744 votes
26 answers
3.1m views

I created a local branch. How do I push it to the remote server?
Jesper Rønn-Jensen's user avatar
3735 votes
33 answers
2.7m views

In Java, are there clear rules on when to use each of access modifiers, namely the default (package private), public, protected and private, while making class and interface and dealing with ...
intrepion's user avatar
  • 39k
3724 votes
19 answers
2.8m views

In an HTML table, the cellpadding and cellspacing can be set like this: <table cellspacing="1" cellpadding="1"> How can the same be accomplished using CSS?
kokos's user avatar
  • 43.7k
3703 votes
30 answers
722k views

When I make changes to a file in Git, how can I commit only some of the changes? For example, how could I commit only 15 lines out of 30 lines that have been changed in a file?
freddiefujiwara's user avatar
3687 votes
40 answers
1.3m views

There have been several questions already posted with specific questions about dependency injection, such as when to use it and what frameworks are there for it. However, What is dependency injection ...
AR.'s user avatar
  • 40.4k
3684 votes
30 answers
2.4m views

How can I print a plain list of all files that were part of a given commit? Although the following lists the files, it also includes unwanted diff information for each: git show ...
Philip Fourie's user avatar
3678 votes
22 answers
1.7m views

For a web page that exists, but for which a user does not have sufficient privileges (they are not logged in or do not belong to the proper user group), what is the proper HTTP response to serve? 401 ...
VirtuosiMedia's user avatar
3671 votes
14 answers
2.6m views

I added a tag to the master branch on my machine: git tag mytag master How do I push this to the remote repository? Running git push gives the message: Everything up-to-date However, the remote ...
Jonas's user avatar
  • 130k
3661 votes
22 answers
3.7m views

How do I print a newline? This merely prints \n: echo -e "Hello,\nWorld!" Output: Hello,\nWorld!
Sergey's user avatar
  • 50.1k
3653 votes
30 answers
3.4m views

I have a string in Bash: string="My string" How can I test if it contains another string? if [ $string ?? 'foo' ]; then echo "It's there!" fi Where ?? is my unknown operator. ...
davidsheldon's user avatar
  • 40.4k
3646 votes
35 answers
1.4m views

I've always been one to simply use: List<String> names = new ArrayList<>(); I use the interface as the type name for portability, so that when I ask questions such as this, I can rework ...
sdellysse's user avatar
  • 39.7k
3627 votes
20 answers
6.9m views

How can I select rows from a DataFrame based on values in some column in Pandas? In SQL, I would use: SELECT * FROM table WHERE column_name = some_value
szli's user avatar
  • 39.3k
3622 votes
48 answers
2.9m views

I have a JavaScript object like the following: var p = { "p1": "value1", "p2": "value2", "p3": "value3" }; How do I loop ...
Tanmoy's user avatar
  • 45.9k
3611 votes
31 answers
5.3m views

In PHP, strings are concatenated together as follows: $foo = "Hello"; $foo .= " World"; Here, $foo becomes "Hello World". How is this accomplished in Bash?
Strawberry's user avatar
  • 68.3k
3611 votes
111 answers
3.6m views

Can I convert a string representing a boolean value (e.g., 'true', 'false') into an intrinsic type in JavaScript? I have a hidden form in HTML that is updated based on a user's selection within a list....
3605 votes
72 answers
7.0m views

How do I format a Javascript Date object as a string? (Preferable format: 10-Aug-2010)
leora's user avatar
  • 198k
3599 votes
20 answers
5.6m views

How do I add a new key to an existing dictionary? It doesn't have an .add() method.
lfaraone's user avatar
  • 50.9k
3593 votes
17 answers
3.9m views

How do I copy a folder from remote to local host using scp? I use ssh to log in to my server. Then, I would like to copy the remote folder foo to local /home/user/Desktop. How do I achieve this?
Slasengger's user avatar
  • 36.2k
3585 votes
10 answers
7.5m views

I'm looking for a string.contains or string.indexof method in Python. I want to do: if not somestring.contains("blah"): continue
Blankman's user avatar
  • 269k
3568 votes
78 answers
1.2m views

I have got a 2.67  GHz Celeron processor, and 1.21  GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android Emulator should start fairly quickly on such a machine, but ...
3556 votes
45 answers
2.9m views

I have an Nginx instance running inside a Docker container. I have a MySQL running on the host system. I want to connect to the MySQL from within my container. MySQL is only binding to the localhost ...
Phil's user avatar
  • 50.9k
3551 votes
32 answers
2.0m views

How can I display JSON in an easy-to-read (for human readers) format? I'm looking primarily for indentation and whitespace, with perhaps even colors / font-styles / etc.
Mark's user avatar
  • 70.5k
3543 votes
48 answers
2.8m views

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 ...
Midhun MP's user avatar
  • 108k
3541 votes
32 answers
7.0m views

How can I convert a String value to an int type? "1234" → 1234
Unknown user's user avatar
  • 45.5k
3533 votes
18 answers
4.0m views

How can I delete a file or folder in Python?
Zygimantas's user avatar
  • 35.7k
3519 votes
41 answers
2.4m views

How do I convert this Ruby code with a multiline string into JavaScript? text = <<"HERE" This Is A Multiline String HERE
Newy's user avatar
  • 40.3k
3513 votes
41 answers
1.5m views

I updated to the latest OS, and/or restarted my computer (this happens on every major update, but this time all I did was restart my computer on 2022-09-13). This morning I navigated to my work's ...
dustbuster's user avatar
  • 82.3k
3505 votes
25 answers
836k views

What is the difference between using Function.prototype.apply() and Function.prototype.call() to invoke a function? const func = function() { alert("Hello world!"); }; func.apply() vs. ...
John Duff's user avatar
  • 38.6k
3505 votes
34 answers
289k views

def foo(a=[]): a.append(5) return a Python novices expect this function called with no parameter to always return a list with only one element: [5]. The result is different and astonishing: &...
Stefano Borini's user avatar
3495 votes
35 answers
1.6m views

How do I globally configure git to use a particular editor (e.g. vim) for commit messages?
brasskazoo's user avatar
  • 79.5k
3494 votes
13 answers
2.2m views

What is the difference between git add [--all | -A] and git add .?
cmcginty's user avatar
  • 118k
3490 votes
27 answers
1.3m views

Is there a way to make the following return true? string title = "ASTRINGTOTEST"; title.Contains("string"); There doesn't seem to be an overload that allows me to set the case ...
Boris Callens's user avatar
3488 votes
28 answers
1.5m views

What do *args and **kwargs mean in these function definitions? def foo(x, y, *args): pass def bar(x, y, **kwargs): pass See What do ** (double star/asterisk) and * (star/asterisk) mean in a ...
Todd's user avatar
  • 36.2k
3478 votes
25 answers
1.2m views

Eclipse issues warnings when a serialVersionUID is missing. The serializable class Foo does not declare a static final serialVersionUID field of type long What is serialVersionUID and why is it ...
ashokgelal's user avatar
  • 81.7k
3477 votes
16 answers
2.7m views

What does git cherry-pick <commit> do?
Rahul's user avatar
  • 47.4k
3476 votes
34 answers
6.2m views

How do I find out which process is listening on a TCP or UDP port on Windows?
readonly's user avatar
  • 358k
3464 votes
21 answers
8.9m views

How can I list all files of a directory in Python and add them to a list?
duhhunjonn's user avatar
  • 45.7k
3457 votes
39 answers
1.3m views

I have heard using namespace std; is wrong, and that I should use std::cout and std::cin directly instead. Why is this? Does it risk declaring variables that share the same name as something in the ...
akbiggs's user avatar
  • 35.3k
3455 votes
34 answers
3.6m views

How can I change the class of an HTML element in response to an onclick or any other events using JavaScript?
Nathan Smith's user avatar
  • 37.7k
3452 votes
17 answers
3.5m views

How can I get the value of an environment variable in Python?
Amit Yadav's user avatar
  • 35.6k
3426 votes
30 answers
786k views

What are the differences between a Service, Provider and Factory in AngularJS?
Lior's user avatar
  • 40.6k
3413 votes
34 answers
5.8m views

I have a dictionary of values read from two fields in a database: a string field and a numeric field. The string field is unique, so that is the key of the dictionary. I can sort on the keys, but how ...
Gern Blanston's user avatar
3412 votes
36 answers
4.0m views

I wanted to create a list of options for testing purposes. At first, I did this: ArrayList<String> places = new ArrayList<String>(); places.add("Buenos Aires"); places.add("Córdoba"); ...
Macarse's user avatar
  • 93.3k
3412 votes
13 answers
522k views

Optimizing SQLite is tricky. Bulk-insert performance of a C application can vary from 85 inserts per second to over 96,000 inserts per second! Background: We are using SQLite as part of a desktop ...
3387 votes
85 answers
2.4m views

How do I iterate over the words of a string composed of words separated by whitespace? Note that I'm not interested in C string functions or that kind of character manipulation/access. I prefer ...
3374 votes
69 answers
2.1m views

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 ...
3367 votes
25 answers
2.3m views

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? For example: >>> my_list = [1, 2, 3] ...
aF.'s user avatar
  • 67k
3365 votes
9 answers
6.6m views

Mod note: This question is about why XMLHttpRequest/fetch/etc. on the browser are subject to the Same Access Policy restrictions (you get errors mentioning CORB or CORS) while Postman is not. This ...
Mr Jedi's user avatar
  • 34.8k
3361 votes
44 answers
2.2m views

I wrote this class for testing: class PassByReference: def __init__(self): self.variable = 'Original' self.change(self.variable) print(self.variable) def change(self, ...
David Sykes's user avatar
  • 50.1k

15 30 50 per page