Most Popular

1500 questions
1111
votes
10 answers

Difference between CR LF, LF and CR line break types

I'd like to know the difference (with examples if possible) between CR LF (Windows), LF (Unix) and CR (Macintosh) line break types.
eozzy
  • 66,048
  • 104
  • 272
  • 428
1110
votes
14 answers

How to display Base64 images in HTML

I'm having trouble displaying a Base64 image inline. How can I do it? Display Image
Christopher
  • 12,057
  • 9
  • 31
  • 37
1110
votes
27 answers

Switch focus between editor and integrated terminal

Does anyone know the keyboard shortcut (Mac and Linux) to switch the focus between editor and integrated terminal in Visual Studio Code?
Abhijeet
  • 11,872
  • 5
  • 22
  • 24
1108
votes
8 answers

Do the parentheses after the type name make a difference with new?

If 'Test' is an ordinary class, is there any difference between: Test* test = new Test; and Test* test = new Test();
David Read
  • 11,031
  • 3
  • 17
  • 5
1108
votes
19 answers

Converting unix timestamp string to readable date

I have a string representing a unix timestamp (i.e. "1284101485") in Python, and I'd like to convert it to a readable date. When I use time.strftime, I get a TypeError: >>>import time >>>print time.strftime("%B %d %Y", "1284101485") Traceback (most…
VeryNewToPython
  • 11,113
  • 3
  • 15
  • 3
1107
votes
13 answers

What is a typedef enum in Objective-C?

I don't think I fundamentally understand what an enum is, and when to use it. For example: typedef enum { kCircle, kRectangle, kOblateSpheroid } ShapeType; What is really being declared here?
Craig
  • 16,291
  • 12
  • 43
  • 39
1107
votes
15 answers

Are multi-line strings allowed in JSON?

Is it possible to have multi-line strings in JSON? It's mostly for visual comfort so I suppose I can just turn word wrap on in my editor, but I'm just kinda curious. I'm writing some data files in JSON format and would like to have some really long…
Anonnobody
  • 11,239
  • 2
  • 18
  • 6
1106
votes
33 answers

"Uncaught SyntaxError: Cannot use import statement outside a module" when importing ECMAScript 6

I'm using ArcGIS JSAPI 4.12 and wish to use Spatial Illusions to draw military symbols on a map. When I add milsymbol.js to the script, the console returns error Uncaught SyntaxError: Cannot use import statement outside a module` so I add…
Jerry Chen
  • 11,595
  • 5
  • 13
  • 16
1106
votes
31 answers

Randomize a List

What is the best way to randomize the order of a generic list in C#? I've got a finite set of 75 numbers in a list I would like to assign a random order to, in order to draw them for a lottery type application.
mirezus
  • 13,892
  • 11
  • 37
  • 42
1106
votes
18 answers

What is the difference between '@' and '=' in directive scope in AngularJS?

I've read the AngularJS documentation on the topic carefully, and then fiddled around with a directive. Here's the fiddle. And here are some relevant snippets: From the HTML: {{text}} From the pane…
iwein
  • 25,788
  • 10
  • 70
  • 111
1105
votes
47 answers

Exclude a column using SELECT * [except columnA] FROM tableA?

We all know that to select all columns from a table, we can use SELECT * FROM tableA Is there a way to exclude column(s) from a table without specifying all the columns? SELECT * [except columnA] FROM tableA The only way that I know is to manually…
uuɐɯǝʃǝs
1105
votes
3 answers

Search all of Git history for a string

I have a code base which I want to push to GitHub as open source. In this Git-controlled source tree, I have certain configuration files which contain passwords. I made sure not to track this file and I also added it to the .gitignore file. However,…
Jorge Israel Peña
  • 36,800
  • 16
  • 93
  • 123
1105
votes
5 answers

Why does the C preprocessor interpret the word "linux" as the constant "1"?

Why does the C preprocessor in GCC interpret the word linux (small letters) as the constant 1? test.c: #include int main(void) { int linux = 5; return 0; } Result of $ gcc -E test.c (stop after the preprocessing…
ahmedaly50
  • 7,765
  • 3
  • 12
  • 7
1105
votes
20 answers

Save PL/pgSQL output from PostgreSQL to a CSV file

What is the easiest way to save PL/pgSQL output from a PostgreSQL database to a CSV file? I'm using PostgreSQL 8.4 with pgAdmin III and PSQL plugin where I run queries from.
Hoff
  • 38,776
  • 17
  • 74
  • 99
1105
votes
9 answers

Should I use 'has_key()' or 'in' on Python dicts?

Given: >>> d = {'a': 1, 'b': 2} Which of the following is the best way to check if 'a' is in d? >>> 'a' in d True >>> d.has_key('a') True
igorgue
  • 17,884
  • 13
  • 37
  • 54