itemId
stringlengths
1
34
itemType
stringclasses
4 values
site
stringclasses
4 values
scrapedAt
timestamp[s]date
2026-08-03 00:21:25
2026-08-03 04:01:45
tagName
stringlengths
1
34
questionCount
int64
2
2.53M
hasSynonyms
bool
2 classes
isModeratorOnly
bool
1 class
isRequired
bool
1 class
link
stringlengths
32
258
_run_id
stringclasses
57 values
_dataset_id
stringclasses
57 values
questionId
int64
1
80M
title
stringlengths
15
150
score
int64
-10
35.3k
viewCount
int64
6
16.7M
answerCount
int64
0
296
isAnswered
bool
2 classes
hasAcceptedAnswer
bool
2 classes
tags
listlengths
1
6
createdAt
timestamp[s]date
2008-08-01 04:18:04
2026-08-03 03:37:34
lastActivityAt
timestamp[s]date
2008-10-30 09:20:18
2026-08-03 01:36:51
ownerDisplayName
stringlengths
3
30
isClosed
bool
2 classes
contentLicense
stringclasses
3 values
acceptedAnswerId
int64
4
80M
ownerUserId
int64
1
33M
ownerReputation
int64
1
1.53M
userId
int64
13
33M
displayName
stringclasses
897 values
reputation
int64
1
1.53M
userType
stringclasses
3 values
lastAccessAt
timestamp[s]date
2011-01-10 08:55:57
2026-08-03 03:38:13
goldBadges
int64
0
895
silverBadges
int64
0
9.32k
bronzeBadges
int64
0
9.36k
reputationChangeMonth
int64
-40
1.43k
reputationChangeYear
int64
-1,146
11.7k
websiteUrl
stringclasses
302 values
location
stringclasses
279 values
acceptRate
int64
17
100
answerId
int64
1.13k
80M
isAccepted
bool
2 classes
bodyText
stringlengths
31
24.4k
bodyHtml
stringlengths
39
34.9k
answers
listlengths
1
3
answersFetched
int64
0
3
613218
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/613218
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
613,183
null
7,099
null
null
null
null
null
2009-03-05T00:59:34
2020-11-22T19:29:02
Devin Jeanpierre
null
CC BY-SA 4.0
null
18,515
96,214
null
null
null
null
null
null
null
null
null
null
null
null
null
613,218
true
Python 3.7+ or CPython 3.6 Dicts preserve insertion order in Python 3.7+. Same in CPython 3.6, but it's an implementation detail . >>> x = {1: 2, 3: 4, 4: 3, 2: 1, 0: 0} >>> {k: v for k, v in sorted(x.items(), key=lambda item: item[1])} {0: 0, 2: 1, 1: 2, 4: 3, 3: 4} or >>> dict(sorted(x.items(), key=lambda item: item[...
<h3>Python 3.7+ or CPython 3.6</h3> <p>Dicts preserve insertion order in Python 3.7+. Same in CPython 3.6, but <a href="https://stackoverflow.com/q/39980323/4518341">it's an implementation detail</a>.</p> <pre><code>&gt;&gt;&gt; x = {1: 2, 3: 4, 4: 3, 2: 1, 0: 0} &gt;&gt;&gt; {k: v for k, v in sorted(x.items(), key=lam...
null
null
3294899
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/3294899
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
3,294,889
null
7,028
null
null
null
null
null
2010-07-20T22:29:33
2020-01-03T05:46:19
sberry
null
CC BY-SA 4.0
null
141,555
132,811
null
null
null
null
null
null
null
null
null
null
null
null
null
3,294,899
true
key is just a variable name. for key in d: will simply loop over the keys in the dictionary, rather than the keys and values. To loop over both key and value you can use the following: For Python 3.x: for key, value in d.items(): For Python 2.x: for key, value in d.iteritems(): To test for yourself, change the word key...
<p><code>key</code> is just a variable name. </p> <pre><code>for key in d: </code></pre> <p>will simply loop over the keys in the dictionary, rather than the keys and values. To loop over both key and value you can use the following:</p> <p>For Python 3.x:</p> <pre><code>for key, value in d.items(): </code></pre>...
null
null
7220510
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/7220510
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
4,810,841
null
6,934
null
null
null
null
null
2011-08-28T10:56:51
2017-05-31T10:48:56
user123444555621
null
CC BY-SA 3.0
null
27,862
154,610
null
null
null
null
null
null
null
null
null
null
null
null
null
7,220,510
true
Pretty-printing is implemented natively in JSON.stringify() . The third argument enables pretty printing and sets the spacing to use: var str = JSON.stringify(obj, null, 2); // spacing level = 2 If you need syntax highlighting, you might use some regex magic like so: function syntaxHighlight(json) { if (typeof json != ...
<p><strong><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify" rel="noreferrer">Pretty-printing is implemented natively in <code>JSON.stringify()</code></a></strong>. The third argument enables pretty printing and sets the spacing to use:</p> <pre><code>var str = J...
null
null
80113
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/80113
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
79,923
null
6,917
null
null
null
null
null
2008-09-17T04:52:19
2021-11-28T14:10:20
Jeff Hill
null
CC BY-SA 4.0
null
14,742
71,440
null
null
null
null
null
null
null
null
null
null
null
null
null
80,113
true
The stack is the memory set aside as scratch space for a thread of execution. When a function is called, a block is reserved on the top of the stack for local variables and some bookkeeping data. When that function returns, the block becomes unused and can be used the next time a function is called. The stack is always...
<p>The stack is the memory set aside as scratch space for a thread of execution. When a function is called, a block is reserved on the top of the stack for local variables and some bookkeeping data. When that function returns, the block becomes unused and can be used the next time a function is called. The stack is ...
null
null
586189
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/586189
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
586,182
null
6,880
null
null
null
null
null
2009-02-25T14:32:56
2024-05-24T03:38:18
tvanfosson
null
CC BY-SA 4.0
null
12,950
534,709
null
null
null
null
null
null
null
null
null
null
null
null
null
586,189
true
You want the splice function on the native array object. arr.splice(index, 0, item); will insert item into arr at the specified index (deleting 0 items first, that is, it's just an insert). In this example we will create an array and add an element to it into index 2: var arr = []; arr[0] = "Jani"; arr[1] = "Hege"; arr...
<p>You want the <strong><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice" rel="noreferrer"><code>splice</code></a></strong> function on the native array object.</p> <p><code>arr.splice(index, 0, item);</code> will insert <code>item</code> into <code>arr</code> at th...
null
null
82852
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/82852
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
82,831
null
6,797
null
null
null
null
null
2008-09-17T12:57:51
2024-06-29T17:58:04
rslite
null
CC BY-SA 4.0
null
15,682
85,592
null
null
null
null
null
null
null
null
null
null
null
null
null
82,852
false
If the reason you're checking is so you can do something like if file_exists: open_it() , it's safer to use a try around the attempt to open it. Checking and then opening risks the file being deleted or moved or something between when you check and when you try to open it. If you're not planning to open the file immedi...
<p>If the reason you're checking is so you can do something like <code>if file_exists: open_it()</code>, it's safer to use a <code>try</code> around the attempt to open it. Checking and then opening risks the file being deleted or moved or something between when you check and when you try to open it.</p> <p>If you're n...
null
null
38578
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/38578
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
38,549
null
6,755
null
null
null
null
null
2008-09-01T22:59:34
2021-12-14T01:51:41
Mark Harrison
null
CC BY-SA 4.0
null
116
306,711
null
null
null
null
null
null
null
null
null
null
null
null
null
38,578
true
Assuming you're joining on columns with no duplicates, which is a very common case: An inner join of A and B gives the result of A intersect B, i.e. the inner part of a Venn diagram intersection. An outer join of A and B gives the results of A union B, i.e. the outer parts of a Venn diagram union. Examples Suppose you ...
<p>Assuming you're joining on columns with no duplicates, which is a very common case:</p> <ul> <li><p>An inner join of A and B gives the result of A intersect B, i.e. the inner part of a <a href="http://en.wikipedia.org/wiki/Venn_diagram" rel="noreferrer">Venn diagram</a> intersection.</p> </li> <li><p>An outer join o...
null
null
46181
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/46181
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
46,155
null
6,668
null
null
null
null
null
2008-09-05T16:15:34
2023-08-31T18:18:10
John Rutherford
null
CC BY-SA 4.0
null
3,880
10,702
null
null
null
null
null
null
null
null
null
null
null
null
null
46,181
true
Using regular expressions is probably the best way of validating an email address in JavaScript. View a bunch of tests on JSFiddle taken from Chromium . const validateEmail = (email) => { return String(email) .toLowerCase() .match( /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}...
<p>Using <a href="http://en.wikipedia.org/wiki/Regular_expression" rel="noreferrer">regular expressions</a> is probably the best way of validating an email address in JavaScript. <a href="http://jsfiddle.net/ghvj4gy9/embedded/result.js" rel="noreferrer">View a bunch of tests on JSFiddle</a> taken from <a href="https://...
null
null
509295
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/509295
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
509,211
null
6,664
null
null
null
null
null
2009-02-03T22:48:24
2024-05-15T16:00:07
Greg Hewgill
null
CC BY-SA 4.0
null
893
1,007,155
null
null
null
null
null
null
null
null
null
null
null
null
null
509,295
true
The syntax is: a[start:stop] # items start through stop-1 a[start:] # items start through the rest of the array a[:stop] # items from the beginning through stop-1 a[:] # a copy of the whole array There is also the step value, which can be used with any of the above: a[start:stop:step] # start through not past stop, by ...
<p>The syntax is:</p> <pre><code>a[start:stop] # items start through stop-1 a[start:] # items start through the rest of the array a[:stop] # items from the beginning through stop-1 a[:] # a copy of the whole array </code></pre> <p>There is also the <code>step</code> value, which can be used with a...
null
null
14220323
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/14220323
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
14,220,321
null
6,659
null
null
null
null
null
2013-01-08T17:06:14
2022-04-08T13:02:30
Felix Kling
null
CC BY-SA 4.0
null
218,196
821,265
null
null
null
null
null
null
null
null
null
null
null
null
null
14,220,323
true
→ For a more general explanation of asynchronous behaviour with different examples, see Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference → If you already understand the problem, skip to the possible solutions below. The problem The A in Ajax stands for asynchronous . Th...
<blockquote> <p><em>→ For a more general explanation of asynchronous behaviour with different examples, see</em> <a href="https://stackoverflow.com/q/23667086/218196">Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference</a></p> <p><em>→ If you already understand the problem...
null
null
17071908
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/17071908
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
17,071,871
null
6,653
null
null
null
null
null
2013-06-12T17:44:20
2023-09-26T05:14:31
unutbu
null
CC BY-SA 4.0
null
190,597
888,423
null
null
null
null
null
null
null
null
null
null
null
null
null
17,071,908
true
To select rows whose column value equals a scalar, some_value , use == : df.loc[df['column_name'] == some_value] To select rows whose column value is in an iterable, some_values , use isin : df.loc[df['column_name'].isin(some_values)] Combine multiple conditions with & : df.loc[(df['column_name'] >= A) & (df['column_na...
<p>To select rows whose column value equals a scalar, <code>some_value</code>, use <code>==</code>:</p> <pre><code>df.loc[df['column_name'] == some_value] </code></pre> <p>To select rows whose column value is in an iterable, <code>some_values</code>, use <code>isin</code>:</p> <pre><code>df.loc[df['column_name'].isin(s...
null
null
3207973
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/3207973
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
3,207,219
null
6,617
null
null
null
null
null
2010-07-08T21:01:11
2023-11-27T15:59:32
pycruft
null
CC BY-SA 4.0
null
346,573
69,475
null
null
null
null
null
null
null
null
null
null
null
null
null
3,207,973
false
os.listdir() returns everything inside a directory -- including both files and directories . os.path 's isfile() can be used to only list files: from os import listdir from os.path import isfile, join onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))] Alternatively, os.walk() yields two lists for each ...
<p><strong><a href="https://docs.python.org/3/library/os.html#os.listdir" rel="noreferrer" title="os.listdir"><code>os.listdir()</code></a></strong> returns everything inside a directory -- including both <strong>files</strong> and <strong>directories</strong>.</p> <p><a href="https://docs.python.org/3/library/os.path....
null
null
21699210
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/21699210
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
3,790,454
null
6,608
null
null
null
null
null
2014-02-11T10:27:28
2025-10-13T10:06:40
Steve Bennett
null
CC BY-SA 4.0
null
263,268
130,940
null
null
null
null
null
null
null
null
null
null
null
null
null
21,699,210
false
There are 5 6 NINE (or 63*, depending how you count) different ways to write multi-line strings in YAML. TL;DR Use > if you want to break a string up for readability but for it to still be treated as a single-line string: interior line breaks will be stripped out, there will only be one line break at the end: key: > Yo...
<p>There are <s>5</s> <em><s>6</s></em> <em><strong>NINE</strong></em> (or 63*, depending how you count) different ways to write multi-line strings in YAML.</p> <h3>TL;DR</h3> <ul> <li><p>Use <code>&gt;</code> if you want to break a string up for readability but for it to still be treated as a single-line string: inter...
null
null
11828573
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/11828573
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
11,828,270
null
6,547
null
null
null
null
null
2012-08-06T12:46:16
2022-11-12T17:49:42
dirvine
null
CC BY-SA 4.0
null
1,445,334
60,459
null
null
null
null
null
null
null
null
null
null
null
null
null
11,828,573
true
Hit the Esc key to enter "Normal mode". Then you can type : to enter "Command-line mode". A colon ( : ) will appear at the bottom of the screen and you can type in one of the following commands. To execute a command, press the Enter key. :q to quit (short for :quit ) :q! to quit without saving (short for :quit! ) :wq t...
<p>Hit the <kbd>Esc</kbd> key to enter &quot;Normal mode&quot;. Then you can type <code>:</code> to enter &quot;Command-line mode&quot;. A colon (<code>:</code>) will appear at the bottom of the screen and you can type in one of the following commands. To execute a command, press the <kbd>Enter</kbd> key.</p> <ul> <li>...
null
null
22345808
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/22345808
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
22,343,224
null
6,505
null
null
null
null
null
2014-03-12T08:28:07
2024-06-14T02:40:24
jgillich
null
CC BY-SA 4.0
null
941,764
77,537
null
null
null
null
null
null
null
null
null
null
null
null
null
22,345,808
true
See the NPM docs and semver docs : ~version “Approximately equivalent to version” , will automatically update you to all future patch versions that are backwards-compatible, without incrementing the minor version. ~1.2.3 will use releases from 1.2.3 to < 1.3.0 . ^version “Compatible with version” , will automatically u...
<p>See the <a href="https://docs.npmjs.com/cli/v8/configuring-npm/package-json#dependencies" rel="noreferrer">NPM docs</a> and <a href="https://docs.npmjs.com/cli/v6/using-npm/semver" rel="noreferrer">semver docs</a>:</p> <ul> <li><p><code>~version</code> <strong>“Approximately equivalent to version”</strong>, will aut...
null
null
215505
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/215505
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
215,497
null
6,459
null
null
null
null
null
2008-10-18T19:57:50
2025-09-13T19:33:59
David Segonds
null
CC BY-SA 4.0
null
13,673
85,233
null
null
null
null
null
null
null
null
null
null
null
null
null
215,505
true
The official tutorial may be of some use to you. Class Package Subclass (same pkg) Subclass (diff pkg) World public ✅ ✅ ✅ ✅ ✅ protected ✅ ✅ ✅ ✅ ❌ no modifier ✅ ✅ ✅ ❌ ❌ private ✅ ❌ ❌ ❌ ❌ ✅: accessible ❌: not accessible
<p><a href="http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html" rel="noreferrer">The official tutorial</a> may be of some use to you.</p> <div class="s-table-container"><table class="s-table"> <thead> <tr> <th></th> <th style="text-align: center;">Class</th> <th style="text-align: center;">Package</t...
null
null
426276
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/426276
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
426,258
null
6,458
null
null
null
null
null
2009-01-08T22:25:08
2019-08-18T19:04:24
Xian
null
CC BY-SA 4.0
null
4,642
76,741
null
null
null
null
null
null
null
null
null
null
null
null
null
426,276
true
Modern jQuery Use .prop() : $('.myCheckbox').prop('checked', true); $('.myCheckbox').prop('checked', false); DOM API If you're working with just one element, you can always just access the underlying HTMLInputElement and modify its .checked property: $('.myCheckbox')[0].checked = true; $('.myCheckbox')[0].checked = fal...
<h2>Modern jQuery</h2> <p>Use <a href="https://api.jquery.com/prop" rel="noreferrer"><code>.prop()</code></a>:</p> <pre><code>$('.myCheckbox').prop('checked', true); $('.myCheckbox').prop('checked', false); </code></pre> <h2>DOM API</h2> <p>If you're working with just one element, you can always just access the und...
null
null
11304926
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/11304926
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
11,304,895
null
6,416
null
null
null
null
null
2012-07-03T05:21:39
2020-10-15T01:21:14
Gryphius
null
CC BY-SA 4.0
null
774,116
79,936
null
null
null
null
null
null
null
null
null
null
null
null
null
11,304,926
true
scp -r user@your.server.example.com:/path/to/foo /home/user/Desktop/ By not including the trailing '/' at the end of foo, you will copy the directory itself (including contents), rather than only the contents of the directory. From man scp (See online manual ) -r Recursively copy entire directories
<pre><code>scp -r user@your.server.example.com:/path/to/foo /home/user/Desktop/ </code></pre> <p>By not including the trailing '/' at the end of foo, you will copy the directory itself (including contents), rather than only the contents of the directory.</p> <p>From <code>man scp</code> (See <a href="http://man7.org/li...
null
null
9229821
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/9229821
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
9,229,645
null
6,306
null
null
null
null
null
2012-02-10T15:05:41
2025-05-16T18:57:23
georg
null
CC BY-SA 4.0
null
989,121
215,811
null
null
null
null
null
null
null
null
null
null
null
null
null
9,229,821
false
TL;DR Using the Set constructor and the spread syntax : uniq = [...new Set(array)]; ( Note that var uniq will be an array... new Set() turns it into a set, but [... ] turns it back into an array again ) "Smart" but naïve way uniqueArray = a.filter(function(item, pos) { return a.indexOf(item) == pos; }) Basically, we it...
<h2>TL;DR</h2> <p>Using the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set" rel="noreferrer">Set</a> constructor and the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax" rel="noreferrer">spread syntax</a>:</p> <pre><code>u...
null
null
2025541
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/2025541
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
2,025,282
null
6,262
null
null
null
null
null
2010-01-08T04:41:53
2024-04-21T14:41:20
Alex Volovoy
null
CC BY-SA 4.0
null
176,761
68,544
null
null
null
null
null
null
null
null
null
null
null
null
null
2,025,541
true
From the Android Developer Documentation : px Pixels - corresponds to actual pixels on the screen. in Inches - based on the physical size of the screen. 1 Inch OR 2.54 centimeters mm > Millimeters - based on the physical size of the screen. pt > Points - 1/72 of an inch based on the physical size of the screen. dp or d...
<p>From the <a href="http://developer.android.com/guide/topics/resources/more-resources.html#Dimension" rel="noreferrer">Android Developer Documentation</a>:</p> <ol> <li> <blockquote> <p><strong>px</strong><br /> <strong>Pixels</strong> - corresponds to actual pixels on the screen.</p> </blockquote> </li> <li> <blockq...
null
null
135614
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/135614
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
134,882
null
6,229
null
null
null
null
null
2008-09-25T19:56:28
2025-03-20T18:01:33
Lara Bailey
null
CC BY-SA 4.0
null
19,563
805,258
null
null
null
null
null
null
null
null
null
null
null
null
null
135,614
true
The easiest way would be to find the head commit of the branch as it was immediately before the rebase started in the reflog ... git reflog and to reset the current branch to it. Suppose the old commit was HEAD@{2} in the ref log: git reset --soft "HEAD@{2}" (If you do not want to retain the working copy changes, you c...
<p>The easiest way would be to find the head commit of the branch as it was immediately before the rebase started in the <a href="https://git-scm.com/docs/git-reflog" rel="noreferrer">reflog</a>...</p> <pre><code>git reflog </code></pre> <p>and to reset the current branch to it.</p> <p>Suppose the old commit was <code>...
null
null
221297
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/221297
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
221,294
null
6,184
null
null
null
null
null
2008-10-21T09:32:32
2022-08-07T22:28:24
daveb
null
CC BY-SA 4.0
null
11,858
76,599
null
null
null
null
null
null
null
null
null
null
null
null
null
221,297
true
Timestamp in milliseconds To get the number of milliseconds since Unix epoch , call Date.now : Date.now() Alternatively, use the unary operator + to call Date.prototype.valueOf : + new Date() Alternatively, call valueOf directly: new Date().valueOf() To support IE8 and earlier (see compatibility table ), create a shim ...
<h3>Timestamp in milliseconds</h3> <p>To get the number of milliseconds since <a href="https://en.wikipedia.org/wiki/Unix_time" rel="noreferrer">Unix epoch</a>, call <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now" rel="noreferrer"><code>Date.now</code></a>:</p> <pre><...
null
null
59839
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/59839
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
59,838
null
6,163
null
null
null
null
null
2008-09-12T20:07:06
2022-08-01T01:21:58
Grundlefleck
null
CC BY-SA 4.0
null
4,120
130,465
null
null
null
null
null
null
null
null
null
null
null
null
null
59,839
true
To check if a directory exists: if [ -d "$DIRECTORY" ]; then echo "$DIRECTORY does exist." fi To check if a directory does not exist: if [ ! -d "$DIRECTORY" ]; then echo "$DIRECTORY does not exist." fi However, as Jon Ericson points out, subsequent commands may not work as intended if you do not take into account that ...
<p>To check if a directory exists:</p> <pre><code>if [ -d &quot;$DIRECTORY&quot; ]; then echo &quot;$DIRECTORY does exist.&quot; fi </code></pre> <p>To check if a directory does not exist:</p> <pre><code>if [ ! -d &quot;$DIRECTORY&quot; ]; then echo &quot;$DIRECTORY does not exist.&quot; fi </code></pre> <hr /> <p>...
null
null
417184
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/417184
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
417,142
null
6,159
null
null
null
null
null
2009-01-06T16:22:18
2025-05-08T14:09:15
Paul Dixon
null
CC BY-SA 4.0
null
6,521
302,402
null
null
null
null
null
null
null
null
null
null
null
null
null
417,184
true
Short answer - de facto limit of 2000 characters If you keep URLs under 2000 characters, they'll work in virtually any combination of client and server software, and any search engine. For specific use cases, longer URLs can be considered. Outside of search engines, 8000 characters offers wide compatibility as of 2023....
<h2>Short answer - de facto limit of 2000 characters</h2> <p>If you keep URLs under 2000 characters, they'll work in virtually any combination of client and server software, and any search engine.</p> <p>For specific use cases, longer URLs can be considered. Outside of search engines, 8000 characters offers wide compat...
null
null
513839
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/513839
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
513,832
null
6,154
null
null
null
null
null
2009-02-04T23:19:49
2023-11-20T14:05:47
Aaron Maenpaa
null
CC BY-SA 4.0
null
2,603
123,778
null
null
null
null
null
null
null
null
null
null
null
null
null
513,839
true
== tests for reference equality (whether they are the same object). .equals() tests for value equality (whether they contain the same data). Objects.equals() checks for null before calling .equals() so you don't have to (available as of JDK7, also available in Guava ). Consequently, if you want to test whether two stri...
<p><code>==</code> tests for reference equality (whether they are the same object).</p> <p><code>.equals()</code> tests for value equality (whether they contain the same data).</p> <p><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Objects.html#equals(java.lang.Object,%20java.lang.Object)" rel="noreferrer">...
null
null
388282
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/388282
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
388,242
null
6,150
null
null
null
null
null
2008-12-23T05:52:48
2025-01-21T19:44:54
Johannes Schaub - litb
null
CC BY-SA 4.0
null
34,509
510,741
null
null
null
null
null
null
null
null
null
null
null
null
null
388,282
false
Beginner Introductory, no previous programming experience Book Author(s) Description review C++ Primer * * Not to be confused with C++ Primer Plus (Stephen Prata), with a significantly less favorable review . Stanley Lippman, Josée Lajoie, and Barbara E. Moo ( updated for C++11 ) Coming at 1k pages, this is a very thor...
<h2>Beginner</h2> <h3>Introductory, no previous programming experience</h3> <div class="s-table-container"><table class="s-table"> <thead> <tr> <th>Book</th> <th>Author(s)</th> <th>Description</th> <th>review</th> </tr> </thead> <tbody> <tr> <td><a href="https://rads.stackoverflow.com/amzn/click/com/0321714113" rel="no...
null
null
2334741
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/2334741
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
2,334,712
null
6,128
null
null
null
null
null
2010-02-25T14:39:55
2016-04-30T01:26:35
Robin Day
null
CC BY-SA 3.0
null
40,655
102,998
null
null
null
null
null
null
null
null
null
null
null
null
null
2,334,741
true
UPDATE Table_A SET Table_A.col1 = Table_B.col1, Table_A.col2 = Table_B.col2 FROM Some_Table AS Table_A INNER JOIN Other_Table AS Table_B ON Table_A.id = Table_B.id WHERE Table_A.col3 = 'cool'
<pre><code>UPDATE Table_A SET Table_A.col1 = Table_B.col1, Table_A.col2 = Table_B.col2 FROM Some_Table AS Table_A INNER JOIN Other_Table AS Table_B ON Table_A.id = Table_B.id WHERE Table_A.col3 = 'cool' </code></pre>
null
null
5201642
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/5201642
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
5,189,560
null
6,119
null
null
null
null
null
2011-03-05T04:19:17
2025-09-26T14:16:46
Chris Johnsen
null
CC BY-SA 4.0
null
193,688
228,664
null
null
null
null
null
null
null
null
null
null
null
null
null
5,201,642
false
You can do this fairly easily without git rebase or git merge --squash . In this example, we'll squash the last 3 commits: git reset --soft HEAD~3 If you also want to write the new commit message from scratch, this suffices: git reset --soft HEAD~3 git commit -m "Squashed commit" If you want to start editing the new co...
<p>You can do this fairly easily without <code>git rebase</code> or <code>git merge --squash</code>. In this example, we'll squash the last 3 commits:</p> <pre class="lang-sh prettyprint-override"><code>git reset --soft HEAD~3 </code></pre> <p>If you also want to write the new commit message from scratch, this suffice...
null
null
176921
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/176921
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
176,918
null
6,115
null
null
null
null
null
2008-10-07T01:40:49
2023-01-02T16:49:23
Alex Coventry
null
CC BY-SA 4.0
null
1,941,213
71,343
null
null
null
null
null
null
null
null
null
null
null
null
null
176,921
true
>>> ["foo", "bar", "baz"].index("bar") 1 See the documentation for the built-in .index() method of the list: list.index(x[, start[, end]]) Return zero-based index in the list of the first item whose value is equal to x . Raises a ValueError if there is no such item. The optional arguments start and end are interpreted ...
<pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;].index(&quot;bar&quot;) 1 </code></pre> <p>See <a href="https://docs.python.org/tutorial/datastructures.html#more-on-lists" rel="noreferrer">the documentation</a> for the built-in <code>.index()</code> method...
null
null
7572252
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/7572252
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
4,181,861
null
6,103
null
null
null
null
null
2011-09-27T16:07:11
2024-10-30T17:45:58
baisong
null
CC BY-SA 4.0
null
581,625
61,334
null
null
null
null
null
null
null
null
null
null
null
null
null
7,572,252
false
Maybe you just need to commit. I ran into this when I did: mkdir repo && cd repo git init git remote add origin /path/to/origin.git git add . Oops! Never committed! git push -u origin master error: src refspec master does not match any. All I had to do was: git commit -m "initial commit" git push origin main Success!
<p>Maybe you just need to commit. I ran into this when I did:</p> <pre class="lang-bash prettyprint-override"><code>mkdir repo &amp;&amp; cd repo git init git remote add origin /path/to/origin.git git add . </code></pre> <p>Oops! Never committed!</p> <pre><code>git push -u origin master error: src refspec master does n...
null
null
5195913
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/5195913
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
5,195,859
null
6,062
null
null
null
null
null
2011-03-04T15:40:30
2024-04-24T21:55:14
Trevor
null
CC BY-SA 4.0
null
207,162
61,883
null
null
null
null
null
null
null
null
null
null
null
null
null
5,195,913
false
To push a single tag: git push origin tag <tag_name> And the following command should push all tags ( not recommended ): # not recommended git push --tags
<p>To push a <strong>single</strong> tag:</p> <pre><code>git push origin tag &lt;tag_name&gt; </code></pre> <p>And the following command should push <strong>all</strong> tags (<strong>not recommended</strong>):</p> <pre><code># not recommended git push --tags </code></pre>
null
null
29973358
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/29973358
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
29,973,357
null
6,023
null
null
null
null
null
2015-04-30T16:43:35
2026-01-13T20:46:30
npc2b
null
CC BY-SA 4.0
null
1,730,061
71,593
null
null
null
null
null
null
null
null
null
null
null
null
null
29,973,358
true
The code formatting is available in Visual Studio Code through the following shortcuts: On Windows Shift + Alt + F On Mac Shift + Option + F On Linux Ctrl + Shift + I Alternatively, you can find the shortcut, as well as other shortcuts, through the submenu View / Command Palette , also provided in the editor with Ctrl ...
<p>The code formatting is available in Visual Studio Code through the following shortcuts:</p> <ul> <li>On Windows <kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>F</kbd></li> <li>On Mac <kbd>Shift</kbd> + <kbd>Option</kbd> + <kbd>F</kbd></li> <li>On Linux <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>I</kbd></li> </ul> <p>Altern...
null
null
122704
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/122704
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
122,102
null
6,002
null
null
null
null
null
2008-09-23T18:09:37
2024-05-21T22:56:53
John Resig
null
CC BY-SA 4.0
null
6,524
36,591
null
null
null
null
null
null
null
null
null
null
null
null
null
122,704
true
Native deep cloning There's now a structuredClone(value) function supported in all major browsers and node >= 17. It has polyfills for older systems . structuredClone(value) If needed, loading the polyfill first: import structuredClone from '@ungap/structured-clone'; See this answer for more details, but note these lim...
<h1>Native deep cloning</h1> <p>There's now a <a href="https://developer.mozilla.org/en-US/docs/Web/API/structuredClone" rel="noreferrer"><code>structuredClone(value)</code></a> function supported in all major browsers and node &gt;= 17. It has <a href="https://www.npmjs.com/package/@ungap/structured-clone" rel="norefe...
null
null
89243
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/89243
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
89,228
null
5,978
null
null
null
null
null
2008-09-18T01:39:35
2023-05-19T23:52:54
David Cournapeau
null
CC BY-SA 4.0
null
11,465
81,296
null
null
null
null
null
null
null
null
null
null
null
null
null
89,243
true
Use subprocess.run : import subprocess subprocess.run(["ls", "-l"]) Another common way is os.system but you shouldn't use it because it is unsafe if any parts of the command come from outside your program or can contain spaces or other special characters, also subprocess.run is generally more flexible (you can get the ...
<p>Use <a href="https://docs.python.org/library/subprocess.html#subprocess.run" rel="noreferrer"><code>subprocess.run</code></a>:</p> <pre class="lang-py prettyprint-override"><code>import subprocess subprocess.run([&quot;ls&quot;, &quot;-l&quot;]) </code></pre> <p>Another common way is <a href="https://docs.python.o...
null
null
46908
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/46908
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
46,898
null
5,965
null
null
null
null
null
2008-09-05T21:15:52
2021-07-07T11:50:48
ScArcher2
null
CC BY-SA 4.0
null
1,310
87,543
null
null
null
null
null
null
null
null
null
null
null
null
null
46,908
true
Map<String, String> map = ... for (Map.Entry<String, String> entry : map.entrySet()) { System.out.println(entry.getKey() + "/" + entry.getValue()); } On Java 10+: for (var entry : map.entrySet()) { System.out.println(entry.getKey() + "/" + entry.getValue()); }
<pre class="lang-java prettyprint-override"><code>Map&lt;String, String&gt; map = ... for (Map.Entry&lt;String, String&gt; entry : map.entrySet()) { System.out.println(entry.getKey() + &quot;/&quot; + entry.getValue()); } </code></pre> <p>On Java 10+:</p> <pre class="lang-java prettyprint-override"><code>for (var e...
null
null
252711
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/252711
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
252,703
null
5,933
null
null
null
null
null
2008-10-31T06:02:25
2024-04-24T20:34:06
kender
null
CC BY-SA 4.0
null
4,172
87,601
null
null
null
null
null
null
null
null
null
null
null
null
null
252,711
true
.append() appends a single object at the end of the list: >>> x = [1, 2, 3] >>> x.append([4, 5]) >>> print(x) [1, 2, 3, [4, 5]] .extend() appends multiple objects that are taken from inside the specified iterable: >>> x = [1, 2, 3] >>> x.extend([4, 5]) >>> print(x) [1, 2, 3, 4, 5]
<p><a href="https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types" rel="noreferrer"><code>.append()</code></a> appends a <strong>single object</strong> at the end of the list:</p> <pre><code>&gt;&gt;&gt; x = [1, 2, 3] &gt;&gt;&gt; x.append([4, 5]) &gt;&gt;&gt; print(x) [1, 2, 3, [4, 5]] </code></pre> <...
null
null
7173011
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/7173011
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
7,172,784
null
5,892
null
null
null
null
null
2011-08-24T09:12:29
2023-03-29T18:43:53
Sean Patrick Floyd
null
CC BY-SA 4.0
null
342,852
301,057
null
null
null
null
null
null
null
null
null
null
null
null
null
7,173,011
true
You need to set your content-type to application/json. But -d (or --data ) sends the Content-Type application/x-www-form-urlencoded by default, which is not accepted on Spring's side. Looking at the curl man page , I think you can use -H (or --header ): -H "Content-Type: application/json" Full example: curl --header "C...
<p>You need to set your content-type to application/json. But <a href="https://curl.haxx.se/docs/manpage.html#-d" rel="noreferrer"><code>-d</code></a> (or <code>--data</code>) sends the Content-Type <code>application/x-www-form-urlencoded</code> by default, which is not accepted on Spring's side.</p> <p>Looking at the ...
null
null
10335943
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/10335943
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
10,335,747
null
5,884
null
null
null
null
null
2012-04-26T14:52:40
2026-07-15T15:29:56
Hailei
null
CC BY-SA 4.0
null
1,241,690
42,133
null
null
null
null
null
null
null
null
null
null
null
null
null
10,335,943
true
You must login to developer.apple before using the links on this page. See Xcode versions at: developer.apple.com/download/all/?q=xcode To install Xcode, download a file below, double-click to unzip, and simply move to the Applications folder. (To have more than one version of Xcode: simply name them differently on the...
<p>You must <a href="https://developer.apple.com/account/" rel="nofollow noreferrer">login</a> to developer.apple before using the links on this page.</p> <p>See Xcode versions at: <a href="https://developer.apple.com/download/all/?q=xcode" rel="nofollow noreferrer">developer.apple.com/download/all/?q=xcode</a></p> <p>...
null
null
606199
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/606199
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
606,191
null
5,881
null
null
null
null
null
2009-03-03T12:26:18
2024-02-05T13:32:31
Aaron Maenpaa
null
CC BY-SA 4.0
null
2,603
123,778
null
null
null
null
null
null
null
null
null
null
null
null
null
606,199
true
Decode the bytes object to produce a string: >>> b"abcde".decode("utf-8") 'abcde' The above example assumes that the bytes object is in UTF-8, because it is a common encoding. However, you should use the encoding your data is actually in!
<p><a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode" rel="noreferrer">Decode the <code>bytes</code> object</a> to produce a string:</p> <pre><code>&gt;&gt;&gt; b&quot;abcde&quot;.decode(&quot;utf-8&quot;) 'abcde' </code></pre> <p>The above example <em>assumes</em> that the <code>bytes</code> object...
null
null
37576787
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/37576787
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
37,576,685
null
5,807
null
null
null
null
null
2016-06-01T19:02:09
2020-02-08T23:30:30
Bergi
null
CC BY-SA 4.0
null
1,048,572
671,974
null
null
null
null
null
null
null
null
null
null
null
null
null
37,576,787
true
Sure the code does work, but I'm pretty sure it doesn't do what you expect it to do. It just fires off multiple asynchronous calls, but the printFiles function does immediately return after that. Reading in sequence If you want to read the files in sequence, you cannot use forEach indeed. Just use a modern for … of loo...
<p>Sure the code does work, but I'm pretty sure it doesn't do what you expect it to do. It just fires off multiple asynchronous calls, but the <code>printFiles</code> function does immediately return after that.</p> <h3>Reading in sequence</h3> <p>If you want to read the files in sequence, <strong>you cannot use <cod...
null
null
1129270
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1129270
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,129,216
null
5,804
null
null
null
null
null
2009-07-15T03:35:51
2022-12-10T22:19:06
Wogan
null
CC BY-SA 4.0
null
137,902
73,027
null
null
null
null
null
null
null
null
null
null
null
null
null
1,129,270
true
It's easy enough to write your own comparison function: function compare( a, b ) { if ( a.last_nom < b.last_nom ){ return -1; } if ( a.last_nom > b.last_nom ){ return 1; } return 0; } objs.sort( compare ); Or inline ( c/o Marco Demaio ): objs.sort((a,b) => (a.last_nom > b.last_nom) ? 1 : ((b.last_nom > a.last_nom) ? -1...
<p>It's easy enough to write your own comparison function:</p> <pre><code>function compare( a, b ) { if ( a.last_nom &lt; b.last_nom ){ return -1; } if ( a.last_nom &gt; b.last_nom ){ return 1; } return 0; } objs.sort( compare ); </code></pre> <p>Or inline (<a href="https://stackoverflow.com/question...
null
null
5515349
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/5515349
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
5,515,310
null
5,791
null
null
null
null
null
2011-04-01T15:17:44
2023-02-03T13:12:10
jAndy
null
CC BY-SA 4.0
null
1,386,886
236,731
null
null
null
null
null
null
null
null
null
null
null
null
null
5,515,349
true
You can just check if the variable has a truthy value or not. That means if (value) { // do something.. } will evaluate to true if value is not : null undefined NaN empty string ("") 0 false The above list represents all possible falsy values in ECMA-/Javascript. Find it in the specification at the ToBoolean section. F...
<p>You can just check if the <em>variable</em> has a <code>truthy</code> value or not. That means</p> <pre><code>if (value) { // do something.. } </code></pre> <p>will evaluate to <code>true</code> if <code>value</code> is <strong>not</strong>:</p> <ul> <li>null</li> <li>undefined</li> <li>NaN</li> <li>empty string...
null
null
2117523
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/2117523
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
105,034
null
5,766
null
null
null
null
null
2010-01-22T13:40:20
2024-03-23T17:11:44
broofa
null
CC BY-SA 4.0
null
109,538
38,371
null
null
null
null
null
null
null
null
null
null
null
null
null
2,117,523
false
[Edited 2023-03-05 to reflect latest best-practices for producing RFC4122-compliant UUIDs] crypto.randomUUID() is now standard on all modern browsers and JS runtimes. However, because new browser APIs are restricted to secure contexts , this method is only available to pages served locally ( localhost or 127.0.0.1 ) or...
<p><em>[Edited 2023-03-05 to reflect latest best-practices for producing RFC4122-compliant UUIDs]</em></p> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID" rel="noreferrer"><code>crypto.randomUUID()</code></a> is now standard on all modern browsers and JS runtimes. However, because <a hr...
null
null
1338744
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1338744
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,338,728
null
5,742
null
null
null
null
null
2009-08-27T03:44:04
2024-03-30T21:31:37
gahooa
null
CC BY-SA 4.0
null
64,004
138,710
null
null
null
null
null
null
null
null
null
null
null
null
null
1,338,744
true
Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES . Be sure to stash any local changes you want to keep before running this command. Assuming you are sitting on that commit, then this command will wack it... git reset --hard HEAD~1 The HEAD~1 means the commit before head. Or, you could look at the ou...
<p><strong>Careful:</strong> <code>git reset --hard</code> <strong>WILL DELETE YOUR WORKING DIRECTORY CHANGES</strong>. Be sure to <strong>stash any local changes you want to keep</strong> before running this command.</p> <p>Assuming you are sitting on that commit, then this command will wack it...</p> <pre class="lang...
null
null
1602964
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1602964
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,602,934
null
5,730
null
null
null
null
null
2009-10-21T19:10:21
2023-03-07T14:12:21
Chris B.
null
CC BY-SA 4.0
null
9,161
91,410
null
null
null
null
null
null
null
null
null
null
null
null
null
1,602,964
true
in tests for the existence of a key in a dict : d = {"key1": 10, "key2": 23} if "key1" in d: print("this will execute") if "nonexistent key" in d: print("this will not") Use dict.get() to provide a default value when the key does not exist: d = {} for i in range(100): key = i % 10 d[key] = d.get(key, 0) + 1 To provide ...
<p><a href="https://docs.python.org/reference/expressions.html#membership-test-operations" rel="noreferrer"><code>in</code></a> tests for the existence of a key in a <a href="https://docs.python.org/library/stdtypes.html#dict" rel="noreferrer"><code>dict</code></a>:</p> <pre><code>d = {&quot;key1&quot;: 10, &quot;key2&...
null
null
1232046
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1232046
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,232,040
null
5,714
null
null
null
null
null
2009-08-05T09:10:00
2022-12-09T19:08:32
Philippe Leybaert
null
CC BY-SA 4.0
null
113,570
172,490
null
null
null
null
null
null
null
null
null
null
null
null
null
1,232,046
true
Ways to clear an existing array A : Method 1 (this was my original answer to the question) A = []; This code will set the variable A to a new empty array. This is perfect if you don't have references to the original array A anywhere else because this actually creates a brand new (empty) array. You should be careful wit...
<p>Ways to clear an existing array <code>A</code>:</p> <p><strong>Method 1</strong></p> <p>(this was my original answer to the question)</p> <pre><code>A = []; </code></pre> <p>This code will set the variable <code>A</code> to a new empty array. This is perfect if you don't have <strong>references to the original array...
null
null
39914235
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/39914235
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
951,021
null
5,705
null
null
null
null
null
2016-10-07T09:44:56
2024-04-03T12:16:53
Dan Dascalescu
null
CC BY-SA 4.0
null
1,269,037
154,165
null
null
null
null
null
null
null
null
null
null
null
null
null
39,914,235
true
2017 — 2021 update Since 2009 when this question was asked, JavaScript has evolved significantly. All other answers are now obsolete or overly complicated. Here is the current best practice: function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } Or as a one-liner: await new Promise(r => setTimeo...
<h2>2017 — 2021 update</h2> <p>Since 2009 when this question was asked, JavaScript has evolved significantly. All other answers are now obsolete or overly complicated. Here is the current best practice:</p> <pre><code>function sleep(ms) { return new Promise(resolve =&gt; setTimeout(resolve, ms)); } </code></pre> <p...
null
null
1143800
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1143800
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,143,796
null
5,689
null
null
null
null
null
2009-07-17T14:57:26
2022-07-25T05:07:20
bdonlan
null
CC BY-SA 4.0
null
36,723
233,819
null
null
null
null
null
null
null
null
null
null
null
null
null
1,143,800
true
The git rm documentation states: When --cached is given, the staged content has to match either the tip of the branch or the file on disk, allowing the file to be removed from just the index. So, for a single file: git rm --cached file_to_remove.txt and for a single directory: git rm --cached -r directory_to_remove
<p>The <a href="https://git-scm.com/docs/git-rm" rel="noreferrer"><code>git rm</code></a> documentation states:</p> <blockquote> <p>When <code>--cached</code> is given, the staged content has to match either the tip of the branch or the file on disk, allowing the file to be removed from just the index.</p> </blockquote...
null
null
12142066
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/12142066
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
6,245,570
null
5,655
null
null
null
null
null
2012-08-27T12:33:46
2022-07-08T06:42:20
Jistanidiot
null
CC BY-SA 4.0
null
1,426,193
57,352
null
null
null
null
null
null
null
null
null
null
null
null
null
12,142,066
false
To display only the name of the current branch you're on: git rev-parse --abbrev-ref HEAD Reference: Show just the current branch in Git
<p>To display <em>only</em> the name of the current branch you're on:</p> <pre><code>git rev-parse --abbrev-ref HEAD </code></pre> <p>Reference: <a href="https://stackoverflow.com/a/1418022/367456">Show just the current branch in Git</a></p>
null
null
2389423
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/2389423
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
2,389,361
null
5,647
null
null
null
null
null
2010-03-05T19:34:01
2018-11-30T02:00:37
Marcin Gil
null
CC BY-SA 4.0
null
5,731
70,141
null
null
null
null
null
null
null
null
null
null
null
null
null
2,389,423
true
With git reflog check which commit is one prior the merge ( git reflog will be a better option than git log ). Then you can reset it using: git reset --hard commit_sha There's also another way: git reset --hard HEAD~1 It will get you back 1 commit. Be aware that any modified and uncommitted/unstashed files will be rese...
<p>With <code>git reflog</code> check which commit is one prior the merge (<code>git reflog</code> will be a better option than <code>git log</code>). Then you can reset it using:</p> <pre><code>git reset --hard commit_sha </code></pre> <p>There's also another way:</p> <pre><code>git reset --hard HEAD~1 </code></pre...
null
null
1720432
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1720432
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,720,421
null
5,641
null
null
null
null
null
2009-11-12T07:07:06
2024-01-10T20:15:51
Daniel G
null
CC BY-SA 4.0
null
207,432
70,342
null
null
null
null
null
null
null
null
null
null
null
null
null
1,720,432
true
Use the + operator to combine the lists: listone = [1, 2, 3] listtwo = [4, 5, 6] joinedlist = listone + listtwo Output: >>> joinedlist [1, 2, 3, 4, 5, 6] NOTE: This will create a new list with a shallow copy of the items in the first list, followed by a shallow copy of the items in the second list. Use copy.deepcopy() ...
<p>Use the <code>+</code> operator to combine the lists:</p> <pre><code>listone = [1, 2, 3] listtwo = [4, 5, 6] joinedlist = listone + listtwo </code></pre> <p>Output:</p> <pre><code>&gt;&gt;&gt; joinedlist [1, 2, 3, 4, 5, 6] </code></pre> <p>NOTE: This will create a new list with a shallow copy of the items in the fi...
null
null
638980
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/638980
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
638,975
null
5,625
null
null
null
null
null
2009-03-12T14:50:01
2022-07-17T00:26:03
John Feminella
null
CC BY-SA 4.0
null
75,170
313,968
null
null
null
null
null
null
null
null
null
null
null
null
null
638,980
true
The test command (written as [ here) has a "not" logical operator, ! (exclamation mark): if [ ! -f /tmp/foo.txt ]; then echo "File not found!" fi
<p>The <a href="http://man7.org/linux/man-pages/man1/test.1.html" rel="noreferrer"><code>test</code></a> command (written as <code>[</code> here) has a &quot;not&quot; logical operator, <code>!</code> (exclamation mark):</p> <pre><code>if [ ! -f /tmp/foo.txt ]; then echo &quot;File not found!&quot; fi </code></pre>...
null
null
336868
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/336868
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
336,859
null
5,623
null
null
null
null
null
2008-12-03T11:37:42
2024-04-23T15:08:21
Greg
null
CC BY-SA 4.0
null
24,181
323,122
null
null
null
null
null
null
null
null
null
null
null
null
null
336,868
true
The difference is that functionOne is a function expression and so only defined when that line is reached, whereas functionTwo is a function declaration and is defined as soon as its surrounding function or script is executed (due to hoisting ). For example, a function expression: // TypeError: functionOne is not a fun...
<p>The difference is that <code>functionOne</code> is a <strong>function expression</strong> and so only defined when that line is reached, whereas <code>functionTwo</code> is a <strong>function declaration</strong> and is defined as soon as its surrounding function or script is executed (due to <a href="http://adripof...
null
null
1098955
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1098955
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,098,040
null
5,620
null
null
null
null
null
2009-07-08T15:51:10
2021-10-16T13:44:29
Ateş Göral
null
CC BY-SA 4.0
null
23,501
140,640
null
null
null
null
null
null
null
null
null
null
null
null
null
1,098,955
true
Checking for undefined-ness is not an accurate way of testing whether a key exists. What if the key exists but the value is actually undefined ? var obj = { key: undefined }; console.log(obj["key"] !== undefined); // false, but the key exists! You should instead use the in operator: var obj = { key: undefined }; consol...
<p>Checking for undefined-ness is not an accurate way of testing whether a key exists. What if the key exists but the value is actually <code>undefined</code>?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js la...
null
null
114549
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/114549
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
114,543
null
5,591
null
null
null
null
null
2008-09-22T12:29:07
2023-01-17T15:23:48
Justin Poliey
null
CC BY-SA 4.0
null
6,967
16,341
null
null
null
null
null
null
null
null
null
null
null
null
null
114,549
true
With flexbox it is very easy to style the div horizontally and vertically centered. #inner { border: 0.05em solid black; } #outer { border: 0.05em solid red; width:100%; display: flex; justify-content: center; } <div id="outer"> <div id="inner">Foo foo</div> </div> To align the div vertically centered, use the property...
<p>With <code>flexbox</code> it is very easy to style the div horizontally and vertically centered.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>#inner { border: 0....
null
null
11832950
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/11832950
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
11,832,914
null
5,571
null
null
null
null
null
2012-08-06T17:20:31
2021-08-27T03:20:23
Brian Ustas
null
CC BY-SA 4.0
null
1,575,238
66,105
null
null
null
null
null
null
null
null
null
null
null
null
null
11,832,950
true
Use Math.round() : Math.round(num * 100) / 100 Or to be more specific and to ensure things like 1.005 round correctly, use Number.EPSILON : Math.round((num + Number.EPSILON) * 100) / 100
<p>Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round" rel="noreferrer"><code>Math.round()</code></a> :</p> <pre><code>Math.round(num * 100) / 100 </code></pre> <p>Or to be more specific and to ensure things like 1.005 round correctly, use <a href="https://developer...
null
null
1473742
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1473742
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
237,104
null
5,535
null
null
null
null
null
2009-09-24T19:35:24
2023-05-30T11:08:02
codeape
null
CC BY-SA 4.0
null
3,571
101,730
null
null
null
null
null
null
null
null
null
null
null
null
null
1,473,742
true
Modern browsers have Array#includes , which does exactly that and is widely supported by everyone except IE: console.log(['joe', 'jane', 'mary'].includes('jane')); // true You can also use Array#indexOf , which is less direct, but doesn't require polyfills for outdated browsers. console.log(['joe', 'jane', 'mary'].inde...
<p>Modern browsers have <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes#browser_compatibility" rel="noreferrer"><code>Array#includes</code></a>, which does <em>exactly</em> that and <a href="https://kangax.github.io/compat-table/es2016plus/#test-Array.prototype.i...
null
null
1335881
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1335881
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,335,851
null
5,529
null
null
null
null
null
2009-08-26T16:15:39
2023-03-12T15:07:59
Pascal MARTIN
null
CC BY-SA 4.0
null
138,475
402,156
null
null
null
null
null
null
null
null
null
null
null
null
null
1,335,881
true
Update for ES6 modules Inside native ECMAScript modules (with import and export statements) and ES6 classes , strict mode is always enabled and cannot be disabled. Original answer This article about Javascript Strict Mode might interest you: John Resig - ECMAScript 5 Strict Mode, JSON, and More To quote some interestin...
<h2>Update for ES6 modules</h2> <p>Inside <a href="https://caniuse.com/#feat=es6-module" rel="noreferrer">native ECMAScript modules</a> (with <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/import" rel="noreferrer"><code>import</code></a> and <a href="https://developer.mozilla.org/docs/W...
null
null
16476974
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/16476974
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
16,476,924
null
5,527
null
null
null
null
null
2013-05-10T07:07:58
2026-02-20T00:28:28
waitingkuo
null
CC BY-SA 4.0
null
1,426,056
94,680
null
null
null
null
null
null
null
null
null
null
null
null
null
16,476,974
true
DataFrame.iterrows is a generator which yields both the index and row (as a Series): import pandas as pd df = pd.DataFrame({'c1': [10, 11, 12], 'c2': [100, 110, 120]}) df = df.reset_index() # Make sure indexes pair with number of rows for index, row in df.iterrows(): print(row['c1'], row['c2']) 10 100 11 110 12 120 Obl...
<p><a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iterrows.html#pandas-dataframe-iterrows" rel="noreferrer"><code>DataFrame.iterrows</code></a> is a generator which yields both the index and row (as a Series):</p> <pre><code>import pandas as pd df = pd.DataFrame({'c1': [10, 11, 12...
null
null
7244456
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/7244456
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
7,244,321
null
5,525
null
null
null
null
null
2011-08-30T14:01:26
2024-05-24T02:45:09
Mark Longair
null
CC BY-SA 4.0
null
223,092
473,915
null
null
null
null
null
null
null
null
null
null
null
null
null
7,244,456
true
In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream v...
<p>In your local clone of your forked repository, you can add the original GitHub repository as a &quot;remote&quot;. (&quot;Remotes&quot; are like nicknames for the URLs of repositories - <code>origin</code> is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work...
null
null
2068371
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/2068371
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
2,068,344
null
5,490
null
null
null
null
null
2010-01-14T23:40:25
2019-07-10T21:45:11
Asaph
null
CC BY-SA 4.0
null
166,339
163,711
null
null
null
null
null
null
null
null
null
null
null
null
null
2,068,371
true
Each YouTube video has four generated images. They are predictably formatted as follows: https://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg https://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg https://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg https://img.youtube.com/vi/<insert-yout...
<p>Each YouTube video has four generated images. They are predictably formatted as follows:</p> <pre class="lang-none prettyprint-override"><code>https://img.youtube.com/vi/&lt;insert-youtube-video-id-here&gt;/0.jpg https://img.youtube.com/vi/&lt;insert-youtube-video-id-here&gt;/1.jpg https://img.youtube.com/vi/&lt;...
null
null
950146
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/950146
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
950,087
null
5,485
null
null
null
null
null
2009-06-04T12:13:28
2022-09-19T09:18:22
Bite code
null
CC BY-SA 4.0
null
9,951
601,871
null
null
null
null
null
null
null
null
null
null
null
null
null
950,146
true
The old versions of JavaScript had no import, include, or require, so many different approaches to this problem have been developed. But since 2015 (ES6), JavaScript has had the ES6 modules standard to import modules in Node.js, which is also supported by most modern browsers . For compatibility with older browsers, bu...
<p>The old versions of JavaScript had no import, include, or require, so many different approaches to this problem have been developed.</p> <p>But since 2015 (ES6), JavaScript has had the <a href="http://exploringjs.com/es6/ch_modules.html" rel="noreferrer">ES6 modules</a> standard to import modules in Node.js, which i...
null
null
9270753
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/9270753
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
9,270,734
null
5,472
null
null
null
null
null
2012-02-14T02:05:01
2022-06-14T04:31:29
quickshiftin
null
CC BY-SA 4.0
null
680,920
70,559
null
null
null
null
null
null
null
null
null
null
null
null
null
9,270,753
true
The keys need to be read-writable only by you: chmod 600 ~/.ssh/id_rsa Alternatively, the keys can be only readable by you (this also blocks your write access): chmod 400 ~/.ssh/id_rsa 600 appears to be better in most cases, because you don't need to change file permissions later to edit it. (See the comments for more ...
<p>The keys need to be read-writable only by you:</p> <pre><code>chmod 600 ~/.ssh/id_rsa </code></pre> <p>Alternatively, the keys can be only readable by you (this also blocks your write access):</p> <pre><code>chmod 400 ~/.ssh/id_rsa </code></pre> <p><code>600</code> appears to be better in most cases, because you don...
null
null
351421
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/351421
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
351,409
null
5,430
null
null
null
null
null
2008-12-09T00:24:28
2024-09-25T10:42:20
jdecuyper
null
CC BY-SA 4.0
null
296
3,963
null
null
null
null
null
null
null
null
null
null
null
null
null
351,421
true
Use the Array.prototype.push method to append values to the end of an array: // initialize array var arr = [ "Hi", "Hello", "Bonjour" ]; // append new value to the array arr.push("Hola"); console.log(arr); You can use the push() function to append more than one value to an array in a single call: // initialize array va...
<p>Use the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push" rel="noreferrer"><code>Array.prototype.push</code></a> method to append values to the end of an array:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <d...
null
null
1066607
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1066607
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,066,589
null
5,421
null
null
null
null
null
2009-06-30T23:28:27
2019-10-17T21:25:25
harto
null
CC BY-SA 4.0
null
86,463
90,653
null
null
null
null
null
null
null
null
null
null
null
null
null
1,066,607
false
If you're only interested in the keys, you can iterate through the keySet() of the map: Map<String, Object> map = ...; for (String key : map.keySet()) { // ... } If you only need the values, use values() : for (Object value : map.values()) { // ... } Finally, if you want both the key and value, use entrySet() : for (Ma...
<p>If you're only interested in the keys, you can iterate through the <a href="https://docs.oracle.com/javase/1.5.0/docs/api/java/util/Map.html#keySet%28%29" rel="noreferrer"><code>keySet()</code></a> of the map:</p> <pre><code>Map&lt;String, Object&gt; map = ...; for (String key : map.keySet()) { // ... } </code...
null
null
9083
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/9083
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
9,081
null
5,416
null
null
null
null
null
2008-08-12T17:57:43
2017-09-21T08:33:54
Pat Notz
null
CC BY-SA 3.0
null
825
216,352
null
null
null
null
null
null
null
null
null
null
null
null
null
9,083
true
For BSD or GNU grep you can use -B num to set how many lines before the match and -A num for the number of lines after the match. grep -B 3 -A 2 foo README.txt If you want the same number of lines before and after you can use -C num . grep -C 3 foo README.txt This will show 3 lines before and 3 lines after.
<p>For <strong>BSD</strong> or <strong>GNU</strong> <code>grep</code> you can use <code>-B num</code> to set how many lines before the match and <code>-A num</code> for the number of lines after the match.</p> <pre><code>grep -B 3 -A 2 foo README.txt </code></pre> <p>If you want the same number of lines before and af...
null
null
3042512
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/3042512
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
3,042,437
null
5,365
null
null
null
null
null
2010-06-15T04:31:46
2020-04-03T10:25:31
Amber
null
CC BY-SA 4.0
null
148,870
533,281
null
null
null
null
null
null
null
null
null
null
null
null
null
3,042,512
true
Interactive rebase off of a point earlier in the history than the commit you need to modify ( git rebase -i <earliercommit> ). In the list of commits being rebased, change the text from pick to edit next to the hash of the one you want to modify. Then when git prompts you to change the commit, use this: git commit --am...
<p>Interactive rebase off of a point earlier in the history than the commit you need to modify (<code>git rebase -i &lt;earliercommit&gt;</code>). In the list of commits being rebased, change the text from <code>pick</code> to <code>edit</code> next to the hash of the one you want to modify. Then when git prompts you t...
null
null
105402
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/105402
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
105,372
null
5,325
null
null
null
null
null
2008-09-19T20:37:18
2026-03-20T17:02:28
jop
null
CC BY-SA 4.0
null
11,830
84,205
null
null
null
null
null
null
null
null
null
null
null
null
null
105,402
true
If you're using .NET 5 or newer, use this solution . foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit))) { } Note : The cast to (Suit[]) is not strictly necessary, but it does make the code 0.5 ns faster .
<p>If you're using .NET 5 or newer, use <a href="https://stackoverflow.com/questions/105372/how-to-enumerate-an-enum#65103244">this solution</a>.</p> <pre><code>foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit))) { } </code></pre> <p><strong>Note</strong>: The cast to <code>(Suit[])</code> is not strictly nece...
null
null
3010848
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/3010848
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
3,010,840
null
5,294
null
null
null
null
null
2010-06-10T00:07:12
2021-05-29T04:15:02
Christian C. Salvadó
null
CC BY-SA 4.0
null
5,445
832,348
null
null
null
null
null
null
null
null
null
null
null
null
null
3,010,848
false
Three main options: for (var i = 0; i < xs.length; i++) { console.log(xs[i]); } xs.forEach((x, i) => console.log(x)); for (const x of xs) { console.log(x); } Detailed examples are below. 1. Sequential for loop: var myStringArray = ["Hello","World"]; var arrayLength = myStringArray.length; for (var i = 0; i < arrayLengt...
<p>Three main options:</p> <ol> <li><code>for (var i = 0; i &lt; xs.length; i++) { console.log(xs[i]); }</code></li> <li><code>xs.forEach((x, i) =&gt; console.log(x));</code></li> <li><code>for (const x of xs) { console.log(x); }</code></li> </ol> <p>Detailed examples are below.</p> <hr /> <h1>1. Sequential <code>for</...
null
null
423596
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/423596
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
423,379
null
5,291
null
null
null
null
null
2009-01-08T08:39:44
2023-03-05T02:17:44
Paul Stephenson
null
CC BY-SA 4.0
null
5,536
69,860
null
null
null
null
null
null
null
null
null
null
null
null
null
423,596
true
You can use a global variable within other functions by declaring it as global within each function that assigns a value to it : globvar = 0 def set_globvar_to_one(): global globvar # Needed to modify global copy of globvar globvar = 1 def print_globvar(): print(globvar) # No need for global declaration to read value o...
<p>You can use a global variable within other functions by declaring it as <code>global</code> <strong>within each function that assigns a value to it</strong>:</p> <pre><code>globvar = 0 def set_globvar_to_one(): global globvar # Needed to modify global copy of globvar globvar = 1 def print_globvar(): ...
null
null
6470452
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/6470452
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
6,470,428
null
5,287
null
null
null
null
null
2011-06-24T15:56:34
2026-07-04T23:10:27
mechanical_meat
null
CC BY-SA 4.0
null
42,346
170,952
null
null
null
null
null
null
null
null
null
null
null
null
null
6,470,452
true
From Python Documentation : An except clause may name multiple exceptions as a parenthesized tuple, for example except (IDontLikeYouException, YouAreBeingMeanException) as e: pass Or, for Python 2 only: except (IDontLikeYouException, YouAreBeingMeanException), e: pass Separating the exception from the variable with a c...
<p>From <a href="https://docs.python.org/3/tutorial/errors.html#handling-exceptions" rel="nofollow noreferrer">Python Documentation</a>:</p> <blockquote> <p>An except clause may name multiple exceptions as a parenthesized tuple, for example</p> </blockquote> <pre><code>except (IDontLikeYouException, YouAreBeingMeanExce...
null
null
932982
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/932982
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
115,983
null
5,259
null
null
null
null
null
2009-05-31T22:10:40
2018-11-20T11:59:59
Jamie Flournoy
null
CC BY-SA 4.0
null
115,218
54,631
null
null
null
null
null
null
null
null
null
null
null
null
null
932,982
true
Another way to make a directory stay (almost) empty (in the repository) is to create a .gitignore file inside that directory that contains these four lines: # Ignore everything in this directory * # Except this file !.gitignore Then you don't have to get the order right the way that you have to do in m104's solution . ...
<p>Another way to make a directory stay (almost) empty (in the repository) is to create a <code>.gitignore</code> file inside that directory that contains these four lines:</p> <pre><code># Ignore everything in this directory * # Except this file !.gitignore </code></pre> <p>Then you don't have to get the order right...
null
null
1144788
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1144788
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,144,783
null
5,258
null
null
null
null
null
2009-07-17T17:54:49
2024-07-10T15:13:23
user21926
null
CC BY-SA 4.0
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
1,144,788
false
As of August 2020: Modern browsers have support for the String.replaceAll() method defined by the ECMAScript 2021 language specification. For older/legacy browsers: function escapeRegExp(str) { return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string } function replaceAll(str, find, repla...
<p><strong>As of August 2020:</strong> <a href="https://www.caniuse.com/mdn-javascript_builtins_string_replaceall" rel="noreferrer">Modern browsers have support</a> for the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll" rel="noreferrer"><code>String.replaceA...
null
null
6937030
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/6937030
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
3,297,048
null
5,244
null
null
null
null
null
2011-08-04T06:24:41
2022-07-21T17:42:26
JPReddy
null
CC BY-SA 4.0
null
305,818
66,303
null
null
null
null
null
null
null
null
null
null
null
null
null
6,937,030
true
A clear explanation from Daniel Irvine [ original link ] : There's a problem with 401 Unauthorized , the HTTP status code for authentication errors. And that’s just it: it’s for authentication, not authorization. Receiving a 401 response is the server telling you, “you aren’t authenticated–either not authenticated at a...
<p>A clear explanation from <a href="http://web.archive.org/web/20190904190534/https://www.dirv.me/blog/2011/07/18/understanding-403-forbidden/index.html" rel="noreferrer">Daniel Irvine</a> <sup>[<a href="http://www.dirv.me/blog/2011/07/18/understanding-403-forbidden/index.html" rel="noreferrer">original link</a>]</sup...
null
null
72156
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/72156
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
67,699
null
5,233
null
null
null
null
null
2008-09-16T13:28:22
2022-08-02T22:29:56
emk
null
CC BY-SA 4.0
null
12,089
61,068
null
null
null
null
null
null
null
null
null
null
null
null
null
72,156
true
First, clone a remote Git repository and cd into it: $ git clone git://example.com/myproject $ cd myproject Next, look at the local branches in your repository: $ git branch * master But there are other branches hiding in your repository! See these using the -a flag: $ git branch -a * master remotes/origin/HEAD remotes...
<p>First, clone a remote <a href="http://en.wikipedia.org/wiki/Git_%28software%29" rel="noreferrer">Git</a> repository and <a href="http://en.wikipedia.org/wiki/Cd_%28command%29" rel="noreferrer"><code>cd</code></a> into it:</p> <pre><code>$ git clone git://example.com/myproject $ cd myproject </code></pre> <p>Next, lo...
null
null
1920585
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1920585
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
352,098
null
5,231
null
null
null
null
null
2009-12-17T09:48:55
2023-11-11T21:10:57
B Bycroft
null
CC BY-SA 4.0
null
233,648
3,470
null
null
null
null
null
null
null
null
null
null
null
null
null
1,920,585
false
With Python 2.6+ or 3 you can use the json.tool module: echo '{"foo": "lorem", "bar": "ipsum"}' | python -m json.tool or, if the JSON is in a file, you can do: python -m json.tool my_json.json if the JSON is from an internet source such as an API, you can use curl http://my_url/ | python -m json.tool For convenience in...
<p>With Python 2.6+ or 3 you can use the <a href="https://docs.python.org/3/library/json.html#module-json.tool" rel="noreferrer">json.tool</a> module:</p> <pre class="lang-sh prettyprint-override"><code>echo '{&quot;foo&quot;: &quot;lorem&quot;, &quot;bar&quot;: &quot;ipsum&quot;}' | python -m json.tool </code></pre> <...
null
null
684692
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/684692
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
684,672
null
5,195
null
null
null
null
null
2009-03-26T06:12:13
2022-12-09T10:25:44
levik
null
CC BY-SA 4.0
null
4,465
118,275
null
null
null
null
null
null
null
null
null
null
null
null
null
684,692
true
You can use the for-in loop as shown by others. However, you also have to make sure that the key you get is an actual property of an object, and doesn't come from the prototype. Here is the snippet: var p = { "p1": "value1", "p2": "value2", "p3": "value3" }; for (var key in p) { if (p.hasOwnProperty(key)) { console.log...
<p>You can use the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in" rel="noreferrer"><code>for-in</code></a> loop as shown by others. However, you also have to make sure that the key you get is an actual property of an object, and doesn't come from the prototype.</p> <p><s...
null
null
2610741
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/2610741
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
2,610,497
null
5,179
null
null
null
null
null
2010-04-09T20:36:56
2024-08-30T08:24:27
fuxia
null
CC BY-SA 4.0
null
299,509
63,706
null
null
null
null
null
null
null
null
null
null
null
null
null
2,610,741
true
From April 2017: most modern browsers now support the simple pseudo-element ::placeholder [ Ref ] Implementation There are three different implementations: pseudo-elements, pseudo-classes, and nothing. WebKit, Blink (Safari, Google Chrome, Opera 15+) and Microsoft Edge are using a pseudo-element: ::-webkit-input-placeh...
<p><strong>From April 2017: most modern browsers now support the simple pseudo-element <code>::placeholder</code> <sup>[<a href="https://caniuse.com/#feat=css-placeholder" rel="noreferrer">Ref</a>]</sup></strong></p> <h2>Implementation</h2> <p>There are three different implementations: pseudo-elements, pseudo-classes, ...
null
null
157950
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/157950
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
157,944
null
5,156
null
null
null
null
null
2008-10-01T14:39:12
2023-10-14T08:19:49
Tom
null
CC BY-SA 4.0
null
22,850
56,471
null
null
null
null
null
null
null
null
null
null
null
null
null
157,950
true
You can use the following instruction: new ArrayList<>(Arrays.asList(array));
<p>You can use the following instruction:</p> <pre><code>new ArrayList&lt;&gt;(Arrays.asList(array)); </code></pre>
null
null
154068
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/154068
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
154,059
null
5,118
null
null
null
null
null
2008-09-30T17:20:14
2022-07-24T23:33:31
Brian Dukes
null
CC BY-SA 4.0
null
2,688
157,007
null
null
null
null
null
null
null
null
null
null
null
null
null
154,068
true
Empty string, undefined, null, ... To check for a truthy value : if (strValue) { // strValue was non-empty string, true, 42, Infinity, [], ... } To check for a falsy value : if (!strValue) { // strValue was empty string, false, 0, null, undefined, ... } Empty string (only!) To check for exactly an empty string, compare...
<h3>Empty string, undefined, null, ...</h3> <p>To check for a <a href="https://developer.mozilla.org/en-US/docs/Glossary/Truthy" rel="noreferrer">truthy value</a>:</p> <pre><code>if (strValue) { // strValue was non-empty string, true, 42, Infinity, [], ... } </code></pre> <p>To check for a <a href="https://develope...
null
null
1085191
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1085191
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,085,162
null
5,108
null
null
null
null
null
2009-07-06T02:36:42
2022-06-17T17:14:12
cloudhead
null
CC BY-SA 4.0
null
120,146
15,383
null
null
null
null
null
null
null
null
null
null
null
null
null
1,085,191
true
You can use: git add --patch <filename> or for short: git add -p <filename> Git will break down your file into what it thinks are sensible "hunks" (portions of the file). It will then prompt you with this question: Stage this hunk [y,n,q,a,d,/,j,J,g,s,e,?]? Here is a description of each option: y stage this hunk for th...
<p>You can use:</p> <pre class="lang-bash prettyprint-override"><code>git add --patch &lt;filename&gt; </code></pre> <p>or for short:</p> <pre class="lang-bash prettyprint-override"><code>git add -p &lt;filename&gt; </code></pre> <p>Git will break down your file into what it thinks are sensible &quot;hunks&quot; (porti...
null
null
264037
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/264037
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
263,965
null
5,093
null
null
null
null
null
2008-11-05T00:51:02
2024-12-09T19:54:05
guinaps
null
CC BY-SA 4.0
null
27,225
4,031
null
null
null
null
null
null
null
null
null
null
null
null
null
264,037
true
Do: var isTrueSet = (myValue === 'true'); Use the strict equality operator ( === ), which doesn't make any implicit type conversions when the compared variables have different types. This will set isTrueSet to a boolean true if the string is "true" and boolean false if it is string "false" or not set at all. For making...
<h2>Do:</h2> <pre class="lang-js prettyprint-override"><code>var isTrueSet = (myValue === 'true'); </code></pre> <p>Use the strict equality operator (<code>===</code>), which doesn't make any implicit type conversions when the compared variables have different types.</p> <p>This will set <code>isTrueSet</code> to a boo...
null
null
52522566
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/52522566
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
52,522,565
null
5,072
null
null
null
null
null
2018-09-26T16:43:18
2023-10-03T14:34:27
dustbuster
null
CC BY-SA 4.0
null
8,221,725
82,313
null
null
null
null
null
null
null
null
null
null
null
null
null
52,522,566
true
The problem is that Xcode Command-line Tools needs to be updated due to a MacOs update. Did not run into this on Sonoma. Maybe Apple fixed the process? Updated for Ventura After opening the terminal after restarting, I tried to go to my code, and do a git status , and I got an error and prompt for command line software...
<p>The problem is that Xcode Command-line Tools needs to be updated due to a MacOs update.</p> <ul> <li>Did not run into this on Sonoma. <ul> <li>Maybe Apple fixed the process?</li> </ul> </li> <li>Updated for Ventura</li> </ul> <p>After opening the terminal after restarting, I tried to go to my code, and do a <code>gi...
null
null
6996628
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/6996628
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
6,996,603
null
5,060
null
null
null
null
null
2011-08-09T13:07:39
2023-10-10T07:04:56
RichieHindle
null
CC BY-SA 4.0
null
21,886
284,158
null
null
null
null
null
null
null
null
null
null
null
null
null
6,996,628
true
Use one of these methods: pathlib.Path.unlink() removes a file or symbolic link. pathlib.Path.rmdir() removes an empty directory. shutil.rmtree() deletes a directory and all its contents. On Python 3.3 and below, you can use these methods instead of the pathlib ones: os.remove() removes a file. os.unlink() removes a sy...
<p>Use one of these methods:</p> <ul> <li><p><a href="https://docs.python.org/3/library/pathlib.html#pathlib.Path.unlink" rel="noreferrer"><code>pathlib.Path.unlink()</code></a> removes a file or symbolic link.</p> </li> <li><p><a href="https://docs.python.org/3/library/pathlib.html#pathlib.Path.rmdir" rel="noreferrer"...
null
null
3855359
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/3855359
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
3,855,127
null
5,054
null
null
null
null
null
2010-10-04T12:48:57
2024-06-10T05:22:06
ghostdog74
null
CC BY-SA 4.0
null
131,527
347,129
null
null
null
null
null
null
null
null
null
null
null
null
null
3,855,359
true
For macOS El Capitan and newer (or if your netstat doesn't support -p ), use lsof : lsof -i tcp:3000 Alternatively, you can use netstat : netstat -vanp tcp | grep 3000 Once you have the PID (Process ID) use: kill -9 <PID>
<p>For <strong>macOS El Capitan</strong> and newer (or if your netstat doesn't support <code>-p</code>), use <code>lsof</code>:</p> <pre class="lang-bash prettyprint-override"><code>lsof -i tcp:3000 </code></pre> <p>Alternatively, you can use <code>netstat</code>:</p> <pre class="lang-bash prettyprint-override"><code>n...
null
null
94608
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/94608
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
94,591
null
5,050
null
null
null
null
null
2008-09-18T17:20:17
2018-02-21T01:13:53
Ben Hoffstein
null
CC BY-SA 3.0
null
4,482
103,643
null
null
null
null
null
null
null
null
null
null
null
null
null
94,608
true
It's 2,147,483,647. Easiest way to memorize it is via a tattoo.
<p>It's 2,147,483,647. Easiest way to memorize it is via a tattoo.</p>
null
null
1260982
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1260982
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,260,748
null
5,049
null
null
null
null
null
2009-08-11T15:09:16
2025-05-15T17:20:13
John Douthat
null
CC BY-SA 4.0
null
2,774
41,377
null
null
null
null
null
null
null
null
null
null
null
null
null
1,260,982
false
In modern git (I'm writing this in 2022, with an updated git installation), this has become quite a bit simpler: Run git rm <path-to-submodule> , and commit . This removes the filetree at <path-to-submodule> , and the submodule's entry in the .gitmodules file. I.e. all traces of the submodule in your repository proper ...
<p>In modern git (I'm writing this in 2022, with an updated <code>git</code> installation), this has become quite a bit simpler:</p> <ul> <li><strong>Run <code>git rm &lt;path-to-submodule&gt;</code>, and commit</strong>.</li> </ul> <p>This removes the filetree at <code>&lt;path-to-submodule&gt;</code>, and the submodu...
null
null
17666279
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/17666279
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
17,666,249
null
5,042
null
null
null
null
null
2013-07-16T00:48:01
2023-01-27T15:46:55
bansi
null
CC BY-SA 4.0
null
2,522,554
57,332
null
null
null
null
null
null
null
null
null
null
null
null
null
17,666,279
true
Try: mysql -u username -p database_name < file.sql Check MySQL Options . Note 1: It is better to use the full path of the SQL file file.sql . Note 2: Use -R and --triggers with mysqldump to keep the routines and triggers of the original database. They are not copied by default. Note 3 You may have to create the (empty)...
<p>Try:</p> <pre><code>mysql -u username -p database_name &lt; file.sql </code></pre> <p>Check <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-command-options.html" rel="noreferrer">MySQL Options</a>.</p> <p><strong>Note 1:</strong> It is better to use the full path of the SQL file <code>file.sql</code>.</p> <p><...
null
null
229606
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/229606
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
229,551
null
5,041
null
null
null
null
null
2008-10-23T12:55:24
2020-04-17T01:20:42
Adam Bellaire
null
CC BY-SA 4.0
null
21,632
111,327
null
null
null
null
null
null
null
null
null
null
null
null
null
229,606
true
You can use Marcus's answer (* wildcards) outside a case statement, too, if you use double brackets: string='My long string' if [[ $string == *"My long"* ]]; then echo "It's there!" fi Note that spaces in the needle string need to be placed between double quotes, and the * wildcards should be outside. Also note that a ...
<p>You can use <a href="https://stackoverflow.com/a/229585/3755692">Marcus's answer (* wildcards)</a> outside a case statement, too, if you use double brackets:</p> <pre><code>string='My long string' if [[ $string == *"My long"* ]]; then echo "It's there!" fi </code></pre> <p>Note that spaces in the needle string n...
null
null
6445794
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/6445794
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
6,441,218
null
5,037
null
null
null
null
null
2011-06-22T20:01:23
2024-04-02T14:12:22
Eric Lippert
null
CC BY-SA 4.0
null
88,656
664,522
null
null
null
null
null
null
null
null
null
null
null
null
null
6,445,794
true
How can it be? Isn't the memory of a local variable inaccessible outside its function? You rent a hotel room. You put a book in the top drawer of the bedside table and go to sleep. You check out the next morning, but "forget" to give back your key. You steal the key! A week later, you return to the hotel, do not check ...
<blockquote> <p>How can it be? Isn't the memory of a local variable inaccessible outside its function?</p> </blockquote> <p>You rent a hotel room. You put a book in the top drawer of the bedside table and go to sleep. You check out the next morning, but &quot;forget&quot; to give back your key. You steal the key!</p> ...
null
null
630475
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/630475
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
630,453
null
4,992
null
null
null
null
null
2009-03-10T14:29:46
2021-04-08T09:47:35
Brian R. Bondy
null
CC BY-SA 4.0
null
3,153
349,938
null
null
null
null
null
null
null
null
null
null
null
null
null
630,475
true
Overall: Both PUT and POST can be used for creating. You have to ask, "what are you performing the action upon?", to distinguish what you should be using. Let's assume you're designing an API for asking questions. If you want to use POST, then you would do that to a list of questions. If you want to use PUT, then you w...
<p><strong>Overall:</strong></p> <p>Both PUT and POST can be used for creating.</p> <p>You have to ask, &quot;what are you performing the action upon?&quot;, to distinguish what you should be using. Let's assume you're designing an API for asking questions. If you want to use POST, then you would do that to a list of ...
null
null
424142
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/424142
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
424,071
null
4,974
null
null
null
null
null
2009-01-08T13:02:22
2023-02-03T10:33:16
Ryan McGeary
null
CC BY-SA 4.0
null
8,985
241,278
null
null
null
null
null
null
null
null
null
null
null
null
null
424,142
true
Preferred Way (because it's a plumbing command; meant to be programmatic): $ git diff-tree --no-commit-id --name-only bd61ad98 -r index.html javascript/application.js javascript/ie6.js Another Way (less preferred for scripts, because it's a porcelain command; meant to be user-facing) $ git show --pretty="" --name-only ...
<p><strong>Preferred Way</strong> (because it's a <em>plumbing</em> command; meant to be programmatic):</p> <pre><code>$ git diff-tree --no-commit-id --name-only bd61ad98 -r index.html javascript/application.js javascript/ie6.js </code></pre> <p><strong>Another Way</strong> (less preferred for scripts, because it's a <...
null
null
2286030
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/2286030
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
520,650
null
4,967
null
null
null
null
null
2010-02-18T03:06:52
2020-08-21T18:22:38
Dan Moulding
null
CC BY-SA 4.0
null
95,706
223,989
null
null
null
null
null
null
null
null
null
null
null
null
null
2,286,030
true
Given a branch foo and a remote upstream : As of Git 1.8.0: git branch -u upstream/foo Or, if local branch foo is not the current branch: git branch -u upstream/foo foo Or, if you like to type longer commands, these are equivalent to the above two: git branch --set-upstream-to=upstream/foo git branch --set-upstream-to=...
<p>Given a branch <code>foo</code> and a remote <code>upstream</code>:</p> <p><strong>As of Git 1.8.0:</strong></p> <pre><code>git branch -u upstream/foo </code></pre> <p>Or, if local branch <code>foo</code> is not the current branch:</p> <pre><code>git branch -u upstream/foo foo </code></pre> <p>Or, if you like to typ...
null
null
1580644
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1580644
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,580,596
null
4,926
null
null
null
null
null
2009-10-16T21:53:40
2025-07-04T15:04:56
Greg Hewgill
null
CC BY-SA 4.0
null
893
1,007,155
null
null
null
null
null
null
null
null
null
null
null
null
null
1,580,644
true
Try: git config core.fileMode false From git-config(1) : core.fileMode Tells Git if the executable bit of files in the working tree is to be honored. Some filesystems lose the executable bit when a file that is marked as executable is checked out, or checks out a non-executable file with executable bit on. git-clone(1)...
<p>Try:</p> <pre class="lang-none prettyprint-override"><code>git config core.fileMode false </code></pre> <p>From <a href="https://www.kernel.org/pub/software/scm/git/docs/git-config.html" rel="noreferrer">git-config(1)</a>:</p> <blockquote> <pre class="lang-none prettyprint-override"><code>core.fileMode Tells Git...
null
null
1527820
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1527820
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
1,527,803
null
4,925
null
null
null
null
null
2009-10-06T20:08:19
2022-11-30T17:41:23
Ionuț G. Stan
null
CC BY-SA 4.0
null
58,808
179,649
null
null
null
null
null
null
null
null
null
null
null
null
null
1,527,820
true
There are some examples on the Mozilla Developer Network page: /** * Returns a random number between min (inclusive) and max (exclusive) */ function getRandomArbitrary(min, max) { return Math.random() * (max - min) + min; } /** * Returns a random integer between min (inclusive) and max (inclusive). * The value is no lo...
<p>There are some examples on the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random" rel="noreferrer">Mozilla Developer Network</a> page:</p> <pre><code>/** * Returns a random number between min (inclusive) and max (exclusive) */ function getRandomArbitrary(min, max...
null
null
572660
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/572660
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
572,549
null
4,922
null
null
null
null
null
2009-02-21T09:00:04
2021-02-20T19:57:41
Lara Bailey
null
CC BY-SA 4.0
null
19,563
805,258
null
null
null
null
null
null
null
null
null
null
null
null
null
572,660
true
This answer only applies to Git version 1.x . For Git version 2.x, see other answers. Summary: git add -A stages all changes git add . stages new files and modifications, without deletions (on the current directory and its subdirectories). git add -u stages modifications and deletions, without new files Detail: git add...
<p><em>This answer only applies to <strong>Git version 1.x</strong>. For Git version 2.x, see other answers.</em></p> <hr /> <p><strong>Summary:</strong></p> <ul> <li><p><code>git add -A</code> stages <strong>all changes</strong></p> </li> <li><p><code>git add .</code> stages new files and modifications, <strong>withou...
null
null
24326540
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/24326540
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
24,319,662
null
4,907
null
null
null
null
null
2014-06-20T11:46:51
2025-04-11T23:10:47
Thomasleveil
null
CC BY-SA 4.0
null
107,049
105,393
null
null
null
null
null
null
null
null
null
null
null
null
null
24,326,540
true
If you are using Docker-for-mac or Docker-for-Windows 18.03+, connect to your MySQL service using the host host.docker.internal (instead of the 127.0.0.1 in your connection string). If you are using Docker-for-Linux 20.10.0+, you can also use the host host.docker.internal if you started your Docker container with the -...
<p>If you are using <a href="https://docs.docker.com/docker-for-mac/networking/#there-is-no-docker0-bridge-on-macos#i-want-to-connect-from-a-container-to-a-service-on-the-host" rel="noreferrer">Docker-for-mac</a> or <a href="https://docs.docker.com/docker-for-windows/networking/#there-is-no-docker0-bridge-on-windows#i-...
null
null
4181721
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/4181721
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
4,181,703
null
4,902
null
null
null
null
null
2010-11-15T05:41:36
2019-09-01T12:51:28
codaddict
null
CC BY-SA 4.0
null
227,665
457,771
null
null
null
null
null
null
null
null
null
null
null
null
null
4,181,721
true
foo="Hello" foo="${foo} World" echo "${foo}" > Hello World In general to concatenate two variables you can just write them one after another: a='Hello' b='World' c="${a} ${b}" echo "${c}" > Hello World
<pre><code>foo="Hello" foo="${foo} World" echo "${foo}" &gt; Hello World </code></pre> <p>In general to concatenate two variables you can just write them one after another:</p> <pre><code>a='Hello' b='World' c="${a} ${b}" echo "${c}" &gt; Hello World </code></pre>
null
null
1594484
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/1594484
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
739,654
null
4,896
null
null
null
null
null
2009-10-20T13:05:46
2021-04-26T21:49:34
Bite code
null
CC BY-SA 4.0
null
9,951
601,871
null
null
null
null
null
null
null
null
null
null
null
null
null
1,594,484
false
If you are not into long explanations, see Paolo Bergantino’s answer . Decorator Basics Python’s functions are objects To understand decorators, you must first understand that functions are objects in Python. This has important consequences. Let’s see why with a simple example : def shout(word="yes"): return word.capit...
<p>If you are not into long explanations, see <a href="https://stackoverflow.com/questions/739654/understanding-python-decorators#answer-739665">Paolo Bergantino’s answer</a>.</p> <h1>Decorator Basics</h1> <h2>Python’s functions are objects</h2> <p>To understand decorators, you must first understand that functions are ...
null
null
123212
answer
stackoverflow
2026-08-03T01:57:01
null
null
null
null
null
https://stackoverflow.com/a/123212
C5IUtYwb765dRarGt
6oAlHJZHBQQzjvMCL
123,198
null
4,877
null
null
null
null
null
2008-09-23T19:25:35
2022-01-25T10:32:18
Swati
null
CC BY-SA 4.0
null
12,682
53,487
null
null
null
null
null
null
null
null
null
null
null
null
null
123,212
true
shutil has many methods you can use. One of which is: import shutil shutil.copyfile(src, dst) # 2nd option shutil.copy(src, dst) # dst can be a folder; use shutil.copy2() to preserve timestamp Copy the contents of the file named src to a file named dst . Both src and dst need to be the entire filename of the files, inc...
<p><a href="http://docs.python.org/3/library/shutil.html" rel="noreferrer"><code>shutil</code></a> has many methods you can use. One of which is:</p> <pre><code>import shutil shutil.copyfile(src, dst) # 2nd option shutil.copy(src, dst) # dst can be a folder; use shutil.copy2() to preserve timestamp </code></pre> <ul...
null
null