question_id
int64
37.6M
73.2M
input_text
stringlengths
88
52.4k
output_text
stringlengths
37
35.6k
title
stringlengths
15
150
tags
stringlengths
1
107
q_score
int64
-19
397
view_count
int64
3
879k
answer_count
int64
1
21
accepted_answer_id
int64
37.6M
73.8M
answer_id
int64
37.6M
73.8M
a_score
int64
-5
1.29k
is_accepted
bool
1 class
creation_date
stringlengths
20
24
input_text_instruct
stringlengths
251
52.6k
72,306,737
How to add Metaplex/Candymachine function to an existing website?<p>I'm hoping someone can point me in the right direction. I would like to add the Metaplex/candymachine function to an existing website that was originally built to work with metamask. Just trying to save myself from having to redo the website. Thanks</...
<p>There's no real easy way to do this unfortunately unless you have some prior HTML/CSS/and JS knowledge.</p> <p>What some people do is take the logic from the CandymachineUI which can be found here <a href="https://github.com/metaplex-foundation/metaplex/blob/master/js/packages/candy-machine-ui/src/candy-machine.ts" ...
How to add Metaplex/Candymachine function to an existing website?
reactjs|blockchain|nft|metaplex|candy-machine
-4
82
1
72,307,123
72,307,123
2
true
2022-05-19T14:51:02.777Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add Metaplex/Candymachine function to an existing website?<p>I'm hoping someone can point me in the right direction. I would like to add the Metaplex/...
72,324,467
Why does Google Books API not return a complete response?<p>I made a request to google books API, trying to retrieve the volumes (a.k.a books) from my bookshelf. But the response I get contains only 10 items whereas on the shelf I have 17 items.</p> <p>Could this be that my code is faulty, or maybe a restriction from g...
<p>As <a href="https://developers.google.com/books/docs/v1/using" rel="nofollow noreferrer">the docs say</a>:</p> <blockquote> <p><strong>Pagination</strong></p> <p>You can paginate the volumes list by specifying two values in the parameters for the request:</p> <p>startIndex - The position in the collection at which t...
Why does Google Books API not return a complete response?
reactjs|google-books-api
0
82
1
72,324,486
72,324,486
2
true
2022-05-20T20:26:39.520Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does Google Books API not return a complete response?<p>I made a request to google books API, trying to retrieve the volumes (a.k.a books) from my booksh...
72,365,250
If you have a pod with multiple containers and one triggers OOMKilller, does it restart the entire pod?<p>Trying to plan out a deployment for an application and am wondering if it makes sense to have multiple pods in a container vs putting them in separate pods. I expect one of the containers to potentially be operatin...
<p>No, only the specific container.</p> <p>For the whole pod to be recreated there needs to be a change in the Pod's <code>ownerObject</code> (tipically a <code>Replicaset</code>) or a scheduling decision by <code>kube-scheduler</code>.</p>
If you have a pod with multiple containers and one triggers OOMKilller, does it restart the entire pod?
kubernetes|memory|containers|kubernetes-pod
1
82
1
72,369,558
72,369,558
2
true
2022-05-24T15:04:06.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: If you have a pod with multiple containers and one triggers OOMKilller, does it restart the entire pod?<p>Trying to plan out a deployment for an application ...
72,400,367
How to move file from one directory to another (Julia)?<p>I have two different paths (directory path and file path). I need to move the file from one directory to another. How i should do it?</p>
<p>Use the <code>mv</code> function.</p> <pre><code>help?&gt; mv … mv(src::AbstractString, dst::AbstractString; force::Bool=false) Move the file, link, or directory from src to dst. force=true will first remove an existing dst. Return dst. </code></pre> <p>One thing to note is that both <code>src</code> and <cod...
How to move file from one directory to another (Julia)?
julia
0
82
1
72,400,729
72,400,729
2
true
2022-05-27T04:07:31.647Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to move file from one directory to another (Julia)?<p>I have two different paths (directory path and file path). I need to move the file from one directo...
72,396,027
Python Download NetCDF file from a website which provides the file after clicking a button<p>If you go to this website: <a href="https://ruc.noaa.gov/raobs/Data_request.cgi?byr=2010&amp;bmo=5&amp;bdy=26&amp;bhr=12&amp;eyr=2010&amp;emo=5&amp;edy=27&amp;ehr=15&amp;shour=All+Times&amp;ltype=All+Levels&amp;wunits=Knots&amp...
<p>You could use my package nctoolkit to download the file and then export to xarray. This will save the file to a temporary directory, but will remove it once the session is done.</p> <pre><code>import nctoolkit as nc import xarray as xr ds = nc.open_url(&quot;https://ruc.noaa.gov/raobs/GetRaobs.cgi?shour=All+Times&am...
Python Download NetCDF file from a website which provides the file after clicking a button
python|web-scraping|netcdf
1
82
1
72,402,211
72,402,211
2
true
2022-05-26T17:49:12.523Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python Download NetCDF file from a website which provides the file after clicking a button<p>If you go to this website: <a href="https://ruc.noaa.gov/raobs/D...
72,373,018
Generating XML in specific format from SQL query<p>I need to generate XML from following table</p> <pre><code> DECLARE @tempXML AS TABLE ( ID INT IDENTITY(1,1), Field VARCHAR(10), VALUE VARCHAR(20), LEVEL INT ) INSERT INTO @tempXML VALUES ('FirstName','FN',2),...
<p>Please try the following solution.</p> <p>It is using XQuery and its FLWOR expression.</p> <p>Simple and easy, almost visually crafting XML process, no guess work.</p> <p>The desired output XML is composed in two steps:</p> <ol> <li>Creating raw XML via <code>FOR XML PATH('r'), TYPE, ROOT('root')</code></li> <li>Com...
Generating XML in specific format from SQL query
sql|sql-server|xml|stored-procedures|sqlxml
1
82
3
72,378,309
72,378,309
2
true
2022-05-25T06:46:47.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generating XML in specific format from SQL query<p>I need to generate XML from following table</p> <pre><code> DECLARE @tempXML AS TABLE ( ID ...
72,352,662
How to display days in "rd", "th", "nd", and "st" format in Oracle SQL Developer?<p>guys,</p> <p>I have to display the day of tomorrow in the format: January 10th of year 2019. I created this query:</p> <pre><code>SELECT TO_CHAR((SYSDATE + 1),'Month DD (ddspth) &quot;of year&quot; YYYY') AS tomorrow FROM DUAL; </code><...
<p>Don't <code>sp</code>ell the word out; and <a href="https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Format-Models.html#GUID-7FF68D9E-C7E2-4CA1-9DDB-5CC7169EEEEA" rel="nofollow noreferrer">use <code>FM</code></a> to suppress blank padding:</p> <pre><code>SELECT TO_CHAR((SYSDATE + 1),'FMMonth ddth ...
How to display days in "rd", "th", "nd", and "st" format in Oracle SQL Developer?
sql|oracle
1
82
1
72,352,772
72,352,772
2
true
2022-05-23T17:34:40.180Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to display days in "rd", "th", "nd", and "st" format in Oracle SQL Developer?<p>guys,</p> <p>I have to display the day of tomorrow in the format: January...
72,238,666
should I still declare GOPATH?<ul> <li>I WAS reading <strong>Learning GO</strong> and suggest that needs to be declared on PATH <code>GOPATH=&quot;/home/user/go&quot;</code>.</li> </ul> <p><strong>this is from author:</strong></p> <blockquote> <p>it’s a good idea to explicitly define <strong>GOPATH</strong> and to put ...
<blockquote> <p>[S]hould I still declare GOPATH, GOROOT?</p> </blockquote> <p>No and <strong>NO!</strong></p> <p>GOPATH defaults to $HOME/go which is fine and GOPATH based builds are deprecated since several <em>years</em>. Use modules.</p> <p>GOROOT never was a thing for the enduser of Go. You have to set if you work ...
should I still declare GOPATH?
bash|go
0
82
1
72,238,891
72,238,891
2
true
2022-05-14T08:48:29.747Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: should I still declare GOPATH?<ul> <li>I WAS reading <strong>Learning GO</strong> and suggest that needs to be declared on PATH <code>GOPATH=&quot;/home/user...
72,384,570
SqlAlchemy + fastApi trying to join many - to - many tables<p>1st table &quot;release_name&quot;:</p> <p>|code|name|</p> <p>|:---|:--:|</p> <p>|1---|SOME|</p> <p>|2---|ANY |</p> <p>...</p> <p>2nd table &quot;release_value&quot;: |code|name|</p> <p>|:---|:--:|</p> <p>|1---|SOME|</p> <p>|2---|ANY |</p> <p>...</p> <p>3rd ...
<p>Inside your <code>relationship</code>, <code>secondary</code> doesn't take a string but the variable containing your Table:</p> <pre class="lang-py prettyprint-override"><code>build_name = relationship(&quot;BuildNames&quot;, secondary=Link, back_populates=&quot;release_name&quot;) </code></pre> <pre class="lang-py ...
SqlAlchemy + fastApi trying to join many - to - many tables
sql|join|sqlalchemy|fastapi
0
82
1
72,389,038
72,389,038
2
true
2022-05-25T21:56:20.647Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SqlAlchemy + fastApi trying to join many - to - many tables<p>1st table &quot;release_name&quot;:</p> <p>|code|name|</p> <p>|:---|:--:|</p> <p>|1---|SOME|</p...
72,352,142
Modelling a School in Java<p>I have been trying to model a school in Java(no main method, just attributes). How do I assign 30 students and a teacher to a classroom?( is it possible to do without a main method?)</p> <pre><code>public class Person{ private String name; private String surname; private String age; ...
<p>For clarity, change <code>name</code> to <code>givenName</code>. See <a href="https://en.wikipedia.org/wiki/Given_name" rel="nofollow noreferrer">Wikipedia</a>.</p> <pre><code>private String givenName; private String surname; </code></pre> <p>Age should be an integer, not text.</p> <pre><code>private int age; </code...
Modelling a School in Java
java|oop
0
82
2
72,352,931
72,352,931
2
true
2022-05-23T16:50:10.540Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Modelling a School in Java<p>I have been trying to model a school in Java(no main method, just attributes). How do I assign 30 students and a teacher to a cl...
72,298,207
Display only days on django template<p>I'm trying to display the difference between 2 giving dates on django, and i've managed to make it, but now i'm strugling to display only the days, without the time, is there any filter that i can use?</p> <p><strong>My html template:</strong></p> <pre><code>&lt;a href=&quot;{% ur...
<p>I think there are a few ways to do what you want here. I'll let you decide what you think works best for you.</p> <ol> <li>The <code>timesince</code> or <code>timeuntil</code> template formatting tags within Django may give you what you want immediately.</li> </ol> <p><code>{{ today |timeuntil:contract.starting_date...
Display only days on django template
django
0
82
2
72,298,514
72,298,514
2
true
2022-05-19T03:13:41.117Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Display only days on django template<p>I'm trying to display the difference between 2 giving dates on django, and i've managed to make it, but now i'm strugl...
72,276,647
how do I parse the local json file from file manager flutter?<p>I have seen lot of examples from parsing the <code>json</code> file from the <code>assets</code></p> <p>But How do I get the get the json file from file manager and parse it?</p> <pre><code>void openJsonFile() async { FilePickerResult? result = await F...
<p>This is for loading from <code>assets</code>,</p> <pre><code>final String response = await rootBundle.loadString(file.path); </code></pre> <p>but reading from a file is something like this:</p> <pre><code>final response = await file.readAsString(); </code></pre>
how do I parse the local json file from file manager flutter?
json|flutter|dart
0
82
1
72,278,004
72,278,004
3
true
2022-05-17T15:19:47.907Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how do I parse the local json file from file manager flutter?<p>I have seen lot of examples from parsing the <code>json</code> file from the <code>assets</co...
72,361,195
Template Literal type equivalent<p>I have an enum like so:</p> <pre><code>export enum ApiFunctions { &quot;setHidden&quot; = &quot;HIDE&quot;, &quot;setReadOnly&quot; = &quot;SET_READ_ONLY&quot;, &quot;setVisible&quot; = &quot;SHOW&quot;, &quot;setDescription&quot; = &quot;SET_DESCRIPTION&quot;, &quot;setName...
<p>No, before TypeScript 4.1 there was no programmatic way to widen <a href="https://www.typescriptlang.org/docs/handbook/enums.html#string-enums" rel="nofollow noreferrer">string <code>enum</code> types</a> to their corresponding <a href="https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types...
Template Literal type equivalent
javascript|typescript|types|bundler|template-literals
6
82
1
72,380,828
72,380,828
3
true
2022-05-24T10:19:55.973Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Template Literal type equivalent<p>I have an enum like so:</p> <pre><code>export enum ApiFunctions { &quot;setHidden&quot; = &quot;HIDE&quot;, &quot;setR...
72,387,690
How can I use named group in C# regex switch/case?<p>I want to write a code that checks if it matches to a regular expression then prints matched string.</p> <p>I found other question <a href="https://stackoverflow.com/questions/42707983">Can I use regex expression in c# with switch case?</a>, but <code>IsMatch</code> ...
<p>First, I'd suggest moving the regex construction itself outside the switch block - both for readability and to allow it to be reused.</p> <p>Then, instead of using <code>IsMatch</code>, use the <code>Match</code> to return a <code>Match</code>, which you'd then check for success (potentially using a C# pattern match...
How can I use named group in C# regex switch/case?
c#|regex|pattern-matching
1
82
2
72,387,767
72,387,767
3
true
2022-05-26T06:34:17.320Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I use named group in C# regex switch/case?<p>I want to write a code that checks if it matches to a regular expression then prints matched string.</p>...
72,389,657
Parameter can not be passed from react route to react Component<p>I have tried the previous solutions but it seems that the v6 of react-dom is not working that way.</p> <p>I can not pass the id from the path to the component.</p> <p>app.js</p> <pre><code>import Container from 'react-bootstrap/Container' import Footer f...
<p>You need to get the useParams hook in order to use params. <a href="https://reactrouter.com/docs/en/v6/getting-started/tutorial#reading-url-params" rel="nofollow noreferrer">https://reactrouter.com/docs/en/v6/getting-started/tutorial#reading-url-params</a></p> <p>You can do it like this:</p> <pre><code>import React ...
Parameter can not be passed from react route to react Component
javascript|reactjs|react-hooks|react-router
0
82
2
72,389,731
72,389,731
3
true
2022-05-26T09:30:47.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parameter can not be passed from react route to react Component<p>I have tried the previous solutions but it seems that the v6 of react-dom is not working th...
72,394,916
Will reading from a pipe ever produce more data after a prior EOF?<p>If you're <code>read</code>ing from a regular file, and it returns 0 because you got to EOF, but then someone else appends something to the file, a subsequent <code>read</code> syscall will give you the new data. Similarly, if you're <code>read</code>...
<p>Yes. <code>read</code> on the same FD will start returning data again if something reopens the pipe for writing.</p> <p>You can easily reopen named pipes, and Linux lets you reopen anonymous pipes by writing to <code>/proc/&lt;pid&gt;/fd/&lt;fd&gt;</code> . In particular, you can open this file for writing even if t...
Will reading from a pipe ever produce more data after a prior EOF?
c|linux|pipe|system-calls|eof
1
82
2
72,395,470
72,395,470
3
true
2022-05-26T16:15:14.233Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Will reading from a pipe ever produce more data after a prior EOF?<p>If you're <code>read</code>ing from a regular file, and it returns 0 because you got to ...
72,341,905
Javascript, convert inline html js to normal js<p>So I have this <strong>input</strong> tag:</p> <pre><code>&lt;input ... onkeypress=&quot;return /^[A-Za-z0-9 -]*$/.test(event.key)&quot; id=&quot;id_title&quot;&gt; </code></pre> <p>And I want it to accept only numbers, letters and spaces. I wonder how to rewrite it in ...
<p>Try this -</p> <pre><code>$('#id_title').on('input', function(event) { let regex = /^[A-Za-z0-9 -]*$/; return regex.test(event.key); }); </code></pre> <p>Check out the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test" rel="nofollow noreferrer">MDN docs</...
Javascript, convert inline html js to normal js
javascript|html|jquery
1
82
1
72,341,942
72,341,942
3
true
2022-05-22T23:18:39.710Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript, convert inline html js to normal js<p>So I have this <strong>input</strong> tag:</p> <pre><code>&lt;input ... onkeypress=&quot;return /^[A-Za-z0-...
72,350,783
Error with cabal install while building lib<p>I'm trying to install FunGEn with <code>cabal install --allow-newer=all FunGEn</code> (I added <code>--allow-newer=all</code> bcs it was having trouble with dependencies). After a few tries of running this I keep getting the same error message:</p> <pre><code>Resolving depe...
<p>These particular errors are coming from using GHC 9.2 to compile code that is not compatible with GHC 9.2. The package you're trying to use compiles okay with GHC 9.0 (no <code>--allow-newer</code> needed), which I suggest you to use. It is very easy to switch between compiler versions these days using <a href="http...
Error with cabal install while building lib
haskell|build|cabal|cabal-install
1
82
1
72,352,030
72,352,030
4
true
2022-05-23T15:05:07.680Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error with cabal install while building lib<p>I'm trying to install FunGEn with <code>cabal install --allow-newer=all FunGEn</code> (I added <code>--allow-ne...
72,352,901
What does "#if ..." (with an ellipsis) do?<p>I was doing some studying of the windows header files and I came upon a preprocessor statement that I didn't recognize. I've been searching for any information on this statement for about a week and I can't find any information on it anywhere. I'm not sure if it's just not a...
<p>The documentation page the code was linked from was not meant to reflect what's actually in the condition of the <code>#if</code> directive. It's only there to show what the options are in terms of what's defined.</p> <p>The actual winnt.h header on my system (under C:\Program Files (x86)\Microsoft SDKs\Windows\v7....
What does "#if ..." (with an ellipsis) do?
c|windows|c-preprocessor|conditional-compilation
3
82
1
72,354,167
72,354,167
4
true
2022-05-23T17:54:07.223Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What does "#if ..." (with an ellipsis) do?<p>I was doing some studying of the windows header files and I came upon a preprocessor statement that I didn't rec...
72,358,758
How do i change any variables inside of a enum element?<p>This is my code</p> <pre><code>using System.Collections; using System.Collections.Generic; using UnityEngine; public class Item { public Inventory inventory; public enum ItemType { Blocks, Potions, Weapons, } pu...
<p>Your question is quite poorly-worded so it is rather confusing. I'm going to make my best guess as to what you mean and recommend based on that. Firstly, get the <code>enum</code> out of the class. Nesting types is generally not a good idea.</p> <pre class="lang-cs prettyprint-override"><code> public enum ItemType ...
How do i change any variables inside of a enum element?
c#|list|unity3d|enums
2
82
2
72,359,005
72,359,005
4
true
2022-05-24T07:23:31.697Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do i change any variables inside of a enum element?<p>This is my code</p> <pre><code>using System.Collections; using System.Collections.Generic; using Un...
72,276,316
Installing Apache Spark Packages to run Locally<p>I am looking for a clear guide or steps to installing Spark packages (specifically spark-avro) to run locally and correctly using them with spark-submit command.</p> <p>I've spent a lot of time reading many posts and guides, but still not able to get spark-submit to use...
<p>In spark-submit command itself you can pass avro package details (make sure avro and spark version support)</p> <pre><code>spark-submit --packages org.apache.spark:spark-avro_&lt;required_version&gt;:&lt;spark_version&gt; </code></pre> <p>Example,</p> <pre><code>spark-submit --packages org.apache.spark:spark-avro_2....
Installing Apache Spark Packages to run Locally
apache-spark|pyspark|apache-spark-sql|spark-avro
0
82
1
72,277,121
72,277,121
-2
true
2022-05-17T14:59:14.790Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Installing Apache Spark Packages to run Locally<p>I am looking for a clear guide or steps to installing Spark packages (specifically spark-avro) to run local...
72,398,822
Is there a way to compare "\x3C!--" with "<!--" and get 'true' in JavaScript?<p>In one of my projects I have to parse HTML pages and to check if each parsed &quot;tag candidate&quot; is in the predefined list of tag defining strings.</p> <p>The problem emerges when for some reason the parser returns <code>&quot;\x3C!--...
<p>After a deeper investigation I have revealed that <code>&quot;\x3C!--&quot; == &quot;&lt;!--&quot;</code> is always <code>true</code>, with no extra efforts (see the screenshot below).</p> <p>We should keep in mind however that string <code>&quot;&lt;!--&quot;</code> (and any longer one) is stored as is in a variabl...
Is there a way to compare "\x3C!--" with "<!--" and get 'true' in JavaScript?
javascript|hex|string-comparison
1
82
2
72,411,519
72,411,519
-2
true
2022-05-26T22:56:05.723Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to compare "\x3C!--" with "<!--" and get 'true' in JavaScript?<p>In one of my projects I have to parse HTML pages and to check if each parsed ...
72,323,865
How to focus z-index: 2 element and not z-index: 1<p>I'm trying to draw a piano with CSS and JavaScript. Here is my 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-css lang-css prettyprint-override"><code>.co...
<p>If it's too much work to separate <code>.black-key</code> from <code>.tile</code> (IDK never used Tailwind), you can change the <code>.black-key</code>s into <code>&lt;a&gt;</code> so they actually are focusable and then use <code>:focus-within</code> on <code>.tile</code>s. <code>:focus-within</code> is the only CS...
How to focus z-index: 2 element and not z-index: 1
html|css
1
82
1
72,324,519
72,324,519
-1
true
2022-05-20T19:18:02.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to focus z-index: 2 element and not z-index: 1<p>I'm trying to draw a piano with CSS and JavaScript. Here is my code :</p> <p><div class="snippet" data-l...
72,868,191
C++: Alternative to this range's view construction with same requirements?<p>To remove manual logic in my code, I use that construct:</p> <pre><code>std::ranges::drop_view a { std::ranges::take_view(my_range, my_range.size() -X), Y}; </code></pre> <p>with X and Y values I pass at runtime.</p> <p>Even though I check the...
<p>You can compose <code>take_view</code> and <code>drop_view</code> into a new adaptor</p> <pre><code>auto take_and_drop = [](auto n, auto m) { return std::views::take(n) | std::views::drop(m); }; auto a = my_range | take_and_drop(my_range.size() - X, Y); </code></pre>
C++: Alternative to this range's view construction with same requirements?
c++|c++20|std-ranges
3
82
1
72,868,392
72,868,392
1
true
2022-07-05T10:51:40.937Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C++: Alternative to this range's view construction with same requirements?<p>To remove manual logic in my code, I use that construct:</p> <pre><code>std::ran...
72,801,858
Sumproduct in R using dplyr<p>Using dplyr, I´m trying to sumproduct in R two columns as it can be done in Excel but although I´ve tried several aproaches, none worked properly.</p> <p>A small piece of my dataframe (almost 61000 rows and 20 columns) looks like this:</p> <pre><code>df &lt;-structure(list(dem_sect = struc...
<pre class="lang-r prettyprint-override"><code>library(tidyverse) df %&gt;% group_by(dem_sect) %&gt;% filter(!duplicated(area, kg_med)) %&gt;% summarise(sumproduct = sum(area * kg_med)) %&gt;% as.data.frame() # to view the result with more significant digits #&gt; dem_sect sumproduct #&gt; 1 MF ...
Sumproduct in R using dplyr
r|dplyr|sumproduct
2
82
2
72,801,895
72,801,895
1
true
2022-06-29T13:00:27.903Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sumproduct in R using dplyr<p>Using dplyr, I´m trying to sumproduct in R two columns as it can be done in Excel but although I´ve tried several aproaches, no...
72,908,322
CSS focus system color<p>css has a bunch of responsive keywords for system colors. What is the keyword for the focus color?</p> <p>Running the snippet below, when the <code>&lt;input&gt;</code> element has the focus it has a light blue outline which may be a different color depending on the user's color preference sett...
<p>You can use <code>-webkit-focus-ring-color</code> for Chrome / Safari and <code>-moz-mac-focusring</code> for Firefox.</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 lang-js prettyprint-override"><code>docume...
CSS focus system color
css
0
82
1
72,948,189
72,948,189
1
true
2022-07-08T07:53:48.523Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CSS focus system color<p>css has a bunch of responsive keywords for system colors. What is the keyword for the focus color?</p> <p>Running the snippet below,...
72,780,223
for loop to generate time list in javascript<p>I want to generate this data list (00:00 ~ 24:00, every 3 minutes)</p> <pre><code>[ &quot;00:00&quot;, &quot;00:03&quot;, &quot;00:06&quot;, &quot;00:09&quot;, &quot;00:12&quot;, &quot;00:15&quot;, &quot;00:18&quot;, &quot;00:21&quot;, &quot;00:24&quot;, &quot;00:27&quot;,...
<p>You can use a loop to generate all times with an interval of 3 minutes.</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 lang-js prettyprint-override"><code>const result = []; const interval = 3; for(let i = 0;...
for loop to generate time list in javascript
javascript|loops|date|for-loop
0
82
3
72,780,271
72,780,271
1
true
2022-06-28T02:48:27.380Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: for loop to generate time list in javascript<p>I want to generate this data list (00:00 ~ 24:00, every 3 minutes)</p> <pre><code>[ &quot;00:00&quot;, &quot;0...
72,823,989
How do i refetch from a diffrent url using react-Query?<p>I'm using react query and fetch to get data from the dictionary API I wanted to add a functionality where I can change the value I pull from the API I added an on-click function that changes the state which is a part of the URL and when it triggers a rerender it...
<p>From the <a href="https://react-query.tanstack.com/guides/query-keys#if-your-query-function-depends-on-a-variable-include-it-in-your-query-key" rel="nofollow noreferrer">documentation</a>...</p> <blockquote> <h3>If your query function depends on a variable, include it in your query key</h3> <p>Since query keys uniqu...
How do i refetch from a diffrent url using react-Query?
reactjs|api|fetch-api|react-query
1
82
1
72,824,163
72,824,163
1
true
2022-07-01T03:06:03.357Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do i refetch from a diffrent url using react-Query?<p>I'm using react query and fetch to get data from the dictionary API I wanted to add a functionality...
72,965,181
How to run Gitlab matrix builds on both Windows/Powershell and Linux/bash?<p>We're moving our CI from Jenkins to Gitlab and I'm trying to setup a pipeline that runs on both Windows and Linux.</p> <p>Running multiple Python versions on a Linux gitlab runner works ok by defining versions like this:</p> <pre><code>.versio...
<p>You can't easily do this in the yaml with that matrix.</p> <p>Instead, you can do this:</p> <pre><code>.scripts: make_venv: - python -m venv venv activate_linux: - !reference [.scripts, make_venv] - source ./venv/bin/activate activate_windows: - !reference [.scripts, make_venv] - venv/Scrip...
How to run Gitlab matrix builds on both Windows/Powershell and Linux/bash?
python|gitlab|gitlab-ci
0
82
1
72,965,453
72,965,453
1
true
2022-07-13T11:01:13.027Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to run Gitlab matrix builds on both Windows/Powershell and Linux/bash?<p>We're moving our CI from Jenkins to Gitlab and I'm trying to setup a pipeline th...
72,809,298
Executing child process in express js route<p>I am trying to run a simple child process in my express js route and return a json message with the stdout as the message value. But for some reason the stdout value is undefined any pointers?</p> <p>express route code</p> <pre><code>const express = require(&quot;express&qu...
<p>You have to move the response INSIDE the callback. <code>cp.exec()</code> is asycnhronous so it starts up and then continues executing the next lines of code. The callback is called sometime later. So, you need to send your response INSIDE the callback.</p> <pre><code>const express = require(&quot;express&quot;) ...
Executing child process in express js route
node.js|express|child-process
0
82
1
72,809,817
72,809,817
1
true
2022-06-30T01:04:36.560Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Executing child process in express js route<p>I am trying to run a simple child process in my express js route and return a json message with the stdout as t...
72,922,784
How to loop st_distance through list<p>My goal is to apply the st_distance function to a very large data frame, yet because the data frame concerns multiple individuals, I split it using the purrr package and split function.</p> <p>I have seen the use of 'lists' and 'forloops' in the past but I have no experience with ...
<p>Here is an basic solution. I split the original data into multiple data frames using split and then wrapped the distance function in <code>lapply()</code>.</p> <pre><code>data &lt;- read.table(header=TRUE, text=&quot;ID Date Time Datetime time2 Long Lat 10_17 4/18/2017 15:02:00 ...
How to loop st_distance through list
r|dataframe|loops|distance|sf
1
82
1
72,924,083
72,924,083
1
true
2022-07-09T15:51:10.003Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to loop st_distance through list<p>My goal is to apply the st_distance function to a very large data frame, yet because the data frame concerns multiple ...
72,775,336
DIV fade in onscroll with JQuery but without triggering on each pixel<p>I have an SVG inside a DIV that is supposed to start at 0% opacity and then fade in to 100% via jQuery when I scroll down to 800px. Currently, it's:</p> <ol> <li>Loading at full opacity (instead of 0%) before fading out and back in again and</li> <...
<p>You could also achieve this fade animation by <strong>toggling classes</strong> (&quot;opened&quot;, &quot;closed&quot;):</p> <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyp...
DIV fade in onscroll with JQuery but without triggering on each pixel
html|jquery|css|svg|division
2
82
3
72,901,115
72,901,115
1
true
2022-06-27T16:20:46.563Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: DIV fade in onscroll with JQuery but without triggering on each pixel<p>I have an SVG inside a DIV that is supposed to start at 0% opacity and then fade in t...
73,013,331
Can not edit data from database via thymeleaf and spring<p>I want to edit data from database via form &quot;bookUpdate.html&quot;, that I can open from page &quot;bookList.html&quot; with the list of all rows from the table. I created a controller and form, that redirect me to the page with filled fields, that contain ...
<p>In your <code>bookUpdate.html</code> file, the action property is not set correctly. Your form after posting send information to <code>@{/bookUpdate}</code> but in related controller, defined <code>PostMapping</code> required <code>@PostMapping(&quot;/bookUpdate/{id}&quot;)</code> and they are mismach.</p> <p>Change...
Can not edit data from database via thymeleaf and spring
java|spring|spring-mvc|thymeleaf|spring-thymeleaf
1
82
1
73,013,429
73,013,429
1
true
2022-07-17T16:04:40.127Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can not edit data from database via thymeleaf and spring<p>I want to edit data from database via form &quot;bookUpdate.html&quot;, that I can open from page ...
72,774,387
Background Worker RunWorkerCompleted isn't being called after DoWork finished<p>I'm creating a simple program that pings all the servers on our network and returns whether the ping requests were successful.</p> <p>I'm trying to utilise background workers so that the user can press the ping button and the pings run in t...
<p>You need to attach your <code>backgroundWorker1_RunWorkerCompleted</code> event handler to the <code>RunWorkerCompleted</code> event. The C# compiler doesn't hook handlers to events based on naming conventions. You have to do it explicitly.</p> <pre><code>public Form1() { InitializeComponent(); backgroundWor...
Background Worker RunWorkerCompleted isn't being called after DoWork finished
c#|forms|backgroundworker
2
82
3
72,775,431
72,775,431
2
true
2022-06-27T15:09:04.487Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Background Worker RunWorkerCompleted isn't being called after DoWork finished<p>I'm creating a simple program that pings all the servers on our network and r...
72,791,654
Kafka Connect protobuf converter not found<p>I have a kafka s3-sink connector which I'm producing messages to. However when I send messages to the topic, I'm noticied the logs of my sink connector are throwing me this error:</p> <pre><code>│ Invalid value io.confluent.connect.protobuf.ProtobufConverter for configuratio...
<p>The Strimzi containers don't contain any converters outside the ones included by Apache Kafka.</p> <p>You need to install it, potentially requiring your own Docker image - <a href="https://www.confluent.io/hub/confluentinc/kafka-connect-protobuf-converter" rel="nofollow noreferrer">https://www.confluent.io/hub/confl...
Kafka Connect protobuf converter not found
apache-kafka|protocol-buffers|apache-kafka-connect|strimzi
1
82
2
72,792,848
72,792,848
2
true
2022-06-28T18:41:52.813Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kafka Connect protobuf converter not found<p>I have a kafka s3-sink connector which I'm producing messages to. However when I send messages to the topic, I'm...
72,795,751
How to add style to a input component with React?<p>In a customized input component</p> <pre><code>import React, { InputHTMLAttributes } from &quot;react&quot;; import styled, { css } from &quot;styled-components&quot;; type InputTypeProps = { disabled: boolean; }; export const MyInput: React.FC&lt;InputHTMLAttribu...
<p>Change to this.</p> <pre><code>const Input = styled.input` background-color: white; &amp;:disabled { background-color: gray; } `; </code></pre>
How to add style to a input component with React?
reactjs|input|styled-components
0
82
1
72,796,985
72,796,985
2
true
2022-06-29T04:18:13.650Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add style to a input component with React?<p>In a customized input component</p> <pre><code>import React, { InputHTMLAttributes } from &quot;react&quo...
72,821,075
Example of how to convert postgres text time with am/pm to a timestamp<p>I have a date time field in postgres like 06/29/2022 1:24 pm and I'd like to cast it to 2022-06-29 13:32:00</p> <p>I know it's something close to this</p> <p>select to_timestamp(created, 'YYYY-MM-DD HH24:MI:SS p')</p> <p>but I cannot find an examp...
<p>It's like this:</p> <pre><code>select to_timestamp('06/29/2022 1:24 pm', 'mm/dd/yyyy hh12:mi am,pm'); </code></pre>
Example of how to convert postgres text time with am/pm to a timestamp
postgresql|datetime|timestamp
0
82
1
72,821,178
72,821,178
2
true
2022-06-30T19:25:05.967Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Example of how to convert postgres text time with am/pm to a timestamp<p>I have a date time field in postgres like 06/29/2022 1:24 pm and I'd like to cast it...
72,842,106
Time complexity of longest palindrome finding algorithm<p>Can some one help me out on this algorithm time complexity? It`s a leetcode task to find the longest palindromic substring (<a href="https://leetcode.com/problems/longest-palindromic-substring/" rel="nofollow noreferrer">https://leetcode.com/problems/longest-pal...
<p>I’d say your algorithm is an O(n²) even though you have three loops:</p> <p>The time-complexity of the for loop is quite easy: You have <code>n</code> iterations for a <code>n</code> long string. The inner while loops are a bit more complex: I noticed that outside the inner while loop the both cursers have always th...
Time complexity of longest palindrome finding algorithm
java|algorithm|time-complexity
1
82
1
72,842,774
72,842,774
2
true
2022-07-02T20:03:48.530Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Time complexity of longest palindrome finding algorithm<p>Can some one help me out on this algorithm time complexity? It`s a leetcode task to find the longes...
72,849,102
How to add multiple types of objects to json array?<p>I need to parse data to JSON in a particular format, which should look like this (notice that there are multiple types of objects in an array).</p> <pre class="lang-json prettyprint-override"><code>{ &quot;member details&quot;: [ { ...
<p>Use an <code>IEnumerable&lt;T&gt;</code> where <code>T</code> is a shared base type (could be <code>object</code>, for example):</p> <pre><code>using System; using System.Text.Json; public class Program { public static void Main() { var values = new object[] { ...
How to add multiple types of objects to json array?
c#|json
-1
82
2
72,849,851
72,849,851
2
true
2022-07-03T18:49:33.680Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add multiple types of objects to json array?<p>I need to parse data to JSON in a particular format, which should look like this (notice that there are...
72,865,649
How does macroexpansion actually work in Lisp?<p>I would like a more detailed explanation of how macro expansion works, at least in Emacs Lisp but an overview of other Lisps would be appreciated. The way I usually see it explained is that the arguments of the macro are passed unevaluated to the body, which is then exec...
<h2>Macros are functions ...</h2> <p>A good way to think about macros is that they are simply functions, like any other function.</p> <h2>... which operate on source code</h2> <p><strong>But they are functions whose arguments are source code, and whose value is also source code</strong>.</p> <h2>Looking at macro functi...
How does macroexpansion actually work in Lisp?
lisp|elisp|elisp-macro
2
82
1
72,874,918
72,874,918
2
true
2022-07-05T07:39:02.720Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How does macroexpansion actually work in Lisp?<p>I would like a more detailed explanation of how macro expansion works, at least in Emacs Lisp but an overvie...
72,881,312
How to write data to file in Kotlin<p>A little while ago, I started learning Kotlin, and I have done its basics, variables, classes, lists, and arrays, etc. but the book I was learning from seemed to miss one important aspect, reading and writing to a file, maybe a function like &quot;fwrite&quot; in C++</p> <p>So I se...
<p>Easiest way is to use a serialization library. Kotlin <a href="https://kotlinlang.org/docs/serialization.html" rel="nofollow noreferrer">already provides something for that</a></p> <p>TL;DR;</p> <p>Add <a href="https://github.com/Kotlin/kotlinx.serialization" rel="nofollow noreferrer">KotlinX Serialization</a> to yo...
How to write data to file in Kotlin
kotlin
0
82
2
72,881,692
72,881,692
2
true
2022-07-06T09:47:57.610Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to write data to file in Kotlin<p>A little while ago, I started learning Kotlin, and I have done its basics, variables, classes, lists, and arrays, etc. ...
72,916,708
Cloud SQL minor patch upgrade not working for MySQL<p>As per <a href="https://cloud.google.com/sql/docs/mysql/release-notes#May_26_2022" rel="nofollow noreferrer">release notes</a> I should be able to upgrade the minor patch of the database, which by default is <code>8.0.26</code> in newly fresh instances:</p> <blockqu...
<p>This is expected because when you execute <code>gcloud sql instances patch mysqldb</code> this will do nothing about an upgrade because actually you're not setting what to patch.</p> <p>If you look at the body sent to the API it is almost &quot;empty&quot;</p> <pre class="lang-json prettyprint-override"><code>{&quot...
Cloud SQL minor patch upgrade not working for MySQL
mysql|google-cloud-platform|google-cloud-sql
1
82
1
72,917,141
72,917,141
2
true
2022-07-08T20:32:20.703Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cloud SQL minor patch upgrade not working for MySQL<p>As per <a href="https://cloud.google.com/sql/docs/mysql/release-notes#May_26_2022" rel="nofollow norefe...
72,928,718
How to add a data to the plot in matplotlib?<p>How can I have the line plot, with the data coming one by one? I have the code</p> <pre class="lang-python prettyprint-override"><code>import matplotlib.pyplot as plt plt.ion() plt.plot(1, 2) plt.pause(2.5) plt.plot(2, 5) plt.pause(2.5) </code></pre> <p>but it does not sh...
<p>To respond to the comment about &quot;deleting the current plot&quot;, and to improve upon Stefano's answer a bit, we can use Matplotlib's object-oriented interface to do this:</p> <pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt x = [0, 1, 2, 3, 4, 5, 6] y = [3, 1, 4, 1, 5, 9, 2] fi...
How to add a data to the plot in matplotlib?
python|python-3.x|matplotlib
1
82
2
72,929,889
72,929,889
2
true
2022-07-10T13:10:22.283Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add a data to the plot in matplotlib?<p>How can I have the line plot, with the data coming one by one? I have the code</p> <pre class="lang-python pre...
72,953,318
How to summarize a variable based on another column in R?<p>I have a dataset that looks like this:</p> <pre><code> study_id weight gender 1 100 55 Male 2 200 65 Female 3 300 84 Female 4 400 59 Male 5 500 62 Female 6 600 75 Male 7 700 70 Male </code...
<p>Although there are reasonable suggestions by harre, I prefer to do it this way:</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) data |&gt; group_by(gender) |&gt; mutate(weight = as.numeric(weight)) |&gt; summarise( across(weight, list(mean = mean, median = median)) ) # #...
How to summarize a variable based on another column in R?
r|mean|median|summary
0
82
2
72,953,393
72,953,393
2
true
2022-07-12T13:42:15.043Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to summarize a variable based on another column in R?<p>I have a dataset that looks like this:</p> <pre><code> study_id weight gender 1 100 55 ...
72,987,860
Terraform Update an existing Lambda function was created on AWS console<p>I want to update a my code on Lambda function.</p> <p>I previous creating lambda function on aws console.</p> <p>I do a creating terraform code for update my function existing but I received an error</p> <p>I try using this block code</p> <pre><c...
<p>You have to <a href="https://www.terraform.io/cli/import" rel="nofollow noreferrer">import</a> your lambda function to TF first. Then you will be able to modify it using TF code using <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function" rel="nofollow noreferrer">aws_l...
Terraform Update an existing Lambda function was created on AWS console
amazon-web-services|terraform|devops
-1
82
1
72,987,882
72,987,882
2
true
2022-07-15T00:16:46.143Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Terraform Update an existing Lambda function was created on AWS console<p>I want to update a my code on Lambda function.</p> <p>I previous creating lambda fu...
73,004,754
How to get a string within "\n" in c++?<p>Suppose I'm having-</p> <pre><code>string s=&quot;Hello Hi Hey\n&quot;&quot;Bye Bye good night&quot;; </code></pre> <p>Now,I want to get the string within <code>&quot;\n&quot;</code> ,i.e I want to get <code>&quot;Hello Hi Hey&quot;</code></p> <p>How can i do so? I've thinking ...
<blockquote> <p>Now,I want to get the string within <code>&quot;\n&quot;</code> ,i.e I want to get <code>&quot;Hello Hi Hey&quot;</code></p> </blockquote> <blockquote> <p>How can i do so? I've thinking of stringstream, but it's not possible as <code>&quot;Hello Hi Hey&quot;</code> itself contains space.</p> </blockquot...
How to get a string within "\n" in c++?
c++
-2
82
2
73,005,819
73,005,819
2
true
2022-07-16T13:51:58.893Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get a string within "\n" in c++?<p>Suppose I'm having-</p> <pre><code>string s=&quot;Hello Hi Hey\n&quot;&quot;Bye Bye good night&quot;; </code></pre>...
73,004,203
Maximum and Minimum values from multiple arrays in Python<p>I have two arrays <code>X1</code> and <code>X2</code>. I want to find maximum and minimum values from these two arrays in one step. But it runs into an error. I present the expected output.</p> <pre><code>import numpy as np X1 = np.array([[ 527.25 ], ...
<p>You can use <a href="https://numpy.org/doc/stable/reference/generated/numpy.ufunc.reduce.html" rel="nofollow noreferrer"><code>np.ufunc.reduce</code></a> with multiple axis to get as <strong><code>array</code> as you want</strong>.</p> <p><em>(first find max on <code>axis=1</code> from <code>X1</code> , <code>X2</co...
Maximum and Minimum values from multiple arrays in Python
python|numpy
2
82
2
73,004,224
73,004,224
2
true
2022-07-16T12:27:03.990Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Maximum and Minimum values from multiple arrays in Python<p>I have two arrays <code>X1</code> and <code>X2</code>. I want to find maximum and minimum values ...
72,998,894
Allow any field in Prisma<p>How do I allow any field to be added in Prisma? What I mean by this is something like <code>[key: String]: String</code> in TypeScript. I use mongoDB as a database.</p>
<p>Prisma doesn't allow passing objects to query methods (e.g. CRUD Methods) with additional fields. You would need to filter out the object with fields which are recognized by Prisma before passing it to query methods.</p> <p>Here's the official Feature Request: <a href="https://github.com/prisma/prisma/issues/14481" ...
Allow any field in Prisma
mongodb|prisma
1
82
1
73,032,795
73,032,795
2
true
2022-07-15T19:38:07.100Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Allow any field in Prisma<p>How do I allow any field to be added in Prisma? What I mean by this is something like <code>[key: String]: String</code> in TypeS...
72,966,024
replacing a number with a string in a list with 'for'loop<p>I'm a beginner in python and I'm stuck on a task I need to complete. I need to define a function that returns a list in a given range in which every time the number 7 appears or the number % 7 == 0 (no remainder), it is replaced with the word 'BOOM', otherwise...
<p>Something like this should work:</p> <pre class="lang-py prettyprint-override"><code> end_number = 18 def seven_boom(end_number): List = range(0, end_number + 1) boomList = [&quot;BOOM&quot; if (x%7 == 0) or (&quot;7&quot; in str(x)) else x for x in List ] return boomList </code></pre>
replacing a number with a string in a list with 'for'loop
python|for-loop
0
82
3
72,966,181
72,966,181
2
true
2022-07-13T12:07:11.787Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: replacing a number with a string in a list with 'for'loop<p>I'm a beginner in python and I'm stuck on a task I need to complete. I need to define a function ...
72,983,728
Why does this recursive function not run asynchronously?<p>I have a <code>start(node, array)</code> function that should perform a DFS by traversing an object tree via recursive calls to an API through <code>callMsGraph(token, end)</code> until <code>image</code> properties are found at the end of the tree, at which po...
<p>There is a few places where you are not handling promises returned in you code. <code>nextNode.then</code> if your forEach loop is just &quot;called&quot;, next line of the code will not wait for it to complete, forEach loop will complete execution before <code>then</code> callbacks are called.</p> <p>I changed you ...
Why does this recursive function not run asynchronously?
javascript|node.js|api|asynchronous|recursion
0
82
2
72,984,140
72,984,140
2
true
2022-07-14T16:22:11.347Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does this recursive function not run asynchronously?<p>I have a <code>start(node, array)</code> function that should perform a DFS by traversing an objec...
72,919,196
Combining two tables together twice and then pivot in MySQL<p>I have been trying to solve this for a while, and I am stumped.</p> <p>I have two tables, and I am basically trying to combine them and pivot them. I'm doing it in MySQL.</p> <p>Here are the tables:</p> <p><strong>pogo_dex</strong>:</p> <div class="s-table-c...
<p>I tried to solve it; but result_set doesn't match. I share my code and result_set here. MySQL has no pivot function; but you can use case statement to achieve a similar result.</p> <pre><code>SELECT c.ID, c.DexNum, c.Pokemon, c.Candy, MIN(case when d.League = 'Attackers' then d.Tier end) as Attackers, MIN(ca...
Combining two tables together twice and then pivot in MySQL
mysql|pivot
0
82
2
72,920,388
72,920,388
2
true
2022-07-09T05:33:15.157Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Combining two tables together twice and then pivot in MySQL<p>I have been trying to solve this for a while, and I am stumped.</p> <p>I have two tables, and I...
72,980,035
'runtime_error' from c++ not captured in iOS<p>In my iOS project, I use a C++ module. The C++ module throws exception for some cases and the Objective C++ wrapper fails to catch it. For instance</p> <p>Here is my <code>HelloWorld.h</code></p> <pre><code>#include &lt;string&gt; using namespace std; class HelloWorld{ pu...
<p><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Exceptions/Articles/Exceptions64Bit.html#//apple_ref/doc/uid/TP40009044-SW1" rel="nofollow noreferrer">C++ Interoperability</a></p> <blockquote> <p>In 64-bit processes, Objective-C exceptions (NSException) and C++ exception are inter...
'runtime_error' from c++ not captured in iOS
c++|ios|swift|objective-c|runtime-error
2
82
1
72,981,895
72,981,895
3
true
2022-07-14T11:51:39.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: 'runtime_error' from c++ not captured in iOS<p>In my iOS project, I use a C++ module. The C++ module throws exception for some cases and the Objective C++ wr...
72,994,967
Checking the length of a part of a dataframe in conditional row selection in pandas<p>Suppose I have a pandas dataframe like this:</p> <pre class="lang-py prettyprint-override"><code> first second third 1 2 2 1 2 2 1 0 3 3 4 5 4 4 6 3 5 5 4...
<p>The trick here is to calculate the <code>rolling</code> <code>sum</code> on a boolean mask to find out the number of values in <code>k</code> previous rows where <code>third</code> column is less than the <code>second</code> column</p> <pre><code>k = 2 m1 = df['second'].gt(df['first']) m2 = df['third'].lt(df['second...
Checking the length of a part of a dataframe in conditional row selection in pandas
python|pandas|dataframe
2
82
3
72,995,373
72,995,373
3
true
2022-07-15T13:42:44.620Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Checking the length of a part of a dataframe in conditional row selection in pandas<p>Suppose I have a pandas dataframe like this:</p> <pre class="lang-py pr...
73,012,167
Convert a text file into a dictionary list<p>I have a text file in this format (in_file.txt):</p> <pre><code>banana 4500 9 banana 350 0 banana 550 8 orange 13000 6 </code></pre> <p><a href="https://i.stack.imgur.com/ZTPm7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZTPm7.png" alt="enter image ...
<pre><code>titles = [&quot;title&quot;,&quot;price&quot;,&quot;count&quot;] [dict(zip(titles, [int(word) if word.isdigit() else word for word in line.strip().split()])) for line in open(&quot;in_file.txt&quot;).readlines()] </code></pre> <p>or:</p> <pre><code>titles = [&quot;title&quot;,&quot;price&quot;,&quot;count&qu...
Convert a text file into a dictionary list
python|dictionary
3
82
3
73,012,191
73,012,191
3
true
2022-07-17T13:26:51.153Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert a text file into a dictionary list<p>I have a text file in this format (in_file.txt):</p> <pre><code>banana 4500 9 banana 350 0 banana 550 8 orang...
72,978,024
Please help me understand one line of code<p>I've inherited a series of mirth channels that I need to modify but don't understand everything that has been done.</p> <p>Yes, I could rewrite them 'my way' but time is short so, if anyone can explain what some of the code does that might be a real life saver.</p> <p>The co...
<p>In <a href="https://www-archive.mozilla.org/js/language/ECMA-357.pdf" rel="nofollow noreferrer">E4X (ECMAScript for XML)</a>, <code>::</code> is the syntax for qualified identifiers (11.1.2). <code>*::['Body']</code> (or the equivalent <code>*::Body</code>) is the <code>Body</code> identifier in any namespace (11.1....
Please help me understand one line of code
javascript|mirth
0
82
1
72,978,259
72,978,259
3
true
2022-07-14T09:11:21.317Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Please help me understand one line of code<p>I've inherited a series of mirth channels that I need to modify but don't understand everything that has been do...
72,931,637
Generate a sphere at each point in a point cloud<p>I have a point cloud in the form of X,Y and Z stored in a txt file as :</p> <pre><code>1.25 4.65 9.15 2.37 8.62 7.59 . . . </code></pre> <p>I want to generate a sphere with a determined radius at each point in the point cloud and count the number of points that lie ins...
<p>If you have your points as a list of lists, you can do it by summing a generator expression and using <code>math.dist</code> to calculate the distances:</p> <pre><code>import math lst = [[1.25, 4.65, 9.15], [2.37, 8.62, 7.59]] r = 5 [sum(1 for j in lst if math.dist(i, j) &lt;= r)-1 for i in lst] </code></pre> <p>O...
Generate a sphere at each point in a point cloud
python|algorithm|geometry
-1
82
1
72,931,688
72,931,688
3
true
2022-07-10T20:23:49.420Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generate a sphere at each point in a point cloud<p>I have a point cloud in the form of X,Y and Z stored in a txt file as :</p> <pre><code>1.25 4.65 9.15 2.37...
72,969,271
Svelte select specific object data from JSON<p>I need help accessing specific objects in a JSON file based on a name value in Svelte.</p> <p>I am using JSON as a data source and am able to pull it into my page and loop through it with each.</p> <p>The JSON looks like so:</p> <pre><code> [ { &quot;id&quot;: 1,...
<p>You would not use <code>{#each}</code> and instead get the item in the JS. E.g. like this:</p> <pre class="lang-js prettyprint-override"><code>$: project = projects.find(p =&gt; p.id == '2'); </code></pre> <p>You now can reference <code>project</code> as is without the loop.</p> <p>If you want a dynamic selection yo...
Svelte select specific object data from JSON
javascript|json|svelte|sveltekit
4
82
1
72,970,173
72,970,173
3
true
2022-07-13T15:58:47.790Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Svelte select specific object data from JSON<p>I need help accessing specific objects in a JSON file based on a name value in Svelte.</p> <p>I am using JSON ...
72,775,134
Converting F# functions to System.Func causes "System.Reflection.TargetException : Non-static method requires a target."<p>I'd like to get MethodInfo for caller-provided functions.</p> <pre class="lang-ml prettyprint-override"><code>module MethodInfo = let from0 (f: unit -&gt; 'a) = (Func&lt;'a&gt;(f)).Method ...
<p>The issue is that the method returned by the delegate is not a static method, but an instance method that has to be invoked on an object that represents the closure (the object would normally capture e.g. variables that are used inside the function but are defined in the outer scope).</p> <p>You can get your code to...
Converting F# functions to System.Func causes "System.Reflection.TargetException : Non-static method requires a target."
.net|f#
1
82
1
72,793,198
72,793,198
4
true
2022-06-27T16:04:33.730Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Converting F# functions to System.Func causes "System.Reflection.TargetException : Non-static method requires a target."<p>I'd like to get MethodInfo for cal...
72,886,398
Add an index column to a csv using awk<p>How can I add an index to a csv file using awk? For example lets assume I have a file</p> <p><strong>data.txt</strong></p> <pre><code>col1,col2,col3 a1,b1,c1 a2,b2,c2 a3,b3,c3 </code></pre> <p>I would like to add another column, which is the index. Basically I would like an ou...
<p>You may use this <code>awk</code> solution:</p> <pre class="lang-bash prettyprint-override"><code>awk '{print (NR == 1 ? &quot;&quot; : NR-2) &quot;,&quot; $0}' file ,col1,col2,col3 0,a1,b1,c1 1,a2,b2,c2 2,a3,b3,c3 </code></pre>
Add an index column to a csv using awk
linux|csv|indexing|awk
3
82
4
72,886,457
72,886,457
4
true
2022-07-06T15:39:28.033Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add an index column to a csv using awk<p>How can I add an index to a csv file using awk? For example lets assume I have a file</p> <p><strong>data.txt</stro...
72,930,176
Rounded corners dilation (Image Processing)<p>I want to perform an Dilation operation while having rounded corners. Something like this : <a href="https://i.stack.imgur.com/8WAYv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8WAYv.png" alt="Example" /></a></p> <hr /> <p><strong>What I tried :</stro...
<p>I figured out a way thanks to &quot;Christoph Rackwitz&quot; comment. <br> <br></p> <p>The idea is pretty simple. We need to use a bigger kernel with a circle shape and reduce the number of Dilation iterations. <br></p> <pre><code>import numpy as np import cv2 kernel = np.zeros((100,100), np.uint8) cv2.circle(kerne...
Rounded corners dilation (Image Processing)
opencv|image-processing|mathematical-morphology
4
82
2
72,930,969
72,930,969
4
true
2022-07-10T16:39:52.420Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rounded corners dilation (Image Processing)<p>I want to perform an Dilation operation while having rounded corners. Something like this : <a href="https://i....
72,964,717
awk with or condition<p>I have a file with a word Sweden in different variations.</p> <p>I am trying to get if 34th column has Sweden there</p> <pre><code>awk -F\&quot; '$34 ~ /Sweden/ {print $0}' $ipp &gt;&gt; sweden.csv &amp; awk -F\&quot; '$34 ~ /sweden/ {print $0}' $ipp &gt;&gt; sweden.csv &amp; awk -F\&quot; '$3...
<p>You can use this <code>awk</code>:</p> <pre class="lang-bash prettyprint-override"><code>awk -F\&quot; 'tolower($34) ~ /sweden|^se$/' &quot;$ipp&quot; &gt;&gt; sweden.csv </code></pre>
awk with or condition
bash|awk
2
82
6
72,964,782
72,964,782
4
true
2022-07-13T10:26:07.707Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: awk with or condition<p>I have a file with a word Sweden in different variations.</p> <p>I am trying to get if 34th column has Sweden there</p> <pre><code>aw...
72,812,223
Can machine code be transpiled to jvm bytecode?<p>I was wondering, the jvm is designed to translate bytecode to machine code, but I can't seem to find any information on whether the inverse operation is even possible. it seems like if it was possible it would happen more often, as it would allow you to run any binary a...
<p>It is not practical to convert an arbitrary machine code binary into JVM byte code.  For example, there are instructions in C++ programs &amp; libraries that have no equivalent in JVM byte code.  You would have to divine the meaning of the program from its binary and translate that intent into something.  In the gen...
Can machine code be transpiled to jvm bytecode?
assembly|jvm|emulation|machine-code
0
82
2
72,816,606
72,816,606
4
true
2022-06-30T07:58:59.703Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can machine code be transpiled to jvm bytecode?<p>I was wondering, the jvm is designed to translate bytecode to machine code, but I can't seem to find any in...
72,782,407
generate a image from scratch?<p>how would I go about creating a pixel image from scratch? I am using web technologies (html/css/javascript/react) how would I take some information (such as pixel 1 is #ff5733 color, pixel 2 is #ff3829 color) and generate the corresponding pixel image for that? If anyone could point me...
<p>Assuming that you have a two-dimensional array of color values, -- represented below by the variable: <strong>mypixels</strong>, -- you could use a set of for loops to draw each pixel on a canvas, then convert it to an image:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel...
generate a image from scratch?
javascript|html|css|reactjs
0
82
2
72,783,044
72,783,044
4
true
2022-06-28T07:35:12.533Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: generate a image from scratch?<p>how would I go about creating a pixel image from scratch? I am using web technologies (html/css/javascript/react) how would ...
73,010,742
Hello guys, ask a question about the address of C++<p>Why are mySwap02 and mySwap03 addresses different?</p> <pre class="lang-cpp prettyprint-override"><code>#include&lt;iostream&gt; using namespace std; //1. Passing Directly void mySwap01(int a, int b) { cout &lt;&lt; &quot;mySwap01's address a:&quot; &lt;&lt; &...
<p>Let's take a look at what <code>mySwap03</code> is doing. Note that I've translated some of the Chinese here; I've submitted the edits, but they have yet to be approved, at least for now. (Edit: My edits have been approved.)</p> <pre><code>void mySwap03(int&amp; a, int&amp; b) { cout &lt;&lt; &quot;mySwap03's ad...
Hello guys, ask a question about the address of C++
c++
-1
82
1
73,010,823
73,010,823
4
true
2022-07-17T09:41:48.457Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hello guys, ask a question about the address of C++<p>Why are mySwap02 and mySwap03 addresses different?</p> <pre class="lang-cpp prettyprint-override"><code...
72,997,805
SQL Server : how to check if a string contains letters only?<p>I have a column of type <code>nvarchar</code> that looks like this:</p> <pre><code>col -------- 123hello45 12345 hello </code></pre> <p>Expect output</p> <pre><code>col -------- hello </code></pre> <p>Azure Synapse doesn't support regular expression. How ca...
<p>We can use SQL Server's enhanced <code>LIKE</code> operator here:</p> <pre class="lang-sql prettyprint-override"><code>SELECT col FROM yourTable WHERE col NOT LIKE '%[^A-Za-z]%'; </code></pre> <p>The logic here is any <code>col</code> value which does <em>not</em> have one or more non letter characters therefore mus...
SQL Server : how to check if a string contains letters only?
sql|sql-server|azure-synapse
-1
82
1
72,997,853
72,997,853
5
true
2022-07-15T17:36:02.303Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL Server : how to check if a string contains letters only?<p>I have a column of type <code>nvarchar</code> that looks like this:</p> <pre><code>col -------...
72,863,970
What is difference between "composer update" and "composer upgrade"?<p>I know difference between &quot;install&quot; and &quot;update&quot; but I couldn't find difference between <code>composer update</code> and <code>composer upgrade</code>.</p>
<p>They are both the same command, <code>upgrade</code> is just an alias for <code>update</code>.</p> <p>see <a href="https://github.com/composer/composer/blob/2.3.8/src/Composer/Command/UpdateCommand.php#L47" rel="nofollow noreferrer"><strong>UpdateCommand</strong> source</a>:</p> <pre class="lang-php prettyprint-over...
What is difference between "composer update" and "composer upgrade"?
php|composer-php|dependency-management|package-managers
2
82
1
72,864,672
72,864,672
5
true
2022-07-05T04:20:50.573Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is difference between "composer update" and "composer upgrade"?<p>I know difference between &quot;install&quot; and &quot;update&quot; but I couldn't fi...
72,990,057
Initialise prop with value passed from Parent component but map to reactive variable/value from store later on<p>In Parent.svelte:</p> <pre><code>&lt;Child {initialName}/&gt; </code></pre> <p>In Child.svelte</p> <pre><code>export let initialName; &lt;p&gt;{initialName}&lt;/p&gt; </code></pre> <p>This works fine, initia...
<p>You simply setup 2 individual reactive statements:</p> <pre class="lang-js prettyprint-override"><code>$: name = $_name; // `$_name` mutation will write to `name` $: name = initialName; // `initialName` will override `name`, if it also mutates </code></pre> <p>OR, if you only want <code>initialName</code> t...
Initialise prop with value passed from Parent component but map to reactive variable/value from store later on
svelte|sveltekit|svelte-3
1
82
1
72,992,496
72,992,496
5
true
2022-07-15T06:51:59.927Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Initialise prop with value passed from Parent component but map to reactive variable/value from store later on<p>In Parent.svelte:</p> <pre><code>&lt;Child {...
73,022,014
Why can MyClass foo() access private default constructor?<p>The following code:</p> <pre><code>#include &lt;iostream&gt; using namespace std; class Myclass { private: Myclass (); public: int num; }; int main() { Myclass foo(); return 0; } </code></pre> <p>Compiles without any warnings or errors in ...
<blockquote> <p>Why can MyClass foo() access private default constructor?</p> </blockquote> <p>It cannot (fancy hacks that allow you to call a private constructor aside).</p> <blockquote> <p>Is foo() being mistaken as a function</p> </blockquote> <p><code>Myclass foo();</code> <strong>is</strong> a function declaration...
Why can MyClass foo() access private default constructor?
c++
-3
82
2
73,022,139
73,022,139
6
true
2022-07-18T12:02:23.910Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why can MyClass foo() access private default constructor?<p>The following code:</p> <pre><code>#include &lt;iostream&gt; using namespace std; class Myclass...
72,891,279
Can't throw exception in constructor of subclass<p>I made 3 classes: a brand class (Marca), a comercial brand class (MarcaComercial) which is a subclass of the brand class and an exception class (ExMarcaInvalida) if one of the attributes initiated in the brand constructor is null. I want to catch this exception in my s...
<blockquote> <p>Can't throw exception in constructor of subclass</p> </blockquote> <p>The problem is NOT that you can't <strong>throw</strong> the exception.</p> <p>The real problem is that you can't <strong>catch</strong> an exception thrown in a constructor's <code>super</code> call ... in the constructor itself. Th...
Can't throw exception in constructor of subclass
java
2
82
1
72,891,340
72,891,340
6
true
2022-07-07T01:05:44.473Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't throw exception in constructor of subclass<p>I made 3 classes: a brand class (Marca), a comercial brand class (MarcaComercial) which is a subclass of t...