question_id
int64
37.6M
73.2M
input_text
stringlengths
88
52.4k
output_text
stringlengths
37
35.6k
title
stringlengths
15
150
tags
stringlengths
1
107
q_score
int64
-19
397
view_count
int64
3
879k
answer_count
int64
1
21
accepted_answer_id
int64
37.6M
73.8M
answer_id
int64
37.6M
73.8M
a_score
int64
-5
1.29k
is_accepted
bool
1 class
creation_date
stringlengths
20
24
input_text_instruct
stringlengths
251
52.6k
72,244,188
Why is my discord bot posting old memes? | Discord.py<p>I'm making a discord meme bot and its working but I have a small problem with it. It keeps sending the same set of old memes for some reason. How do I fix that?</p> <pre><code>def updateMemes(subreddit = &quot;memes&quot;): global name global url subreddit...
<p>Because you're explicitly requesting the top 100 posts of all time, which rarely change.</p> <blockquote> <p>top = subreddit.top(limit=100)</p> </blockquote> <p>As you can see in the <a href="https://praw.readthedocs.io/en/stable/code_overview/models/subreddit.html#praw.models.Subreddit.top" rel="nofollow noreferrer...
Why is my discord bot posting old memes? | Discord.py
python|discord.py
-2
61
1
72,244,615
72,244,615
2
true
2022-05-14T22:09:36.073Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is my discord bot posting old memes? | Discord.py<p>I'm making a discord meme bot and its working but I have a small problem with it. It keeps sending th...
72,247,812
Binary search: Not getting upper & lower bound for very large values<p>I'm trying to solve this cp problem, <a href="https://onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;page=show_problem&amp;problem=1552" rel="nofollow noreferrer">UVA - The Playboy Chimp</a> using Python but for some reason, the a...
<p>This is because you are inserting the first input to <code>set</code>, which changes the order of the numbers in the list. If you are using Python 3.6 or newer <code>dict</code> maintains the insertion order, so you can use <code>dict.fromkeys</code> to maintain the order</p> <pre><code>f_heights = list(dict.fromkey...
Binary search: Not getting upper & lower bound for very large values
python|algorithm|binary-search
2
61
1
72,247,913
72,247,913
2
true
2022-05-15T11:25:28.903Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Binary search: Not getting upper & lower bound for very large values<p>I'm trying to solve this cp problem, <a href="https://onlinejudge.org/index.php?option...
72,246,964
Is it possible to table AUC output using gtsummary package in R?<p>I am using <code>auc</code> function from <code>pROC</code> package in R. Is it possible to use <code>gtsummary</code> package to put the results in table?</p>
<p>There are a few ways to add the AUC. Below is an example adding it with the glance statistics from <code>broom::glance()</code></p> <pre class="lang-r prettyprint-override"><code>library(gtsummary) packageVersion(&quot;gtsummary&quot;) #&gt; [1] '1.6.0' mod &lt;- glm(response ~ age + trt, trial, family = binomial) ...
Is it possible to table AUC output using gtsummary package in R?
r|gtsummary
0
61
2
72,248,030
72,248,030
2
true
2022-05-15T09:13:54.760Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to table AUC output using gtsummary package in R?<p>I am using <code>auc</code> function from <code>pROC</code> package in R. Is it possible t...
72,262,118
How can I implement different functions using the same interface in golang<p>I have defined an <code>interface</code> named <code>session</code>, and I have <code>SessionA</code> and <code>SessionB</code> like this</p> <pre><code>type Session interface { StartSession() } type SessionA struct { jobs string } ty...
<p>Two fixes are needed:</p> <ul> <li>To call an interface method on some variable, declare the variable as the interface type.</li> <li>The pointer receiver implements the method. Assign pointers to the interface variable.</li> </ul> <p>Here's the code:</p> <pre><code>var s Session // Declare variable as Sessio...
How can I implement different functions using the same interface in golang
go
0
61
3
72,262,359
72,262,359
2
true
2022-05-16T15:57:50.970Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I implement different functions using the same interface in golang<p>I have defined an <code>interface</code> named <code>session</code>, and I have ...
72,279,246
I am trying to Stack, Melt, grouby or reshape a Pandas DataFrame<p>I am trying to reshape the dataframe below (imported from a .csv), keeping the Easting, Northing and Node Name value together on the same row, but having everything 'stacked' in 4 columns. So I want data in columns V0e, V0n and Vd on top of data in colu...
<p>You can use the often forgotten <code>pd.lreshape</code> to do this:</p> <p>This function is a generic version of <code>pd.wide_to_long</code> where you pass a dictionary of <code>{new_column name: [*columns to vertically stack]}</code>. Then any unspecified columns in this dictionary are <code>melt</code>ed to fit ...
I am trying to Stack, Melt, grouby or reshape a Pandas DataFrame
python|pandas|dataframe|multi-index|pandas-melt
2
61
3
72,279,556
72,279,556
2
true
2022-05-17T18:47:24.973Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I am trying to Stack, Melt, grouby or reshape a Pandas DataFrame<p>I am trying to reshape the dataframe below (imported from a .csv), keeping the Easting, No...
72,307,461
How to change the color of the text that goes outside the block? JS/CSS<p>In this case, I have the background image and text. My text is white, but when there is a lot of text, some of it will go beyond the background image and it will not be visible. Please tell me how to make text that goes beyond the background imag...
<p>You can try do it like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.back { width: 150px; height: 150px; background-color: lightblue; } .text { position:...
How to change the color of the text that goes outside the block? JS/CSS
javascript|html|css|text|effect
0
61
3
72,307,973
72,307,973
2
true
2022-05-19T15:43:21.970Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change the color of the text that goes outside the block? JS/CSS<p>In this case, I have the background image and text. My text is white, but when ther...
72,284,059
Join two collection in mongodb<p>I'm new in mongodb. Could you please tell me how to perform join operation in this. I've two collection:</p> <p>Collection 1 (&quot;user&quot;)</p> <pre><code>{ _id: &quot;d04d53dc-fb88-433e-a1c5-dd41a68d7655&quot;, userName: &quot;XYZ User&quot;, age: 12 } </code></pre> <p>Collectio...
<p>Here's one way to do it.</p> <pre class="lang-js prettyprint-override"><code>db.square.aggregate([ { &quot;$lookup&quot;: { &quot;from&quot;: &quot;user&quot;, &quot;localField&quot;: &quot;userId&quot;, &quot;foreignField&quot;: &quot;_id&quot;, &quot;as&quot;: &quot;userDoc&quot; ...
Join two collection in mongodb
mongodb-query|aggregation-framework|spring-mongodb|spring-mongo
0
61
2
72,311,080
72,311,080
2
true
2022-05-18T06:19:45.857Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Join two collection in mongodb<p>I'm new in mongodb. Could you please tell me how to perform join operation in this. I've two collection:</p> <p>Collection 1...
72,323,469
In which cases numpy's out parameter is faster?<p>I am not sure if the out parameter is worth the trouble for my project, so I am doing a series of tests.</p> <p>But so far, in every case I've tested, the out parameter seems to make the performance slightly slower if not the same as the simpler implementation and I can...
<p>It will make a bigger impact when your arrays are bigger and the allocation time takes longer. Using the <code>out</code> parameter would allow you to amortize the allocation time by re-using that memory. To take your example:</p> <pre><code>import numpy as np from timeit import timeit N = 4096 weights = np.arange...
In which cases numpy's out parameter is faster?
python|numpy
0
61
2
72,323,724
72,323,724
2
true
2022-05-20T18:36:14.117Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In which cases numpy's out parameter is faster?<p>I am not sure if the out parameter is worth the trouble for my project, so I am doing a series of tests.</p...
72,341,410
Unity 2D OnTriggerEnter Not Working, Tried Everything<p>Ive been trying to find the solution to this for hours. I'm trying to learn but I've been stuck on this single problem. I have red creatures that move around randomly, and I want them to clone themselves when they collide with the green objects. Here is the script...
<p>Maybe you should try this one:</p> <pre class="lang-cs prettyprint-override"><code>public void OnTriggerEnter2D(Collider2D col) { // do something.. } </code></pre>
Unity 2D OnTriggerEnter Not Working, Tried Everything
c#|visual-studio|unity3d
3
61
1
72,341,452
72,341,452
2
true
2022-05-22T21:29:06.880Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unity 2D OnTriggerEnter Not Working, Tried Everything<p>Ive been trying to find the solution to this for hours. I'm trying to learn but I've been stuck on th...
72,341,143
How to set values in a 2d numpy array given 1D indices for each row?<p>In numpy you can set the indices of a 1d array to a value</p> <pre><code>import numpy as np b = np.array([0, 0, 0, 0, 0]) indices = [1, 3] b[indices] = 1 b </code></pre> <pre><code>array([0, 1, 0, 1, 0]) </code></pre> <p>I'm trying to do this wi...
<p>In [330]: b = np.zeros((3,5),int)</p> <p>To set the (3,2) columns, the row indices need to be (3,1) shape (matching by broadcasting):</p> <pre><code>In [331]: indices = np.array([[1,3],[0,1],[0,3]]) In [332]: b[np.arange(3)[:,None], indices] = 1 In [333]: b Out[333]: array([[0, 1, 0, 1, 0], [1, 1, 0, 0, 0]...
How to set values in a 2d numpy array given 1D indices for each row?
python|arrays|numpy
1
61
3
72,341,557
72,341,557
2
true
2022-05-22T20:39:58.353Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to set values in a 2d numpy array given 1D indices for each row?<p>In numpy you can set the indices of a 1d array to a value</p> <pre><code>import numpy ...
72,342,288
How to create loops and use push_back()<p>I am trying to have the user choose how many names they would like to add, and then use <code>push_back()</code> to add that many to the list.</p> <p>I am new to programming and very confused.</p> <p>Here is the code I have so far:</p> <pre class="lang-cpp prettyprint-override"...
<p>When using the <a href="https://en.cppreference.com/w/cpp/container/vector" rel="nofollow noreferrer">std::vector</a> there is no need to have the user enter the number of names beforehand. That is the benefit of having <code>std::vector</code> handle the memory management for you. You simply read and validate the i...
How to create loops and use push_back()
c++
0
61
2
72,342,461
72,342,461
2
true
2022-05-23T00:56:47.647Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create loops and use push_back()<p>I am trying to have the user choose how many names they would like to add, and then use <code>push_back()</code> to...
72,344,291
-D in npm install<p>While installing react-router-dom, I came across a term -D in it,</p> <pre><code>npm i -D react-router-dom@latest </code></pre> <p>When I surfed online I came to know that it is -d: --loglevel info.</p> <p>I need to know what exactly does this -d do and what happens if I remove this -D ?</p>
<p>Straight from the <a href="https://docs.npmjs.com/cli/v6/commands/npm-install" rel="nofollow noreferrer">documentation</a>:</p> <ul> <li><code>-D, --save-dev</code>: Package will appear in your <code>devDependencies</code>.</li> </ul> <p>You can remove it if you want and the package will show up in dependencies and ...
-D in npm install
reactjs|npm|npm-install
0
61
1
72,344,342
72,344,342
2
true
2022-05-23T06:50:44.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: -D in npm install<p>While installing react-router-dom, I came across a term -D in it,</p> <pre><code>npm i -D react-router-dom@latest </code></pre> <p>When I...
72,354,714
How to make postgres not use a particular index?<p>I have the following query:</p> <pre><code>devapp=&gt; Explain SELECT DISTINCT &quot;chaindata_tokentransfer&quot;.&quot;emitting_contract&quot; FROM &quot;chaindata_tokentransfer&quot; WHERE ((&quot;chaindata_tokentransfer&quot;.&quot;to_addr&quot; = 100 OR &quot;cha...
<p>You can probably disable the index by doing some dummy arithmetic on the indexed column.</p> <pre><code> ...AND &quot;chaindata_tokentransfer&quot;.&quot;chain_id&quot; + 0 = 1... </code></pre> <p>If you put that into production, make sure to add a code comment on why you are doing such an odd thing.</p> <p>I'm curi...
How to make postgres not use a particular index?
sql|postgresql|indexing
0
61
1
72,356,572
72,356,572
2
true
2022-05-23T20:54:38.647Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make postgres not use a particular index?<p>I have the following query:</p> <pre><code>devapp=&gt; Explain SELECT DISTINCT &quot;chaindata_tokentrans...
72,358,864
How to sort an array of objects on the basis of properties which are provided by another array of objects?<p>I have been working around for sorting an array of objects according to a property that doesn't exist in that array. I had my first array like</p> <pre><code>const scores = [ { &quot;scoreDefinitionN...
<p>Presented below is one possible way to achieve the desired objective, with the <strong>assumption</strong> that the <code>scores</code> array needs to be sorted based on the <code>sequence</code> prop on the <code>variables</code> array (&amp; not on the order in which the <code>variables</code> array is populated)....
How to sort an array of objects on the basis of properties which are provided by another array of objects?
javascript|arrays|sorting|compare|lookup
2
61
2
72,359,965
72,359,965
2
true
2022-05-24T07:33:50.630Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to sort an array of objects on the basis of properties which are provided by another array of objects?<p>I have been working around for sorting an array ...
72,359,994
append! cuts strings into characters, push! doesn't [Julia]<p><strong>Objective:</strong> <br /> I need a tuple like (Float, string, int, string, int, string, int, ...). <br /> Since I calculate the entries over the course of my program, I first add them to an array/vector.</p> <p><strong>Attempt:</strong></p> <pre><co...
<p>The problem is not with the tuple construction, but an appearent misunderstanding of <code>append!</code>:</p> <pre><code>julia&gt; append!(my_array, 0.1) 1-element Vector{Any}: 0.1 julia&gt; append!(my_array, &quot;ab&quot;) 3-element Vector{Any}: 0.1 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)...
append! cuts strings into characters, push! doesn't [Julia]
arrays|tuples|julia
2
61
1
72,360,166
72,360,166
2
true
2022-05-24T08:57:25.370Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: append! cuts strings into characters, push! doesn't [Julia]<p><strong>Objective:</strong> <br /> I need a tuple like (Float, string, int, string, int, string...
72,387,338
How to remove first n columns containing blanks from text file by linux shell scripting<p>I want to remove the first 6 columns containing blanks of this text file <code>sample.txt</code></p> <pre><code> 2022-05-26 Mary Jane foo bar 2022-05-27 Tom Powels lorem ipsum ...
<pre><code> sed -E 's/^ {6}//' sample.txt &gt; output.txt awk '{gsub(/^ {6}/,&quot;&quot;); print &gt; &quot;output.txt&quot;}' sample.txt </code></pre>
How to remove first n columns containing blanks from text file by linux shell scripting
bash|awk|sed|cut
0
61
4
72,387,839
72,387,839
2
true
2022-05-26T05:58:57.347Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to remove first n columns containing blanks from text file by linux shell scripting<p>I want to remove the first 6 columns containing blanks of this text...
72,328,583
Why does Main not wait for all threads to evaluate in asynchronous program?<p>@Dan Dinu's answer from a previous question regarding asynchronous programming in C# provides a useful minimal example, which I have adapted as follows:</p> <pre><code>// From https://stackoverflow.com/questions/14455293/how-and-when-to-use-a...
<p>The answer to your question &quot;Why or why not?&quot; is complex, but could be answered with a better understanding of a <code>Task</code>.</p> <p>A <code>Task</code> is not a thread. Many tasks can run on a single thread, and a single task can be run on multiple threads.</p> <p>A task is more like an event, that ...
Why does Main not wait for all threads to evaluate in asynchronous program?
c#|asynchronous
1
61
1
72,328,670
72,328,670
2
true
2022-05-21T10:08:51.650Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does Main not wait for all threads to evaluate in asynchronous program?<p>@Dan Dinu's answer from a previous question regarding asynchronous programming ...
72,339,299
How can I create an array of objects by extracting an array that is inside another array of objects in Javascript/Typescript?<p>I am trying to create a new array based on another array of objects that has another array of objects within its keys. To explain myself. I have the following interfaces:</p> <pre><code>export...
<p>Is this what you're looking for?</p> <pre><code>const routeNodes = [ { label: &quot;NodeRoute&quot;, children: [ { path: 'child', label: 'child', data: { message: 'child' }}] }, { label: &quot;R2&quot;, children: [ { path: 'child', label: 'child', data: { message: 'child' }}] } ] routeNodes.reduce((acc, curr) =&gt...
How can I create an array of objects by extracting an array that is inside another array of objects in Javascript/Typescript?
javascript|arrays|typescript|multidimensional-array|arraylist
0
61
2
72,339,350
72,339,350
2
true
2022-05-22T16:16:00.267Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I create an array of objects by extracting an array that is inside another array of objects in Javascript/Typescript?<p>I am trying to create a new a...
72,286,052
Stuck trying to select an html element of a given class with xpath, where am I wrong?<p>Having done <a href="https://stackoverflow.com/questions/1604471/how-can-i-find-an-element-by-css-class-with-xpath">research on selecting an html element of a given class</a>, I'm stuck being unable to select a <code>table</code> el...
<p>Actually,<code>'//table[contains(@class,&quot;treasuries-table&quot;)]'</code> is selecting 5 tables but '//table[@class=&quot;treasuries-index treasuries-table treasuries-table--smaller&quot;)]' is selecting the first table which is equivalent to (//table[contains(@class,&quot;treasuries-table&quot;)])[1]</p> <p>T...
Stuck trying to select an html element of a given class with xpath, where am I wrong?
html|css|xpath
0
61
4
72,286,163
72,286,163
2
true
2022-05-18T08:54:23.680Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Stuck trying to select an html element of a given class with xpath, where am I wrong?<p>Having done <a href="https://stackoverflow.com/questions/1604471/how-...
72,304,199
No matching Constructor Error For Initialization in c++. Whats wrong with my constructor?<p>I have a class in a header file as follows:</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;sstream&gt; using namespace std; class ShowTicket { public: bool is_sold(void){ ...
<p>By the looks of it, you only want to supply two arguments, but your constructor requires three:</p> <pre class="lang-cpp prettyprint-override"><code>ShowTicket(const char* row, const char* seat_number, bool sold_status){ sold_status = false; } </code></pre> <p>The body of the constructor makes be believe that yo...
No matching Constructor Error For Initialization in c++. Whats wrong with my constructor?
c++|class|constructor|header|c-strings
0
61
1
72,304,328
72,304,328
2
true
2022-05-19T12:02:13.547Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: No matching Constructor Error For Initialization in c++. Whats wrong with my constructor?<p>I have a class in a header file as follows:</p> <pre><code>#inclu...
72,339,615
Extract all text before the last occurrence of a specific word<p>I wanted to extract all the text before the last occurrence of a specific word:</p> <blockquote> <p>Please note again that and-approved forms are not to be count toward the page limit. To the extent possible, please limit the appendix file to one 50-page ...
<p>We can find the location of 'Appendix', extract the <code>last</code> (<code>dplyr</code>) 'start'ing index, and get the substring (<code>str_sub</code>) from the start (<code>1</code>) to that location (wrap with <code>trimws</code> to remove any leading/lagging spaces)</p> <pre><code>library(stringr) out &lt;- tri...
Extract all text before the last occurrence of a specific word
r
1
61
4
72,339,700
72,339,700
2
true
2022-05-22T16:58:34.457Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extract all text before the last occurrence of a specific word<p>I wanted to extract all the text before the last occurrence of a specific word:</p> <blockqu...
72,278,207
Count events by group per day including 0 in R<p>I want columns counting for events per day including dates without events. This is an example of my data although my real dataset has more than 100 <code>ID</code>'s</p> <pre><code>dt &lt;- structure(list(id = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L...
<p>Here is an approach using <code>data.table</code></p> <pre><code>library(data.table) setDT(dt)[,`:=`(date=as.Date(date, &quot;%Y-%m-%d&quot;),id=paste0(&quot;count&quot;,id))] dcast( dt[SJ(date=seq(min(date), max(date),1)), on=.(date)], date~id,fun.aggregate = length, )[,`NA`:=NULL] </code></pre> <p>Output:</p> ...
Count events by group per day including 0 in R
r|count|multiple-columns|days
1
61
3
72,278,611
72,278,611
2
true
2022-05-17T17:16:48.507Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Count events by group per day including 0 in R<p>I want columns counting for events per day including dates without events. This is an example of my data alt...
72,292,849
What exactly is the bitwise AND doing with collections.Counter?<p>There was a <a href="https://stackoverflow.com/q/72263877">recent question</a> where the, correct, answer really surprised me by using <code>&amp;</code> on two Counters and then &quot;getting it right&quot;.</p> <p>From the <a href="https://docs.python....
<p>Your understanding is pretty much correct. <a href="https://docs.python.org/3/library/collections.html#collections.Counter" rel="nofollow noreferrer">If you look a couple lines down from where you've quoted</a>, you'll see an example use of <code>&amp;</code> on <code>Counter</code> objects -- you don't need to dive...
What exactly is the bitwise AND doing with collections.Counter?
python|dictionary|data-structures
0
61
3
72,292,908
72,292,908
2
true
2022-05-18T16:28:40.217Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What exactly is the bitwise AND doing with collections.Counter?<p>There was a <a href="https://stackoverflow.com/q/72263877">recent question</a> where the, c...
72,292,309
Is address of structure members defined behavior?<p>Sometimes I do pointer arithmetic on structures and I'm not certain if it's defined behavior or not..</p> <p>If I have this structure</p> <pre><code>typedef struct SCustomData{ uint32_t a; uint32_t b; }CustomData; </code></pre> <p>Rather than having to constan...
<h4>First Question</h4> <p>It's actually is defined in the C standard! Section <code>6.7.2.1</code> (in this <a href="https://www.open-std.org/jtc1/sc22/WG14/www/docs/n1570.pdf" rel="nofollow noreferrer">standard draft</a>)</p> <blockquote> <p>15 Within a structure object, the non-bit-field members and the units in whi...
Is address of structure members defined behavior?
c
1
61
1
72,292,681
72,292,681
2
true
2022-05-18T15:49:15.093Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is address of structure members defined behavior?<p>Sometimes I do pointer arithmetic on structures and I'm not certain if it's defined behavior or not..</p>...
72,350,133
How to apply the same decorator chain to multiple functions<pre class="lang-py prettyprint-override"><code>@extend_schema( methods=['GET'], responses={(200, STYLES_MIME_TYPE): OpenApiTypes.BINARY}) @extend_schema( methods=['PUT'], request={STYLES_MIME_TYPE: OpenApiTypes.BINARY}, responses={(204, 'ap...
<p>You could define a new decorator which returns a pre-decorated function with the chain you want. For example, we can first define three custom decorators:</p> <pre><code>import functools # A decorator factory which returns a new decorator. def decorator_factory(message): def decorator(function): # Wr...
How to apply the same decorator chain to multiple functions
python|django|decorator|dry
1
61
2
72,352,608
72,352,608
2
true
2022-05-23T14:19:35.497Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to apply the same decorator chain to multiple functions<pre class="lang-py prettyprint-override"><code>@extend_schema( methods=['GET'], responses...
72,383,825
How can subtract a character from csv using PowerShell<p>I'm trying to insert my CSV into my SQL Server database but just wondering how can I subtract the last three character from CSV GID column and then assigned it to my $CSVHold1 variable.</p> <p>My CSV file look like this</p> <pre><code>GID Source ...
<p>Your original line 3 was/is not valid syntax as <a href="https://stackoverflow.com/users/15339544/santiago-squarzon">Santiago</a> pointed out.</p> <pre><code>$CSVHold1 = $CSVLine1.GID | ForEach-Object { $_.$GID = $_.$GID.subString(0, $_.$GID.Length - 3); $_ } </code></pre> <p>You are calling <code>$_.$GID</code> but...
How can subtract a character from csv using PowerShell
powershell|azure-powershell|powershell-4.0
0
61
1
72,384,133
72,384,133
2
true
2022-05-25T20:30:48.443Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can subtract a character from csv using PowerShell<p>I'm trying to insert my CSV into my SQL Server database but just wondering how can I subtract the la...
72,282,360
Regarding state machine diagram, if two actions trigger the same transition from a state, how should corresponding state transition table look like?<p><a href="https://i.stack.imgur.com/NLA25.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NLA25.png" alt="enter image description here" /></a></p> <p>I...
<p>Your table is a state transition matrix. You need in any case to show both alternative paths in the S2-&gt;S1 cell, i.e. <code>a2/e2</code> and <code>a3/e3</code>.</p> <p>There is as far as I know no standard specification for such matrix. So any of the following should do:</p> <ul> <li>separating the two transiti...
Regarding state machine diagram, if two actions trigger the same transition from a state, how should corresponding state transition table look like?
uml|state-machine
4
61
1
72,296,463
72,296,463
2
true
2022-05-18T01:41:11.820Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regarding state machine diagram, if two actions trigger the same transition from a state, how should corresponding state transition table look like?<p><a hre...
72,337,084
Use requestBodyProcessor after base64Decode<p>ModSecurity allows us to use different request body processors (e.g. for XML or JSON). My question is, is it possible to first decode a body that holds a base64 encoded string</p> <p><code>eyJuYW1lIjoiSm9obiIsICJhZ2UiOjI1fQ==</code></p> <p>which translates to</p> <p><code>{...
<p>Unfortunately, this isn't possible, because:</p> <ul> <li>body processor needs to be activated in phase 1, this cannot by done in any later phase</li> <li>REQUEST_BODY variable is populated at the start of phase 2 so it's not accessible in phase 1</li> </ul> <p>There IS a way how to achieve what you need but it's a ...
Use requestBodyProcessor after base64Decode
mod-security|mod-security2
0
61
1
72,344,033
72,344,033
2
true
2022-05-22T11:19:10.640Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Use requestBodyProcessor after base64Decode<p>ModSecurity allows us to use different request body processors (e.g. for XML or JSON). My question is, is it po...
72,338,841
How do I retrieve an image for use in a vue file?<p>I have been making a portfolio website, usually when using Nuxt I have an assets folder, this time I did not have one.</p> <p>Therefore, I created one manually and added my images into it, however, I cannot retrieve the images for use on my vue file.</p> <p>However, I...
<p>Firstly you don't have to import the image as <code>/assets</code> contains your un-compiled assets such as Stylus or SASS files, images, or fonts. Inside your vue templates, if you need to link to your assets directory use <code>~/assets/ethereum.jpg</code> with a slash before assets.</p> <pre class="lang-html pret...
How do I retrieve an image for use in a vue file?
vue.js|three.js|nuxt.js
0
61
2
72,339,853
72,339,853
2
true
2022-05-22T15:16:46.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I retrieve an image for use in a vue file?<p>I have been making a portfolio website, usually when using Nuxt I have an assets folder, this time I did ...
72,376,679
Moving multiple items from one list to another in single line in Python<p>I'd like to move multiple items from one list to another.<br /> The items are to be removed from the first list and inserted at the end of the second list.<br /> The value of the items are unknown but the indexes of the items are known.<br /> I'd...
<p>You can make something like that</p> <pre class="lang-py prettyprint-override"><code>listOne = [0, 1, 2, 3, 4, 5] listTwo = [6, 7, 8, 9, 10] # Must respect this criteria : 0 &lt;= X &lt; Y &lt;= len(listOne) Y = 2 X = 0 listTwo.extend([listOne.pop(X) for _ in range(Y-X)]) print(listTwo) # [6, 7, 8, 9, 10, 0, 1] pr...
Moving multiple items from one list to another in single line in Python
python|list|move
1
61
2
72,376,760
72,376,760
2
true
2022-05-25T11:20:29.207Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Moving multiple items from one list to another in single line in Python<p>I'd like to move multiple items from one list to another.<br /> The items are to be...
72,262,843
Define the reference type<p>I use a singleton for my project. It is seen not to be used like below, because it's local variable:</p> <pre><code>var index = undomanager.singleton.index; index--; </code></pre> <p>so how can I define it in reference type in C#? or I have to use</p> <pre><code>undomanager.singleton.index--...
<p>Writing <code>var index</code>, declares a <em>new variable</em>. This variable presumably is an <code>int</code>, which is a <em>value type</em>, and so when you assign to it via <code> = undomanager.singleton.index;</code> what you have actually done is <em>make a copy</em> of the property value in your singleton....
Define the reference type
c#
1
61
1
72,262,980
72,262,980
2
true
2022-05-16T16:52:15.230Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Define the reference type<p>I use a singleton for my project. It is seen not to be used like below, because it's local variable:</p> <pre><code>var index = u...
72,239,736
MySQL Get same yesterday day of previous week data<p>Let say yesterday was Wednesday; I need to get all records for Wednesday of previous week. How to achieve this in MySQL statement condition?</p>
<p>Yesterday would be today - 1 day. Then subtract additional 7 days:</p> <pre><code>select * from t where date_column &gt;= current_date - interval 8 day and date_column &lt; current_date - interval 7 day </code></pre>
MySQL Get same yesterday day of previous week data
mysql|datetime
0
61
2
72,239,781
72,239,781
2
true
2022-05-14T11:25:32.247Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MySQL Get same yesterday day of previous week data<p>Let say yesterday was Wednesday; I need to get all records for Wednesday of previous week. How to achiev...
72,298,670
Why does my button run both the onTap function and the onLongPressDown function at the same time?<p>I'm using a gesture detector to do 2 different things:</p> <ol> <li>onTap: record audio for a fixed 10 seconds</li> <li>on long press: record audio until the user releases the button, up to a maximum of 10 seconds</li> <...
<p>From the docs of <a href="https://api.flutter.dev/flutter/widgets/GestureDetector/onLongPressDown.html" rel="nofollow noreferrer">onLongPressDown</a></p> <blockquote> <p>which might be the start of a long-press.</p> </blockquote> <p>It says that the widget calls if it thinks the long press happens which includes tap...
Why does my button run both the onTap function and the onLongPressDown function at the same time?
android|ios|flutter|dart|mobile-application
0
61
1
72,300,902
72,300,902
2
true
2022-05-19T04:32:42.693Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does my button run both the onTap function and the onLongPressDown function at the same time?<p>I'm using a gesture detector to do 2 different things:</p...
72,266,186
What's the difference between R_386_GOT32 and R_386_GOT32X?<p>I've found a lot of documentation for <code>R_386_GOT32</code>, but not <code>R_386_GOT32X</code>. I was able to find <a href="https://github.com/hjl-tools/x86-psABI/wiki/intel386-psABI-draft.pdf" rel="nofollow noreferrer">https://github.com/hjl-tools/x86-ps...
<p>Both relocations have the same effect and the calculations are the same, but <code>R_386_GOT32X</code> relocations allow the linker to optimize the instructions used for the calculation, using immediate operands instead of memory operands under certain conditions.</p> <p>H. J. Lu (Intel engineer who introduced <code...
What's the difference between R_386_GOT32 and R_386_GOT32X?
x86|elf|relocation
1
61
1
72,266,887
72,266,887
3
true
2022-05-16T22:14:58.007Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What's the difference between R_386_GOT32 and R_386_GOT32X?<p>I've found a lot of documentation for <code>R_386_GOT32</code>, but not <code>R_386_GOT32X</cod...
72,270,600
Fibonacci number overflow in c++<p>I am a <code>c++</code> newbie, and start learning it by learning algorithm at the same time. However, I encountered some problem when writing this algorithm --- the number overflows, which is quite different to the overflow I thought. To solve the problem, I searched for a long time,...
<p>This line in your function <strong>int res = F(N - 1) + F(N - 2);</strong> makes your result an int, which is then casted to long long. so the overflow occurs here. Should be flagged by some compilers flags tho.</p> <pre><code>long long F(int N) { if (Fs[N] != -1) { return Fs[N]; } // int res = F...
Fibonacci number overflow in c++
c++|algorithm
0
61
1
72,270,677
72,270,677
3
true
2022-05-17T08:27:04.107Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fibonacci number overflow in c++<p>I am a <code>c++</code> newbie, and start learning it by learning algorithm at the same time. However, I encountered some ...
72,290,467
Starting with Go Templates, what does the T indicate in {{T "post_nav_prev"}}<p>Trying to understand Go templates in Hugo. I find the subject construct {{T &quot;post_nav_prev&quot;}}. I see post_nav_prev defined in i18n yaml file en.yaml, but can't seem to find what T is or where it is defined. Sorry for the lack of...
<p><code>T</code> is an alias for <code>lang.Translate</code></p> <p>source : <a href="https://gohugo.io/functions/lang/#langtranslate" rel="nofollow noreferrer">https://gohugo.io/functions/lang/#langtranslate</a></p> <p>It define <a href="https://github.com/gohugoio/hugo/blob/e164834f0aaaf1c58489fab41f5835b66f16b87c/t...
Starting with Go Templates, what does the T indicate in {{T "post_nav_prev"}}
go|hugo
0
61
1
72,290,868
72,290,868
3
true
2022-05-18T13:50:38.867Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Starting with Go Templates, what does the T indicate in {{T "post_nav_prev"}}<p>Trying to understand Go templates in Hugo. I find the subject construct {{T ...
72,289,915
Change StringWriter xml node output<p>I am using .NET Core 3.1</p> <p>Is there any way of editing the xml node that StringWriter outputs?</p> <p>I'd like to change the casing of &quot;utf-8&quot; for example. The output currently looks like below.</p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quo...
<p>You can write the Xml declaration manually:</p> <pre><code>using (TextWriter tw= new MyStringWriter()) { using (var xw = XmlWriter.Create(tw)) { xw.WriteProcessingInstruction(&quot;xml&quot;, &quot;version='1.0' encoding='UTF-8'&quot;); xmlDoc.WriteTo(xw); } var output = tw.ToString()...
Change StringWriter xml node output
c#|xml|.net-core
3
61
1
72,290,918
72,290,918
3
true
2022-05-18T13:14:22.180Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change StringWriter xml node output<p>I am using .NET Core 3.1</p> <p>Is there any way of editing the xml node that StringWriter outputs?</p> <p>I'd like to ...
72,297,071
Show me a better way! How to unnest a heavily nested list in R<p>I will start off by stating that I have working code, but it is embarrassingly inefficient and clumsy. I was hoping that someone in the community might be able to show me a better way to unnest this heavily nested list.</p> <p>As a background, it is trans...
<pre class="lang-r prettyprint-override"><code>library(dplyr) mydata &lt;- jsonlite::fromJSON(&quot;https://api2.cryptoslam.io/api/nft-indexes/NFTGlobal&quot;) monthly &lt;- bind_rows(lapply(mydata, `[[`, &quot;monthlySummary&quot;), .id = &quot;monthly_id&quot;) daily &lt;- bind_rows(lapply(mydata, function(z) bind_ro...
Show me a better way! How to unnest a heavily nested list in R
r|nested-lists
1
61
2
72,298,385
72,298,385
3
true
2022-05-18T23:35:08.843Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Show me a better way! How to unnest a heavily nested list in R<p>I will start off by stating that I have working code, but it is embarrassingly inefficient a...
72,325,070
Get the exact command error output displayed in console into a Powershell variable<p>I'm writing some scripts to backup registry and I encountered 2 small issues. The 1st one is that I can't intercept the error output of the <code>reg export</code> command.</p> <p>Example:</p> <p><code>reg export HKEY_CURRENT_USER\Soft...
<p>Simply convert the stderr lines to <em>strings</em>:</p> <pre><code>$regerror = reg export HKEY_CURRENT_USER\Software\OpenVPN-GUI test.reg 2&gt;&amp;1 | ForEach-Object ToString </code></pre> <p>While stderr are are strings to begin with, PowerShell wraps them in <a href="https://docs.microsoft.com/en-US/dotn...
Get the exact command error output displayed in console into a Powershell variable
powershell|console|output
1
61
1
72,325,260
72,325,260
3
true
2022-05-20T21:46:52.330Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get the exact command error output displayed in console into a Powershell variable<p>I'm writing some scripts to backup registry and I encountered 2 small is...
72,356,386
Properly format postgres interval to HH:MM<p>Trying to calculate time interval in postgre,</p> <pre><code>SELECT employee_id, clock_in, clock_out, (SELECT EXTRACT(epoch FROM (clock_out-clock_in))/3600) AS time_worked FROM payroll_timelog WHERE employee_id=31; </code></pre> <p>I am trying to for...
<p>We can use <a href="https://www.postgresql.org/docs/current/functions-formatting.html" rel="nofollow noreferrer"><code>TO_CHAR</code></a> with <code>HH24:MI</code> format after subtracting from two datetime.</p> <pre><code>SELECT employee_id, clock_in, clock_out, TO_CHAR(clock_out - clock_in,'HH24:M...
Properly format postgres interval to HH:MM
sql|postgresql
2
61
1
72,356,453
72,356,453
3
true
2022-05-24T01:45:02.590Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Properly format postgres interval to HH:MM<p>Trying to calculate time interval in postgre,</p> <pre><code>SELECT employee_id, clock_in, clock_ou...
72,386,689
Trying to get a variable from a function using tkinter<p>I've been trying to get the printed output into a variable. Whenever I call the function it just simply repeats the button process. I tried to utilize global, but it doesn't seem to work.</p> <p>Help pls thanks.</p> <pre><code>from tkinter import * from tkinter i...
<p><code>print</code> , outputs the string to <code>stdout</code> it does not store the value in a variable, you'll need to store it yourself.</p> <p>Since you're using a callback you can't return the value. The best way to implement this is to use classes, the bad way is to use a global variable to store the result</p...
Trying to get a variable from a function using tkinter
python|tkinter
0
61
1
72,386,964
72,386,964
3
true
2022-05-26T04:27:19.933Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trying to get a variable from a function using tkinter<p>I've been trying to get the printed output into a variable. Whenever I call the function it just sim...
72,387,789
PerformClick + KeyDown doesn't work c# but works fine in vb net<p>I'm trying to convert VB.NET code to C#, from all the code I found this PerformClick issue and I don't know what happened.</p> <p>My VB.Net code:</p> <pre><code>Private Sub FormLogin_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEven...
<p>You would need to set the <code>KeyPreview</code> property of the form to <code>true</code>. If it is <code>false</code>, which it is by default, then the form will not raise keyboard events when a child control that can raise keyboard events has focus. Set it to <code>true</code> and the form will raise the events ...
PerformClick + KeyDown doesn't work c# but works fine in vb net
c#|vb.net
2
61
2
72,388,030
72,388,030
3
true
2022-05-26T06:43:59.903Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PerformClick + KeyDown doesn't work c# but works fine in vb net<p>I'm trying to convert VB.NET code to C#, from all the code I found this PerformClick issue ...
72,315,481
Peaks Find on Hist and DF Python<p>We are trying to wrote a code that help us to find peaks in a histo like this:</p> <p><a href="https://i.stack.imgur.com/3rzml.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3rzml.png" alt="enter image description here" /></a></p> <p>In the previus image we can see...
<p>First off there is a difference between outputs of <code>plotly</code> histogram and <code>np.histogram</code> that is probably the most confusing part about this.</p> <p>Here is the code that generates the output you are looking for:</p> <pre><code>c = [value for value in x if value &lt; 1000] hist, bin_edges = np....
Peaks Find on Hist and DF Python
python|pandas|dataframe
1
61
1
72,316,630
72,316,630
3
true
2022-05-20T08:00:41.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Peaks Find on Hist and DF Python<p>We are trying to wrote a code that help us to find peaks in a histo like this:</p> <p><a href="https://i.stack.imgur.com/3...
72,374,034
Generating two vectors with a given angle between them<p>I am trying to generate two vectors with a given cosine similarity. Input would be the degree of cosine similarity (or angle as it depends on it anyway) and the number of dimensions (D) in the vectors, and output would be two vectors of D dimensions with that giv...
<p>For a given starting vector <code>u</code> and cosine similarity <code>c</code>:</p> <ul> <li>Generate 2 points in n-D space; call them <code>a</code> and <code>b</code></li> <li>Project <code>b</code> onto the plane orthogonal to <code>u</code> and containing <code>a</code></li> <li>Subtract <code>a</code> from the...
Generating two vectors with a given angle between them
math|vector|linear-algebra|cosine-similarity
1
61
1
72,375,611
72,375,611
3
true
2022-05-25T08:07:14.943Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generating two vectors with a given angle between them<p>I am trying to generate two vectors with a given cosine similarity. Input would be the degree of cos...
72,253,644
I want to Display all the strings in my queue<p>This is my code , I want to display all I put on tail and Head in this c++ program. I want the program display all the queue elements when I click displayAll(). I edited the code, by adding the full details of the code. Not idea to show all elements in the queue , I able...
<p>A simple loop like this will do:</p> <pre><code>void displayAllPatients() { cout &lt;&lt; &quot;Patients are: &quot; &lt;&lt; &quot;\n&quot;; auto p = head; while(p) { cout &lt;&lt; p-&gt;name &lt;&lt; &quot;\n&quot;; p = p-&gt;next; } } </code></pre> <p>or</p> <pre><code> for(aut...
I want to Display all the strings in my queue
c++
1
61
1
72,253,805
72,253,805
4
true
2022-05-16T02:28:35.197Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I want to Display all the strings in my queue<p>This is my code , I want to display all I put on tail and Head in this c++ program. I want the program displ...
72,380,299
How to replace <NA> values based on another column main value in pandas<p>Problem with pandas</p> <p>I have a following dataframe:</p> <pre><code> product code trends_vs trends_100_0 1 aaaaaaa it 150 100 6 aaaaaaa pl &lt;NA&gt; 90 11 aaaaaaa ro &lt;NA&gt; ...
<p>Another method without <code>groupby</code>:</p> <pre><code>df['trends_vs'] = (df.sort_values(['product', 'trends_100_0'])['trends_vs'].bfill() * df['trends_100_0'] / 100) print(df) # Output product code trends_vs trends_100_0 1 aaaaaaa it 150.0 100 6 aaaaaaa pl ...
How to replace <NA> values based on another column main value in pandas
python|python-3.x|pandas|dataframe
1
61
3
72,380,564
72,380,564
4
true
2022-05-25T15:19:29.393Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to replace <NA> values based on another column main value in pandas<p>Problem with pandas</p> <p>I have a following dataframe:</p> <pre><code> produ...
72,377,947
What is the VIM way to copy a list of variables (a list of words vertically aligned with different widths)?<pre><code>let(:aaaaa) { 123 } let(:bb) { true } let(:ccc_ccc) { &quot;foo bar&quot; } </code></pre> <p>I want to copy all variable names (:aaaaa, :bb, :ccc_ccc).<br /> In VsCode, for example, I would use a...
<p>You could use the command <code>:%norm f:&quot;Qyt)</code> to make your 'q register' contain the following:</p> <pre><code>:aaaaa:bb:ccc_ccc </code></pre> <p>The way it works is as follows:</p> <ul> <li><code>:%norm</code> means 'to all lines, apply the following normal commands'</li> <li><code>f:</code> moves the c...
What is the VIM way to copy a list of variables (a list of words vertically aligned with different widths)?
vim
1
61
2
72,380,011
72,380,011
4
true
2022-05-25T12:47:19.837Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the VIM way to copy a list of variables (a list of words vertically aligned with different widths)?<pre><code>let(:aaaaa) { 123 } let(:bb) { t...
72,259,800
Get only relevant Rows when Grouping Data<p>I have data with reference that I wish to group and extract the highest and most common values whilst retaining the relevant references:</p> <p><a href="https://i.stack.imgur.com/9Ztob.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Ztob.png" alt="enter im...
<p>It's all in the grouping:</p> <p><em><strong>Edited to account for multiple modes</strong> as seen after your edit</em></p> <pre><code>let Source = Excel.CurrentWorkbook(){[Name=&quot;Input&quot;]}[Content], #&quot;Changed Type&quot; = Table.TransformColumnTypes(Source,{{&quot;CAS&quot;, type text}, {&quot;T...
Get only relevant Rows when Grouping Data
excel|transform|multiple-columns|powerquery
0
61
1
72,261,742
72,261,742
4
true
2022-05-16T13:12:48.240Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get only relevant Rows when Grouping Data<p>I have data with reference that I wish to group and extract the highest and most common values whilst retaining t...
72,781,295
How to check all Empty Folders under a Directory in Java<p>I want to find all empty folders under my <code>E:</code> Drive. When I run below Code it shows all empty folders in the <code>E</code> drive. But the main problem is, it also shows a folder named <code>MS OFFICE TUTORIAL SERIES</code> which is not empty,becaus...
<p>You are using the wrong approach to check if the directory is actually empty or not. According to the <a href="https://docs.oracle.com/javase/7/docs/api/java/io/File.html#length()" rel="nofollow noreferrer">Java documentation</a> the usage of length() on directories is undefined &quot;[...]The return value is unspec...
How to check all Empty Folders under a Directory in Java
java|file
-1
61
1
72,781,453
72,781,453
1
true
2022-06-28T05:48:03.273Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to check all Empty Folders under a Directory in Java<p>I want to find all empty folders under my <code>E:</code> Drive. When I run below Code it shows al...
72,969,342
Filter XML collection based on child node data in c#<p>I have following XML collection of students as shown below.</p> <pre><code>&lt;stdXmlFormat version=&quot;1.0&quot;&gt; &lt;students&gt; &lt;field id=&quot;ClassId&quot;&gt;CB0012&lt;/field&gt; &lt;field id=&quot;ClassName&quot;&gt;CBSE-12&lt;/field&gt; ...
<p>Here is a start :</p> <pre><code>using System; using System.Linq; using System.Text; using System.Collections; using System.Collections.Generic; using System.Data; using System.Xml; using System.Xml.Linq; namespace ConsoleApp2 { class Program { const string FILENAME = @&quot;c:\temp\test.xml&quot;...
Filter XML collection based on child node data in c#
c#|xml|xml-parsing|linq-to-xml|xmldocument
0
61
1
72,970,346
72,970,346
1
true
2022-07-13T16:03:54Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Filter XML collection based on child node data in c#<p>I have following XML collection of students as shown below.</p> <pre><code>&lt;stdXmlFormat version=&q...
72,791,528
Count occurrences of a filtered value in a window<p>I have the following dataframe:</p> <pre class="lang-none prettyprint-override"><code>| Timestamp | info | +-------------------+----------+ |2016-01-01 17:54:30| 8 | |2016-02-01 12:16:18| 2 | |2016-03-01 12:17:57| 1 | |2016-04-01 10:05...
<p>The following would work if you don't mind calculations performed for the first 2 rows.</p> <pre class="lang-py prettyprint-override"><code>w = Window.orderBy('Timestamp').rowsBetween(-2, 0) df_input = df_input.withColumn('count', F.count(F.when(F.col('info') &gt; 5, 1)).over(w)) df_input.show() # +----------------...
Count occurrences of a filtered value in a window
apache-spark|pyspark|apache-spark-sql|databricks|window-functions
0
61
1
72,791,674
72,791,674
1
true
2022-06-28T18:31:44.383Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Count occurrences of a filtered value in a window<p>I have the following dataframe:</p> <pre class="lang-none prettyprint-override"><code>| Timestamp ...
72,938,274
How to find duplicated rows in Pandas with a "wildcard" string value?<p>I'm trying to find an efficient way of finding duplicated rows when a value represents a set of values:</p> <pre class="lang-py prettyprint-override"><code>df = pd.DataFrame( { &quot;ID&quot;: [&quot;one&quot;, &quot;two&quot;, &quot;tw...
<p>Here is my take on your interesting question.</p> <p>With the toy dataframe you provided, modified to take into account more use cases:</p> <pre class="lang-py prettyprint-override"><code>import pandas as pd df = pd.DataFrame( { &quot;ID&quot;: [&quot;one&quot;, &quot;two&quot;, &quot;two&quot;, &quot;o...
How to find duplicated rows in Pandas with a "wildcard" string value?
python|pandas|performance|duplicates
1
61
1
73,009,621
73,009,621
1
true
2022-07-11T12:02:09.490Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to find duplicated rows in Pandas with a "wildcard" string value?<p>I'm trying to find an efficient way of finding duplicated rows when a value represent...
72,896,151
Matching in python<p>I have two dataframes and want to match both dataframes on below conditions</p> <ul> <li>State matches between df1 and df2</li> <li>pre_year count matches. i.e if the pre_year is &quot;2018&quot; then column year_2018 in df1 and df2 should match</li> </ul> <p>If match is found in df2 then I want t...
<p>There are probably some different solutions for your problem. I would first pull the years as a column and the values as a separate with</p> <pre class="lang-py prettyprint-override"><code>df2 = df2.melt(id_vars=['ID', 'state'], var_name=&quot;year&quot;, value_name=&quot;value&quot;)...
Matching in python
python|loops|match
1
61
1
72,896,813
72,896,813
1
true
2022-07-07T10:21:37.033Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Matching in python<p>I have two dataframes and want to match both dataframes on below conditions</p> <ul> <li>State matches between df1 and df2</li> <li>pre_...
72,951,796
How to change html element after text has been edited<p>I have this code that should change the contents of a table position when you change the contents of <em><strong>nameDiv</strong></em> which is <code> var nameDiv = document.createElement('div');</code> (<code>nameDiv.contentEditable = &quot;true&quot;;</code>) an...
<p>For <code>contenteditable</code>, you can use the <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event" rel="nofollow noreferrer"><code>input</code></a> event:</p> <blockquote> <p>The input event fires when the value of an input element has been changed.</p> </blockquote> <p>The <code>ch...
How to change html element after text has been edited
javascript|html|events|listener
3
61
2
72,951,835
72,951,835
1
true
2022-07-12T11:46:34.857Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change html element after text has been edited<p>I have this code that should change the contents of a table position when you change the contents of ...
72,787,583
How do you initialize a vector bool matrix in C++?<p>I come from a mostly Java background (I use Java for algorithm challenges) , but I'm trying to practice my C++. This is my solution to a problem in which I need a vector bool matrix.</p> <pre><code>class Solution { public: string longestPalindrome(string s) { ...
<p>You can initialize a vector matrix like this:</p> <pre><code>std::vector&lt;std::vector&lt;type&gt;&gt; vec_name{ rows, std::vector&lt;type&gt;(cols) }; </code></pre> <p>..which in your case is:</p> <pre><code>std::vector&lt;std::vector&lt;bool&gt;&gt; dp{ s.length(), std::vector&lt;bool&gt;(s.length()) }; </code></...
How do you initialize a vector bool matrix in C++?
c++|matrix|vector
-2
61
1
72,787,753
72,787,753
2
true
2022-06-28T13:45:06.240Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you initialize a vector bool matrix in C++?<p>I come from a mostly Java background (I use Java for algorithm challenges) , but I'm trying to practice ...
72,807,804
problem getting id and deleting document Vuejs Firestore<p>I am creating site for my store and learning Vue js at the same time. I'm having a problem with getting product id from firestore and being able to delete product. When i create a new product in console id doesn't come out either, got this message (Document wri...
<p>The &quot;Document written with ID: undefined&quot; output is because the <a href="https://firebase.google.com/docs/reference/js/firestore_#adddoc" rel="nofollow noreferrer"><code>addDoc</code> function</a> is an asynchronous operation and thus returns a <code>Promise&lt;DocumentReference&gt;</code>. You'll have to ...
problem getting id and deleting document Vuejs Firestore
javascript|firebase|vue.js|google-cloud-firestore|vuejs3
1
61
1
72,807,849
72,807,849
2
true
2022-06-29T20:59:27.950Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: problem getting id and deleting document Vuejs Firestore<p>I am creating site for my store and learning Vue js at the same time. I'm having a problem with ge...
72,811,130
React state from props that doesn't update (even doing destructuring and using different keys)<p>Sorry for the long question in advance but I have been struggling with this for some time</p> <p>To give some context of what I am trying to accomplish I am loading this table when my app loads</p> <p><a href="https://i.sta...
<p>Problem with your code is this:</p> <pre><code>const [originalValues, setOriginalValues] = useState({ ...propsData }); const [modifiedValues, setModifiedValues] = useState({ ...propsData }); </code></pre> <p>You just spread same object in two different states, by spread you shallowly copied only top level of object,...
React state from props that doesn't update (even doing destructuring and using different keys)
reactjs|react-hooks|react-props|react-state|react-refresh
1
61
3
72,811,302
72,811,302
2
true
2022-06-30T06:22:47.730Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React state from props that doesn't update (even doing destructuring and using different keys)<p>Sorry for the long question in advance but I have been strug...
72,815,687
Replace multiple strings in place that match<p>I want to replace multiple strings in my list of dataframes that match. I cannot get these to match and replace in place, instead it produces additional row entries.</p> <p>Here's the example data:</p> <pre><code>import pandas as pd import re from scipy import linalg nm=[...
<pre><code>import pandas as pd from scipy import linalg nm=['sr', 'pop15', 'pop75', 'dpi', 'ddpi'] df_tbl=pd.DataFrame(linalg.circulant(nm)) extract_text=['dpi', 'pop15'] clean_text=['np.log(dpi)', 'np.log(pop15)'] df_tbl.replace(extract_text, clean_text, inplace=True) print(df_tbl) </code></pre> <p>Output:</p> <pre...
Replace multiple strings in place that match
python|pandas
0
61
1
72,822,604
72,822,604
2
true
2022-06-30T12:17:52.040Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Replace multiple strings in place that match<p>I want to replace multiple strings in my list of dataframes that match. I cannot get these to match and replac...
72,818,234
How to optimize SYCL kernel<p>I'm studying SYCL at university and I have a question about performance of a code. In particular I have this C/C++ code:</p> <p><a href="https://i.stack.imgur.com/2YYTY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2YYTY.png" alt="c code" /></a></p> <p>And I need to tr...
<p>Interesting question. In this case the value <code>2</code> will be a literal in the instruction in your SYCL kernel - this is as efficient as it gets, I think! There's the slight complication that you have an implicit cast from <code>int</code> to <code>float</code>. My guess is that you'll probably end up with a <...
How to optimize SYCL kernel
parallel-processing|gpu|nvidia|amd|sycl
1
61
1
72,826,161
72,826,161
2
true
2022-06-30T15:16:53.057Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to optimize SYCL kernel<p>I'm studying SYCL at university and I have a question about performance of a code. In particular I have this C/C++ code:</p> <p...
72,830,367
How to replace a word in a string, based on a condition?<p>I have a column in a dataframe like this.</p> <pre><code>Text &quot;Lorum Ipsum Rotterdam dolor sit.&quot; &quot;ed ut perspiciatis Boekarest, New York, consectetur adipiscing elit, sed &quot; &quot;Excepteur sint occaecat Glasgow cupidatat non proident, sunt...
<p>You can use</p> <pre class="lang-py prettyprint-override"><code>import spacy, warnings import pandas as pd warnings.filterwarnings(&quot;ignore&quot;, 'User provided device_type of \'cuda\', but CUDA is not available. Disabling') df = pd.DataFrame({'Text':[&quot;Lorum Ipsum Rotterdam dolor sit.&quot;, &quot;ed ut p...
How to replace a word in a string, based on a condition?
python|pandas|nlp|spacy
3
61
1
72,830,474
72,830,474
2
true
2022-07-01T13:54:40.790Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to replace a word in a string, based on a condition?<p>I have a column in a dataframe like this.</p> <pre><code>Text &quot;Lorum Ipsum Rotterdam dolor si...
72,833,753
Stream computer camera on blazor WASM website and receive each display image<p>I have two problems which I need to solve in my blazor app. What I'm trying to achieve in the end is to decode barcodes from a computer camera and the user should be able to see the camera stream while it is trying to find a barcode.</p> <p>...
<p>I think I've got exactly what you need. A while back I wrote a blazor component library that can stream a camera video and fires an event on each frame it receives because I didn't find any component allowing this:</p> <p><a href="https://github.com/baltermia/blazor-camera-streamer" rel="nofollow noreferrer">BlazorC...
Stream computer camera on blazor WASM website and receive each display image
c#|.net|blazor
-1
61
1
72,837,889
72,837,889
2
true
2022-07-01T19:16:34.720Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Stream computer camera on blazor WASM website and receive each display image<p>I have two problems which I need to solve in my blazor app. What I'm trying to...
72,841,209
LaTeX algorithm2e vlined parameter doesn't work<p>I've been trying to set a short LaTeX doc with an algorithm. The vertical block lines should have a horizontal line marking the end, like in this picture from the handbook: <a href="https://i.stack.imgur.com/VF8lw.png" rel="nofollow noreferrer"><img src="https://i.stack...
<p>With <code>noend</code> you explicitly remove the horizontal end lines</p> <pre><code>\documentclass[12pt]{article} \usepackage{amsmath} \usepackage[vlined,linesnumbered,ruled]{algorithm2e} \begin{document} \NoCaptionOfAlgo \begin{algorithm} \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} ...
LaTeX algorithm2e vlined parameter doesn't work
latex|algorithm2e
2
61
1
72,841,326
72,841,326
2
true
2022-07-02T17:39:13.750Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: LaTeX algorithm2e vlined parameter doesn't work<p>I've been trying to set a short LaTeX doc with an algorithm. The vertical block lines should have a horizon...
72,848,933
Escape backslash in Ansible while posting json to teams webhook using uri module<p>I have a file called test.log where it contains a structure like below:</p> <p>{&quot;Check something&quot; : &quot;Pass&quot; , &quot;Result&quot; : &quot;Found something -</p> <p>Name Path test C:\Windows\system32\xyz&quot;}</p> <p>Wh...
<p>I would try this:</p> <pre><code>- uri: url: &quot;{{webhook_url}}&quot; method: POST body: &quot;{{ { 'title': title , 'text': text } | to_json }}&quot; body_format: json vars: text: &quot;{{lookup('file', filepath) }}&quot; </code></pre> <p>It's easier to use a <code>vars</code> block than to...
Escape backslash in Ansible while posting json to teams webhook using uri module
ansible|jinja2|uri|microsoft-teams|webhooks
0
61
1
72,850,778
72,850,778
2
true
2022-07-03T18:23:40.180Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Escape backslash in Ansible while posting json to teams webhook using uri module<p>I have a file called test.log where it contains a structure like below:</...
72,851,401
How do I know whether my function returns a value in C<p>I wrote a macro which checks whether <code>calloc</code> success like</p> <pre class="lang-c prettyprint-override"><code>#define CHECK_CALLOC(ptr) \ if (ptr == NULL) ...
<p>You can use variable arguments to specify the return value to use if the function returns a value.</p> <pre><code>#define CHECK_CALLOC(ptr, ...) \ if (ptr == NULL) \ { ...
How do I know whether my function returns a value in C
c
0
61
1
72,851,560
72,851,560
2
true
2022-07-04T03:05:36.233Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I know whether my function returns a value in C<p>I wrote a macro which checks whether <code>calloc</code> success like</p> <pre class="lang-c prettyp...
72,830,614
Using Regex to define hostname<p>I am working on a script that looks at the hostname of a device and based on this aplies geographical config. It is currently working using a script I found online.</p> <pre><code>DEVICE_NAME = net_connect.send_command('show version') HOSTNAME = re.search(r'(\S+)\suptime', DEVICE_NAME,...
<p>Since <code>hostname</code> will always come <em>before</em> the word you need to extract, you need</p> <pre class="lang-py prettyprint-override"><code>match = re.search(r'hostname\s+(\S+)', DEVICE_NAME) if match: print(match.group(1)) </code></pre> <p>Note it is always better to check if a match occurred <em>be...
Using Regex to define hostname
python|regex|netmiko
1
61
1
72,855,169
72,855,169
2
true
2022-07-01T14:15:16.180Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using Regex to define hostname<p>I am working on a script that looks at the hostname of a device and based on this aplies geographical config. It is current...
72,855,202
Spring/Hibernate app in docker doesn't remove columns<p>I am new to docker and it is easy to get confused about some things. Here is my question. I am working on my Spring Boot app and was creating entities for DB. I found out that when I remove a column from the entity after rebuilding the container (docker-compose up...
<p>I found the problem. It is all about this line of code in docker-compose.yml(and application.properties)</p> <pre><code> SPRING_JPA_HIBERNATE_DDL_AUTO=update </code></pre> <p>The <code>update</code> operation for example, will attempt to add new columns, constraints, etc. but will never remove a column or constrai...
Spring/Hibernate app in docker doesn't remove columns
java|spring|docker|hibernate|docker-compose
2
61
2
72,855,878
72,855,878
2
true
2022-07-04T10:20:37.897Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring/Hibernate app in docker doesn't remove columns<p>I am new to docker and it is easy to get confused about some things. Here is my question. I am workin...
72,858,036
Create NumPy array from list of tuples<p>I have data in the following format:</p> <pre><code>[('user_1', 2, 1.0), ('user_2', 6, 2.5), ('user_3', 9, 3.0), ('user_4', 1, 3.0)] </code></pre> <p>And I want use this information to create a NumPy array that has the value 1.0 in position 2, value 2.5 in position 6, etc. Al...
<p>First reformat the data:</p> <pre class="lang-py prettyprint-override"><code>data = [ (&quot;user_1&quot;, 2, 1.0), (&quot;user_2&quot;, 6, 2.5), (&quot;user_3&quot;, 9, 3.0), (&quot;user_4&quot;, 1, 3.0), ] usernames, indices, values = zip(*data) </code></pre> <p>And then create the array:</p> <pre...
Create NumPy array from list of tuples
python|numpy|numpy-ndarray
1
61
2
72,858,290
72,858,290
2
true
2022-07-04T14:06:17.913Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create NumPy array from list of tuples<p>I have data in the following format:</p> <pre><code>[('user_1', 2, 1.0), ('user_2', 6, 2.5), ('user_3', 9, 3.0), ...
72,885,859
Pandas find multiple words from a list and assign Boolean value if found<p>So, I have dataframe like this,</p> <pre><code>data = { &quot;properties&quot;: [&quot;FinancialOffice&quot;,&quot;Gas Station&quot;, &quot;Office&quot;, &quot;K-12 School&quot;, &quot;Commercial, Office&quot;], } df = pd.DataFrame(data) </cod...
<p>Use a crafted regex with word delimiter:</p> <pre><code>import re regex = r'\b(?:%s)\b' % '|'.join(map(re.escape, proplist)) # '\\b(?:Office|Other\\ \\-\\ Mall|Gym)\\b' df['flag'] = df['properties'].str.contains(regex, regex=True) # for a case insensitive match add the case=False parameter </code></pre> <p>output:...
Pandas find multiple words from a list and assign Boolean value if found
python|pandas|regex|dataframe|text-mining
-2
61
3
72,885,953
72,885,953
2
true
2022-07-06T15:03:54.137Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas find multiple words from a list and assign Boolean value if found<p>So, I have dataframe like this,</p> <pre><code>data = { &quot;properties&quot;: ...
72,889,257
In JQ is there a better way to process an array using a sliding window than using indexes?<p>In my specific case, I'm looking to convert input like <code>[&quot;a&quot;, 1, &quot;b&quot;, 2, &quot;c&quot;, 3]</code> into an object like <code>{&quot;a&quot;: 1, &quot;b&quot;: 2, &quot;c&quot;: 3}</code>, but the general...
<p>I am confused with the meaning of <code>2</code> and <code>2</code> in <code>sliding(2;2)</code>, but here's a definition for <code>sliding</code> that can master what (I think) you are looking for (with maybe different parameter values). It generates an array of arrays using a step size and a length parameter:</p> ...
In JQ is there a better way to process an array using a sliding window than using indexes?
jq
1
61
3
72,889,528
72,889,528
2
true
2022-07-06T20:03:32.760Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In JQ is there a better way to process an array using a sliding window than using indexes?<p>In my specific case, I'm looking to convert input like <code>[&q...
72,903,874
This element <ion-select-option#ion-selopt-0.md.hydrated> is not visible because it has CSS property: display: none<p>I'm writing a Cypress test to select options from ion-select-option. Typically I'd use Cypress select() command with the ('option text') but that doesn't work. So as a work around I'm using the followi...
<p>Notice in the screenshot the testing attribute <code>data-cy=&quot;gender-dropdown&quot;</code> does not appear.</p> <p>If you search upwards (inside <code>&lt;ion-router-outlet&gt;</code>) the element that has the data-cy attribute is</p> <pre class="lang-html prettyprint-override"><code>&lt;ion-select-option _ngco...
This element <ion-select-option#ion-selopt-0.md.hydrated> is not visible because it has CSS property: display: none
javascript|html|ionic-framework|cypress
1
61
1
72,905,822
72,905,822
2
true
2022-07-07T20:28:53.213Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: This element <ion-select-option#ion-selopt-0.md.hydrated> is not visible because it has CSS property: display: none<p>I'm writing a Cypress test to select op...
72,906,025
Loading fixture with component test<p>Performing a Cypress component test, I load a fixture in a before hook.</p> <p>The fixture loads, but disappears after the first test.</p> <pre class="lang-js prettyprint-override"><code>before(() =&gt; { cy.fixture('my-fixture').as('fixture') }) it('test1', function() { mount...
<p>Alises are cleared down between tests. You can change the hook to <code>beforeEach()</code> to allow all tests to see the data.</p> <p>Note that the fixture is not read from disk every time it's called, the <code>cy.fixture()</code> command has a cache the returns the previously read value on 2nd, 3rd calls.</p> <pr...
Loading fixture with component test
cypress
2
61
1
72,906,038
72,906,038
2
true
2022-07-08T02:19:09.977Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Loading fixture with component test<p>Performing a Cypress component test, I load a fixture in a before hook.</p> <p>The fixture loads, but disappears after ...
72,922,801
What's better: to open connection in every method or one time in constructor?<p>Is it normally to create an instance &quot;connection&quot; (type of MySqlConnection) every time in every methods in form (I have about 20 methods) and open connection with Open method (in the start of the method) and close connection with ...
<p>depends on the implementation of the SqlConnection and the configuration.</p> <p>In your case (the MySqlConnection) and in most variants of other databases, there is a pooling implementation under the hood.</p> <p><a href="https://dev.mysql.com/doc/connector-net/en/connector-net-connections-pooling.html" rel="nofoll...
What's better: to open connection in every method or one time in constructor?
c#|mysql|.net|winforms
3
61
1
72,922,955
72,922,955
2
true
2022-07-09T15:53:19.170Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What's better: to open connection in every method or one time in constructor?<p>Is it normally to create an instance &quot;connection&quot; (type of MySqlCon...
72,927,377
recharts x-axis not showing 0 values<p>I'm using recharts to show an area graph. I want to show values of concentration over time, including when there is 0 concentration.</p> <p>Currently with the dataset going in I can't get the x-axis to show 0 values where there aren't any time value / concentration values i.e.,</p...
<p>I see two problems with your approach.</p> <ol> <li><p>In your <code>XAxis</code> definition you specify that only the tick with time number <code>25</code> is supposed to show. But your dataset does not contain a time value with <code>25</code>. Given that - no tick is rendered on your XAxis with the example datase...
recharts x-axis not showing 0 values
javascript|reactjs|next.js|recharts
0
61
1
72,927,922
72,927,922
2
true
2022-07-10T09:11:35.380Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: recharts x-axis not showing 0 values<p>I'm using recharts to show an area graph. I want to show values of concentration over time, including when there is 0 ...
72,929,800
Combining 3 lists to create a list of dictionaries<p>I'm trying to figure out the best way to take the following 3 lists:</p> <pre><code>name_list = [&quot;potatoes&quot;, &quot;milk&quot;, &quot;butter&quot;] quant_list = [500, 200, 40] unit_list = [&quot;g&quot;, &quot;ml&quot;, &quot;g&quot;] </code></pre> <p>and co...
<p>You could also use list comprehension, which would make it a one-liner and generally is a really cool concept in python</p> <pre><code>name_list = [&quot;potatoes&quot;, &quot;milk&quot;, &quot;butter&quot;] quant_list = [500, 200, 40] unit_list = [&quot;g&quot;, &quot;ml&quot;, &quot;g&quot;] [{'name': f'{food}', ...
Combining 3 lists to create a list of dictionaries
python|json|list|dictionary
2
61
5
72,929,981
72,929,981
2
true
2022-07-10T15:47:26.640Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Combining 3 lists to create a list of dictionaries<p>I'm trying to figure out the best way to take the following 3 lists:</p> <pre><code>name_list = [&quot;p...
72,930,524
Ubuntu 22.04 LTS not fully showing some git commands<p>(new to linux terminal, comming from git bash) Linux terminal isn't showing the git command response in some cases. Git branch for example. <a href="https://i.stack.imgur.com/QvAWK.png" rel="nofollow noreferrer">git branch does not list branches (git branch -l does...
<p>A branch with no commits yet doesn't yet really exist, when you commit the first time that's the one you'll make. <code>git status</code> shows you as &quot;on&quot; that branch because that's the tip you'll commit to, <code>git branch</code> <em>doesn't</em> show you that branch because you can't do anything (else...
Ubuntu 22.04 LTS not fully showing some git commands
linux|git|ubuntu|git-branch
0
61
1
72,930,602
72,930,602
2
true
2022-07-10T17:30:47.157Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ubuntu 22.04 LTS not fully showing some git commands<p>(new to linux terminal, comming from git bash) Linux terminal isn't showing the git command response i...
72,931,139
Is there a simpler way to write this if/else statement without a variable?<p>I have a quiz with one input. On the first enter press, it grades the answer. On the second enter press, it resets a new question.</p> <ol> <li><p>Is there a simpler way to write this without the <code>flip</code> variable?</p> </li> <li><p>If...
<p>You can use a data-attribute or a class</p> <pre class="lang-js prettyprint-override"><code>document.getElementById(&quot;guess-input&quot;).addEventListener(&quot;keyup&quot;, (event) =&gt; { if (event.key === &quot;Enter&quot;) { event.preventDefault(); const tgt = event.target; if (tgt.matches(&quot...
Is there a simpler way to write this if/else statement without a variable?
javascript
0
61
4
72,931,203
72,931,203
2
true
2022-07-10T19:03:25.270Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a simpler way to write this if/else statement without a variable?<p>I have a quiz with one input. On the first enter press, it grades the answer. On...
72,973,267
How to add 2 columns to an HTML table dynamically created using JS?<p>The function below does check if the row of data coming in is valid and sets the 06th column to an input field, where the price will be informed. The data, however, has 07 &quot;columns&quot;, but I'd need to add two more and I can't wrap my head aro...
<p>From your added information, how about modifying your showing script as follows?</p> <h3>From:</h3> <pre><code>for (var i = 0; i &lt; ar.length; i++) { result += &quot;&lt;tr&gt;&quot;; for (var j = 0; j &lt; ar[i].length; j++) { (j === 6 &amp;&amp; isNan(ar[i][4]) === false) ? &quot;&lt;td&gt;&lt;in...
How to add 2 columns to an HTML table dynamically created using JS?
javascript|html|google-apps-script
1
61
1
72,974,072
72,974,072
2
true
2022-07-13T22:23:52.227Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add 2 columns to an HTML table dynamically created using JS?<p>The function below does check if the row of data coming in is valid and sets the 06th c...
72,987,777
Cannot catch error with try-catch block inside async function<p>I'm trying to incorporate a try-catch block into an async function. But I cannot seem to catch an error with status code 400 with the code I have written below.</p> <pre><code>const run = async () =&gt; { const response = await client.lists.addListMember...
<p>The issue is that in order to <code>catch</code> the possible rejection returned by <code>await client.lists.addListMember(...)</code> that code needs to be <em>inside</em> the <code>try</code> block - since <code>catch</code> only handles errors <em>inside</em> the associated <code>try</code> block</p> <p>i.e.</p> ...
Cannot catch error with try-catch block inside async function
javascript|node.js|api|async-await|mailchimp
0
61
2
72,987,930
72,987,930
2
true
2022-07-14T23:58:56.460Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cannot catch error with try-catch block inside async function<p>I'm trying to incorporate a try-catch block into an async function. But I cannot seem to catc...
73,007,388
How can I set a c++ variable to permanently be the sum of two others?<p>I want to permanently set one variable to be the sum of two other integer variables in c++, such that the value of the sum variable will change as either or both of the original two variables change:</p> <pre><code>#include &lt;iostream&gt; int ma...
<p>You cannot achieve this with the exact same syntax you're suggesting, but you can create a type containing 2 references to <code>int</code> that behaves reasonably similar to an <code>int</code> resulting in the desired behaviour:</p> <pre><code>class Sum { public: Sum(const int&amp; s1, const int&amp; s2) noexc...
How can I set a c++ variable to permanently be the sum of two others?
c++|pointers|reference
1
61
2
73,007,453
73,007,453
2
true
2022-07-16T20:16:52.640Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I set a c++ variable to permanently be the sum of two others?<p>I want to permanently set one variable to be the sum of two other integer variables i...
73,013,115
Github latest release is not same as a newest release<p><a href="https://i.stack.imgur.com/s1Osm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s1Osm.png" alt="enter image description here" /></a></p> <p>This is the situation.</p> <ol> <li><strong>30 minutes ago</strong>, I made a release note with ...
<p>This information was <a href="https://github.community/t/release-page-not-sorting-correctly/121002/2" rel="nofollow noreferrer">provided by a GitHub staff member</a>:</p> <blockquote> <p>Releases are based on Git tags, which mark a specific point in your repository’s history. The sort order of tags is as follows:</p...
Github latest release is not same as a newest release
github
2
61
1
73,013,785
73,013,785
2
true
2022-07-17T15:37:33.080Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Github latest release is not same as a newest release<p><a href="https://i.stack.imgur.com/s1Osm.png" rel="nofollow noreferrer"><img src="https://i.stack.img...
73,014,269
Google Sheets Overlapping Conditional Formatting<p>I have a google sheet I am working on where I have a conditional formatting rule that bolds certain rows in a range, I also have one that highlights certain rows in the same range. These both work independently unless the second formatting rule wants to act on a row th...
<p>Unfortunately, there must be an order of precedence for conditional formatting rules so that Sheets knows which to apply when there is a conflict. However, a problem naturally arises when conflicts are desired and expected, and multiple rules should apply to the same cell. The workaround for this is to <strong>have ...
Google Sheets Overlapping Conditional Formatting
google-sheets|spreadsheet|conditional-formatting
1
61
1
73,014,503
73,014,503
2
true
2022-07-17T18:17:54.777Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google Sheets Overlapping Conditional Formatting<p>I have a google sheet I am working on where I have a conditional formatting rule that bolds certain rows i...
73,016,549
How to convert string permission to mode_t type<p>I am writing a program which changes file permissions. The permissions will be passed through a command line argument as a <code>char *</code> and then converted to <code>mode_t</code> type and given to <a href="https://man7.org/linux/man-pages/man2/chmod.2.html" rel="n...
<p>You can parse a string to extract an octal value by calling <a href="https://en.cppreference.com/w/c/string/byte/strtol" rel="nofollow noreferrer">strtol</a> and providing <code>8</code> as the base:</p> <pre><code>int mode = strtol(str, NULL, 8); </code></pre> <p>To be safe, you might want to do some additional san...
How to convert string permission to mode_t type
c|file|permissions|chmod|stat
1
61
1
73,016,687
73,016,687
2
true
2022-07-18T01:41:13.883Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert string permission to mode_t type<p>I am writing a program which changes file permissions. The permissions will be passed through a command lin...
73,018,320
pandas: insert rows in a dataframe from column values in another dataframe<p>I've two multi-indexed dataframes with data as shown below:</p> <p>df1:</p> <pre><code> qty plot name sub plot name crop date BL1 Cabbage-0412...
<p>Create a new column <code>date</code> in <code>df2</code> with the value <code>Subtotal</code> then concatenate both dataframes and sort index:</p> <pre><code>out = (pd.concat([df1, df2.assign(date='Subtotal').set_index('date', append=True)]) .sort_index()) </code></pre> <p>Output:</p> <pre><code>&gt;&gt;&g...
pandas: insert rows in a dataframe from column values in another dataframe
python|pandas|dataframe
1
61
1
73,018,659
73,018,659
2
true
2022-07-18T06:55:18.607Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: pandas: insert rows in a dataframe from column values in another dataframe<p>I've two multi-indexed dataframes with data as shown below:</p> <p>df1:</p> <pre...
72,780,487
Scanf() stores a newline when I type characters 'i' or 'n'<p>I'm trying to have my program end if the user types 'end' and while brainstorming for an implementation, one of the solutions I came up with has an interesting behavior.</p> <p>In the code below, numbers are stored in <em><strong>firstArray.content[index];</s...
<p><code>i</code> is the first character in <code>inf</code> and <code>n</code> is the first character in <code>nan</code>. Those are legitimate inputs for the <code>%f</code> format conversion, so <code>scanf</code> will look at the next character. When it turns out the the next character is <code>\n</code>, <code>sca...
Scanf() stores a newline when I type characters 'i' or 'n'
c
0
61
1
72,780,898
72,780,898
2
true
2022-06-28T03:38:09.720Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scanf() stores a newline when I type characters 'i' or 'n'<p>I'm trying to have my program end if the user types 'end' and while brainstorming for an impleme...
72,820,304
Laravel prevent open route in browser<p>I'm very new to <code>laravel</code> and created my first <code>REST api</code> project with it, then I set <code>cors</code> middleware and it works perfectly, one thing is so important to me, that prevent open route with <code>GET</code> method in browser directly, I don't know...
<p>in this case will recommend to look towards the next solution:</p> <pre class="lang-php prettyprint-override"><code>function handle(\Illuminate\Http\Request $request, \Closure $next) { $allowedList = env('allowed_user_agents'); if (! in_array($request-&gt;userAgent(), $allowedList, true)) { return re...
Laravel prevent open route in browser
php|reactjs|laravel|axios
0
61
1
72,820,404
72,820,404
2
true
2022-06-30T18:13:06.323Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Laravel prevent open route in browser<p>I'm very new to <code>laravel</code> and created my first <code>REST api</code> project with it, then I set <code>cor...
73,002,351
Rendering nested components<p>I am starting to learn VueJS by building a simple website.<br /> Right now I have made three components:</p> <ul> <li>Header</li> <li>Navigation</li> <li>Topbar</li> </ul> <p>I want to render navigation and topbar inside header, so I can call the header component inside every page (I haven...
<p>Since the question is tagged with a Nuxt tag, I'll recommend looking into Nuxt layouts: <a href="https://nuxtjs.org/docs/concepts/views#layouts" rel="nofollow noreferrer">https://nuxtjs.org/docs/concepts/views#layouts</a></p> <p>There is a default named <code>default</code> that you could use by creating the file <c...
Rendering nested components
vue.js|components|nuxt.js
1
61
2
73,002,594
73,002,594
2
true
2022-07-16T07:24:44.243Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rendering nested components<p>I am starting to learn VueJS by building a simple website.<br /> Right now I have made three components:</p> <ul> <li>Header</l...
72,995,348
Python - Trying to print metadata into a table<p>I have a python script that gets the meta data of photos and prints it out into a text file for now however I'd like to print it into a table that look like that</p> <pre><code>| Filename | DPI | Height | Width | Format | Mode | Frames | </code></pre> <p>Here is the scri...
<p>You can change your second <code>for</code> loop to print it horizontally:</p> <pre><code>newfile.write(&quot;Filename | Image DPI | ...\n&quot;) for file in os.listdir(rootdir): # read the image data using PIL image = Image.open(os.path.join(rootdir, file)) # extract other basic metadata info...
Python - Trying to print metadata into a table
python
2
61
2
72,995,458
72,995,458
2
true
2022-07-15T14:12:29.467Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python - Trying to print metadata into a table<p>I have a python script that gets the meta data of photos and prints it out into a text file for now however ...
72,977,833
How to properly wait for completion when having forked TPL Dataflow pipeline?<p>I have a TPL Dataflow pipeline where a target block is linked to two propagating blocks, which are then both linked to a source block. All are linked with <code>PropagateCompletion = true</code>. The first propagating block is linked with a...
<p>There is a diamond in your dataflow graph that causes the completion to propagate faster by either of two branches making the final block complete prematurely.</p> <p>The completion of the last block can be customized using a task continuation:</p> <pre class="lang-cs prettyprint-override"><code> ... ...
How to properly wait for completion when having forked TPL Dataflow pipeline?
c#|tpl-dataflow
3
61
3
72,978,142
72,978,142
2
true
2022-07-14T08:54:34.110Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to properly wait for completion when having forked TPL Dataflow pipeline?<p>I have a TPL Dataflow pipeline where a target block is linked to two propagat...
72,836,439
Multithreaded use of a single QP vs multiple QPs to improve throughput<p>I am using RDMA writes in my application and want to improve throughput.</p> <p>Currently, I have a single thread using my queue pair. I was wondering, what is a more standard way (or what are the advantages of each):</p> <ol> <li>Creating more co...
<p>All libibverbs APIs are thread-safe, so having multiple threads post to a single QP is obviously not a safety issue. That said, the concurrency is being handled somewhere along the stack, and it may have synchronization costs that outweigh the threading benefits.</p> <p>In general, having a QP per core should be mor...
Multithreaded use of a single QP vs multiple QPs to improve throughput
infiniband|rdma
2
61
1
72,946,513
72,946,513
2
true
2022-07-02T04:27:24.863Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Multithreaded use of a single QP vs multiple QPs to improve throughput<p>I am using RDMA writes in my application and want to improve throughput.</p> <p>Curr...
73,004,604
How to apply array formula taking data from another table?<p>We have two tables in Google Sheets.</p> <p>First:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Date</th> <th>Amount</th> <th>Currency</th> <th>Worth</th> </tr> </thead> <tbody> <tr> <td>01.01.2021</td> <td>100</td> <td>USD</td...
<p>Use <code>VLOOKUP</code> to find the correct date row and <code>MATCH</code> to find which column the value is in:</p> <pre><code>=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A,I2:L,MATCH(C2:C,I1:L1,0))*B2:B)) </code></pre> <p><a href="https://i.stack.imgur.com/Bv9gm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgu...
How to apply array formula taking data from another table?
google-sheets
1
61
2
73,004,975
73,004,975
2
true
2022-07-16T13:28:45.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to apply array formula taking data from another table?<p>We have two tables in Google Sheets.</p> <p>First:</p> <div class="s-table-container"> <table cl...
72,842,263
Gradle implementations not working with JavaFX<p>I am trying to do some fun Java projects on the side to get better at coding. Currently, I'm trying to do an offline, local password manager with JavaFX and Gradle.</p> <p>I wanted a way to hash a password, for security, and then store it in a file. Previously, I used <a...
<p>You have modular project, so you need to include the following line in your <code>module-info.java</code> file to access the guava API:</p> <pre><code>requires com.google.common; </code></pre> <p>With current guava distributions (31.1-jre), this module name is defined inside the jar file in the <code>META-INF/MANIFE...
Gradle implementations not working with JavaFX
java|gradle|intellij-idea|javafx|guava
1
61
1
72,842,528
72,842,528
2
true
2022-07-02T20:35:19.717Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Gradle implementations not working with JavaFX<p>I am trying to do some fun Java projects on the side to get better at coding. Currently, I'm trying to do an...
72,878,182
how do I stop a function to iterate through all items in a list<p>I am writing a simple word guessing game in python. Instead of using a list, I have all the words for the game in a <code>.txt</code> file called as the parameter of a function. The list itself is fine.</p> <p>The game requires the user to enter a letter...
<p>few ideas:</p> <ul> <li>make a loop over your &quot;tries&quot; - the player can play until that is 0</li> <li>the player has to provide the letter inside this loop</li> <li>check for the letter provided by the player using</li> </ul> <pre><code>if ans in word </code></pre> <p>Here is my suggestion:</p> <pre><code>...
how do I stop a function to iterate through all items in a list
python|list|variables
0
61
3
72,878,337
72,878,337
2
true
2022-07-06T05:07:37.880Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how do I stop a function to iterate through all items in a list<p>I am writing a simple word guessing game in python. Instead of using a list, I have all the...
72,817,892
conditional rendering to display in React<p><a href="https://i.stack.imgur.com/Orgpd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Orgpd.png" alt="enter image description here" /></a></p> <p>I wanted to display badge/text after which condition is met from two conditions. First condition is that if ...
<p>The JSX being returned does not include the JSX in your <code>if</code>/<code>else</code> statement. It needs to be part of the JSX that's returned in order for it to show up.</p> <p>You could use ternary expressions to do it like this (add this to the JSX after your <code>return</code> statement, put it wherever yo...
conditional rendering to display in React
javascript|reactjs
1
61
3
72,817,961
72,817,961
2
true
2022-06-30T14:52:11.180Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: conditional rendering to display in React<p><a href="https://i.stack.imgur.com/Orgpd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Orgpd...
72,931,469
In a List, get "team" from a player in "all_players" without the "name"<p>my question is about this list that i have. In the list are 2 things: &quot;meta-data&quot; and &quot;players&quot; in &quot;players&quot; is &quot;all_players&quot;. Now i want to get the Player Name and Player Team but i dont know how i can do ...
<p>Here's a way to do what your question asks:</p> <pre class="lang-py prettyprint-override"><code>all_players = data[&quot;data&quot;][0][&quot;players&quot;][&quot;all_players&quot;] playerNames = [player[&quot;name&quot;] for player in all_players] teamNames = [player[&quot;team&quot;] for player in all_players] tea...
In a List, get "team" from a player in "all_players" without the "name"
python
2
61
1
72,931,559
72,931,559
2
true
2022-07-10T19:54:08.340Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In a List, get "team" from a player in "all_players" without the "name"<p>my question is about this list that i have. In the list are 2 things: &quot;meta-da...
72,859,137
imagemagick trim the bottom from transparent PNG<p>I am attempting to write an imagemagick command to trim the transparent pixels from the bottom of a transparent PNG. <a href="http://www.fmwconcepts.com/imagemagick/tidbits/image.php#trim_2sides" rel="nofollow noreferrer">I found these commands</a> and modified them to...
<p>If you're trying to remove what a &quot;-trim&quot; would remove, but only from the bottom edge of an image, this command should give you that result...</p> <pre><code>convert input.png -background none -set page %[@] \ -set option:distort:viewport %[w]x%[fx:page.y+page.height] \ +repage -distort SRT 0 result....
imagemagick trim the bottom from transparent PNG
php|imagemagick|imagemagick-convert
0
61
1
72,863,921
72,863,921
2
true
2022-07-04T15:33:58.220Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: imagemagick trim the bottom from transparent PNG<p>I am attempting to write an imagemagick command to trim the transparent pixels from the bottom of a transp...
72,859,905
Deduping an array of objects with similar datetimes<p>I am trying to dedupe an array of JSON objects where the content and author are the same, but the timestamp is slightly different (i.e. within 1 second). I'd like to preserve the duplicated messages as a new field, called duplicates. For example, consider the foll...
<p>I've done that, but I use a sort...</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 getTimeMs = YMDhmsx =&gt; // date string conversion to UTC (time zone = 0) ...
Deduping an array of objects with similar datetimes
javascript|arrays|json|datetime|lodash
3
61
1
72,860,578
72,860,578
2
true
2022-07-04T16:51:17.427Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Deduping an array of objects with similar datetimes<p>I am trying to dedupe an array of JSON objects where the content and author are the same, but the times...
72,963,649
Unity how to get component reference on instantiated object<pre><code>var playedCard = Instantiate(Cards[selectedCard], spawnLoc[gameQueue - 1], Quaternion.identity); </code></pre> <p>How can i get reference to playedCard's SpriteRenderer?</p>
<p>Considering Cards[selectedCard] holds a reference to a GameObject, you can go with</p> <pre><code>var sp = playedCard.GetComponent&lt;SpriteRenderer&gt;(); </code></pre> <p>Or if Cards is an array of SpriteRenderer itself, Instantiate should return a new GameObject via its spriteRenderer Reference (you may need to a...
Unity how to get component reference on instantiated object
unity3d|instantiation|game-development|gameobject
0
61
1
72,963,754
72,963,754
2
true
2022-07-13T09:06:23.597Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unity how to get component reference on instantiated object<pre><code>var playedCard = Instantiate(Cards[selectedCard], spawnLoc[gameQueue - 1], Quaternion.i...
72,944,749
SingleChildScrollView does not scroll on iOS<p>I do compile and debug my current Flutter app using native MacOS. Works fine.</p> <p>If I compile to web, upload it to a web server and test it on <strong>iOS Safari or iOS Chrome</strong>, a <code>SingleChildScrollView</code> with a <code>ListView.builder</code> as child ...
<p>Add this to listview</p> <p><code>physics : const NeverScrollableScrollPhysics(),</code></p> <p>Since listview and SingleChildScrollView both have scroll it doesnt work as expected. If you stop the listview scroll then it should let SingleChildScrollView scroll as expected</p>
SingleChildScrollView does not scroll on iOS
flutter|flutter-layout|flutter-web
0
61
1
72,944,790
72,944,790
2
true
2022-07-11T21:15:21.047Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SingleChildScrollView does not scroll on iOS<p>I do compile and debug my current Flutter app using native MacOS. Works fine.</p> <p>If I compile to web, uplo...
72,798,064
Indicate variable values from side-effects with Python type hinting<p>With type-hinting in Python 3.9, once an <code>isinstance</code> call is made in an if-statement, the typing interpreter knows the variable type. For example:</p> <pre><code>if isinstance(value, int): value += 1 # &lt;-- known to be an int </cod...
<p>Since the implementation of <a href="https://peps.python.org/pep-0647/" rel="nofollow noreferrer">PEP 647</a> in Python 3.10, you can use <code>typing.TypeGuard</code> for this:</p> <blockquote> <p>Using <code>-&gt; TypeGuard</code> tells the static type checker that for a given function:</p> <ol> <li><p>The return ...
Indicate variable values from side-effects with Python type hinting
python|python-typing
2
61
1
72,799,316
72,799,316
3
true
2022-06-29T08:20:58.207Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Indicate variable values from side-effects with Python type hinting<p>With type-hinting in Python 3.9, once an <code>isinstance</code> call is made in an if-...
72,798,358
How to determine which character is used as decimal separator (radix point) or thousand separator, under current locale?<p>Comming from <a href="https://stackoverflow.com/a/72796093/1765658">this answer to <em><code>Format currency in Bash</code></em></a>, I wonder for ways to determine which characters are used as num...
<p>You can get the locale's <strong>radix character</strong> (decimal separator) with:</p> <pre><code>printf -v ds '%#.1f' 1 ds=${ds//[0-9]} </code></pre> <p>And the <strong>thousands grouping separator</strong>, with:</p> <pre><code>printf -v ts &quot;%'d&quot; 1111 ts=${ts//1} </code></pre> <p>Some locales (eg. <code...
How to determine which character is used as decimal separator (radix point) or thousand separator, under current locale?
bash|locale|number-formatting
1
61
1
72,800,369
72,800,369
3
true
2022-06-29T08:42:12.870Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to determine which character is used as decimal separator (radix point) or thousand separator, under current locale?<p>Comming from <a href="https://stac...