Most Popular
1500 questions
1221
votes
33 answers
Get difference between two lists with Unique Entries
I have two lists in Python:
temp1 = ['One', 'Two', 'Three', 'Four']
temp2 = ['One', 'Two']
Assuming the elements in each list are unique, I want to create a third list with items from the first list which are not in the second list:
temp3 =…

Max Frai
- 61,946
- 78
- 197
- 306
1220
votes
29 answers
How do I get ASP.NET Web API to return JSON instead of XML using Chrome?
Using the newer ASP.NET Web API, in Chrome I am seeing XML - how can I change it to request JSON so I can view it in the browser? I do believe it is just part of the request headers, am I correct in that?

naspinski
- 34,020
- 36
- 111
- 167
1220
votes
16 answers
How can I navigate back to the last cursor position in Visual Studio Code?
What is the keyboard shortcut to navigate back to the last cursor position in Visual Studio Code?

kimsagro
- 15,513
- 17
- 54
- 69
1220
votes
31 answers
What is the difference between a Docker image and a container?
When using Docker, we start with a base image. We boot it up, create changes and those changes are saved in layers forming another image.
So eventually I have an image for my PostgreSQL instance and an image for my web application, changes to which…

Bibek Shrestha
- 32,848
- 7
- 31
- 34
1219
votes
29 answers
Has Django served an excess of 100k daily visits?
I'm building a web application with Django. The reasons I chose Django were:
I wanted to work with free/open-source tools.
I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to…

Roee Adler
- 33,434
- 32
- 105
- 133
1219
votes
33 answers
How do I get a list of locally installed Python modules?
How do I get a list of Python modules installed on my computer?

Léo Léopold Hertz 준영
- 134,464
- 179
- 445
- 697
1219
votes
29 answers
How to effectively work with multiple files in Vim
I've started using Vim to develop Perl scripts and am starting to find it very powerful.
One thing I like is to be able to open multiple files at once with:
vi main.pl maintenance.pl
and then hop between them with:
:n
:prev
and see which file are…

Edward Tanguay
- 189,012
- 314
- 712
- 1,047
1219
votes
45 answers
How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
I have some code that uses JAXB API classes which have been provided as a part of the JDK in Java 6/7/8. When I run the same code with Java 9, at runtime I get errors indicating that JAXB classes can not be found.
The JAXB classes have been…

Andy Guibert
- 41,446
- 8
- 38
- 61
1219
votes
13 answers
How does the SQL injection from the "Bobby Tables" XKCD comic work?
Just looking at:
(Source: https://xkcd.com/327/)
What does this SQL do:
Robert'); DROP TABLE STUDENTS; --
I know both ' and -- are for comments, but doesn't the word DROP get commented as well since it is part of the same line?

Blankman
- 259,732
- 324
- 769
- 1,199
1217
votes
6 answers
Git: Create a branch from unstaged/uncommitted changes on master
Context: I'm working on master adding a simple feature. After a few minutes I realize it was not so simple and it should have been better to work into a new branch.
This always happens to me and I have no idea how to switch to another branch and…

knoopx
- 17,089
- 7
- 36
- 41
1216
votes
18 answers
Convert character to ASCII code in JavaScript
How can I convert a character to its ASCII code using JavaScript?
For example:
get 10 from "\n".

levik
- 114,835
- 27
- 73
- 90
1216
votes
35 answers
What is an example of the Liskov Substitution Principle?
I have heard that the Liskov Substitution Principle (LSP) is a fundamental principle of object oriented design. What is it and what are some examples of its use?

NotMyself
- 29,209
- 17
- 56
- 74
1216
votes
6 answers
Convert ArrayList to String[] array
I'm working in the android environment and have tried the following code, but it doesn't seem to be working.
String [] stockArr = (String[]) stock_list.toArray();
If I define as follows:
String [] stockArr = {"hello", "world"};
it works. Is there…

locoboy
- 38,002
- 70
- 184
- 260
1216
votes
12 answers
How to compare strings in Bash
How do I compare a variable to a string (and do something if they match)?

Erik Sapir
- 23,209
- 28
- 81
- 141
1216
votes
28 answers
Set select option 'selected', by value
I have a select field with some options in it. Now I need to select one of those options with jQuery. But how can I do that when I only know the value of the option that must be selected?
I have the following HTML:

w00
- 26,172
- 30
- 101
- 147