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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
73,014,362 | Skip post-merge hook when fast-forwarding<p>I have <code>post-merge</code> hook that check a few things after a merge/pull.
However, these check are unnecessary after a fast-forward merge and they just wasting several seconds for no good reason.
This is rather annoying.</p>
<p>How can I detect that the <code>post-merge... | <p>I thought just counting parents would do it, but OP pointed out that fast-forwarding to an existing merge would fail that test.</p>
<p>So:</p>
<pre><code>if [[ `git reflog -1` = *Fast-forward ]]
then this is a fast-forward
fi
</code></pre> | Skip post-merge hook when fast-forwarding | git|githooks|fast-forward | 0 | 58 | 1 | 73,014,494 | 73,014,494 | 2 | true | 2022-07-17T18:31:56.563Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Skip post-merge hook when fast-forwarding<p>I have <code>post-merge</code> hook that check a few things after a merge/pull.
However, these check are unnecess... |
72,965,968 | Matrix by Vector multiplication using numpy dot product<p>I have a matrix <code>m = np.array([[3,4], [5,6], [7,5]])</code> and a vector <code>v = np.array([1,2])</code> and these two tensors can be multiplied.<br />
For multiplication of the above two tensors, no. of columns of <code>m</code> must be equal to no. of ro... | <p>The multiplication is possible because <code>v</code> has only one dimension. Numpy considers it as a vector, so as this vector has 2 components, the matrix vector multiplication is allowed.</p>
<p>However, if you force <code>v</code> shape to be 1 row and 2 columns (so 2 dimensions), you will get an (expected) erro... | Matrix by Vector multiplication using numpy dot product | python|numpy|numpy-ndarray|tensor | 1 | 58 | 2 | 72,966,058 | 72,966,058 | 2 | true | 2022-07-13T12:02:03.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Matrix by Vector multiplication using numpy dot product<p>I have a matrix <code>m = np.array([[3,4], [5,6], [7,5]])</code> and a vector <code>v = np.array([1... |
72,784,850 | R which rows in a dataframe exist in another dataframe<p>I have two dataframes A and B:</p>
<h2>A</h2>
<pre><code> x y
1 0.0 0.0000000
2 0.5 0.8000000
3 -0.5 0.8000000
4 -1.0 0.0000000
5 -0.5 -0.8000000
6 0.5 -0.8000000
7 1.0 0.0000000
8 1.5 0.8000000
</code></pre>
<h2>B</h2>
<pre><code>... | <p><code>interaction</code> could be used to use <code>%in%</code> on multiple columns.</p>
<pre><code>which(interaction(A) %in% interaction(B))
#[1] 4 6
</code></pre>
<p>Data</p>
<pre><code>A <- read.table(header=TRUE, text=" x y
1 0.0 0.0000000
2 0.5 0.8000000
3 -0.5 0.8000000
4 -1.0 0.... | R which rows in a dataframe exist in another dataframe | r | 0 | 58 | 6 | 72,785,299 | 72,785,299 | 3 | true | 2022-06-28T10:31:38.623Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R which rows in a dataframe exist in another dataframe<p>I have two dataframes A and B:</p>
<h2>A</h2>
<pre><code> x y
1 0.0 0.0000000
2 0.... |
72,786,233 | Why does my id i get from next js router.query return undefined on refresh?<p>I am using the id gotten from next router.query to render elements dynamically it works when i access the room from next/link but when i refresh the page it throws this error</p>
<p><a href="https://i.stack.imgur.com/yEjGS.png" rel="nofollow ... | <p>You try to access the query parameter before its state is ready. There is a workaround to solve this problem.</p>
<pre><code> import { useRouter } from 'next/router';
const router = useRouter();
useEffect(() => {
if (router.isReady) {
// Do your stuff
// for example: assign query param to a s... | Why does my id i get from next js router.query return undefined on refresh? | javascript|reactjs|next.js | 1 | 58 | 1 | 72,786,329 | 72,786,329 | 3 | true | 2022-06-28T12:13:52.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does my id i get from next js router.query return undefined on refresh?<p>I am using the id gotten from next router.query to render elements dynamically ... |
72,792,812 | How to limit number of parallel file copy using gsutil<p>As per gsutil cp command documentation -</p>
<p><a href="https://cloud.google.com/storage/docs/gsutil/commands/cp" rel="nofollow noreferrer">https://cloud.google.com/storage/docs/gsutil/commands/cp</a></p>
<p>we can use <code>gsutil -m</code> option for parallel ... | <blockquote>
<p>gsutil performs the specified operation using a combination of
multi-threading and multi-processing. The number of threads and
processors are determined by <strong>parallel_thread_count</strong> and
<strong>parallel_process_count</strong>, respectively. These values are set in the
<strong>.boto</strong>... | How to limit number of parallel file copy using gsutil | google-cloud-platform|gsutil | 0 | 58 | 1 | 72,793,055 | 72,793,055 | 3 | true | 2022-06-28T20:29:09.307Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to limit number of parallel file copy using gsutil<p>As per gsutil cp command documentation -</p>
<p><a href="https://cloud.google.com/storage/docs/gsuti... |
72,839,770 | Transform dataframe to binary dataframe in R<p>I have a dataframe such as</p>
<pre><code>Groups Names
G1 SP1
G1 SP2
G1 SP3
G2 SP1
G2 SP4
G3 SP2
G3 SP1
</code></pre>
<p>And I would like to transform it as :</p>
<pre><code> Names G1 G2 G3
SP1 1 1 1
SP2 1 0 1
SP3 1 0 0
... | <p>Use <code>table</code>:</p>
<pre><code>table(df$Names, df$Groups)
G1 G2 G3
SP1 1 1 1
SP2 1 0 1
SP3 1 0 0
SP4 0 1 0
</code></pre> | Transform dataframe to binary dataframe in R | r|dplyr|reshape|melt | 0 | 58 | 3 | 72,839,940 | 72,839,940 | 3 | true | 2022-07-02T14:20:21.323Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Transform dataframe to binary dataframe in R<p>I have a dataframe such as</p>
<pre><code>Groups Names
G1 SP1
G1 SP2
G1 SP3
G2 SP1
G2 SP4
... |
72,845,321 | If some of the columns of the data set are empty, I want to eliminate that columns in R<p>I'm using R and stuck at the following problem.
I have a data called <code>data</code>. It has 48 columns. <code>id</code>, <code>title_1</code>, <code>title_2</code>, ..., <code>title_47</code>. <code>id</code> stands for persona... | <p>You can <code>Filter</code> the columns which have <code>all</code> values "". Here I use an example dataframe where the column title_2 has only "" values:</p>
<pre><code>Filter(function(x)!all(x == ""), df)
</code></pre>
<p>Output:</p>
<pre><code> id title_1
1 1 2
2 2 3
... | If some of the columns of the data set are empty, I want to eliminate that columns in R | r|dataframe|for-loop | 2 | 58 | 4 | 72,845,364 | 72,845,364 | 3 | true | 2022-07-03T09:20:04.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
If some of the columns of the data set are empty, I want to eliminate that columns in R<p>I'm using R and stuck at the following problem.
I have a data calle... |
72,849,813 | Should I provide x or log(x) to predict() if my model is y ~ log(x)?<p>I have a fitted <code>lm</code> model</p>
<pre><code>log_log_model = lm(log(price) ~ log(carat), data = diamonds)`
</code></pre>
<p>I want to predict <code>price</code> using this model, but I'm not sure if I should be entering <code>log(carat)</cod... | <p><strong>Choice 2 is correct.</strong></p>
<p>To give you some extra bit of confidence, let's inspect what the design matrix looks like when we make prediction.</p>
<pre><code>## for diamonds dataset
library(ggplo2)
## log-log linear model
fit <- lm(log(price) ~ log(carat), data = diamonds)
## for prediction
new... | Should I provide x or log(x) to predict() if my model is y ~ log(x)? | r|regression|linear-regression|lm|predict | 2 | 58 | 1 | 72,850,166 | 72,850,166 | 3 | true | 2022-07-03T20:50:03.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Should I provide x or log(x) to predict() if my model is y ~ log(x)?<p>I have a fitted <code>lm</code> model</p>
<pre><code>log_log_model = lm(log(price) ~ l... |
72,863,035 | SM-G525F (Samsung Galaxy XCover 5) - How to activate Flash and Torch LED at the same time<p>The SM-G525F (Samsung Galaxy XCover 5) has two build in flashlights on its backside. One is the torch which is available by the android menu and the other one is the camera flash.</p>
<p>I can activate the camera flash when usin... | <p>Just took a look at the <a href="https://www.galaxyxcover5.com/" rel="nofollow noreferrer">product description</a> and according to Samsung both LEDs won't turn on simultaneusly.</p> | SM-G525F (Samsung Galaxy XCover 5) - How to activate Flash and Torch LED at the same time | android|xamarin|led|samsung | 0 | 58 | 1 | 72,863,399 | 72,863,399 | 3 | true | 2022-07-05T00:40:37.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SM-G525F (Samsung Galaxy XCover 5) - How to activate Flash and Torch LED at the same time<p>The SM-G525F (Samsung Galaxy XCover 5) has two build in flashligh... |
72,850,265 | tcpdump difference between ip host hostname | ip and host hostname<p>In <code>tcpdump</code>, which is the difference between the following two commands? I tried to understand but they seems pretty much the same to me.</p>
<pre><code>tcpdump ip host google.com
</code></pre>
<p>and</p>
<pre><code>tcpdump ip and host goo... | <p>There is no difference. If you compare the packet-matching code, generated by including the <code>-d</code> option, then you can see that they produce identical results:</p>
<pre>
tcpdump -d "ip host google.com"
(000) ldh [12]
(001) jeq #0x800 jt 2 jf 7
(002) ld [26]
(003) jeq #0x8... | tcpdump difference between ip host hostname | ip and host hostname | wireshark|packet|tcpdump|packet-sniffers|packet-capture | -2 | 58 | 1 | 72,870,607 | 72,870,607 | 3 | true | 2022-07-03T22:18:33.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
tcpdump difference between ip host hostname | ip and host hostname<p>In <code>tcpdump</code>, which is the difference between the following two commands? I t... |
72,879,290 | how to iterate over object and dynamically assign values to keys<p>Hella all,</p>
<p>so I am struggling with the following problem:
I have an object with some keys and values. I would like to take them out and make a new array of objects. Here is the code, as it describes my problem better.</p>
<p><div class="snippet" ... | <p>you can iterate on object keys and use method array.map to get the expected object</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 sourceObj = {
test1: "a",
test2:... | how to iterate over object and dynamically assign values to keys | javascript|arrays|json|object | 0 | 58 | 5 | 72,879,333 | 72,879,333 | 3 | true | 2022-07-06T07:14:08.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to iterate over object and dynamically assign values to keys<p>Hella all,</p>
<p>so I am struggling with the following problem:
I have an object with som... |
72,899,920 | Inheritance and operator overloading<p>Hi I am new to c++ and had some conceptual questions that I wasn't able to find any direct answers to online.
So if we have a parent class and multiple children classes and we want to create an overloaded input function for it. So do we create it for every child class or just for ... | <p>So, what @john said, basically, something like this (reduced to a minimal example):</p>
<pre><code>#include <iostream>
class A {
public:
friend std::ostream &operator << (std::ostream &os, const A &a);
private:
virtual std::ostream& print (std::ostream &os) const { std::cout... | Inheritance and operator overloading | c++|inheritance|operator-overloading | 1 | 58 | 1 | 72,900,340 | 72,900,340 | 3 | true | 2022-07-07T14:47:48.827Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Inheritance and operator overloading<p>Hi I am new to c++ and had some conceptual questions that I wasn't able to find any direct answers to online.
So if we... |
72,903,966 | My C++ code seems to stop in the middle of a for loop<p>I've been practicing USACO questions and I solved the problem but my code just randomly stops executing in the second for loop.</p>
<p>Code:</p>
<pre><code>#include <vector>
#include <string>
using namespace std;
int main()
{
int R = 0;
int C =... | <p>When <code>i</code> equals zero then <code>values[i-1][j]</code> is an out of bounds access on your vector.</p>
<p>When <code>i</code> equals <code>R-1</code> then <code>values[i+1][j]</code> is an out of bounds access on your vector.</p>
<p>Similar errors exist for <code>j</code>.</p> | My C++ code seems to stop in the middle of a for loop | c++|visual-c++ | -3 | 58 | 1 | 72,903,990 | 72,903,990 | 3 | true | 2022-07-07T20:39:18.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
My C++ code seems to stop in the middle of a for loop<p>I've been practicing USACO questions and I solved the problem but my code just randomly stops executi... |
72,917,066 | SQL: get a substring using a delimiter<p>I have column which has <code>-</code> as delimiter and I want to get substring between the first and second delimiter:</p>
<pre><code>ABC-DEF-FG
ABCD-JAFF-UIOU-TYU
</code></pre>
<p>Output</p>
<pre><code>DEF
JAFF
</code></pre>
<p>I have tried substring and charIndex but not gett... | <p>With a bit of JSON</p>
<p><strong>Example</strong></p>
<pre><code>Select A.[column]
,Pos2 = JSON_VALUE(S,'$[1]')
From YourTable A
Cross Apply ( values ( '["'+replace(string_escape([column],'json'),'-','","')+'"]' ) ) B(S)
</code></pre>
<p><strong>Results</strong></p>
<pre><code>column ... | SQL: get a substring using a delimiter | sql|sql-server | 1 | 58 | 1 | 72,917,114 | 72,917,114 | 3 | true | 2022-07-08T21:15:17.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL: get a substring using a delimiter<p>I have column which has <code>-</code> as delimiter and I want to get substring between the first and second delimit... |
72,961,421 | How to use `apply` in Kotlin when property and function have the same variable name<pre class="lang-kotlin prettyprint-override"><code>data class Foo(
var aaa: String,
var bbb: String
)
</code></pre>
<pre class="lang-kotlin prettyprint-override"><code>fun bar(aaa: String) {
Foo().apply {
aaa = aaa // this lin... | <p>Like @Nikolai Shevchenko answered this can be done using <code>this</code>.</p>
<p>When having a szenario where <code>this</code> references multiple instances with a same variable name, you can add a <a href="https://kotlinlang.org/docs/returns.html" rel="nofollow noreferrer">label</a> to determine the exact target... | How to use `apply` in Kotlin when property and function have the same variable name | kotlin | 0 | 58 | 3 | 72,961,598 | 72,961,598 | 3 | true | 2022-07-13T05:41:52.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use `apply` in Kotlin when property and function have the same variable name<pre class="lang-kotlin prettyprint-override"><code>data class Foo(
var ... |
72,986,964 | How to write a wrapper enum for C error codes?<p>I am writing a Rust wrapper for a C API. It contains a function that may fail, in which case it returns an error code encoded as an <code>int</code>. Let's call these <code>SOME_ERROR</code> and <code>OTHER_ERROR</code>, and they will have the values 1 and 2, respectivel... | <blockquote>
<p>Here comes my first question. It does not seem to be possible to specify <code>std::os::raw::c_int</code> as the underlying type of an enum. But I do feel like it should be, as <code>int</code> isn't required to be 32 bits wide. Is there any way to achieve this?</p>
</blockquote>
<p>No. <a href="https:/... | How to write a wrapper enum for C error codes? | rust|error-handling | 0 | 58 | 1 | 72,987,087 | 72,987,087 | 3 | true | 2022-07-14T21:45:19.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to write a wrapper enum for C error codes?<p>I am writing a Rust wrapper for a C API. It contains a function that may fail, in which case it returns an e... |
73,014,387 | How to deal with TypeScript not treating uninitialized optional parameter as undefined<p>Here's the simplified reproduction of my function:</p>
<pre class="lang-js prettyprint-override"><code>const nullify = <T extends string | undefined>(
value?: T,
): T extends string ? string : null => {
if (value === u... | <p>The problem is that when you don't pass in a <code>value</code> argument, there is no value from which the compiler can infer <code>T</code>, and inference just fails. When inference fails, it generally falls back to its <a href="https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints" rel=... | How to deal with TypeScript not treating uninitialized optional parameter as undefined | javascript|typescript | 2 | 58 | 2 | 73,015,169 | 73,015,169 | 3 | true | 2022-07-17T18:35:16.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to deal with TypeScript not treating uninitialized optional parameter as undefined<p>Here's the simplified reproduction of my function:</p>
<pre class="l... |
73,029,989 | Java generate random double between exclusive starting range and inclusive ending range<pre class="lang-java prettyprint-override"><code>double num = min + Math.random() * (max - min);
</code></pre>
<p>This creates random double between <code>[min, max)</code>. I would like to create random double between <code>(min, m... | <pre><code>double num = max - Math.random() * (max - min);
</code></pre>
<p>This will produce numbers whose upper limit, <code>max</code> is inclusive, but whose lower limit, <code>min</code> is exclusive, because <code>max</code> is returned when <code>Math.random()</code> returns zero.</p> | Java generate random double between exclusive starting range and inclusive ending range | java|random | 0 | 58 | 1 | 73,030,119 | 73,030,119 | 3 | true | 2022-07-19T00:48:08.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java generate random double between exclusive starting range and inclusive ending range<pre class="lang-java prettyprint-override"><code>double num = min + M... |
72,960,217 | How to get value of select form inside the views?<ol>
<li>In the HTML template I created a select form passing into it player names from Player Model.</li>
<li>I want to delete the player selected in this form.</li>
<li>Inside my views, I am trying to get the selected value as a string
but I can't. for me it would be ... | <p>Your form is sending the data using POST method. To delete the data with their names, change the value of options in select with their names as well like this</p>
<pre><code><option value="{{pl.name}}">{{pl.name}}</option>
</code></pre>
<p>Then inside your views.py</p>
<pre><code>result = reque... | How to get value of select form inside the views? | python|html|django | 2 | 58 | 1 | 72,960,421 | 72,960,421 | 3 | true | 2022-07-13T02:23:24.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get value of select form inside the views?<ol>
<li>In the HTML template I created a select form passing into it player names from Player Model.</li>
<... |
72,815,705 | Combine two lambda expressions without intermediate step<p>I'm trying to write a lambda expression that sorts a string array by string length by using a single lambda expression variable. This is what I have come up with (using two)</p>
<pre><code>public static void main(String[] args) {
Consumer<String[]> s... | <p>Lambdas in Java always need to target a functional interface (an interface with only a single abstract method). In your case, that is the <code>Consumer</code>-interface.</p>
<p>The reason you get the error when you chain the two lambdas together with <code>andThen</code> is because the compiler doesn't know which f... | Combine two lambda expressions without intermediate step | java|lambda|expression | 1 | 58 | 2 | 72,815,834 | 72,815,834 | 3 | true | 2022-06-30T12:19:11.553Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combine two lambda expressions without intermediate step<p>I'm trying to write a lambda expression that sorts a string array by string length by using a sing... |
72,938,170 | Difference of dynamic routing in Nextjs<p>What is the difference among <code>[id].js</code>, <code>[...id].js</code> and <code>[[...id]].js</code> dynamic routing in Nextjs?</p> | <p><strong>Case:</strong> <code>posts/[id].js</code></p>
<p>When you are calling /posts/1099 - your page will be triggered (value of <code>id</code> variable is <code>1099</code>.</p>
<p><em>Example:</em></p>
<p><code>/posts</code> - the system will trigger an error (id is not defined) or possible issue depending on yo... | Difference of dynamic routing in Nextjs | next.js|url-routing | 1 | 58 | 1 | 72,938,622 | 72,938,622 | 3 | true | 2022-07-11T11:54:25.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Difference of dynamic routing in Nextjs<p>What is the difference among <code>[id].js</code>, <code>[...id].js</code> and <code>[[...id]].js</code> dynamic ro... |
72,918,230 | How to compare file on local PC and github?<p>I have a file on my PC called <code> test.ps1</code></p>
<p>I have a file hosted on my github called <code> test.ps1</code></p>
<p>both of them have the same contents <code> a string</code> inside them</p>
<p>I am using the following script to try and comapare them:</p>
<pr... | <p><strong>tl;dr</strong></p>
<pre><code># Remove a trailing newline from the downloaded file content
# before splitting into lines.
# Parameter names omitted for brevity.
Compare-Object $fileA ($fileB -replace '\r?\n\z' -split '\r?\n' )
</code></pre>
<p>If the files are truly identical (save for any character-encodi... | How to compare file on local PC and github? | powershell|github|string-comparison | 2 | 58 | 1 | 72,922,414 | 72,922,414 | 3 | true | 2022-07-09T00:59:58.580Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to compare file on local PC and github?<p>I have a file on my PC called <code> test.ps1</code></p>
<p>I have a file hosted on my github called <code> tes... |
72,943,176 | HTML & CSS, not able to center horizontally with margin auto<p>I have problem with vertically centering the element in the navigation bar on my page. This 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-... | <p>As you can read on <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/margin#values" rel="nofollow noreferrer">mdn</a>, you can't center a normal element horizontally with <code>margin: auto</code>:</p>
<blockquote>
<p><code>auto</code>: The browser selects a suitable margin to use. For example, in certain ca... | HTML & CSS, not able to center horizontally with margin auto | html|css | 1 | 58 | 3 | 72,943,216 | 72,943,216 | 3 | true | 2022-07-11T18:38:07.210Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
HTML & CSS, not able to center horizontally with margin auto<p>I have problem with vertically centering the element in the navigation bar on my page. This is... |
72,984,541 | How do I add new lines after deleting a large amount of text in Perl windows?<p>I'm trying to remove a large amount of text from a file before inserting a few new lines. I can delete everything after the word 'CParticleSystemDefinition' with a single line of code like this</p>
<pre><code>perl -0777 -pi -we "s/CPar... | <p>Do it in two steps -- clear the rest of the file after that phrase, then add the desired text</p>
<pre><code>perl -0777 -i.bak -wpe"s{Definition\x22\K.*}{}s; $_ .= qq(\n\tm_Children...)" file
</code></pre>
<p>where I've used ellipses to indicate the rest, for clarity. I added <code>.bak</code> to keep a ... | How do I add new lines after deleting a large amount of text in Perl windows? | windows|perl | 2 | 58 | 1 | 72,984,652 | 72,984,652 | 3 | true | 2022-07-14T17:33:48.607Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I add new lines after deleting a large amount of text in Perl windows?<p>I'm trying to remove a large amount of text from a file before inserting a fe... |
72,808,881 | C++ How to map string keys to class method invocations for a specific object?<p>In C++, I am trying to map a user-provided string to a class method invocation for a specific object. I was successful in mapping user-provided strings to function calls for another application, but I do not know how to extend this approach... | <p>Since all of the methods belong to the same class, and have the same signature, you can use <a href="https://en.cppreference.com/w/cpp/language/pointer#Pointers_to_member_functions" rel="nofollow noreferrer">Pointers to member functions</a>, using the member access <a href="https://en.cppreference.com/w/cpp/language... | C++ How to map string keys to class method invocations for a specific object? | c++|methods|stdmap | 0 | 58 | 1 | 72,809,029 | 72,809,029 | 3 | true | 2022-06-29T23:34:22.693Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ How to map string keys to class method invocations for a specific object?<p>In C++, I am trying to map a user-provided string to a class method invocatio... |
72,852,018 | what is the idiomatic way to update *part* of a memory element in FIRRTL? this comes up when updating one entry of a line in a cache<p>Writing a register file in FIRRTL is straightforward: make a memory of machine words and read/write them.</p>
<p>However, when writing a cache, it is different: you typically have a cac... | <p>The simplest approach would be to use a FIRRTL memory construct (<code>mem</code>) and avoid CHIRRTL entirely (<code>cmem</code>/<code>smem</code>). The former gives you an explicit mask port on the memory. This then enables you to describe a masked write which is exactly what you want. FIRRTL memory constructs h... | what is the idiomatic way to update *part* of a memory element in FIRRTL? this comes up when updating one entry of a line in a cache | chisel|firrtl | 1 | 58 | 1 | 72,852,520 | 72,852,520 | 3 | true | 2022-07-04T05:11:33.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
what is the idiomatic way to update *part* of a memory element in FIRRTL? this comes up when updating one entry of a line in a cache<p>Writing a register fil... |
72,867,598 | Can I call this an implementation of the Composite Pattern<p>I have this design which I self-proclaim to be Composite Pattern, though I'm not entirely sure about that. So I'm aksing for your statement on this.</p>
<p>This is the interface which collectively describes all of them</p>
<pre><code>public interface DomainRe... | <p>I do not think that it looks like <code>Composite</code> pattern as:</p>
<ul>
<li>there is no a place where <a href="https://en.wikipedia.org/wiki/Composite_pattern" rel="nofollow noreferrer">a group of objects that are treated the same way as a single instance of the same type of object</a>.</li>
</ul>
<p>In my vie... | Can I call this an implementation of the Composite Pattern | java|design-patterns|composite | 2 | 58 | 1 | 72,868,294 | 72,868,294 | 3 | true | 2022-07-05T10:08:30.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can I call this an implementation of the Composite Pattern<p>I have this design which I self-proclaim to be Composite Pattern, though I'm not entirely sure a... |
72,789,663 | using keyword with private member assignment to manage IDisposable<p>I was reading <a href="https://blog.stephencleary.com/2022/03/cancellation-2-requesting-cancellation.html" rel="nofollow noreferrer">Stephen Cleary's blog post about cancellation</a>, and I saw something I haven't seen before in the following code sni... | <p>It's simply because you can't do this:</p>
<pre><code>using _cts = new();
</code></pre>
<p>That will give a compile error, "Identifier expected".</p>
<p>So he's introduced a local variable which will be disposed at the end of the method:</p>
<pre><code>using var cts = _cts = new();
</code></pre>
<p>Now it ... | using keyword with private member assignment to manage IDisposable | c#|idisposable | 3 | 58 | 1 | 72,789,795 | 72,789,795 | 3 | true | 2022-06-28T15:54:55.030Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
using keyword with private member assignment to manage IDisposable<p>I was reading <a href="https://blog.stephencleary.com/2022/03/cancellation-2-requesting-... |
72,914,090 | How to find the length of a command line arguments individual strings<p>Say I run the following in my command line</p>
<p><code>$./(file name) abcd efg hijkl</code></p>
<p>How would I best find the length of argv[1],argv[2], etc.</p>
<p>In this example, I would like to hold argv[1], or "abcd", as an integer w... | <p><a href="https://en.cppreference.com/w/c/string/byte/strlen" rel="nofollow noreferrer"><code>strlen</code></a> is used to find the length of strings.</p>
<pre><code>#include <string.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int i;
for (i = 0; i < argc; i++)
printf(&qu... | How to find the length of a command line arguments individual strings | c|command-line | 0 | 58 | 1 | 72,914,104 | 72,914,104 | 3 | true | 2022-07-08T16:02:56.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to find the length of a command line arguments individual strings<p>Say I run the following in my command line</p>
<p><code>$./(file name) abcd efg hijkl... |
73,000,024 | Select and join rows when column value changes per group<h4>Assessments table:</h4>
<pre><code>+---------------+-----------+---------------------+
| assessment_id | device_id | created_at |
+---------------+-----------+---------------------+
| 1 | 1 | 2022-07-15 20:03:03 |
| 2 |... | <p>If you are using MySQL 8, Window functions can help. <a href="https://dev.mysql.com/doc/refman/8.0/en/window-function-descriptions.html" rel="nofollow noreferrer">https://dev.mysql.com/doc/refman/8.0/en/window-function-descriptions.html</a></p>
<p>You can partition <em>your results</em> by <code>device</code> and <c... | Select and join rows when column value changes per group | mysql | 2 | 58 | 2 | 73,002,108 | 73,002,108 | 3 | true | 2022-07-15T22:08:19.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Select and join rows when column value changes per group<h4>Assessments table:</h4>
<pre><code>+---------------+-----------+---------------------+
| assessme... |
72,804,437 | Finding correlation in dataframe<p>I have a pandas dataframe(df) that has columns (say x_1,x_2,....x_n as column names). I want to find a correlation (Pearson) between the ith column and the rest of the columns.</p>
<p>One way I can do this is by using the .corr() function</p>
<pre><code>correlation = df.corr(method='p... | <p><code>corrwith()</code> might be what are looking for.</p>
<p>Say you had a data frame with columns <code>c1,c2,c3,c4</code>.</p>
<p>Then you should be able to:</p>
<pre><code>df[['c2','c3','c4']].corrwith(df['c1'])
</code></pre> | Finding correlation in dataframe | python|pandas|dataframe|correlation|pearson-correlation | 0 | 58 | 1 | 72,805,997 | 72,805,997 | 3 | true | 2022-06-29T15:54:23.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Finding correlation in dataframe<p>I have a pandas dataframe(df) that has columns (say x_1,x_2,....x_n as column names). I want to find a correlation (Pearso... |
72,873,189 | Is there a way to facet a line graph but add a constant line in R?<p>I am making a line graph using ggplot of some data that I have were I am sizing objects based on treatment groups into bins and looking at the percentage in each size bin by group.</p>
<p>My goal is to facet the data but have the control line as a gra... | <p>One option would be to add your reference group via an additional <code>stat_summary</code> for which you only use the data on the reference group. To get this layer displayed on each facet it's important to drop the <code>group</code> column after filtering.</p>
<p>For the example code I have chosen group "a&q... | Is there a way to facet a line graph but add a constant line in R? | r|ggplot2|facet | 0 | 58 | 1 | 72,873,512 | 72,873,512 | 4 | true | 2022-07-05T17:07:49.600Z | 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 facet a line graph but add a constant line in R?<p>I am making a line graph using ggplot of some data that I have were I am sizing objects ... |
72,884,509 | Best practice for accessing data in PDL objects<p>I have a 2 dimensional pdl,for example:</p>
<pre><code>my $data = random(4,4);
</code></pre>
<p>and I want to compute the sum of the 0,0 and the 1,0 element outside of the pdl context.
(Not like, for example <code>$data->slice('0,0') + $data->slice('1,0)</code>, ... | <p>If you're looking to extract individual elements as normal Perl scalars, use <code>at</code> instead of <code>slice</code>:</p>
<pre><code>pdl> $pdl = random(4,4)
pdl> p $pdl->at(0,0) + $pdl->at(1,0)
0.288796754210711
pdl> p ref \($pdl->at(0,0) + $pdl->at(1,0))
SCALAR
</code></pre>
<p>To convert... | Best practice for accessing data in PDL objects | perl|pdl | 3 | 58 | 2 | 72,892,350 | 72,892,350 | 4 | true | 2022-07-06T13:33:58.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Best practice for accessing data in PDL objects<p>I have a 2 dimensional pdl,for example:</p>
<pre><code>my $data = random(4,4);
</code></pre>
<p>and I want... |
72,920,883 | C# Why property's get and set methods both called accessor but not accessor and mutator?<p>I read that (in C#) getter method is called 'accessor' and setter method is called 'mutator' <em>(for example: methods get_Name(){} and set_Name(){})</em>. But when we talk about properties <em>(for example: string Name {get; set... | <p>Why are you assuming that "accessor" means "get"? Accessor is just a generic term that provides some kind of access to the property. That could be read access
("getter"), write access ("setter"), or something else. Events also have accessors (add and remove, although more are ... | C# Why property's get and set methods both called accessor but not accessor and mutator? | c#|terminology | 4 | 58 | 1 | 72,920,924 | 72,920,924 | 4 | true | 2022-07-09T11:12:30.097Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# Why property's get and set methods both called accessor but not accessor and mutator?<p>I read that (in C#) getter method is called 'accessor' and setter ... |
72,922,585 | How to print a variable by push in Perl?<p>I'm trying to make an array variable which is pushed from an Excel file in Perl.</p>
<p><a href="https://i.stack.imgur.com/52LSy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/52LSy.png" alt="Excel is" /></a></p>
<pre><code>my @registers=();
my $registers_n... | <p>Assuming you are using <a href="https://metacpan.org/pod/Spreadsheet::ParseExcel" rel="nofollow noreferrer">Spreadsheet::ParseExcel</a>, as in your <a href="https://stackoverflow.com/questions/72912293/how-do-i-get-the-size-of-a-merged-excel-cell-in-perl">previous question</a>, the <code>get_cell</code> method retur... | How to print a variable by push in Perl? | perl | 1 | 58 | 1 | 72,922,777 | 72,922,777 | 4 | true | 2022-07-09T15:22:58.730Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to print a variable by push in Perl?<p>I'm trying to make an array variable which is pushed from an Excel file in Perl.</p>
<p><a href="https://i.stack.i... |
72,936,376 | taking square using "value**2" results causes an overflow while "value*value" is fine<p>Given the same input, <code>x**2</code> gives an integer overflow while <code>x*x</code> works fine.</p>
<p>I am not sure if this is because of the python's internal implementation of those operator or if this is a bug in the hypoth... | <p>This is just Python's standard semantics for <code>float</code>: overflow in multiplication returns <code>inf</code>, but overflow in exponentiation raises <code>OverflowError</code>.</p>
<p>Weird, but not a bug in Hypothesis.</p> | taking square using "value**2" results causes an overflow while "value*value" is fine | python|python-internals|python-hypothesis | 0 | 58 | 1 | 72,958,608 | 72,958,608 | 4 | true | 2022-07-11T09:31:33.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
taking square using "value**2" results causes an overflow while "value*value" is fine<p>Given the same input, <code>x**2</code> gives an integer overflow whi... |
73,016,183 | How can I get this javascript function to work all of the time? (Uncaught TypeError: Cannot read properties of null)<p>I'm trying to create two numerical inputs, each of which has their own custom '+' and '-' buttons. However, with my current code, it appears that the button functions only work some of the time. On the... | <p>The <code>event.target</code> may be the span inside the button, and therefore the code may not find the <code>data-id</code> attribute. Instead perhaps get the id without using <code>event.target</code>. Either use <code>item</code> or <code>event.currentTarget</code>.</p> | How can I get this javascript function to work all of the time? (Uncaught TypeError: Cannot read properties of null) | javascript|html | 3 | 58 | 3 | 73,016,225 | 73,016,225 | 4 | true | 2022-07-18T00:03:31.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I get this javascript function to work all of the time? (Uncaught TypeError: Cannot read properties of null)<p>I'm trying to create two numerical inp... |
72,784,724 | Issues in the Rust reference book<p><a href="https://doc.rust-lang.org/reference/types/closure.html#capture-modes" rel="nofollow noreferrer">https://doc.rust-lang.org/reference/types/closure.html#capture-modes</a></p>
<pre><code>struct SetVec {
set: HashSet<u32>,
vec: Vec<u32>
}
impl SetVec {
f... | <p>This was true in the past, but has changed since and the reference was not updated. Since edition 2021, <a href="https://doc.rust-lang.org/edition-guide/rust-2021/disjoint-capture-in-closures.html" rel="nofollow noreferrer">closures capture disjoint fields</a>.</p>
<p>See <a href="https://github.com/rust-lang/refere... | Issues in the Rust reference book | rust | 3 | 58 | 1 | 72,784,900 | 72,784,900 | 4 | true | 2022-06-28T10:22:52.760Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Issues in the Rust reference book<p><a href="https://doc.rust-lang.org/reference/types/closure.html#capture-modes" rel="nofollow noreferrer">https://doc.rust... |
72,907,213 | scala: updating string value in an option<p>I have an Option of a string. I want to update the contained value:</p>
<pre><code>if(x.isEmpty) {
...another calculation
} else {
x.map(val => ...update val)
}
</code></pre>
<p>Is this an idiomatic way?</p> | <pre><code>x.fold(another calculation)(v => ...update v)
</code></pre>
<p>e.g.</p>
<pre><code>x.fold("no value")("Value is " + _)
</code></pre>
<hr />
<p>Note that this <strong>extracts</strong> the value from the <code>Option</code> so if you want to have the result as an <code>Option</code> you... | scala: updating string value in an option | scala|scala-option | 0 | 58 | 3 | 72,907,537 | 72,907,537 | 4 | true | 2022-07-08T05:58:59.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
scala: updating string value in an option<p>I have an Option of a string. I want to update the contained value:</p>
<pre><code>if(x.isEmpty) {
...another c... |
72,971,968 | Meanning of %! and %K with printf<p>I try to rewrite printf function and i found a strange result when use format specifier (%) with ! or K. I want to understand why i get this result.</p>
<pre><code> printf("%!");
printf("%K")
</code></pre>
<p>I get output ! and K.
Thank for all response</p> | <p>According to <a href="http://port70.net/%7Ensz/c/c11/n1570.html#7.21.6.1p9" rel="nofollow noreferrer">§7.21.6.1 ¶9 of the ISO C11 standard</a>, using an invalid conversion specification will result in <a href="https://en.wikipedia.org/wiki/Undefined_behavior" rel="nofollow noreferrer">undefined behavior</a>.</p>
<p>... | Meanning of %! and %K with printf | c|format|output|printf|format-specifiers | 1 | 58 | 2 | 72,972,414 | 72,972,414 | 4 | true | 2022-07-13T19:59:52.030Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Meanning of %! and %K with printf<p>I try to rewrite printf function and i found a strange result when use format specifier (%) with ! or K. I want to unders... |
72,852,890 | Performance of the splat operator when accessing a matrix<p>Let's say we have a matrix and a vector of the indices at which we want to access that matrix:</p>
<pre><code>matrix = Matrix{Float64}(undef, 5000, 4000)
point = [1244, 3353]
</code></pre>
<p>We can use the splat operator (...) to expand the point vector to ac... | <p>Splatting a tuple seems to be as fast as explicit destruction:</p>
<pre><code>julia> @btime $matrix[point...] setup=(point = [1244, 3353])
91.024 ns (4 allocations: 64 bytes)
0.0
julia> @btime $matrix[point[1], point[2]] setup=(point = [1244, 3353])
2.530 ns (0 allocations: 0 bytes)
0.0
julia> @btime ... | Performance of the splat operator when accessing a matrix | arrays|performance|matrix|julia | 1 | 58 | 1 | 72,853,303 | 72,853,303 | 4 | true | 2022-07-04T07:05:26.267Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Performance of the splat operator when accessing a matrix<p>Let's say we have a matrix and a vector of the indices at which we want to access that matrix:</p... |
72,832,657 | Class object and class type in Python<p>I am new to Python and I have a question about OOP. So, when we create a class we write "object" in parentheses. For example,</p>
<pre class="lang-py prettyprint-override"><code>class My(object):
</code></pre>
<p>I have read somewhere that this means that the class inh... | <p>There are two relationships here: <em>instance of</em> and <em>subtype of</em>. For a non-programming analogy, you can think about the difference like this. A particular apple sitting on a desk is an <em>instance</em> of "apple". It's an example of an apple, that particular one. On the other hand, "ap... | Class object and class type in Python | python|class | 2 | 58 | 1 | 72,832,761 | 72,832,761 | 5 | true | 2022-07-01T17:13:56.717Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Class object and class type in Python<p>I am new to Python and I have a question about OOP. So, when we create a class we write "object" in parenth... |
72,892,730 | Sum over the rows using SQL but we need to stop and start the sum at specific condition<p>Here is an example of the data I have and the output I want in <strong>SQL</strong>.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>date</th>
<th>flag</th>
</tr>
</thead>
<tbody>
<tr>
<td>... | <p>This is a gaps and islands problem. One approach uses the difference in row numbers method:</p>
<pre class="lang-sql prettyprint-override"><code>WITH cte AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY id ORDER BY date) rn1,
ROW_NUMBER() OVER (PARTITION BY id, flag ORDER BY date) rn2
FROM yourT... | Sum over the rows using SQL but we need to stop and start the sum at specific condition | sql|postgresql|gaps-and-islands | 1 | 58 | 1 | 72,892,853 | 72,892,853 | 5 | true | 2022-07-07T05:34:57.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sum over the rows using SQL but we need to stop and start the sum at specific condition<p>Here is an example of the data I have and the output I want in <str... |
72,937,632 | Count with reduce<p>I have the current code (snippet) but I want to count the total of the answers</p>
<p>Example:</p>
<pre><code>"2022-01-03": {
"yes": 1,
"no": 2,
"total": 3
}
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="tru... | <p>You can add a <code>total</code> field and increment for every value:</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 array = [
{ date: '2022-01-03', answer: 'yes' }... | Count with reduce | javascript|reduce | 1 | 58 | 3 | 72,937,669 | 72,937,669 | 5 | true | 2022-07-11T11:11:54.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Count with reduce<p>I have the current code (snippet) but I want to count the total of the answers</p>
<p>Example:</p>
<pre><code>"2022-01-03": {
... |
72,975,929 | Does the division of two float numbers being-1.0 mean they are equal but oppositely signed?<p>Due to precision, <code>0.1 + 0.2</code> is not equal to <code>0.3</code> in most programming languages. However,</p>
<pre><code>var float a, float b
assert(a != 0 && b != 0)
if a / b == -1.0 {
// a, b are opposite... | <p>First, it is not true that <code>a/b</code> = −1 ⇔ <code>a</code> = −<code>b</code>. As the sample code in the question suggests, this does not hold for <code>a</code> = 0, <code>b</code> = 0, since <code>a/b</code> yields NaN. Another case is <code>a</code> = ±∞, <code>b</code> = ∓∞, for which <code>a/b</code> also... | Does the division of two float numbers being-1.0 mean they are equal but oppositely signed? | floating-point|precision | 0 | 58 | 4 | 72,979,602 | 72,979,602 | 5 | true | 2022-07-14T06:07:35.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does the division of two float numbers being-1.0 mean they are equal but oppositely signed?<p>Due to precision, <code>0.1 + 0.2</code> is not equal to <code>... |
72,981,284 | Why is this code not printing the prime factors of num?<p>I wrote this code for obtaining the prime factors of a number taken as an input from the user.</p>
<pre><code>#include<bits/stdc++.h>
using namespace std;
void prime_Factors(int);
bool isPrime(int);
int main()
{
int num;
cout << "Enter... | <p>The ranges of the loops are wrong.</p>
<p>Firstly, the loop <code>for(int i = 2; i<n1; i++)</code> will fail to find prime factors of prime numbers (the numbers theirself). It should be <code>for(int i = 2; i<=n1; i++)</code>.</p>
<p>Secondly, the loop <code>for(int i = 0; i*i <= n0; i++)</code> will result... | Why is this code not printing the prime factors of num? | c++|math | -1 | 58 | 2 | 72,981,317 | 72,981,317 | 7 | true | 2022-07-14T13:24:39.613Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is this code not printing the prime factors of num?<p>I wrote this code for obtaining the prime factors of a number taken as an input from the user.</p>
... |
72,988,548 | Custom Calendar in JavaScript<p>Does anyone know how to create such a calendar. Or give advice where to dig. I will be glad for any help. (React.js project)</p>
<p><a href="https://i.stack.imgur.com/vUFF7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vUFF7.png" alt="Custom Calendar in JavaScript" /... | <p>I found this solution and Also used I have one time this type of calendar I have shown the following calendar helps you</p>
<p>codepen.io/sebpearce/pen/JpMbLK</p>
<p>I hope this reference helps you and check this</p>
<ul>
<li><a href="https://year-calendar.github.io/js-year-calendar/docs/index.html" rel="nofollow no... | Custom Calendar in JavaScript | javascript|calendar | -2 | 58 | 1 | 72,988,875 | 72,988,875 | -2 | true | 2022-07-15T02:46:44.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Custom Calendar in JavaScript<p>Does anyone know how to create such a calendar. Or give advice where to dig. I will be glad for any help. (React.js project)<... |
72,838,151 | How can I segment the object in the image?<p>Below are the images that I want to segment the object by white and keep the background in black, tried many methods but can't be able to find the solution;</p>
<p>Google Drive: <a href="https://drive.google.com/drive/folders/19mWGtxUZccMKtZkcqRO1rcJs2o5thRMq?usp=sharing" re... | <p>Use the following method;</p>
<pre><code>img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
h,w, c = img.shape
_, thresh = cv2.threshold(img, np.mean(img), 255, cv2.THRESH_BINARY_INV)
edges = cv2.dilate(cv2.Canny(thresh, 0, 255), None)
cnt = sorted(cv2.findContours(edges, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)[-2], key=... | How can I segment the object in the image? | python|opencv|image-processing | 1 | 58 | 1 | 72,840,747 | 72,840,747 | -1 | true | 2022-07-02T09:57:19.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I segment the object in the image?<p>Below are the images that I want to segment the object by white and keep the background in black, tried many met... |
72,903,643 | Filter a string value from a column in Python?<p>Need to extract Diabetes value from column name chronic from a df in python.</p>
<p>Can anyone pls help to retrieve this in python?</p>
<pre class="lang-none prettyprint-override"><code>Patients Chronic
1 Diabetes
2 Diabetes
3 Hypertension
... | <p>If your <code>df</code> is:</p>
<pre class="lang-py prettyprint-override"><code> Patients Chronic
0 1 Diabetes
1 2 Diabetes
2 3 Hypertension
3 4 Hypertension
4 5 Diabetes type 1
</code></pre>
<p>Then:</p>
<pre class="lang-py prettyprint-over... | Filter a string value from a column in Python? | python|regex|pandas | -1 | 58 | 1 | 72,904,463 | 72,904,463 | -1 | true | 2022-07-07T20:06:02.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filter a string value from a column in Python?<p>Need to extract Diabetes value from column name chronic from a df in python.</p>
<p>Can anyone pls help to r... |
72,901,813 | Waiting for a promise to resolve from a loop<p>I have an app that animates a value. Below, if <code>to</code> is set, the amount <code>lerps</code> to it.</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 p... | <p>In order to create a promise for an arbitrary action (rather than a promise for the whole <code>animate</code> loop like Konrad showed) I used something from this answer: <a href="https://stackoverflow.com/a/53373813/630203">https://stackoverflow.com/a/53373813/630203</a> to create a promise I could resolve from any... | Waiting for a promise to resolve from a loop | javascript | 0 | 58 | 2 | 72,937,439 | 72,937,439 | -1 | true | 2022-07-07T17:07:15.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Waiting for a promise to resolve from a loop<p>I have an app that animates a value. Below, if <code>to</code> is set, the amount <code>lerps</code> to it.</p... |
72,773,963 | Python tkinter: Howto set individual colors for Notebook tabs?<p>I would like to have indiviual colors for the tabs in a Python tkinter Notebook. I tried it with this sketch, but it did not work as intended.</p>
<pre><code>from tkinter import *
from tkinter import ttk
mygreen = "#d2ffd2"
myred = "#dd0... | <p>This is not possible with a style. What you are doing with <code>ttk.Style().configure("TNotebook.Tab", background=myred)</code> is globally changing the background color of all notebooks, even the already existing ones. To do what you want, you would need to be able to assign different styles to different... | Python tkinter: Howto set individual colors for Notebook tabs? | python|tkinter | 0 | 59 | 2 | 72,774,960 | 72,774,960 | 0 | true | 2022-06-27T14:41:07.587Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python tkinter: Howto set individual colors for Notebook tabs?<p>I would like to have indiviual colors for the tabs in a Python tkinter Notebook. I tried it ... |
72,792,698 | trying to distribute the numbers to each other in a list<p>I am trying to take a list like this</p>
<pre><code>[ 2, 14, 275, 10000, 1, 45]
</code></pre>
<p>and distribute and subtract from the large values to add to numbers to equal the same thing</p>
<p>for example</p>
<pre><code>[5, 10, 6]
</code></pre>
<p>would equa... | <pre><code>from statistics import mean
def distribute(l):
return [mean(l)]*len(l)
x = [ 2, 14, 275, 10000, 1, 45]
y = [5, 10, 6]
new_x = distribute(x)
new_y = distribute(y)
print(new_x)
print(new_y)
</code></pre>
<p>Output:</p>
<pre><code>[1722.8333333333333, 1722.8333333333333, 1722.8333333333333, 1722.8333333... | trying to distribute the numbers to each other in a list | python | 0 | 59 | 2 | 72,793,334 | 72,793,334 | 0 | true | 2022-06-28T20:20:35.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
trying to distribute the numbers to each other in a list<p>I am trying to take a list like this</p>
<pre><code>[ 2, 14, 275, 10000, 1, 45]
</code></pre>
<p>a... |
72,801,543 | how to sort values in plotly px.violin<p>guys!</p>
<p>i am plotting some distributions across different states using <code>px.violin</code> and i want to order the stated based on distribution: right now you can see that florida with the biggest variance and higher values is in the middle, while i want it on the first ... | <p>You could use groupBy and sort by var like I've done here or define a custum order.</p>
<pre><code>import pandas as pd
df = pd.DataFrame([["jojo", 3], ["marcel", 4], ["jojo", 20], ["jojo", 0.1], ["marcel", 9], ["pierre", 0.9], ["pierre", 0.8], [&... | how to sort values in plotly px.violin | python|plotly|visualization|plotly-python|violin-plot | 0 | 59 | 1 | 72,802,140 | 72,802,140 | 0 | true | 2022-06-29T12:36:06.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to sort values in plotly px.violin<p>guys!</p>
<p>i am plotting some distributions across different states using <code>px.violin</code> and i want to ord... |
72,800,710 | Want to capture all frames when a face is present in frame<p>I am trying to build a dataset of face images, I have searched and find a code that is working fine with my laptop's webcam but when I am trying to capture with IP Camera which is usually used for surveillance than code is not working.</p>
<pre><code>import c... | <p>The issue has been resolved after adjusting the resolution, I have added the line of code for frame adjustment <code>frame = cv2.resize(frame, (1360, 768))</code> than code has started working properly.</p>
<p>This code might be helpful for anyone.</p>
<pre><code>import cv2
import numpy as np
face_cascade = cv2.Cas... | Want to capture all frames when a face is present in frame | python|opencv|computer-vision|camera|video-streaming | 0 | 59 | 3 | 72,804,832 | 72,804,832 | 0 | true | 2022-06-29T11:33:44.423Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Want to capture all frames when a face is present in frame<p>I am trying to build a dataset of face images, I have searched and find a code that is working f... |
72,805,683 | Error: Could not find the correct Provider<Networkprovider> above this Widget<p>I am new to flutter and was trying out the implementation of Network Connectivity with the Flutter Provider. I got across this error and have tried every bit of code on the Internet from changing the context and changing the place where the... | <p>Declare <code>ChangeNotifierProvider</code> like this</p>
<pre><code>MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => Networkprovider()),
],
child: <your widget>,
)
</code></pre>
<p>then access like this</p>
<pre><code>final provider = Provider.of<Networkprovider>(context);
... | Error: Could not find the correct Provider<Networkprovider> above this Widget | flutter|dart | 1 | 59 | 1 | 72,805,989 | 72,805,989 | 0 | true | 2022-06-29T17:38:16.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error: Could not find the correct Provider<Networkprovider> above this Widget<p>I am new to flutter and was trying out the implementation of Network Connecti... |
72,806,024 | Recursive function returns only one value correctly<p>So I am working on a JavaScript project for school. It uses a recursive function to create a tree of all the nodes within an article element on a web-page. The actual article element uses the makeBranches function to calculate how many of each type of node exists. I... | <pre class="lang-html prettyprint-override"><code><td><code><em>node</em>.nextSibling</code</td>
</code></pre>
<p>code tag here forget to close</p> | Recursive function returns only one value correctly | javascript|recursion|tree | 1 | 59 | 1 | 72,810,720 | 72,810,720 | 0 | true | 2022-06-29T18:09:40.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Recursive function returns only one value correctly<p>So I am working on a JavaScript project for school. It uses a recursive function to create a tree of al... |
72,812,010 | Why I get only the last entrie of array with foreach loop<p>I want to save Databaseentrise with the key "weekday, date" in an array with an array.
(Idea is that I could save xx guests on weekday xxx in an array. And to output a lists of guests on weekday xxx or in a Lists of Days Mo-Sun.)</p>
<p>After that I ... | <p>you should use this in your loop</p>
<pre><code>while ($row = $result->fetch_object())
{
$calendar['2022-06-30'][] = array ($row->firstname . " " . $row->lastname);
}
</code></pre> | Why I get only the last entrie of array with foreach loop | php|arrays|multidimensional-array|mysqli | -2 | 59 | 1 | 72,812,242 | 72,812,242 | 0 | true | 2022-06-30T07:42:50.333Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why I get only the last entrie of array with foreach loop<p>I want to save Databaseentrise with the key "weekday, date" in an array with an array.
... |
72,821,548 | Dividing a dataframe row wise using a vector with condition in r<p>I have a data frame and a vector with which I want to divide each row of the data frame.</p>
<pre><code>col1 <- c(500, 20000, 50000)
col2 <- c(20000, 500, 50000)
col3 <- c(20000, 50000, 500)
dividing_factor <- c(1.5, 2, 0.5)
df <- data.fr... | <p>No need to use <code>apply</code>, we can use vectorized/matrix operations:</p>
<pre class="lang-r prettyprint-override"><code>df / t(ifelse(df > 500, dividing_factor, 1))
# col1 col2 col3
# 1 500.00 10000 4e+04
# 2 13333.33 500 1e+05
# 3 33333.33 25000 5e+02
</code></pre> | Dividing a dataframe row wise using a vector with condition in r | r | 1 | 59 | 3 | 72,821,636 | 72,821,636 | 0 | true | 2022-06-30T20:17:16.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dividing a dataframe row wise using a vector with condition in r<p>I have a data frame and a vector with which I want to divide each row of the data frame.</... |
72,797,947 | How to sort dynamically in mongodb<p>I have a "sort" query parameter. This maybe looking like this:</p>
<pre><code>?sort=-name,+number
</code></pre>
<p>Now I want to read this and build a sort query for the c# MongoDB-Driver.<br />
I thought of something like this:</p>
<pre><code>var sortByList = parameters.S... | <p>You can solve it like this:</p>
<pre><code>var bldr = Builders<BsonDocument>.Sort;
var sortDefinitions = sortByList.Select(x =>
{
SortDefinition<BsonDocument> sortDef;
var propName = x.Substring(1);
if (x.StartsWith("-"))
sortDef = bldr.Descending(propName);
else
... | How to sort dynamically in mongodb | c#|mongodb|mongodb-.net-driver | 1 | 59 | 1 | 72,825,129 | 72,825,129 | 0 | true | 2022-06-29T08:11:04.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to sort dynamically in mongodb<p>I have a "sort" query parameter. This maybe looking like this:</p>
<pre><code>?sort=-name,+number
</code></pre... |
72,826,550 | How to put docx in JSZIP<p>I have no way to insert docx/rtf into a zip folder. I am using React TypeScript JSZip docx.</p>
<p>It seems to me that the problem is that I can't convert the File type to Blob type.</p>
<p>I'm making a word file using docx, I'm returning a document of the File type, and I can't put it in the... | <p>You should use the 3rd option with Packer.toBlob and call zip.generateAsync only ONCE right after promise Packer.toBlob will be resolved.
Mime-type of zip archive should be application/zip (it's default value, you can just not pass this parameter)</p>
<pre><code>Packer.toBlob(doc).then(blob => {
word?.file(
... | How to put docx in JSZIP | javascript|reactjs|typescript|blob|docx | 0 | 59 | 1 | 72,826,692 | 72,826,692 | 0 | true | 2022-07-01T08:36:25.057Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to put docx in JSZIP<p>I have no way to insert docx/rtf into a zip folder. I am using React TypeScript JSZip docx.</p>
<p>It seems to me that the problem... |
72,828,435 | How to replace value in a column of dataframe python?<p>How can i find value "100 e pìu" in age column and replace it by 100 ?<a href="https://i.stack.imgur.com/NTBSL.png" rel="nofollow noreferrer">This is a few rows of dataset</a></p> | <p>You can redefine column Age with new one, where values are replaced already:</p>
<pre><code>df.Age = df.Age.replace('100 e più', 100)
</code></pre> | How to replace value in a column of dataframe python? | python|pandas|dataframe | 0 | 59 | 1 | 72,829,149 | 72,829,149 | 0 | true | 2022-07-01T11:16:04.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to replace value in a column of dataframe python?<p>How can i find value "100 e pìu" in age column and replace it by 100 ?<a href="https://i.st... |
72,831,772 | Error: wrap your Route components in a Routes component (change between versions 5 and 6 of react-router-dom)<p>I'm doing a course where version 5 of <code>react-router-dom</code> is used where there have been some pretty significant changes to <code>react-router-dom</code>.</p>
<p>When, launch the application, a white... | <p>You are importing the <code>BrowserRouter</code> as <code>Routes</code>, and then importing the low-level <code>Router</code>. You are still missing the real <code>Routes</code> component wrapping the routes.</p>
<p>Fix the imports and then fix the route API/syntax.</p>
<p>Example:</p>
<pre><code>import {
BrowserR... | Error: wrap your Route components in a Routes component (change between versions 5 and 6 of react-router-dom) | javascript|node.js|reactjs|react-router | 2 | 59 | 2 | 72,831,916 | 72,831,916 | 0 | true | 2022-07-01T15:50:20.923Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error: wrap your Route components in a Routes component (change between versions 5 and 6 of react-router-dom)<p>I'm doing a course where version 5 of <code>r... |
72,840,902 | Why strategy.openprofit only shows for the previous candle?<p>I'm using version 5 and trying to display a label that shows the current live unrealized loss/profit. I made it so that previous labels of the same get deleted and only the last one remains printed. The problem is that instead of showing the current live can... | <p>By default strategies are calculated on bars' closes. If you really want real-time data, you should set <code>calc_on_every_tick</code> property of your <code>strategy()</code> to <code>true</code>.</p>
<p><strong>Note:</strong> Instead of creating and deleting labels all the time, you can have one label for each an... | Why strategy.openprofit only shows for the previous candle? | pine-script|pinescript-v5 | 0 | 59 | 1 | 72,841,341 | 72,841,341 | 0 | true | 2022-07-02T17:00:04.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why strategy.openprofit only shows for the previous candle?<p>I'm using version 5 and trying to display a label that shows the current live unrealized loss/p... |
72,845,060 | ValueError: x, y, and format string must not be None<p>I wanted to re-plot a graph with exponential moving averages, so I defined smooth curve below.</p>
<pre><code>def smooth_curve(points, factor=0.8):
smoothed_points = []
for point in points:
if smoothed_points:
previous = smoothed_points[-1]
s... | <p>You need to return <code>smoothed_points</code> variable after the function execution. If you just use <code>return</code>, the function will return a <code>None</code> null value causing issues with the rest of the code:</p>
<pre><code>def smooth_curve(points, factor=0.8):
smoothed_points = []
for point in poin... | ValueError: x, y, and format string must not be None | python|matplotlib|keras | 0 | 59 | 1 | 72,845,072 | 72,845,072 | 0 | true | 2022-07-03T08:42:02.960Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ValueError: x, y, and format string must not be None<p>I wanted to re-plot a graph with exponential moving averages, so I defined smooth curve below.</p>
<pr... |
72,845,126 | Uncheck all treeview checkboxes<p>I have a <code>v-treeview</code> component (Vuetify 2.6.7)</p>
<pre><code><v-treeview
class="location-tree"
v-model="location_tree"
ref="location_tree"
:search="location_search"
selec... | <p>you just need to empty the array you passed to <code>v-model</code> on a button click like <code>location_tree.splice(0)</code> or <code>location_tree = []</code>.</p>
<p>check the example below:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-... | Uncheck all treeview checkboxes | vue.js|treeview|vuetify.js | 0 | 59 | 1 | 72,845,188 | 72,845,188 | 0 | true | 2022-07-03T08:49:38.023Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Uncheck all treeview checkboxes<p>I have a <code>v-treeview</code> component (Vuetify 2.6.7)</p>
<pre><code><v-treeview
class="location-t... |
72,845,354 | Text is too close to the edge of col or box<p>Does any of you know how to add padding to the text? Here is the image.
<a href="https://i.stack.imgur.com/Zd78K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zd78K.png" alt="enter image description here" /></a></p>
<p><div class="snippet" data-lang="j... | <p>This is easily fixable with the padding property being applied to the div that contains the text elements, but one side effect that you may not like is that the box can get bigger in order to apply the space around the inner text elements
this too can be easily fixed by telling your css file that:
box-sizing: border... | Text is too close to the edge of col or box | html|css|twitter-bootstrap|padding | 0 | 59 | 5 | 72,845,411 | 72,845,411 | 0 | true | 2022-07-03T09:23:48.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Text is too close to the edge of col or box<p>Does any of you know how to add padding to the text? Here is the image.
<a href="https://i.stack.imgur.com/Zd7... |
72,846,038 | How export logs from AWS Lambda to S3 bucket without CloudWatch?<p>How I can send or export logs from my AWS Lambda function to S3 without using by CloudWatch?</p>
<p>Is there another option?</p> | <p>This AWS Sample shows you have to use a <a href="https://github.com/aws-samples/aws-lambda-extensions/tree/main/s3-logs-extension-demo-zip-archive" rel="nofollow noreferrer">Lambda extension to send logs to S3</a>. But there is currently no way to stop logs from going to CloudWatch.</p> | How export logs from AWS Lambda to S3 bucket without CloudWatch? | amazon-web-services|amazon-s3|aws-lambda | 0 | 59 | 1 | 72,847,875 | 72,847,875 | 0 | true | 2022-07-03T11:18:53.023Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How export logs from AWS Lambda to S3 bucket without CloudWatch?<p>How I can send or export logs from my AWS Lambda function to S3 without using by CloudWatc... |
72,847,956 | Archunit test to not allow to log the return value of method with specific annotation using Log4j logging methods<p>Suppose I have below Person class with one <strong>getAccountNumber()</strong> method having <strong>@ShouldNotBeLogged</strong> custom annotation.</p>
<pre><code>public class Person {
private String nam... | <p>ArchUnit (as of the current version 0.23.1) does not analyze parameter <em>values</em> of a method call – but maybe it's good enough to find calls to a logger and to a <code>@ShouldNotBeLogged</code> annotated method in the same line?</p>
<ul>
<li><p>False positives (unrelated calls in the same line) like</p>
<pre c... | Archunit test to not allow to log the return value of method with specific annotation using Log4j logging methods | java|archunit | 1 | 59 | 1 | 72,849,182 | 72,849,182 | 0 | true | 2022-07-03T15:54:58.357Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Archunit test to not allow to log the return value of method with specific annotation using Log4j logging methods<p>Suppose I have below Person class with on... |
72,825,218 | How can i auto open a ng-dropdown-multiselect in Angularjs?<p>I have the following definition for a ng-dropdown-multiselect:</p>
<pre><code> <div id="selectedColumns"
ng-dropdown-multiselect="false"
extra-settings="ddextraSetti... | <p>If without changing the library, and provided without use of JQuery, then this should do it (using <code>Javascript</code>)</p>
<pre class="lang-js prettyprint-override"><code>setTimeout(function(){document.querySelectorAll("#selectedColumns button")[0].click();});
</code></pre> | How can i auto open a ng-dropdown-multiselect in Angularjs? | angularjs | 1 | 59 | 1 | 72,852,341 | 72,852,341 | 0 | true | 2022-07-01T06:33:50.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can i auto open a ng-dropdown-multiselect in Angularjs?<p>I have the following definition for a ng-dropdown-multiselect:</p>
<pre><code> &... |
72,853,544 | How can I show the interval in the output<p>I want to see my interval in the output and the couples that are in the interval.
For example</p>
<pre><code>
and then in the output:
interval a = 1,1,1,1,2,3,5,2,5
couples in interval a = 4
the couples are = 1,1,1,1 // 2,2 // 3 // 5,5```
The code:
[![The code][1]][1]
... | <p>this code will code will formate the output as follow</p>
<ul>
<li><p>couples in intervals 3</p>
</li>
<li><p>couples are : {1=3, 2=3, 3=2}</p>
<pre><code> public static void main(String[] args) {
int[] f = { 1, 1, 1, 2, 3, 2, 3, 2 };
TreeMap<Integer, Integer> pairs = countPair(f);
System.ou... | How can I show the interval in the output | java | -2 | 59 | 1 | 72,854,304 | 72,854,304 | 0 | true | 2022-07-04T08:08:19.503Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I show the interval in the output<p>I want to see my interval in the output and the couples that are in the interval.
For example</p>
<pre><code>
and... |
72,854,653 | Counting ways to climb up the stairs<p>"You are climbing a staircase. It takes n steps to reach the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?"</p>
<p>I saw this question on leetcode and I was trying to work it out using recursive way. I am not sure i... | <p>This is far from optimal solution - the complexity will be O(2^n). To achieve an optimal programatic solution you should use DP / memoization:</p>
<pre class="lang-py prettyprint-override"><code>def climb_stairs_updated(n):
climb_stairs_updated.counter += 1
if n <= 2:
memoization[n] = n
re... | Counting ways to climb up the stairs | python|recursion | 1 | 59 | 3 | 72,855,334 | 72,855,334 | 0 | true | 2022-07-04T09:38:52.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Counting ways to climb up the stairs<p>"You are climbing a staircase. It takes n steps to reach the top.
Each time you can either climb 1 or 2 steps. In... |
72,854,248 | Where are anki deck files stored<p>Once I import a file, and I corrupt it (having anki synchronisation turned off) the deck is still fully functional. So where is a copy of the imported file stored? What folder in macos or windows?</p> | <p>As explained in the <a href="https://docs.ankiweb.net/files.html#file-locations" rel="nofollow noreferrer">relevant section of the manual</a>, all Anki's files are stored at the following places:</p>
<ul>
<li>Windows: <code>%APPDATA\Anki2</code></li>
<li>MacOS: <code>~/Library/ApplicationSupport/Anki2</code></li>
</... | Where are anki deck files stored | file|directory|anki | 0 | 59 | 1 | 72,857,050 | 72,857,050 | 0 | true | 2022-07-04T09:06:15.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Where are anki deck files stored<p>Once I import a file, and I corrupt it (having anki synchronisation turned off) the deck is still fully functional. So whe... |
72,855,532 | Rename a tab with todays date "MM/DD/YYYY" and then another one with "MM/DD/YYYY-1"<p>i got a script that create a new tab and changes the name to today's date. But if a run the script again, shows up an error bc the tabs name already exist. Anyway I can rename the first with today date and the rest with a "- 1&qu... | <p>You can use a recursive <code>try...catch</code> loop to <code>setName()</code>.</p>
<p>Replace</p>
<pre><code>sheets[1].setName(date);
</code></pre>
<p>with</p>
<pre><code>const tcloop = ((i) => (func) => {
try {
func(i);
} catch (e) {
++i;
tcloop(func);
}
})(0);
tcloop((i)=>sheets[1].set... | Rename a tab with todays date "MM/DD/YYYY" and then another one with "MM/DD/YYYY-1" | google-apps-script|google-sheets | 0 | 59 | 2 | 72,861,796 | 72,861,796 | 0 | true | 2022-07-04T10:48:00.720Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rename a tab with todays date "MM/DD/YYYY" and then another one with "MM/DD/YYYY-1"<p>i got a script that create a new tab and changes the name to today's da... |
72,859,399 | Django auto save the current user in the model on save<p>I am trying to save the user automatically when saving new data. I mean I want to save the user id for the user who is posting a new thing (submitting a form) without asking that user to choose his account from the droplist (the droplist from the User ForeignKey)... | <p><code>ListCreateAPIView</code> don't have method <code>form_valid</code>, look at <a href="https://www.cdrf.co/3.1/rest_framework.generics/ListCreateAPIView.html" rel="nofollow noreferrer">this</a></p>
<p>In your <code>class FeedbackListView</code> you need to do something like this:</p>
<pre><code>class FeedbackLis... | Django auto save the current user in the model on save | python|django|django-models | -1 | 59 | 1 | 72,861,810 | 72,861,810 | 0 | true | 2022-07-04T15:58:38.187Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django auto save the current user in the model on save<p>I am trying to save the user automatically when saving new data. I mean I want to save the user id f... |
72,856,387 | Initializing fanout for mint multiple times<p>We're building a frontend for <a href="https://hydra-docs.glasseaters.xyz" rel="nofollow noreferrer">Hydra Wallet</a> to help with wallet creation and management. One issue we ran into is understanding the edge cases of membership models other than the Wallet membership mod... | <p>I think - I am not 100% sure though - that you should be able to use it with all three mints that you initialised.</p>
<p>The initialisation creates the necessary accounts for it to work. When distributing you will obviously have to run the call for each token.</p>
<p>To be save you should test this in devnet though... | Initializing fanout for mint multiple times | solana|metaplex | 0 | 59 | 1 | 72,864,487 | 72,864,487 | 0 | true | 2022-07-04T12:01:33.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Initializing fanout for mint multiple times<p>We're building a frontend for <a href="https://hydra-docs.glasseaters.xyz" rel="nofollow noreferrer">Hydra Wall... |
72,867,516 | Bootstrap Progress Bar with Apps Script Variable<p>I have this Google Sheet cell counter in Apps Script and I don't know how to set the bootstrap progress bar with the "percentage" variable.</p>
<p><strong>GS</strong></p>
<pre><code>function cellCounter() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
... | <h2>Use <a href="https://developers.google.com/apps-script/guides/html/templates#force-printing_scriptlets" rel="nofollow noreferrer">Force-printing scriptlets</a></h2>
<ul>
<li>This allows you to pass Apps Script variables into your html syntax with <code><?!= ... ?></code></li>
<li>For this, the variable to be ... | Bootstrap Progress Bar with Apps Script Variable | javascript|google-apps-script|google-sheets|bootstrap-4 | 0 | 59 | 1 | 72,867,910 | 72,867,910 | 0 | true | 2022-07-05T10:02:16.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bootstrap Progress Bar with Apps Script Variable<p>I have this Google Sheet cell counter in Apps Script and I don't know how to set the bootstrap progress ba... |
72,867,923 | deleting from the database does not work with apis in laravel<p>The process of deleting from the database does not work with apis in laravel
I created a function that deletes from database but my code doesn't work</p>
<pre><code> public function deletePatient($id)
{
$patient =Patient::find($id);
... | <p>You appear to be complicating things a bit, try the following:</p>
<pre><code>public function deletePatient(Patient $id)
{
if (!$patient->delete()) {
return response()->json(['message' => 'Failed to delete patient'], 404);
}
return response()->json(['message' => 'Patient deleted']... | deleting from the database does not work with apis in laravel | laravel|api|laravel-9 | 0 | 59 | 3 | 72,868,127 | 72,868,127 | 0 | true | 2022-07-05T10:31:28.867Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
deleting from the database does not work with apis in laravel<p>The process of deleting from the database does not work with apis in laravel
I created a func... |
72,864,045 | Getting only the values base on a list<p>My code below gives me a result with a unique customer codes base on Calculation sheet. However, I want to get my result base on the list that I have in Solution Sheet. Also want to run the macro within Solution Sheet. Any help will be appreciated.</p>
<p>Calculation Sheet</p>
<... | <h2>Using Data Structures (Array, Collection, Dictionary)</h2>
<pre class="lang-vb prettyprint-override"><code>Option Explicit
Sub CalculateData()
' Define constants.
' Source
Const sName As String = "Calculation"
Const scCol As Long = 2
Dim sCols() As Variant: sCols = VBA.Array... | Getting only the values base on a list | excel|vba | 1 | 59 | 1 | 72,868,713 | 72,868,713 | 0 | true | 2022-07-05T04:33:18.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting only the values base on a list<p>My code below gives me a result with a unique customer codes base on Calculation sheet. However, I want to get my re... |
72,869,596 | Flutter Sqflite does not call onUpgrade on first time install in debug mode<p>Ok, I understand that Sqflite onUpgrade is only fire if there is older version. But what will happen if user newly installed and only call onCreate. Because all the db changes are in onUpgrade function.</p>
<p>For example, I have installed th... | <p>You are not supposed to fire <code>onUpgrade</code> when you install a brand new app.</p>
<p><code>onUpgrade</code> handles if the user has an existing older version of the database.</p>
<p><code>onCreate</code> handles if the user does not have any older version of the database.</p>
<p>Therefor you have to update y... | Flutter Sqflite does not call onUpgrade on first time install in debug mode | flutter|sqflite | 0 | 59 | 1 | 72,870,301 | 72,870,301 | 0 | true | 2022-07-05T12:39:44.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter Sqflite does not call onUpgrade on first time install in debug mode<p>Ok, I understand that Sqflite onUpgrade is only fire if there is older version.... |
72,872,040 | Apache Perl 500 “Internal Server Error” - malformed header from script. Bad header=<!DOCTYPE html><p>I'm getting an Apache "500 Internal Server Error" even after installing Perl. Running the file from the terminal works fine (<code>perl hello.pl</code>).</p>
<p>Perl Mod setup with Apache everything is configu... | <p>I checked the apache_error.log and saw</p>
<pre><code>malformed header from script. Bad header=<!DOCTYPE html>
</code></pre>
<p>You need to add a <code>Content-type</code> Header to the file.</p>
<p><strong>Fix</strong></p>
<pre><code>#!/usr/bin/perl
print "Content-type: text/html\n\n";
print("H... | Apache Perl 500 “Internal Server Error” - malformed header from script. Bad header=<!DOCTYPE html> | perl|cgi-bin | -1 | 59 | 1 | 72,872,041 | 72,872,041 | 0 | true | 2022-07-05T15:32:50.217Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Apache Perl 500 “Internal Server Error” - malformed header from script. Bad header=<!DOCTYPE html><p>I'm getting an Apache "500 Internal Server Error&qu... |
72,875,526 | Netsuite client script https post request unexpected error<p>I have a User Event and Client Script for my Netsuite system. I added a button on a transaction page. This code works on the User Event beforeLoad function, but for my client script button press function I get an error: Unexpected error and am not sure why it... | <p>Netsuite doesn't expect an array as headers. Your basic code looks correct so try:</p>
<pre class="lang-js prettyprint-override"><code> var requestData = {"externUserId":"Tom","externAppName":"Netsuite","externAppScreenTitle":"Bill","Setting":&... | Netsuite client script https post request unexpected error | https|netsuite|clientscript | 0 | 59 | 1 | 72,875,855 | 72,875,855 | 0 | true | 2022-07-05T21:05:21.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Netsuite client script https post request unexpected error<p>I have a User Event and Client Script for my Netsuite system. I added a button on a transaction ... |
72,870,947 | How to create an object that can build many other objects all of which have a mutable reference back to the builder object?<p>I have a bit of a difficulty formulating my question concisely enough for a title. <a href="https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=e6882c41c536bd6820... | <p>This can be achieved in two ways. Using smart-pointers or introducing internal mutability to the <code>ThingMaker</code>.</p>
<h2>Smart-pointers</h2>
<p>Using this approach we wrap our reference to <code>ThingMaker</code> in <code>Rc<RefCell></code> so that we can have multiple mutable references to one object... | How to create an object that can build many other objects all of which have a mutable reference back to the builder object? | rust | 1 | 59 | 1 | 72,877,197 | 72,877,197 | 0 | true | 2022-07-05T14:15:55.523Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create an object that can build many other objects all of which have a mutable reference back to the builder object?<p>I have a bit of a difficulty fo... |
72,881,155 | How can I create custom pipe for my angular app using ngx-translate and i8n in angular 12<p>I'm doing internationalization in my angular project it's like admin portal using @ngx-translate but I'm failing. I want to redo the whole internationalization task any suggestions how to do it</p>
<p><strong>auth.component.html... | <p>The error you are getting is because angular doesn't recognize the pipe. There could be many reasons why that is the case, firstly you don't need the <code>TranslatePipe</code> in your <code>declarations</code>, also make sure you load the <code>TranslateModule</code> (in your <code>imports</code>) in the correct mo... | How can I create custom pipe for my angular app using ngx-translate and i8n in angular 12 | angular|translate|angular12|ngx-translate | 0 | 59 | 2 | 72,882,388 | 72,882,388 | 0 | true | 2022-07-06T09:36:24.357Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I create custom pipe for my angular app using ngx-translate and i8n in angular 12<p>I'm doing internationalization in my angular project it's like ad... |
72,841,427 | PROXY protocol - test client /tool<p><a href="https://www.haproxy.org/download/2.6/doc/proxy-protocol.txt" rel="nofollow noreferrer">Proxy Protocol</a> is implemented by <a href="https://www.haproxy.com/blog/use-the-proxy-protocol-to-preserve-a-clients-ip-address/" rel="nofollow noreferrer">various software</a> includi... | <p>As I couldn't find something, here's <a href="https://github.com/tuck1s/happie" rel="nofollow noreferrer">a start</a>. Will add documentation etc. shortly.</p> | PROXY protocol - test client /tool | haproxy|netcat|socat | 0 | 59 | 1 | 72,887,655 | 72,887,655 | 0 | true | 2022-07-02T18:15:23.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PROXY protocol - test client /tool<p><a href="https://www.haproxy.org/download/2.6/doc/proxy-protocol.txt" rel="nofollow noreferrer">Proxy Protocol</a> is im... |
72,881,078 | How to connect Slider with Database?<p>My model represents an assembly line with 27 cycles and a defined cycletime. The product which has to get assembled is transported trough the assembly line by AGVs. On each AGV is one product.
Because the cycle areas have different lengths the AGV speed [m/sec] differs from cycle ... | <p>Use the database query wizard to query the table for your slider's value, something like this in the slider action code:</p>
<pre><code>v_agvSpeed = (int) selectFrom(cyclespeedavg)
.where(cyclespeedavg.cycletime.eq((double)slider.getValue()))
.firstResult(cyclespeedavg.cycle1)
</code></pre> | How to connect Slider with Database? | simulation|anylogic | 0 | 59 | 1 | 72,888,129 | 72,888,129 | 0 | true | 2022-07-06T09:31:45.343Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to connect Slider with Database?<p>My model represents an assembly line with 27 cycles and a defined cycletime. The product which has to get assembled is... |
72,833,228 | Open Web Components Testing / Lit - component not being rendered?<p>I'm trying to test my Lit components with @open-wc/testing. Lit has an example repo here, with this test:</p>
<p><a href="https://github.com/lit/lit-element-starter-ts/blob/main/src/test/my-element_test.ts#L44" rel="nofollow noreferrer">https://github.... | <p>This is likely due to TypeScript removing the <code>CodingEditor</code> import that's only used as a type so the side effect of defining the custom element is not happening.</p>
<p>You can either set the TS compiler option <code>importsNotUsedAsValues</code> to <code>preserve</code> (See <a href="https://www.typescr... | Open Web Components Testing / Lit - component not being rendered? | lit | 0 | 59 | 1 | 72,891,267 | 72,891,267 | 0 | true | 2022-07-01T18:17:02.560Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Open Web Components Testing / Lit - component not being rendered?<p>I'm trying to test my Lit components with @open-wc/testing. Lit has an example repo here,... |
72,900,057 | CSS :not(:first-of-type) isn't working on div but works on other elements<p>I am creating an accordion in which the first element is open. Crediting the code <a href="https://codepen.io/yukinouz1/pen/Mdxqqx" rel="nofollow noreferrer">here</a>.</p>
<p>The main modification to this code is that I wanted to put some subte... | <p>First of type targets the first div(in your case) in the parent, not based on the class you provided so it would not work as you would expect</p>
<p>You can use this instead</p>
<p><code>$( ".accordion-content:not( :first )" ).css( "display", "none" );</code></p>
<p>or you could just se... | CSS :not(:first-of-type) isn't working on div but works on other elements | javascript|html|jquery|css | -1 | 59 | 2 | 72,900,314 | 72,900,314 | 0 | true | 2022-07-07T14:56:41.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CSS :not(:first-of-type) isn't working on div but works on other elements<p>I am creating an accordion in which the first element is open. Crediting the code... |
72,891,640 | How can I retrieve an Excel IRibbonUI instance in Python using win32com?<p>I'm trying to invalidate specific controls on an Excel add-in ribbon using Python's <code>win32com</code> package in order to have their callbacks re-fire.</p>
<p>Reading over Microsoft's <a href="https://docs.microsoft.com/en-us/office/vba/api/... | <p>Sigh, looks like the global variable option is <a href="https://support.pyxll.com/hc/en-gb/articles/360042867554-How-can-I-update-ribbon-controls-" rel="nofollow noreferrer">the recommended route</a></p>
<h1>Excerpt</h1>
<blockquote>
<p>...<br />
For example, in your ribbon XML you would add the onLoad action to the... | How can I retrieve an Excel IRibbonUI instance in Python using win32com? | python|python-3.x|excel|win32com|pyxll | 1 | 59 | 1 | 72,901,580 | 72,901,580 | 0 | true | 2022-07-07T02:23:00.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I retrieve an Excel IRibbonUI instance in Python using win32com?<p>I'm trying to invalidate specific controls on an Excel add-in ribbon using Python'... |
72,906,028 | How to read the contents in textframe from InDesign document using C#?<p>I need to create an API function in a web server to import any InDesign document and read content from all textboxes. If I use C# to call Adobe InDesign via COM, can I install the InDesign application to the web server instead of the InDesign serv... | <p>Adobe makes it super clear that you cannot use InDesign desktop app in a server application,</p>
<p><a href="https://www.adobe.com/products/indesignserver/faq.html" rel="nofollow noreferrer">https://www.adobe.com/products/indesignserver/faq.html</a></p>
<blockquote>
<p><strong>Will I violate the terms of the End-Use... | How to read the contents in textframe from InDesign document using C#? | c#|api|iis|adobe-indesign|indesign-server | 0 | 59 | 1 | 72,906,370 | 72,906,370 | 0 | true | 2022-07-08T02:20:04.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to read the contents in textframe from InDesign document using C#?<p>I need to create an API function in a web server to import any InDesign document and... |
72,879,834 | Unity- vs code error: if ($?) { dotnet run $Player_Movement } (Solved)<p>Hi I am getting "cd "c:\Users\UMUT\Desktop\Unity Projects\Newest\Assets" ; if
($?) { dotnet run $Player_Movement }" message and I get this error message "Couldn't find a project to run. Ensure a project exists in C:\Users... | <p>I reseted Vs code settings to default and my problem is fixed.</p> | Unity- vs code error: if ($?) { dotnet run $Player_Movement } (Solved) | c#|visual-studio|unity3d|error-handling|unity-container | 0 | 59 | 1 | 72,907,717 | 72,907,717 | 0 | true | 2022-07-06T08:00:19.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unity- vs code error: if ($?) { dotnet run $Player_Movement } (Solved)<p>Hi I am getting "cd "c:\Users\UMUT\Desktop\Unity Projects\Newest\Assets&qu... |
72,914,729 | Stripe - Is it possible to retrieving promotion code from payment_intent.succeeded?<p>So I'm trying to implement promotion codes in my Stripe Checkout. I got everything working just fine, the only thing I'm missing is the ability to see which promotion-code was used in the payment_intent.succeeded object.</p>
<p>I can'... | <p>The Checkout Session object has a <code>total_details.breakdown.discounts.discount</code> field that contains the ID of the coupon or promotion code that was used in the Checkout Session: <a href="https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-total_details-breakdown-discounts-discount"... | Stripe - Is it possible to retrieving promotion code from payment_intent.succeeded? | node.js|stripe-payments|coupon|promotion-code|stripe-payment-intent | 1 | 59 | 1 | 72,917,962 | 72,917,962 | 0 | true | 2022-07-08T17:04:02.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Stripe - Is it possible to retrieving promotion code from payment_intent.succeeded?<p>So I'm trying to implement promotion codes in my Stripe Checkout. I got... |
72,915,349 | Unexpected output when running tqdm inside multiprocessing.Process<p>I am trying to show a separate progress bar for each thread in my program, although I'm also okay with a progress bar that shows the total progress overall. Here is the code:</p>
<pre class="lang-py prettyprint-override"><code>def cluster(indexes, pro... | <p>You can manage your <code>tqdm</code> bars manually and use <code>multiprocessing.Queue</code> to signal that bar should update.</p>
<p>This example will create 4 processes that do the work and one process that updates the bars through the Queue:</p>
<pre class="lang-py prettyprint-override"><code>import random
from... | Unexpected output when running tqdm inside multiprocessing.Process | python|multiprocessing|tqdm | 1 | 59 | 1 | 72,918,173 | 72,918,173 | 0 | true | 2022-07-08T18:05:08.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unexpected output when running tqdm inside multiprocessing.Process<p>I am trying to show a separate progress bar for each thread in my program, although I'm ... |
72,890,727 | How to create a SQL autoincrement ID only when conditional requirements are met<p>I am trying to create a new ID for a dataset which will identify and group people together when certain conditions are met, for example a shared address. I'm trying to add an autoincrement column that creates this ID for those people, so ... | <p>Since addresses are shared, and not people, you should create a new table of addresses and have the auto-increment applied there for each unique address.</p>
<p>The quality of your address sources will play heavily into this - if you are using an address lookup service to improve your data quality, then you're heade... | How to create a SQL autoincrement ID only when conditional requirements are met | sql|snowflake-cloud-data-platform|auto-increment | 0 | 59 | 1 | 72,918,748 | 72,918,748 | 0 | true | 2022-07-06T23:08:12.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a SQL autoincrement ID only when conditional requirements are met<p>I am trying to create a new ID for a dataset which will identify and group ... |
72,918,850 | Remove a response when reacting with an ❌<p>I tried doing this and adapting it from discordjs.guide, but I've either adapted something wrongly or it isn't working in my context. I tried this:</p>
<pre><code>botMessage.react('❌');
const filter = (reaction, user) => {
return ['❌'].includes(reaction.emoji.name);
}... | <p>All you have to do is add the <code>GUILD_MESSAGE_REACTIONS</code> intent:</p>
<pre class="lang-js prettyprint-override"><code>const client = new Client({ intents: [Intents.FLAGS.GUILD_MESSAGE_REACTIONS /* other intents */] });
</code></pre> | Remove a response when reacting with an ❌ | node.js|discord.js | 0 | 59 | 1 | 72,920,572 | 72,920,572 | 0 | true | 2022-07-09T04:01:08.123Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove a response when reacting with an ❌<p>I tried doing this and adapting it from discordjs.guide, but I've either adapted something wrongly or it isn't wo... |
72,920,940 | Alignment of text while writing and reading a file<p><a href="https://i.stack.imgur.com/VIwax.png" rel="nofollow noreferrer">the image is of my console outcome that definitely doesn't seem correct as
the total grade holders should be properly printed </a><br />
<a href="https://i.stack.imgur.com/9i218.png" rel="nofollo... | <p>I made lots of changes in your code and fixed its broken logic to some extent. The rest is your responsibility though I did not make it look too advanced cause there is no need for anything fancy in this case.</p>
<p>Here it is:</p>
<pre><code>#include <iostream>
#include <string>
#include <fstream>... | Alignment of text while writing and reading a file | c++|file-handling | 1 | 59 | 2 | 72,921,586 | 72,921,586 | 0 | true | 2022-07-09T11:22:25.697Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Alignment of text while writing and reading a file<p><a href="https://i.stack.imgur.com/VIwax.png" rel="nofollow noreferrer">the image is of my console outco... |
72,921,860 | How can i iterate through a python dict and reach easily the leaves?<p>I am trying to iterate a graph-dict object and reach every time the leave nodes, and i want to do it for different level of depth of the graph (if the leaves are in a deeper level )</p>
<pre><code>{'Node': [0, 0, 0],
'children': [{'Node': [1, 0, 0]... | <p>You can use recursion in this case.
Below is a sample code.</p>
<pre class="lang-py prettyprint-override"><code>graph={'Node': [0, 0, 0],
'children': [{'Node': [1, 0, 0],
'children': [{'Node': [2, 0, 0], 'children': []},
{'Node': [1, 1, 0], 'children': []},
{'Node': [1, 0, 1], 'children': []}]},
{'Node... | How can i iterate through a python dict and reach easily the leaves? | python|dictionary|graph|parallel-processing|parent-child | 0 | 59 | 1 | 72,921,994 | 72,921,994 | 0 | true | 2022-07-09T13:43:58.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can i iterate through a python dict and reach easily the leaves?<p>I am trying to iterate a graph-dict object and reach every time the leave nodes, and i... |
72,897,415 | How to use useForm to validate input while using localStorage<p>I'm trying to validate a simple form with a single input just for practice. I also don't want the value that the user types in the input to disappear after page refresh, for that reason, I did a little bit of searching and found out about saving that data ... | <p>Looking at the <a href="https://react-hook-form.com/api/useform/register" rel="nofollow noreferrer">documentation</a>, you had the syntax a little off with your <code>register</code> function. That function takes a second argument, which is an object of props, and that is where you want to define <code>value</code>... | How to use useForm to validate input while using localStorage | javascript|reactjs | 0 | 59 | 1 | 72,924,582 | 72,924,582 | 0 | true | 2022-07-07T11:56:04.997Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use useForm to validate input while using localStorage<p>I'm trying to validate a simple form with a single input just for practice. I also don't want... |
72,925,190 | Find previous element using Selenium Python<p>I have HTML:</p>
<pre><code><div class="value">
<div style="float: right;">100.00</div>
<span class="yellow">Frequency:</span>
</div>
</code></pre>
<p>With selenium By.XPATH '//*[text()="Frequenc... | <p>To print the text from the <code><div></code> tag i.e. <em><strong>100.00</strong></em> wrt the <code><span></code> you can use either of the following <a href="https://stackoverflow.com/questions/48369043/official-locator-strategies-for-the-webdriver"><em>locator strategies</em></a>:</p>
<ul>
<li><p>Usi... | Find previous element using Selenium Python | python|selenium|selenium-webdriver|web-scraping|xpath | 0 | 59 | 1 | 72,925,218 | 72,925,218 | 0 | true | 2022-07-09T23:11:45.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find previous element using Selenium Python<p>I have HTML:</p>
<pre><code><div class="value">
<div style="float: right;">... |
72,928,617 | I want to create an object of objects input with the results from looping an array<p>I want to construct a JSON object from the result obtained by iterating through the array below.</p>
<p>Here is the array list : Input</p>
<pre><code>var input = [
{
bio: "Test",
id: 2,
image: "http://local... | <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>var input = [
{
bio: "Test",
id: 2,
image: "http://localhost:8000/media/default.jpg",
user: 2
},
{
b... | I want to create an object of objects input with the results from looping an array | javascript|jquery|arrays|json|object | -3 | 59 | 3 | 72,928,702 | 72,928,702 | 0 | true | 2022-07-10T12:54:10.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I want to create an object of objects input with the results from looping an array<p>I want to construct a JSON object from the result obtained by iterating ... |
72,934,484 | How to create a new column using existing column in SQL Redshift<p>I am trying to create a new column in SQL with certain conditions in DBVisualizer by connecting redshift data source.
I used the following command to achieve the results but getting syntax error.
I would be really grateful for any help.</p>
<p><strong>C... | <p>As stated in the error message, the <code>IF()</code> function does not exist in Redshift. Therefore, you should use <a href="https://docs.aws.amazon.com/redshift/latest/dg/r_CASE_function.html" rel="nofollow noreferrer">CASE</a>:</p>
<pre class="lang-sql prettyprint-override"><code>select
existing_col,
case
... | How to create a new column using existing column in SQL Redshift | sql|syntax|logic|amazon-redshift|dbvisualizer | 0 | 59 | 1 | 72,938,621 | 72,938,621 | 0 | true | 2022-07-11T06:27:27.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a new column using existing column in SQL Redshift<p>I am trying to create a new column in SQL with certain conditions in DBVisualizer by conne... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.