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
203198
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
203,198
Event binding on dynamically created elements?
1,673
1,104,052
23
true
true
[ "javascript", "jquery", "events", "unobtrusive-javascript" ]
2008-10-14T23:25:19
2025-06-17T11:10:39
Eli
false
CC BY-SA 3.0
1,207,393
27,580
100,298
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off . This happens on page ready and works just fine. The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't hav...
<p>I have a bit of code where I am looping through all the select boxes on a page and binding a <code>.hover</code> event to them to do a bit of twiddling with their width on <code>mouse on/off</code>.</p> <p>This happens on page ready and works just fine.</p> <p>The problem I have is that any select boxes I add via ...
[ { "answerId": 1207393, "score": 2583, "isAccepted": true, "createdAt": "2009-07-30T15:34:49", "ownerDisplayName": "dev.e.loper", "ownerUserId": 37759, "bodyText": "As of jQuery 1.7 you should use jQuery.fn.on with the selector parameter filled: $(staticAncestors).on(eventName, dynamicChi...
1
281264
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/281264/remove-empty-elements-from-an-array-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
281,264
Remove empty elements from an array in Javascript
1,666
1,869,339
52
true
true
[ "javascript", "arrays" ]
2008-11-11T15:48:54
2024-11-19T21:23:03
Mkkt Bkkt
false
CC BY-SA 4.0
281,335
8,954
122,035
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I remove empty elements from an array in JavaScript? Is there a straightforward way, or do I need to loop through it and remove them manually?
<p>How do I remove empty elements from an array in JavaScript? </p> <p>Is there a straightforward way, or do I need to loop through it and remove them manually?</p>
[ { "answerId": 2843625, "score": 1837, "isAccepted": false, "createdAt": "2010-05-16T12:02:48", "ownerDisplayName": "vsync", "ownerUserId": 104380, "bodyText": "A few simple ways: var arr = [1,2,,3,,-3,null,,0,,undefined,4,,4,,5,,6,,,,]; arr.filter(n => n) // [1, 2, 3, -3, 4, 4, 5, 6] arr...
2
1470488
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1470488/what-is-the-purpose-of-the-var-keyword-and-when-should-i-use-it-or-omit-it
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,470,488
What is the purpose of the var keyword and when should I use it (or omit it)?
1,664
341,635
19
true
true
[ "javascript", "keyword", "ecmascript-5" ]
2009-09-24T08:54:04
2021-08-25T15:14:00
Alex
false
CC BY-SA 3.0
1,470,494
114,916
77,739
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
NOTE : This question was asked from the viewpoint of ECMAScript version 3 or 5. The answers might become outdated with the introduction of new features in the release of ECMAScript 6. What exactly is the function of the var keyword in JavaScript, and what is the difference between var someNumber = 2; var someFunction =...
<blockquote> <p><strong><em>NOTE</strong>: This question was asked from the viewpoint of ECMAScript version 3 or 5. The answers might become outdated with the introduction of new features in the release of ECMAScript 6.</em></p> </blockquote> <p>What exactly is the function of the <code>var</code> keyword in JavaScr...
[ { "answerId": 1470494, "score": 1411, "isAccepted": true, "createdAt": "2009-09-24T08:55:47", "ownerDisplayName": "Greg", "ownerUserId": 24181, "bodyText": "If you're in the global scope then there's not much difference. Read Kangax's answer for explanation If you're in a function then v...
1
10636611
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/10636611/how-does-the-access-control-allow-origin-header-work
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
10,636,611
How does the 'Access-Control-Allow-Origin' header work?
1,662
2,826,557
21
true
true
[ "javascript", "cross-domain", "cors" ]
2012-05-17T13:23:54
2025-02-01T10:08:58
mark
false
CC BY-SA 4.0
10,636,765
80,002
63,986
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Apparently, I have completely misunderstood its semantics. I thought of something like this: A client downloads JavaScript code MyCode.js from http://siteA - the origin . The response header of MyCode.js contains Access-Control-Allow-Origin: http://siteB , which I thought meant that MyCode.js was allowed to make cross-...
<p>Apparently, I have completely misunderstood its semantics. I thought of something like this:</p> <ol> <li>A client downloads JavaScript code MyCode.js from <code>http://siteA</code> - <strong>the origin</strong>.</li> <li>The response header of MyCode.js contains <strong>Access-Control-Allow-Origin: <code>http://sit...
[ { "answerId": 10636765, "score": 1955, "isAccepted": true, "createdAt": "2012-05-17T13:33:26", "ownerDisplayName": "apsillers", "ownerUserId": 710446, "bodyText": "Access-Control-Allow-Origin is a CORS (cross-origin resource sharing) header . When Site A tries to fetch content from Site ...
1
1230233
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1230233/how-to-find-the-sum-of-an-array-of-numbers
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,230,233
How to find the sum of an array of numbers
1,658
3,188,625
62
true
true
[ "javascript", "jquery", "arrays" ]
2009-08-04T22:29:40
2025-09-11T00:19:41
akano1
false
CC BY-SA 3.0
43,363,105
149,738
41,952
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Given an array [1, 2, 3, 4] , how can I find the sum of its elements? (In this case, the sum would be 10 .) I thought $.each might be useful, but I'm not sure how to implement it.
<p>Given an array <code>[1, 2, 3, 4]</code>, how can I find the sum of its elements? (In this case, the sum would be <code>10</code>.)</p> <p>I thought <a href="http://api.jquery.com/jquery.each/" rel="noreferrer"><code>$.each</code></a> might be useful, but I'm not sure how to implement it.</p>
[ { "answerId": 16751601, "score": 1828, "isAccepted": false, "createdAt": "2013-05-25T16:30:40", "ownerDisplayName": "Florian Margaine", "ownerUserId": 851498, "bodyText": "This'd be exactly the job for reduce . If you're using ECMAScript 2015 (aka ECMAScript 6 ): const sum = [1, 2, 3].re...
2
2727167
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/2727167/how-do-you-get-a-list-of-the-names-of-all-files-present-in-a-directory-in-node-j
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
2,727,167
How do you get a list of the names of all files present in a directory in Node.js?
1,655
1,725,652
33
true
true
[ "javascript", "node.js", "directory-listing" ]
2010-04-28T06:10:16
2025-06-28T12:58:20
resopollution
false
CC BY-SA 3.0
2,727,191
76,969
20,440
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'm trying to get a list of the names of all the files present in a directory using Node.js. I want output that is an array of filenames. How can I do this?
<p>I'm trying to get a list of the names of all the files present in a directory using Node.js. I want output that is an array of filenames. How can I do this?</p>
[ { "answerId": 2727191, "score": 2221, "isAccepted": true, "createdAt": "2010-04-28T06:15:23", "ownerDisplayName": "Christian C. Salvadó", "ownerUserId": 5445, "bodyText": "You can use the fs.readdir or fs.readdirSync methods. fs is included in Node.js core, so there's no need to install ...
1
867916
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/867916/creating-a-div-element-in-jquery
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
867,916
Creating a div element in jQuery
1,651
1,992,781
24
true
true
[ "javascript", "jquery", "html", "append", "jquery-append" ]
2009-05-15T10:30:24
2021-09-07T10:35:25
useranon
true
null
867,981
79,980
29,494
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I create a div element in jQuery ?
<p>How do I create a <code>div</code> element in <strong>jQuery</strong>?</p>
[ { "answerId": 4158203, "score": 2090, "isAccepted": false, "createdAt": "2010-11-11T19:01:18", "ownerDisplayName": "ian", "ownerUserId": 171056, "bodyText": "As of jQuery 1.4 you can pass attributes to a self-closed element like so: jQuery('<div>', { id: 'some-id', class: 'some-class som...
1
6002254
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/6002254/get-the-current-year-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
6,002,254
Get the current year in JavaScript
1,639
1,402,789
13
true
true
[ "javascript", "date" ]
2011-05-14T13:53:05
2025-04-05T07:30:54
Satch3000
false
CC BY-SA 3.0
6,002,276
683,553
49,748
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I get the current year in JavaScript?
<p>How do I get the current year in JavaScript?</p>
[ { "answerId": 6002276, "score": 2733, "isAccepted": true, "createdAt": "2011-05-14T13:57:40", "ownerDisplayName": "Jason Harwig", "ownerUserId": 98048, "bodyText": "Create a new Date() object and call getFullYear() : new Date().getFullYear() // returns the current year Example usage: a p...
1
10865025
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/10865025/merge-flatten-an-array-of-arrays
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
10,865,025
Merge/flatten an array of arrays
1,583
1,339,526
90
true
true
[ "javascript", "arrays", "multidimensional-array", "merge", "flatten" ]
2012-06-02T18:53:46
2026-06-03T10:52:07
Andy
false
CC BY-SA 4.0
10,865,042
109,407
19,321
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have a JavaScript array like: [["$6"], ["$12"], ["$25"], ["$25"], ["$18"], ["$22"], ["$10"]] How would I go about merging the separate inner arrays into one like: ["$6", "$12", "$25", ...]
<p>I have a JavaScript array like:</p> <pre><code>[["$6"], ["$12"], ["$25"], ["$25"], ["$18"], ["$22"], ["$10"]] </code></pre> <p>How would I go about merging the separate inner arrays into one like:</p> <pre><code>["$6", "$12", "$25", ...] </code></pre>
[ { "answerId": 10865042, "score": 2611, "isAccepted": true, "createdAt": "2012-06-02T18:56:33", "ownerDisplayName": "Gumbo", "ownerUserId": 53114, "bodyText": "ES2019 ES2019 introduced the Array.prototype.flat() method which you could use to flatten the arrays. It is compatible with most ...
1
10286204
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/10286204/what-is-the-right-json-date-format
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
10,286,204
What is the "right" JSON date format?
1,582
2,131,290
16
true
true
[ "javascript", "json" ]
2012-04-23T18:32:32
2025-11-20T13:22:25
Kamyar Nazeri
false
CC BY-SA 4.0
15,952,652
1,041,321
26,714
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I've seen so many different standards for the JSON date format: "\"\\/Date(1335205592410)\\/\"" .NET JavaScriptSerializer "\"\\/Date(1335205592410-0500)\\/\"" .NET DataContractJsonSerializer "2012-04-23T18:25:43.511Z" JavaScript built-in JSON object "2012-04-21T18:25:43-05:00" ISO 8601 Which one is the right one? Or be...
<p>I've seen so many different standards for the JSON date format:</p> <pre><code>"\"\\/Date(1335205592410)\\/\"" .NET JavaScriptSerializer "\"\\/Date(1335205592410-0500)\\/\"" .NET DataContractJsonSerializer "2012-04-23T18:25:43.511Z" JavaScript built-in JSON object "2012-04-21T18:25:43-05:00"...
[ { "answerId": 15952652, "score": 2537, "isAccepted": true, "createdAt": "2013-04-11T15:20:43", "ownerDisplayName": "funroll", "ownerUserId": 878969, "bodyText": "JSON itself does not specify how dates should be represented, but JavaScript does. You should use the format emitted by Date '...
1
7837456
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/7837456/how-to-compare-arrays-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
7,837,456
How to compare arrays in JavaScript?
1,580
1,924,427
57
true
true
[ "javascript", "arrays", "json" ]
2011-10-20T14:27:57
2025-09-22T09:29:04
Julian H. Lam
false
CC BY-SA 3.0
14,853,974
122,353
26,324
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'd like to compare two arrays... ideally, efficiently. Nothing fancy, just true if they are identical, and false if not. Not surprisingly, the comparison operator doesn't seem to work. var a1 = [1,2,3]; var a2 = [1,2,3]; console.log(a1==a2); // Returns false console.log(JSON.stringify(a1)==JSON.stringify(a2)); // Retu...
<p>I'd like to compare two arrays... ideally, efficiently. Nothing fancy, just <code>true</code> if they are identical, and <code>false</code> if not. Not surprisingly, the comparison operator doesn't seem to work.</p> <pre><code>var a1 = [1,2,3]; var a2 = [1,2,3]; console.log(a1==a2); // Returns false console.log(...
null
0
4870328
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/4870328/read-environment-variables-in-node-js
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
4,870,328
Read environment variables in Node.js
1,579
991,365
10
true
true
[ "javascript", "node.js", "environment-variables" ]
2011-02-02T02:54:28
2025-03-14T23:10:05
Jayesh
false
CC BY-SA 4.0
4,870,450
174,527
53,723
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Is there a way to read environment variables in Node.js code? Like for example Python's os.environ['HOME'] .
<p>Is there a way to read environment variables in Node.js code?</p> <p>Like for example Python's <code>os.environ['HOME']</code>.</p>
[ { "answerId": 4870450, "score": 2208, "isAccepted": true, "createdAt": "2011-02-02T03:14:13", "ownerDisplayName": "Jayesh", "ownerUserId": 174527, "bodyText": "process.env.ENV_VARIABLE Where ENV_VARIABLE is the name of the variable you wish to access. See Node.js docs for process.env ." ...
1
476436
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/476436/is-there-a-null-coalescing-operator-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
476,436
Is there a "null coalescing" operator in JavaScript?
1,575
486,427
19
true
true
[ "javascript", "operators", "null-coalescing-operator", "null-coalescing" ]
2009-01-24T18:18:02
2023-02-03T05:46:59
Daniel Schaffer
false
CC BY-SA 3.0
476,445
2,596
58,091
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Is there a null coalescing operator in Javascript? For example, in C#, I can do this: String someString = null; var whatIWant = someString ?? "Cookies!"; The best approximation I can figure out for Javascript is using the conditional operator: var someString = null; var whatIWant = someString ? someString : 'Cookies!';...
<p>Is there a null coalescing operator in Javascript?</p> <p>For example, in C#, I can do this:</p> <pre><code>String someString = null; var whatIWant = someString ?? "Cookies!"; </code></pre> <p>The best approximation I can figure out for Javascript is using the conditional operator:</p> <pre><code>var someString ...
[ { "answerId": 476445, "score": 2331, "isAccepted": true, "createdAt": "2009-01-24T18:25:31", "ownerDisplayName": "Ateş Göral", "ownerUserId": 23501, "bodyText": "Update JavaScript now supports the nullish coalescing operator (??) . It returns its right-hand-side operand when its left-han...
1
596467
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/596467/how-do-i-convert-a-float-number-to-a-whole-number-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
596,467
How do I convert a float number to a whole number in JavaScript?
1,573
1,813,321
18
true
true
[ "javascript", "syntax" ]
2009-02-27T20:15:07
2023-06-22T03:01:34
mcherm
false
CC BY-SA 3.0
596,503
14,570
24,794
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'd like to convert a float to a whole number in JavaScript. Actually, I'd like to know how to do BOTH of the standard conversions: by truncating and by rounding. And efficiently, not via converting to a string and parsing.
<p>I'd like to convert a float to a whole number in JavaScript. Actually, I'd like to know how to do BOTH of the standard conversions: by truncating and by rounding. And efficiently, not via converting to a string and parsing.</p>
[ { "answerId": 596503, "score": 2261, "isAccepted": true, "createdAt": "2009-02-27T20:21:02", "ownerDisplayName": "moonshadow", "ownerUserId": 11834, "bodyText": "var intvalue = Math.floor( floatvalue ); var intvalue = Math.ceil( floatvalue ); var intvalue = Math.round( floatvalue ); // `...
1
1107220
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1107220/how-can-i-select-an-element-by-name-with-jquery
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,107,220
How can I select an element by name with jQuery?
1,564
2,401,525
15
true
true
[ "javascript", "jquery", "html", "dom", "jquery-selectors" ]
2009-07-10T01:05:38
2025-02-11T01:10:48
T.T.T.
false
CC BY-SA 4.0
1,107,264
52,256
34,907
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have a table column I’m trying to expand and hide. jQuery seems to hide the <td> elements when I select it by class but not by the element’s name . For example: $(".bold").hide(); // Selecting by class works. $("tcol1").hide(); // Selecting by name does not work. [Edit: this is NOT selecting by name! This is selectin...
<p>I have a table column I’m trying to expand and hide. jQuery seems to hide the <code>&lt;td&gt;</code> elements when I select it by <code>class</code> but not by the element’s <code>name</code>.</p> <p>For example:</p> <pre class="lang-js prettyprint-override"><code>$(&quot;.bold&quot;).hide(); // Selecting by class ...
[ { "answerId": 1107264, "score": 2777, "isAccepted": true, "createdAt": "2009-07-10T01:21:08", "ownerDisplayName": "Jon Erickson", "ownerUserId": 1950, "bodyText": "You can use the jQuery attribute selector : $('td[name=\"tcol1\"]') // Matches exactly 'tcol1' $('td[name^=\"tcol\"]' ) // M...
1
10729276
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/10729276/how-can-i-get-the-full-object-in-node-jss-console-log-rather-than-object
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
10,729,276
How can I get the full object in Node.js's console.log(), rather than '[Object]'?
1,561
1,069,285
22
true
true
[ "javascript", "node.js", "debugging", "console.log" ]
2012-05-23T23:29:28
2025-08-06T09:35:01
user1372449
false
CC BY-SA 4.0
10,729,284
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have this object: const myObject = { "a":"a", "b":{ "c":"c", "d":{ "e":"e", "f":{ "g":"g", "h":{ "i":"i" } } } } }; But when I try to show it using console.log(myObject) , I receive this output: { a: 'a', b: { c: 'c', d: { e: 'e', f: [Object] } } } How can I get the full object, including the content of property f ?
<p>I have this object:</p> <pre><code>const myObject = { &quot;a&quot;:&quot;a&quot;, &quot;b&quot;:{ &quot;c&quot;:&quot;c&quot;, &quot;d&quot;:{ &quot;e&quot;:&quot;e&quot;, &quot;f&quot;:{ &quot;g&quot;:&quot;g&quot;, &quot;h&quot;:{ &quot;i&...
[ { "answerId": 10729284, "score": 2268, "isAccepted": true, "createdAt": "2012-05-23T23:30:34", "ownerDisplayName": "250R", "ownerUserId": 555899, "bodyText": "You need to use util.inspect() : const util = require('util') console.log(util.inspect(myObject, {showHidden: false, depth: null,...
1
5311334
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/5311334/what-is-the-purpose-of-node-js-module-exports-and-how-do-you-use-it
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
5,311,334
What is the purpose of Node.js module.exports and how do you use it?
1,561
536,737
13
true
true
[ "javascript", "node.js" ]
2011-03-15T11:56:10
2022-07-08T04:18:07
mrwooster
false
CC BY-SA 4.0
5,311,377
527,749
24,257
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What is the purpose of Node.js module.exports and how do you use it? I can't seem to find any information on this, but it appears to be a rather important part of Node.js as I often see it in source code. According to the Node.js documentation : module A reference to the current module . In particular module.exports is...
<p>What is the purpose of Node.js <code>module.exports</code> and how do you use it?</p> <p>I can't seem to find any information on this, but it appears to be a rather important part of Node.js as I often see it in source code.</p> <p>According to the <a href="http://nodejs.org/docs/v0.4.2/api/globals.html#module" rel=...
[ { "answerId": 5311377, "score": 1684, "isAccepted": true, "createdAt": "2011-03-15T12:00:00", "ownerDisplayName": "Alnitak", "ownerUserId": 6782, "bodyText": "module.exports is the object that's actually returned as the result of a require call. The exports variable is initially set to t...
1
5926672
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/5926672/where-does-npm-install-packages
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
5,926,672
Where does npm install packages?
1,554
1,382,927
23
true
true
[ "javascript", "node.js", "location", "npm" ]
2011-05-08T09:39:20
2024-03-23T08:03:23
trnc
false
CC BY-SA 3.0
5,926,706
193,643
21,785
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Can someone tell me where can I find the Node.js modules, which I installed using npm ?
<p>Can someone tell me where can I find the Node.js modules, which I installed using <strong><code>npm</code></strong>?</p>
[ { "answerId": 5926706, "score": 1667, "isAccepted": true, "createdAt": "2011-05-08T09:47:01", "ownerDisplayName": "Decko", "ownerUserId": 320702, "bodyText": "Global libraries You can run npm list -g to see which global libraries are installed and where they're located. Use npm list -g |...
1
199099
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/199099/how-to-manage-a-redirect-request-after-a-jquery-ajax-call
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
199,099
How to manage a redirect request after a jQuery Ajax call
1,541
1,182,284
34
true
true
[ "javascript", "jquery", "ajax", "http-redirect" ]
2008-10-13T21:29:50
2021-09-29T14:07:43
Elliot Vargas
false
CC BY-SA 3.0
484,541
2,024
20,899
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'm using $.post() to call a servlet using Ajax and then using the resulting HTML fragment to replace a div element in the user's current page. However, if the session times out, the server sends a redirect directive to send the user to the login page. In this case, jQuery is replacing the div element with the contents...
<p>I'm using <code>$.post()</code> to call a servlet using Ajax and then using the resulting HTML fragment to replace a <code>div</code> element in the user's current page. However, if the session times out, the server sends a redirect directive to send the user to the login page. In this case, jQuery is replacing the ...
null
0
5915096
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/5915096/get-a-random-item-from-a-javascript-array
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
5,915,096
Get a random item from a JavaScript array
1,536
1,618,596
13
true
true
[ "javascript", "arrays", "random" ]
2011-05-06T17:47:45
2024-07-11T09:50:16
James
true
null
5,915,122
398,431
43,885
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
var items = Array(523, 3452, 334, 31, ..., 5346); How do I get random item from items ?
<pre><code>var items = Array(523, 3452, 334, 31, ..., 5346); </code></pre> <p>How do I get random item from <code>items</code>?</p>
[ { "answerId": 5915122, "score": 3160, "isAccepted": true, "createdAt": "2011-05-06T17:50:19", "ownerDisplayName": "Kelly", "ownerUserId": 585105, "bodyText": "var item = items[Math.floor(Math.random()*items.length)];" } ]
1
69913
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/69913/why-dont-self-closing-script-elements-work
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
69,913
Why don't self-closing script elements work?
1,534
176,947
12
true
true
[ "javascript", "html", "internet-explorer", "xhtml" ]
2008-09-16T06:52:38
2023-06-03T19:41:40
dimarzionist
false
CC BY-SA 4.0
69,984
10,778
18,767
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What is the reason browsers do not correctly recognize: <script src="foobar.js" /> <!-- self-closing script element --> Only this is recognized: <script src="foobar.js"></script> Does this break the concept of XHTML support? Note: This statement is correct at least for all IE (6-8 beta 2).
<p>What is the reason browsers do not correctly recognize:</p> <pre><code>&lt;script src="foobar.js" /&gt; &lt;!-- self-closing script element --&gt; </code></pre> <p>Only this is recognized:</p> <pre><code>&lt;script src="foobar.js"&gt;&lt;/script&gt; </code></pre> <p>Does this break the concept of XHTML support?<...
null
0
11580961
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/11580961/sending-command-line-arguments-to-npm-script
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
11,580,961
Sending command line arguments to npm script
1,524
1,163,050
26
true
true
[ "javascript", "node.js", "npm" ]
2012-07-20T14:02:36
2025-12-27T09:17:04
user291545
false
CC BY-SA 4.0
14,404,223
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
The scripts portion of my package.json currently looks like this: "scripts": { "start": "node ./script.js server" } ...which means I can run npm start to start the server. So far so good. However, I would like to be able to run something like npm start 8080 and have the argument(s) passed to script.js (e.g. npm start 8...
<p>The <code>scripts</code> portion of my <code>package.json</code> currently looks like this:</p> <pre class="lang-json prettyprint-override"><code>&quot;scripts&quot;: { &quot;start&quot;: &quot;node ./script.js server&quot; } </code></pre> <p>...which means I can run <code>npm start</code> to start the server. S...
[ { "answerId": 14404223, "score": 2058, "isAccepted": true, "createdAt": "2013-01-18T17:20:59", "ownerDisplayName": "jakub.g", "ownerUserId": 245966, "bodyText": "npm 2 and newer It's possible to pass args to npm run since npm 2 (2014). The syntax is as follows: npm run <command> [-- <arg...
1
1374126
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1374126/how-to-extend-an-existing-javascript-array-with-another-array-without-creating
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,374,126
How to extend an existing JavaScript array with another array, without creating a new array
1,524
1,110,884
21
true
true
[ "javascript", "arrays", "concatenation" ]
2009-09-03T15:27:30
2024-11-30T09:13:13
Dzinx
false
CC BY-SA 4.0
1,374,131
18,745
58,242
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
There doesn't seem to be a way to extend an existing JavaScript array with another array, i.e. to emulate Python's extend method. I want to achieve the following: >>> a = [1, 2] [1, 2] >>> b = [3, 4, 5] [3, 4, 5] >>> SOMETHING HERE >>> a [1, 2, 3, 4, 5] I know there's a a.concat(b) method, but it creates a new array in...
<p>There doesn't seem to be a way to extend an existing JavaScript array with another array, i.e. to emulate Python's <code>extend</code> method.</p> <p>I want to achieve the following:</p> <pre><code>&gt;&gt;&gt; a = [1, 2] [1, 2] &gt;&gt;&gt; b = [3, 4, 5] [3, 4, 5] &gt;&gt;&gt; SOMETHING HERE &gt;&gt;&gt; a [1, 2,...
[ { "answerId": 1374131, "score": 2202, "isAccepted": true, "createdAt": "2009-09-03T15:27:55", "ownerDisplayName": "Dzinx", "ownerUserId": 18745, "bodyText": "The .push method can take multiple arguments. You can use the spread operator to pass all the elements of the second array as argu...
1
1056728
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1056728/where-can-i-find-documentation-on-formatting-a-date-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,056,728
Where can I find documentation on formatting a date in JavaScript?
1,518
1,565,830
40
true
true
[ "javascript", "date", "datetime-format", "java-dateformat", "time-format" ]
2009-06-29T05:44:03
2024-01-16T07:10:56
Naga Kiran
true
null
1,056,730
65,670
8,805
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I noticed that JavaScript's new Date() function is very smart in accepting dates in several formats. Xmas95 = new Date("25 Dec, 1995 23:15:00") Xmas95 = new Date("2009 06 12,12:52:39") Xmas95 = new Date("20 09 2006,12:52:39") I could not find documentation anywhere showing all the valid string formats while calling new...
<p>I noticed that JavaScript's <code>new Date()</code> function is very smart in accepting dates in several formats.</p> <pre><code>Xmas95 = new Date("25 Dec, 1995 23:15:00") Xmas95 = new Date("2009 06 12,12:52:39") Xmas95 = new Date("20 09 2006,12:52:39") </code></pre> <p>I could not find documentation anywhere show...
null
0
2204250
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/2204250/check-if-checkbox-is-checked-with-jquery
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
2,204,250
Check if checkbox is checked with jQuery
1,516
2,780,518
27
true
true
[ "javascript", "jquery", "html", "checkbox" ]
2010-02-05T00:23:20
2025-08-12T03:30:31
Jake
false
CC BY-SA 4.0
2,204,275
229,853
26,187
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How can I check if a checkbox in a checkbox array is checked using the id of the checkbox array? I am using the following code, but it always returns the count of checked checkboxes regardless of id. function isCheckedById(id) { alert(id); var checked = $("input[@id=" + id + "]:checked").length; alert(checked); if (che...
<p>How can I check if a checkbox in a checkbox array is checked using the id of the checkbox array?</p> <p>I am using the following code, but it always returns the count of checked checkboxes regardless of id.</p> <pre class="lang-js prettyprint-override"><code>function isCheckedById(id) { alert(id); var chec...
[ { "answerId": 2204253, "score": 2472, "isAccepted": false, "createdAt": "2010-02-05T00:24:34", "ownerDisplayName": "John Boker", "ownerUserId": 2847, "bodyText": "$('#' + id).is(\":checked\") That gets if the checkbox is checked. For an array of checkboxes with the same name you can get ...
1
1068834
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1068834/object-comparison-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,068,834
Object comparison in JavaScript
1,515
1,548,343
10
true
true
[ "javascript", "object", "comparison", "object-comparison" ]
2009-07-01T12:18:29
2020-06-17T10:05:00
spankmaster79
true
null
1,144,249
131,664
22,371
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What is the best way to compare objects in JavaScript? Example: var user1 = {name : "nerd", org: "dev"}; var user2 = {name : "nerd", org: "dev"}; var eq = user1 == user2; alert(eq); // gives false I know that two objects are equal if they refer to the exact same object , but is there a way to check if they have the sam...
<p>What is the best way to compare objects in JavaScript?</p> <p>Example:</p> <pre><code>var user1 = {name : "nerd", org: "dev"}; var user2 = {name : "nerd", org: "dev"}; var eq = user1 == user2; alert(eq); // gives false </code></pre> <p>I know that <strong>two objects are equal if they refer to the exact same obje...
[ { "answerId": 1144249, "score": 1818, "isAccepted": true, "createdAt": "2009-07-17T16:08:59", "ownerDisplayName": "crazyx", "ownerUserId": 140277, "bodyText": "Unfortunately there is no perfect way, unless you use _proto_ recursively and access all non-enumerable properties, but this wor...
1
75980
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/75980/when-are-you-supposed-to-use-escape-instead-of-encodeuri-encodeuricomponent
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
75,980
When are you supposed to use escape instead of encodeURI / encodeURIComponent?
1,515
597,590
16
true
true
[ "javascript", "encoding", "query-string" ]
2008-09-16T19:24:34
2023-07-31T08:27:51
Adam
false
CC BY-SA 4.0
3,608,791
1,341
28,908
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
When encoding a query string to be sent to a web server - when do you use escape() and when do you use encodeURI() or encodeURIComponent() : Use escape: escape("% +&="); OR use encodeURI() / encodeURIComponent() encodeURI("http://www.google.com?var1=value1&var2=value2"); encodeURIComponent("var1=value1&var2=value2");
<p>When encoding a query string to be sent to a web server - when do you use <code>escape()</code> and when do you use <code>encodeURI()</code> or <code>encodeURIComponent()</code>:</p> <p>Use escape:</p> <pre><code>escape(&quot;% +&amp;=&quot;); </code></pre> <p>OR</p> <p>use <code>encodeURI()</code> / <code>encodeURI...
[ { "answerId": 3608791, "score": 2020, "isAccepted": true, "createdAt": "2010-08-31T12:04:17", "ownerDisplayName": "Arne Evertsson", "ownerUserId": 16686, "bodyText": "escape() Don't use it! escape() is defined in section B.2.1.1 escape and the introduction text of Annex B says: ... All o...
1
45015
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/45015/safely-turning-a-json-string-into-an-object
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
45,015
Safely turning a JSON string into an object
1,510
1,491,053
28
true
true
[ "javascript", "json", "parsing" ]
2008-09-05T00:12:01
2022-09-21T10:18:43
Matt Sheppard
false
CC BY-SA 4.0
5,686,237
797
118,363
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Given a string of JSON data, how can I safely turn that string into a JavaScript object? Obviously I can do this unsafely with something like: var obj = eval("(" + json + ')'); but that leaves me vulnerable to the JSON string containing other code, which it seems very dangerous to simply eval.
<p>Given a string of JSON data, how can I safely turn that string into a JavaScript object?</p> <p>Obviously I can do this unsafely with something like:</p> <pre><code>var obj = eval("(" + json + ')'); </code></pre> <p>but that leaves me vulnerable to the JSON string containing other code, which it seems very danger...
[ { "answerId": 5686237, "score": 2127, "isAccepted": true, "createdAt": "2011-04-16T11:45:21", "ownerDisplayName": "Jonathan.", "ownerUserId": 191463, "bodyText": "JSON.parse(jsonString) is a pure JavaScript approach so long as you can guarantee a reasonably modern browser." } ]
1
31048953
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/31048953/what-are-these-three-dots-in-react-doing
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
31,048,953
What are these three dots in React doing?
1,501
667,970
21
true
true
[ "javascript", "reactjs", "spread-syntax" ]
2015-06-25T11:21:52
2025-01-25T17:51:34
Thomas Johansen
false
CC BY-SA 4.0
31,049,016
5,038,178
15,328
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What does the ... do in this React (using JSX) code and what is it called? <Modal {...this.props} title='Modal heading' animation={false}>
<p>What does the <code>...</code> do in this React (using JSX) code and what is it called?</p> <pre><code>&lt;Modal {...this.props} title='Modal heading' animation={false}&gt; </code></pre>
[ { "answerId": 31049016, "score": 1637, "isAccepted": true, "createdAt": "2015-06-25T11:25:12", "ownerDisplayName": "T.J. Crowder", "ownerUserId": 157247, "bodyText": "That's property spread notation . It was added in ES2018 (spread for arrays/iterables was earlier, ES2015), but it's been...
1
4592493
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/4592493/check-if-element-exists-in-jquery
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
4,592,493
Check if element exists in jQuery
1,500
1,779,581
8
true
true
[ "javascript", "jquery" ]
2011-01-04T10:15:11
2017-08-12T09:34:27
Nick
true
null
4,592,511
482,925
16,125
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I check if an element exists if the element is created by .append() method? $('elemId').length doesn't work for me.
<p>How do I check if an element exists if the element is created by <code>.append()</code> method? <code>$('elemId').length</code> doesn't work for me.</p>
[ { "answerId": 4592511, "score": 2042, "isAccepted": true, "createdAt": "2011-01-04T10:17:43", "ownerDisplayName": "Sarfraz", "ownerUserId": 139459, "bodyText": "$('elemId').length doesn't work for me. You need to put # before element id: $('#elemId').length ---^ With vanilla JavaScript, ...
1
3127429
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/3127429/how-does-the-this-keyword-work-and-when-should-it-be-used
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
3,127,429
How does the "this" keyword work, and when should it be used?
1,500
482,607
22
true
true
[ "javascript", "this" ]
2010-06-27T13:12:56
2025-05-07T05:34:55
Maxim Gershkovich
false
CC BY-SA 4.0
3,127,440
314,661
47,477
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I am looking to find a clear explanation of what the "this" keyword does, and how to use it correctly. It seems to behave strangely, and I don't fully understand why. How does this work and when should it be used?
<p>I am looking to find a clear explanation of what the &quot;this&quot; keyword does, and how to use it correctly.</p> <p>It seems to behave strangely, and I don't fully understand why.</p> <p>How does <code>this</code> work and when should it be used?</p>
[ { "answerId": 3127440, "score": 1506, "isAccepted": true, "createdAt": "2010-06-27T13:15:40", "ownerDisplayName": "Daniel Trebbien", "ownerUserId": 196844, "bodyText": "this is a keyword in JavaScript that is a property of an execution context. Its main use is in functions and constructo...
1
2140627
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/2140627/how-to-do-case-insensitive-string-comparison
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
2,140,627
How to do case insensitive string comparison?
1,493
1,385,077
23
true
true
[ "javascript", "string" ]
2010-01-26T16:07:45
2023-04-21T22:03:01
flybywire
false
CC BY-SA 4.0
2,140,644
63,051
277,632
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I perform case insensitive string comparison in JavaScript?
<p>How do I perform case insensitive string comparison in JavaScript?</p>
[ { "answerId": 2140644, "score": 1550, "isAccepted": true, "createdAt": "2010-01-26T16:09:23", "ownerDisplayName": "SLaks", "ownerUserId": 34397, "bodyText": "EDIT: This answer was originally added over 10 years ago. Today should use localeCompare. See the other answers. The simplest way ...
1
170986
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/170986/what-is-the-best-way-to-add-options-to-a-select-from-a-javascript-object-with-jq
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
170,986
What is the best way to add options to a select from a JavaScript object with jQuery?
1,492
1,158,635
37
true
true
[ "javascript", "jquery", "html-select" ]
2008-10-04T20:58:46
2021-10-22T05:44:29
Darryl Hein
false
CC BY-SA 4.0
171,007
5,441
145,595
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What is the best method for adding options to a <select> from a JavaScript object using jQuery? I'm looking for something that I don't need a plugin to do, but I would also be interested in the plugins that are out there. This is what I did: selectValues = { "1": "test 1", "2": "test 2" }; for (key in selectValues) { i...
<p>What is the best method for adding options to a <code>&lt;select&gt;</code> from a JavaScript object using jQuery?</p> <p>I'm looking for something that I don't need a plugin to do, but I would also be interested in the plugins that are out there.</p> <p>This is what I did:</p> <pre><code>selectValues = { "1": "t...
[ { "answerId": 171007, "score": 1486, "isAccepted": true, "createdAt": "2008-10-04T21:12:02", "ownerDisplayName": "matdumsa", "ownerUserId": 1775, "bodyText": "The same as other answers, in a jQuery fashion: $.each(selectValues, function(key, value) { $('#mySelect') .append($(\"<option></...
1
155188
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/155188/trigger-a-button-click-with-javascript-on-the-enter-key-in-a-text-box
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
155,188
Trigger a button click with JavaScript on the Enter key in a text box
1,473
1,832,132
31
true
true
[ "javascript", "button", "onclick", "onkeydown", "onkeypress" ]
2008-09-30T21:32:09
2023-06-30T18:26:12
kdenney
false
CC BY-SA 4.0
155,263
23,947
18,593
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have one text input and one button (see below). How can I use JavaScript to trigger the button's click event when the Enter key is pressed inside the text box? There is already a different submit button on my current page, so I can't simply make the button a submit button. And, I only want the Enter key to click this...
<p>I have one text input and one button (see below). How can I use JavaScript to <strong>trigger the button's click event</strong> when the <kbd>Enter</kbd> key is pressed inside the text box?</p> <p>There is already a different submit button on my current page, so I can't simply make the button a submit button. And, ...
[ { "answerId": 155263, "score": 1560, "isAccepted": true, "createdAt": "2008-09-30T21:52:16", "ownerDisplayName": "Steve Paulo", "ownerUserId": 9414, "bodyText": "In jQuery, the following would work: $(\"#id_of_textbox\").keyup(function(event) { if (event.keyCode === 13) { $(\"#id_of_butt...
1
3755606
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/3755606/what-does-the-exclamation-mark-do-before-the-function
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
3,755,606
What does the exclamation mark do before the function?
1,472
244,976
8
true
true
[ "javascript", "function" ]
2010-09-20T21:21:51
2023-03-15T15:45:40
Sebastian Otto
false
CC BY-SA 4.0
5,654,929
453,227
15,299
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I found this code: !function () {}(); What is the purpose of the exclamation mark here?
<p>I found this code:</p> <pre><code>!function () {}(); </code></pre> <p>What is the purpose of the exclamation mark here?</p>
[ { "answerId": 5654929, "score": 2437, "isAccepted": true, "createdAt": "2011-04-13T20:02:29", "ownerDisplayName": "Neil", "ownerUserId": 182705, "bodyText": "JavaScript syntax 101: here is a function declaration : function foo() {} Note that there’s no semicolon; this is just a function ...
1
179713
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/179713/how-to-change-the-href-attribute-for-a-hyperlink-using-jquery
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
179,713
How to change the href attribute for a hyperlink using jQuery
1,471
1,786,455
13
true
true
[ "javascript", "html", "jquery", "hyperlink" ]
2008-10-07T18:17:33
2022-04-06T00:03:17
Brian Boatright
false
CC BY-SA 4.0
179,717
3,747
36,864
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How can you change the href attribute (link target) for a hyperlink using jQuery?
<p>How can you change the <code>href</code> attribute (link target) for a hyperlink using jQuery?</p>
[ { "answerId": 179717, "score": 2074, "isAccepted": true, "createdAt": "2008-10-07T18:19:42", "ownerDisplayName": "Shog9", "ownerUserId": 811, "bodyText": "Using $(\"a\").attr(\"href\", \"http://www.google.com/\") will modify the href of all hyperlinks to point to Google. You probably wan...
1
32370994
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/32370994/how-to-pass-props-to-this-props-children
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
32,370,994
How to pass props to {this.props.children}
1,465
1,028,191
33
true
true
[ "javascript", "reactjs" ]
2015-09-03T08:47:25
2024-08-21T13:59:48
plus-
false
CC BY-SA 3.0
32,371,612
709,635
46,713
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'm trying to find the proper way to define some components which could be used in a generic way: <Parent> <Child value="1"> <Child value="2"> </Parent> There is a logic going on for rendering between parent and children components of course, you can imagine <select> and <option> as an example of this logic. This is a ...
<p>I'm trying to find the proper way to define some components which could be used in a generic way:</p> <pre><code>&lt;Parent&gt; &lt;Child value="1"&gt; &lt;Child value="2"&gt; &lt;/Parent&gt; </code></pre> <p>There is a logic going on for rendering between parent and children components of course, you can imag...
[ { "answerId": 32371612, "score": 1515, "isAccepted": true, "createdAt": "2015-09-03T09:17:38", "ownerDisplayName": "nanobar", "ownerUserId": 414062, "bodyText": "Cloning children with new props You can use React.Children to iterate over the children, and then clone each element with new ...
1
1063007
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1063007/how-can-i-sort-an-array-of-integers
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,063,007
How can I sort an array of integers?
1,464
1,334,278
34
true
true
[ "javascript", "arrays", "sorting", "numbers" ]
2009-06-30T10:43:11
2026-03-11T14:40:26
peirix
false
CC BY-SA 4.0
1,063,027
59,242
37,959
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I am trying to get the highest and lowest value from an array that I know will contain only integers, and it seemed to be harder than I thought. var numArray = [140000, 104, 99]; numArray = numArray.sort(); console.log(numArray) I'd expect this to show 99, 104, 140000 . Instead, it shows 104, 140000, 99 . So it seems t...
<p>I am trying to get the highest and lowest value from an array that I know will contain only integers, and it seemed to be harder than I thought.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false" data-babel-preset-react="false" data-babel-preset-ts="false"> <div class...
[ { "answerId": 1063027, "score": 2059, "isAccepted": true, "createdAt": "2009-06-30T10:47:04", "ownerDisplayName": "aks", "ownerUserId": 2533756, "bodyText": "By default, the sort method sorts elements alphabetically. To sort numerically just add a new method which handles numeric sorts (...
1
500606
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/500606/deleting-array-elements-in-javascript-delete-vs-splice
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
500,606
Deleting array elements in JavaScript - delete vs splice
1,459
1,698,988
29
true
true
[ "javascript", "arrays", "element", "delete-operator", "array-splice" ]
2009-02-01T11:11:16
2022-06-01T03:16:55
lYriCAlsSH
false
CC BY-SA 4.0
500,617
60,102
58,197
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What is the difference between using the delete operator on the array element as opposed to using the Array.splice method ? For example: myArray = ['a', 'b', 'c', 'd']; delete myArray[1]; // or myArray.splice (1, 1); Why even have the splice method if I can delete array elements like I can with objects?
<p>What is the difference between using <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/delete" rel="noreferrer">the <code>delete</code> operator</a> on the array element as opposed to using <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/spli...
[ { "answerId": 500617, "score": 1825, "isAccepted": true, "createdAt": "2009-02-01T11:16:23", "ownerDisplayName": "Andy Hume", "ownerUserId": 46460, "bodyText": "delete will delete the object property, but will not reindex the array or update its length. This makes it appears as if it is ...
1
48152674
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/48152674/how-do-i-check-if-pytorch-is-using-the-gpu
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
48,152,674
How do I check if PyTorch is using the GPU?
645
1,490,567
21
true
true
[ "python", "memory-management", "gpu", "nvidia", "pytorch" ]
2018-01-08T14:50:13
2026-07-04T06:04:13
vvvvv
false
CC BY-SA 4.0
48,152,675
5,446,749
33,214
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
42703500
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/42703500/how-do-i-save-a-trained-model-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
42,703,500
How do I save a trained model in PyTorch?
400
470,297
11
true
true
[ "python", "serialization", "deep-learning", "pytorch", "tensor" ]
2017-03-09T19:06:40
2024-09-04T03:14:13
Wasi Ahmad
false
CC BY-SA 4.0
43,819,235
5,352,399
38,072
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
48001598
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/48001598/why-do-we-need-to-call-zero-grad-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
48,001,598
Why do we need to call zero_grad() in PyTorch?
387
324,919
9
true
true
[ "python", "neural-network", "deep-learning", "pytorch", "gradient-descent" ]
2017-12-28T04:31:40
2025-12-23T08:47:16
user1424739
false
CC BY-SA 4.0
48,009,142
1,424,739
14,243
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
42480111
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/42480111/how-do-i-print-the-model-summary-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
42,480,111
How do I print the model summary in PyTorch?
358
504,551
11
true
true
[ "python", "machine-learning", "deep-learning", "pytorch" ]
2017-02-27T07:35:42
2025-05-15T12:12:05
Wasi Ahmad
false
CC BY-SA 4.0
42,616,812
5,352,399
38,072
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
42479902
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/42479902/what-does-view-do-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
42,479,902
What does `view()` do in PyTorch?
353
284,305
9
true
true
[ "python", "machine-learning", "memory", "pytorch", "tensor" ]
2017-02-27T07:21:10
2025-05-15T12:08:13
Wasi Ahmad
false
CC BY-SA 4.0
42,482,819
5,352,399
38,072
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
60018578
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/60018578/what-does-model-eval-do-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
60,018,578
What does model.eval() do in pytorch?
304
370,972
6
true
true
[ "python", "machine-learning", "deep-learning", "pytorch" ]
2020-02-01T15:58:15
2025-10-14T19:49:18
Gulzar
false
CC BY-SA 4.0
60,018,731
913,098
29,103
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
49433936
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/49433936/how-do-i-initialize-weights-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
49,433,936
How do I initialize weights in PyTorch?
282
528,750
11
true
true
[ "python", "machine-learning", "deep-learning", "neural-network", "pytorch" ]
2018-03-22T16:34:42
2024-12-23T03:21:24
Fábio Perez
false
CC BY-SA 4.0
49,433,937
604,734
26,698
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
49643225
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/49643225/whats-the-difference-between-reshape-and-view-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
49,643,225
What's the difference between `reshape()` and `view()` in PyTorch?
275
181,105
5
true
true
[ "python", "pytorch", "reshape", "tensor", "difference" ]
2018-04-04T05:09:50
2024-08-21T10:55:03
Lifu Huang
false
CC BY-SA 4.0
49,644,300
4,794,308
13,119
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
48915810
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/48915810/what-does-contiguous-do-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
48,915,810
What does .contiguous() do in PyTorch?
253
179,078
8
true
true
[ "python", "memory", "pytorch", "contiguous" ]
2018-02-21T21:30:57
2023-02-20T14:53:03
MBT
false
CC BY-SA 4.0
52,229,694
7,483,494
24,741
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
51433378
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/51433378/what-does-model-train-do-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
51,433,378
What does model.train() do in PyTorch?
242
279,223
6
true
true
[ "python", "machine-learning", "deep-learning", "pytorch" ]
2018-07-20T00:10:00
2025-08-20T18:11:49
aerin
false
CC BY-SA 4.0
51,433,411
3,907,250
23,134
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
49201236
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/49201236/check-the-total-number-of-parameters-in-a-pytorch-model
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
49,201,236
Check the total number of parameters in a PyTorch model
215
197,096
12
true
true
[ "python", "pytorch" ]
2018-03-09T19:55:23
2024-04-22T08:24:33
Fábio Perez
false
CC BY-SA 4.0
49,201,237
604,734
26,698
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
53975717
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/53975717/pytorch-connection-between-loss-backward-and-optimizer-step
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
53,975,717
pytorch - connection between loss.backward() and optimizer.step()
212
90,295
7
true
true
[ "machine-learning", "neural-network", "pytorch", "gradient-descent" ]
2018-12-30T06:30:53
2023-09-21T19:58:53
aerin
false
CC BY-SA 4.0
53,975,741
3,907,250
23,134
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
59013109
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/59013109/runtimeerror-input-type-torch-floattensor-and-weight-type-torch-cuda-floatte
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
59,013,109
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same
201
379,984
8
true
true
[ "python", "python-3.x", "machine-learning", "deep-learning", "pytorch" ]
2019-11-23T23:08:32
2023-07-20T07:31:03
Guillermina
false
CC BY-SA 4.0
59,013,131
10,168,730
3,757
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
55266154
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/55266154/pytorch-preferred-way-to-copy-a-tensor
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
55,266,154
PyTorch preferred way to copy a tensor
199
231,160
4
true
true
[ "python", "pytorch", "copy", "tensor" ]
2019-03-20T16:51:41
2024-08-20T13:55:21
dkv
false
CC BY-SA 4.0
62,496,418
2,593,878
7,482
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
59129812
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/59129812/how-to-avoid-cuda-out-of-memory-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
59,129,812
How to avoid "CUDA out of memory" in PyTorch
194
826,202
25
true
true
[ "python", "deep-learning", "pytorch", "object-detection", "low-memory" ]
2019-12-01T20:46:13
2025-12-03T12:41:26
voilalex
false
CC BY-SA 4.0
62,556,666
9,543,830
2,705
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
51030782
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/51030782/why-do-we-pack-the-sequences-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
51,030,782
Why do we "pack" the sequences in PyTorch?
191
88,604
5
true
true
[ "deep-learning", "pytorch", "recurrent-neural-network", "tensor", "zero-padding" ]
2018-06-25T19:40:53
2022-03-29T08:35:33
aerin
false
CC BY-SA 4.0
51,030,945
3,907,250
23,134
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
49768306
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/49768306/pytorch-tensor-to-numpy-array
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
49,768,306
Pytorch tensor to numpy array
189
618,329
8
true
true
[ "python", "numpy", "pytorch" ]
2018-04-11T06:49:22
2025-02-03T19:40:36
DukeLover
false
CC BY-SA 4.0
49,768,500
1,249,184
2,507
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
50999977
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/50999977/what-does-gather-do-in-pytorch-in-layman-terms
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
50,999,977
What does `gather()` do in PyTorch in layman terms?
149
94,497
6
true
true
[ "python", "function", "pytorch", "tensor" ]
2018-06-23T09:54:01
2024-12-28T23:58:08
amitection
false
CC BY-SA 4.0
51,032,153
3,564,468
3,053
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
52468956
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/52468956/how-do-i-visualize-a-net-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
52,468,956
How do I visualize a net in Pytorch?
148
236,650
9
true
true
[ "python", "pytorch" ]
2018-09-23T18:15:04
2026-07-11T13:56:35
raaj
false
CC BY-SA 4.0
52,511,383
1,436,508
3,529
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
57237352
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/57237352/what-does-unsqueeze-do-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
57,237,352
What does "unsqueeze" do in Pytorch?
144
159,244
7
true
true
[ "python", "numpy", "machine-learning", "deep-learning", "pytorch" ]
2019-07-28T01:43:43
2025-05-15T11:01:35
user6549804
false
CC BY-SA 4.0
57,237,378
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
43451125
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/43451125/pytorch-what-are-the-gradient-arguments
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
43,451,125
Pytorch, what are the gradient arguments
143
30,357
4
true
true
[ "neural-network", "gradient", "pytorch", "torch", "gradient-descent" ]
2017-04-17T12:04:14
2021-12-03T21:55:12
Qubix
false
CC BY-SA 4.0
57,540,363
5,016,028
4,373
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
60987997
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/60987997/why-torch-cuda-is-available-returns-false-even-after-installing-pytorch-with
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
60,987,997
Why `torch.cuda.is_available()` returns False even after installing pytorch with cuda?
139
445,873
17
true
true
[ "python", "pytorch" ]
2020-04-02T09:12:19
2025-05-19T12:14:52
mac179
false
CC BY-SA 4.0
61,034,368
11,512,643
2,080
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
50935345
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/50935345/understanding-torch-nn-parameter
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
50,935,345
Understanding `torch.nn.Parameter()`
138
193,075
3
true
true
[ "python", "class", "pytorch" ]
2018-06-19T19:03:47
2024-08-24T00:21:32
Vineet Pandey
false
CC BY-SA 4.0
51,027,227
9,761,439
1,686
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
50544730
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/50544730/how-do-i-split-a-custom-dataset-into-training-and-test-datasets
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
50,544,730
How do I split a custom dataset into training and test datasets?
135
251,863
8
true
true
[ "python", "deep-learning", "pytorch" ]
2018-05-26T16:16:04
2024-08-09T19:21:49
nirvair
false
CC BY-SA 4.0
50,544,887
4,229,637
4,228
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
42704283
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/42704283/l1-l2-regularization-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
42,704,283
L1/L2 regularization in PyTorch
134
282,769
9
true
true
[ "python", "machine-learning", "pytorch", "loss-function", "regularized" ]
2017-03-09T19:54:19
2025-05-15T11:55:59
Wasi Ahmad
false
CC BY-SA 4.0
42,723,573
5,352,399
38,072
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
54307225
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/54307225/stack-vs-cat-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
54,307,225
`stack()` vs `cat()` in PyTorch
130
103,381
4
true
true
[ "python", "machine-learning", "deep-learning", "pytorch", "concatenation" ]
2019-01-22T11:24:47
2025-05-15T11:58:21
Gulzar
false
CC BY-SA 4.0
54,307,331
913,098
29,103
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
56741087
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/56741087/how-to-fix-runtimeerror-expected-object-of-scalar-type-float-but-got-scalar-typ
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
56,741,087
How to fix RuntimeError "Expected object of scalar type Float but got scalar type Double for argument"?
126
278,943
9
true
true
[ "python", "neural-network", "deep-learning", "classification", "pytorch" ]
2019-06-24T17:05:49
2023-08-16T01:31:52
Shawn Zhang
false
CC BY-SA 4.0
56,741,419
6,491,230
1,779
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
57727372
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/57727372/how-do-i-get-the-value-of-a-tensor-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
57,727,372
How do I get the value of a tensor in PyTorch?
122
240,283
4
true
true
[ "python", "pytorch", "tensor" ]
2019-08-30T13:08:12
2025-08-12T14:22:53
apostofes
false
CC BY-SA 4.0
57,727,748
10,855,529
3,833
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
54716377
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/54716377/how-to-do-gradient-clipping-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
54,716,377
How to do gradient clipping in pytorch?
121
204,256
5
true
true
[ "python", "machine-learning", "deep-learning", "pytorch", "gradient-descent" ]
2019-02-15T20:09:44
2024-08-08T22:20:42
Gulzar
false
CC BY-SA 4.0
54,816,498
913,098
29,103
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
54374935
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/54374935/how-can-i-fix-this-strange-error-runtimeerror-cuda-error-out-of-memory
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
54,374,935
How can I fix this strange error: "RuntimeError: CUDA error: out of memory"?
121
462,392
21
true
false
[ "python", "pytorch" ]
2019-01-26T01:39:46
2026-02-11T09:43:22
xiaoding chen
false
CC BY-SA 4.0
null
10,912,236
1,317
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
53998282
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/53998282/how-does-the-number-of-workers-parameter-in-pytorch-dataloader-actually-work
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
53,998,282
How does the "number of workers" parameter in PyTorch dataloader actually work?
119
149,909
1
true
true
[ "python", "memory-management", "deep-learning", "pytorch", "ram" ]
2019-01-01T19:23:26
2020-10-12T18:14:39
Bassel
false
CC BY-SA 4.0
54,002,191
4,931,135
1,773
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
48302810
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/48302810/whats-the-difference-between-hidden-and-output-in-pytorch-lstm
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
48,302,810
What's the difference between "hidden" and "output" in PyTorch LSTM?
117
58,750
6
true
true
[ "deep-learning", "pytorch", "lstm", "recurrent-neural-network", "tensor" ]
2018-01-17T13:54:17
2024-12-12T07:16:36
N. Virgo
false
CC BY-SA 4.0
48,305,882
1,119,340
8,519
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
53903373
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/53903373/convert-pytorch-tensor-to-python-list
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
53,903,373
Convert PyTorch tensor to python list
116
226,438
3
true
true
[ "python", "pytorch" ]
2018-12-23T11:50:34
2022-03-28T12:46:09
Tom Hale
false
CC BY-SA 4.0
53,903,817
5,353,461
48,475
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
66091226
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/66091226/runtimeerror-expected-all-tensors-to-be-on-the-same-device-but-found-at-least
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
66,091,226
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! when resuming training
115
391,054
11
true
false
[ "python", "deep-learning", "pytorch", "runtime-error", "tensor" ]
2021-02-07T17:54:33
2025-01-04T07:54:28
Ido Do
false
CC BY-SA 4.0
null
13,757,501
1,151
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
50307707
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/50307707/how-do-i-convert-a-pandas-dataframe-to-a-pytorch-tensor
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
50,307,707
How do I convert a Pandas dataframe to a PyTorch tensor?
115
229,096
7
true
true
[ "python", "pandas", "dataframe", "pytorch" ]
2018-05-12T15:13:34
2022-07-11T08:43:16
M. Fabio
false
CC BY-SA 4.0
50,308,132
9,781,113
1,281
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
53580088
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/53580088/calculate-the-output-size-in-convolution-layer
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
53,580,088
Calculate the output size in convolution layer
110
262,121
5
true
false
[ "machine-learning", "deep-learning", "pytorch", "conv-neural-network" ]
2018-12-02T12:09:28
2025-07-18T05:11:19
Monk247uk
true
null
null
9,362,939
1,340
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
56859803
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/56859803/modulenotfounderror-no-module-named-tools-nnwrap
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
56,859,803
ModuleNotFoundError: No module named 'tools.nnwrap'
105
111,605
17
true
true
[ "python", "pytorch" ]
2019-07-02T20:43:08
2022-03-29T06:45:44
Monu
false
CC BY-SA 4.0
56,877,423
8,237,992
2,180
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
44429199
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/44429199/how-to-load-a-list-of-numpy-arrays-to-pytorch-dataset-loader
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
44,429,199
How to load a list of numpy arrays to pytorch dataset loader?
105
134,949
3
true
true
[ "python", "numpy", "pytorch" ]
2017-06-08T07:22:58
2022-12-25T22:20:43
deepayan das
false
CC BY-SA 4.0
44,475,689
8,059,047
1,677
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
57814535
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/57814535/assertionerror-torch-not-compiled-with-cuda-enabled-in-spite-upgrading-to-cud
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
57,814,535
"AssertionError: Torch not compiled with CUDA enabled" in spite upgrading to CUDA version
104
498,968
16
true
false
[ "python", "pytorch", "conda" ]
2019-09-06T01:03:31
2025-03-08T04:46:18
angel_30
false
CC BY-SA 4.0
null
22,674,380
5,737
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
54843067
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/54843067/no-module-named-torch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
54,843,067
No module named "Torch"
103
869,667
27
true
true
[ "python", "pip", "pytorch", "conda" ]
2019-02-23T15:21:31
2025-12-05T00:38:40
RedCrayon
false
CC BY-SA 4.0
56,809,312
11,086,331
1,123
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
53266350
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/53266350/how-to-tell-pytorch-to-not-use-the-gpu
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
53,266,350
How to tell PyTorch to not use the GPU?
101
195,247
7
true
true
[ "python", "machine-learning", "deep-learning", "pytorch", "gpu" ]
2018-11-12T16:29:59
2024-04-16T09:55:59
aneccodeal
false
CC BY-SA 4.0
53,266,932
46,190
8,883
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
51677788
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/51677788/data-augmentation-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
51,677,788
Data Augmentation in PyTorch
100
105,512
6
true
true
[ "python", "machine-learning", "pytorch", "dataset", "data-augmentation" ]
2018-08-03T17:51:49
2025-03-25T16:04:34
Fawaz
false
CC BY-SA 4.0
51,678,124
9,109,354
1,383
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
54216920
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/54216920/how-to-use-multiple-gpus-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
54,216,920
How to use multiple GPUs in pytorch?
100
195,057
7
true
false
[ "python", "pytorch" ]
2019-01-16T12:17:25
2026-03-30T15:25:07
ML Xu
false
CC BY-SA 4.0
null
10,305,579
1,141
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
51691563
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/51691563/cuda-runtime-error-59-device-side-assert-triggered
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
51,691,563
CUDA runtime error (59) : device-side assert triggered
98
256,329
16
true
true
[ "python", "pytorch" ]
2018-08-05T05:10:27
2024-08-29T17:06:43
saichand
false
CC BY-SA 4.0
51,701,698
7,295,290
1,313
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
48324152
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/48324152/how-to-change-the-learning-rate-of-an-optimizer-at-any-given-moment-no-lr-sched
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
48,324,152
How to change the learning rate of an optimizer at any given moment (no LR schedule)?
97
126,027
2
true
true
[ "python", "optimization", "neural-network", "deep-learning", "pytorch" ]
2018-01-18T14:55:52
2025-11-28T11:19:10
patapouf_ai
false
CC BY-SA 4.0
48,324,389
3,990,607
18,953
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
68166721
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/68166721/pytorch-fails-with-cuda-error-device-side-assert-triggered-on-colab
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
68,166,721
Pytorch fails with CUDA error: device-side assert triggered on Colab
95
384,447
18
true
true
[ "python", "pytorch", "google-colaboratory", "tensor" ]
2021-06-28T16:12:46
2024-12-18T02:21:43
3nomis
false
CC BY-SA 4.0
68,169,616
5,080,195
1,662
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
44524901
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/44524901/how-to-multiply-matrices-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
44,524,901
How to multiply matrices in PyTorch?
94
174,849
4
true
true
[ "python", "matrix", "pytorch", "matrix-multiplication", "tensor" ]
2017-06-13T14:50:00
2024-08-20T22:57:27
timbmg
false
CC BY-SA 4.0
44,525,687
4,139,024
3,358
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
56816241
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/56816241/difference-between-detach-and-with-torch-nograd-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
56,816,241
Difference between "detach()" and "with torch.nograd()" in PyTorch?
93
101,965
3
true
false
[ "python", "pytorch", "autograd" ]
2019-06-29T08:47:44
2021-01-28T22:44:37
user637140
false
CC BY-SA 4.0
null
10,973,886
1,161
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
58151507
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/58151507/why-pytorch-officially-use-mean-0-485-0-456-0-406-and-std-0-229-0-224-0-2
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
58,151,507
Why Pytorch officially use mean=[0.485, 0.456, 0.406] and std=[0.229, 0.224, 0.225] to normalize images?
91
119,707
4
true
true
[ "python", "pytorch", "normalize" ]
2019-09-29T01:31:04
2025-04-06T20:04:28
laridzhang
false
CC BY-SA 4.0
58,151,903
9,066,532
1,891
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
53623472
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/53623472/how-do-i-display-a-single-image-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
53,623,472
How do I display a single image in PyTorch?
89
204,788
9
true
true
[ "python", "matplotlib", "pytorch" ]
2018-12-05T00:33:01
2025-01-27T15:32:24
Tom Hale
false
CC BY-SA 4.0
55,196,345
5,353,461
48,475
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
46826218
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/46826218/pytorch-how-to-get-the-shape-of-a-tensor-as-a-list-of-int
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
46,826,218
PyTorch: How to get the shape of a Tensor as a list of int
87
337,139
4
true
true
[ "python", "pytorch", "tensor" ]
2017-10-19T08:59:33
2021-03-09T22:09:24
patapouf_ai
false
CC BY-SA 3.0
46,826,785
3,990,607
18,953
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
46774641
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/46774641/what-does-the-parameter-retain-graph-mean-in-the-variables-backward-method
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
46,774,641
What does the parameter retain_graph mean in the Variable's backward() method?
84
92,212
2
true
true
[ "neural-network", "conv-neural-network", "backpropagation", "pytorch", "automatic-differentiation" ]
2017-10-16T16:11:34
2022-03-19T07:04:56
jvans
false
CC BY-SA 3.0
47,174,709
1,646,823
2,905
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
73747731
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/73747731/runtimeerror-cuda-out-of-memory-how-can-i-set-max-split-size-mb
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
73,747,731
RuntimeError: CUDA out of memory. How can I set max_split_size_mb?
83
298,924
5
true
false
[ "memory", "pytorch", "runtime-error", "google-colaboratory" ]
2022-09-16T16:18:51
2024-06-11T05:05:21
eli
false
CC BY-SA 4.0
null
19,509,665
831
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
50747947
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/50747947/embedding-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
50,747,947
Embedding in pytorch
82
132,919
5
true
false
[ "python", "pytorch", "word-embedding" ]
2018-06-07T18:29:18
2024-04-07T06:30:04
user1927468
false
CC BY-SA 4.0
null
1,927,468
1,143
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
55322434
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/55322434/how-to-clear-cuda-memory-in-pytorch
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
55,322,434
How to clear CUDA memory in PyTorch
81
229,910
2
true
true
[ "python", "pytorch" ]
2019-03-24T09:38:43
2022-10-10T09:57:36
ntd
false
CC BY-SA 4.0
55,340,037
9,536,387
2,472
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
55627780
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/55627780/evaluating-pytorch-models-with-torch-no-grad-vs-model-eval
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
55,627,780
Evaluating pytorch models: `with torch.no_grad` vs `model.eval()`
79
38,215
3
true
true
[ "python", "machine-learning", "deep-learning", "pytorch", "autograd" ]
2019-04-11T08:16:55
2022-01-05T23:37:58
Tom Hale
false
CC BY-SA 4.0
55,627,781
5,353,461
48,475
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
62359175
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/62359175/pytorch-says-that-cuda-is-not-available-on-ubuntu
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
62,359,175
Pytorch says that CUDA is not available (on Ubuntu)
78
340,476
8
true
true
[ "linux", "pytorch", "ubuntu-18.04" ]
2020-06-13T11:36:19
2024-06-21T03:16:18
wfgeo
false
CC BY-SA 4.0
62,361,395
2,068,931
3,278
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
63582590
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/63582590/why-do-we-call-detach-before-calling-numpy-on-a-pytorch-tensor
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
63,582,590
Why do we call .detach() before calling .numpy() on a Pytorch Tensor?
76
97,891
3
true
true
[ "numpy", "pytorch", "autodiff" ]
2020-08-25T15:48:28
2024-05-06T16:59:15
Josiah Yoder
false
CC BY-SA 4.0
63,869,655
1,048,186
3,936
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
43328632
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/43328632/pytorch-reshape-tensor-dimension
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
43,328,632
PyTorch reshape tensor dimension
76
243,999
11
true
true
[ "python", "pytorch", "reshape", "tensor" ]
2017-04-10T16:38:52
2022-09-16T10:57:37
Haha TTpro
false
CC BY-SA 4.0
43,451,081
5,250,620
5,627
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
41924453
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/41924453/pytorch-how-to-use-dataloaders-for-custom-datasets
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
41,924,453
PyTorch: How to use DataLoaders for custom Datasets
76
63,611
5
true
true
[ "python", "torch", "pytorch" ]
2017-01-29T18:31:24
2023-01-21T10:30:57
Sarthak
false
CC BY-SA 3.0
42,054,194
3,398,648
1,178
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
55563376
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/55563376/pytorch-how-does-pin-memory-work-in-dataloader
aO4Eqk7nKPBaX2E4c
VeFg1xd5Sk176X1D0
55,563,376
Pytorch. How does pin_memory work in Dataloader?
75
69,108
1
true
true
[ "pytorch", "cuda", "pytorch-dataloader", "dataloader" ]
2019-04-07T20:27:24
2024-03-28T08:26:17
Ivan Belonogov
false
CC BY-SA 4.0
55,564,072
8,509,167
919
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null