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,282,082 | Is there a way to get position_jitterdodge in ggplot2 to sort by two categorical variables when using two data sets?<p>I'm trying to make a jittered boxplot from a data set with one continuous variable and two categorical variables. I've separated the data into two data frames because I don't want the means of data fra... | <p>I think the issue is that <code>df.2</code> has incomplete factor levels in field <code>b</code>. I'd suggest keeping your data together but structuring it in long format (this is what ggplot prefers).</p>
<pre><code>df.1$grp <- "1"
df.2$grp <- "2"
df <- rbind(df.1, df.2)
ggplot(data = ... | Is there a way to get position_jitterdodge in ggplot2 to sort by two categorical variables when using two data sets? | r|ggplot2 | 2 | 53 | 1 | 72,292,039 | 72,292,039 | 2 | true | 2022-05-18T00:40:07.123Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to get position_jitterdodge in ggplot2 to sort by two categorical variables when using two data sets?<p>I'm trying to make a jittered boxplot ... |
72,259,583 | Unable to resolve dead simple configuration dependency<p>I am trying to set up dependency injection in a small blazor-based web app.</p>
<p>My current code is:</p>
<pre><code>var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServer... | <p>By default, a call to <code>services.Configure</code> will only allow injecting an <code>IOption<BigQuerySettings></code> into your consumers.</p>
<p>If, however, you wish to inject <code>BigQuerySettings</code> directly into your consumer (which I would argue <a href="https://docs.simpleinjector.org/en/latest... | Unable to resolve dead simple configuration dependency | asp.net|dependency-injection|blazor-server-side|appsettings | 0 | 53 | 1 | 72,259,750 | 72,259,750 | 2 | true | 2022-05-16T12:55:48.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to resolve dead simple configuration dependency<p>I am trying to set up dependency injection in a small blazor-based web app.</p>
<p>My current code i... |
72,361,271 | Hover over class and modify another class<p>I have a grid layout which inside is a sidebar with (64px) width,
the grid :</p>
<pre><code>.container {
display: grid;
height: 100vh;
width: 100vw;
grid-template-areas:
"sidebar header"
"sidebar content"
"footer footer";
gr... | <p>Other commenters are correct, you can't change the parent from the child. But you can make the parent adapt to the child and just modify the child width.</p>
<pre><code> grid-template-columns: auto auto;
</code></pre>
<p>Snippet here based on your code: <a href="https://codepen.io/29b6/pen/wvypzGq" rel="nofollow no... | Hover over class and modify another class | html|css | 0 | 53 | 1 | 72,397,796 | 72,397,796 | 2 | true | 2022-05-24T10:26:05.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hover over class and modify another class<p>I have a grid layout which inside is a sidebar with (64px) width,
the grid :</p>
<pre><code>.container {
displa... |
72,313,483 | The service variable is not read in a method running in another thread<p>The Spring application In the service spins an endless cycle</p>
<pre><code>@Service
public class MyService {
public boolean isStart = false;
@Async("threadPoolTaskExecutor")
public void sending() {
while (is... | <p>The problem is that <code>@Async</code> triggers the creation of a <code>proxy</code>, so when you mutate the variable directly, the proxy doesn't intercept that call.</p>
<p>Create a <code>setter</code> for the <code>isStart</code> property and it'll work.</p>
<p>This application works as expected with the setter. ... | The service variable is not read in a method running in another thread | java|spring|spring-async | 0 | 53 | 1 | 72,313,709 | 72,313,709 | 3 | true | 2022-05-20T04:05:19.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The service variable is not read in a method running in another thread<p>The Spring application In the service spins an endless cycle</p>
<pre><code>@Service... |
72,344,324 | bash delete rows contains more than three times<p>I have this file with some with millions of lines, I should delete with bash all lines that contain more than three times the word "..Nessuna Risposta" for row.</p>
<p>For example: in this output I should delete rows "1003", "1084" and &quo... | <p>Using <code>grep</code></p>
<pre><code>$ grep -v '\([^.]*\.Nessuna Risposta\)\{3,\}' input_file
1095;N.Nuovo;4;327;;327001951;Poliambulatori;02102019;1.F;59;2.SCUOLA OBBLIGO;1.ITALIANA;1.Telefonicamente;5;5;5;5;7;6;6;7;6;6;6
1119;N.Nuovo;4;327;;327001951;Laboratorio;03102019;2.M;30;3.SCUOLA SUP;1.ITALIANA;2.Allo sp... | bash delete rows contains more than three times | bash|grep|contains|delete-row|morelikethis | 1 | 53 | 1 | 72,344,514 | 72,344,514 | 3 | true | 2022-05-23T06:54:25.733Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
bash delete rows contains more than three times<p>I have this file with some with millions of lines, I should delete with bash all lines that contain more th... |
72,367,342 | Selecting items on a matrix based on indexes given by an array<p>Consider this matrix:</p>
<pre><code>[0.9, 0.45, 0.4, 0.35],
[0.4, 0.8, 0.3, 0.25],
[0.5, 0.45, 0.9, 0.35],
[0.2, 0.18, 0.8, 0.1],
[0.6, 0.45, 0.4, 0.9]
</code></pre>
<p>and this list:</p>
<pre><code>[0,1,2,3,3]
</code></pre>
<p>I want to create a list th... | <p>Zip the two lists together as below</p>
<pre><code>a=[[0.9, 0.45, 0.4, 0.35],[0.4, 0.8, 0.3, 0.25],[0.5, 0.45, 0.9, 0.35],[0.2, 0.18, 0.8, 0.1],[0.6, 0.45, 0.4, 0.9]]
b=[0,1,2,3,3]
[i[j] for i,j in zip(a,b)]
</code></pre>
<p>Result</p>
<pre><code>[0.9, 0.8, 0.9, 0.1, 0.9]
</code></pre>
<p>This basically pairs up eac... | Selecting items on a matrix based on indexes given by an array | python|arrays|list | 4 | 53 | 4 | 72,367,390 | 72,367,390 | 3 | true | 2022-05-24T17:51:01.323Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Selecting items on a matrix based on indexes given by an array<p>Consider this matrix:</p>
<pre><code>[0.9, 0.45, 0.4, 0.35],
[0.4, 0.8, 0.3, 0.25],
[0.5, 0.... |
72,368,222 | How to combine string with the previous one based on condition?<p>I have a text file of messages in the form:</p>
<pre class="lang-py prettyprint-override"><code>with open(code_path) as f:
contents = f.readlines()
print(contents)
['22/05/2022, 21.58 - Name: message1 \n',
'22/05/2022, 22.07 – Name2: message2\n',
... | <p>A basic approach would be to use a kind of cache: go through the lines,</p>
<ul>
<li>if the line starts with a date, append a new item to the cache</li>
<li>if it doesn't, append to the most recent item.</li>
</ul>
<pre class="lang-py prettyprint-override"><code>messages = []
for line in contents:
if re.match(r'... | How to combine string with the previous one based on condition? | python|regex|list|text | 0 | 53 | 2 | 72,368,347 | 72,368,347 | 3 | true | 2022-05-24T19:06:13.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to combine string with the previous one based on condition?<p>I have a text file of messages in the form:</p>
<pre class="lang-py prettyprint-override"><... |
72,326,895 | How to implement a Search inside a Nested Array of Objects?<p>I want to implement a keyword search for a field which is located inside Nested Array of Objects. How can I achieve it?</p>
<p>Data -</p>
<pre><code>const groupList = [{
"group_name": "General",
"trainings": [
{
&q... | <p>Assuming you want to keep the group object if the <code>searchKeyword</code> is contained within the group name OR one of the training name objects, you can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some" rel="nofollow noreferrer"><code>.some()</code></a>. By... | How to implement a Search inside a Nested Array of Objects? | javascript|reactjs | 2 | 53 | 3 | 72,326,947 | 72,326,947 | 3 | true | 2022-05-21T05:25:24.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to implement a Search inside a Nested Array of Objects?<p>I want to implement a keyword search for a field which is located inside Nested Array of Object... |
72,315,877 | How to check if a really big number is a continuous sum from 1?<p>I am trying to solve this problem: check if the element of an array is a continuous sum from 1. Input Q (length of array, 1≤Q≤10^3), then Input elements based on length (1≤N[i]≤10^18).
Example: 6=1+2+3 print Yes. 10=1+2+3+4 print Yes. 5=2+3 print No caus... | <p>Math works here. You can use the quadratic equation solution.
The sum of first N natural numbers is n*(n+1)/2.
So basically</p>
<pre><code>⇾ 1 + 2 + 3 + …. N = S
⇾ (N * (N + 1)) / 2 = S
⇾ N * (N + 1) = 2 * S
⇾ N2 + N – 2 * S = 0
</code></pre>
<p>We know your s here so just solve the quadratic equation.
Something... | How to check if a really big number is a continuous sum from 1? | java|arrays|sum | 0 | 53 | 1 | 72,316,240 | 72,316,240 | 3 | true | 2022-05-20T08:34:50.097Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check if a really big number is a continuous sum from 1?<p>I am trying to solve this problem: check if the element of an array is a continuous sum fro... |
72,399,564 | python - Conway's Game of Life bug at calculating neighbors, and therefore gets wrong results<p>I'm trying to built 'Conway's Game of Life' but for some reason the number of neighbors are not calculated correctly, therefore I gets wrong results. please help me:)</p>
<p>I'm pretty lost I don't know what's wrong...</p>
<... | <p>In the series of <code>if</code> and <code>elif</code>s, at most one of them will get executed, which means <code>neighbors</code> is either 0 or 1.</p>
<p>You may replace <code>elif</code>s with <code>if</code>s, but I would recommend at least using some loops to simplify the code:</p>
<pre class="lang-py prettypri... | python - Conway's Game of Life bug at calculating neighbors, and therefore gets wrong results | python|debugging|conways-game-of-life|neighbours | 0 | 53 | 1 | 72,399,638 | 72,399,638 | 3 | true | 2022-05-27T01:26:42.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
python - Conway's Game of Life bug at calculating neighbors, and therefore gets wrong results<p>I'm trying to built 'Conway's Game of Life' but for some reas... |
72,347,496 | Can't read from user after using exec <file to read from file<p>I have the following code</p>
<pre><code>#!/bin/bash
declare -i max
exec < lista.csv
read header
max=0
while IFS=, && read -r id _ _ _ _ _
do
if [ "$id" -gt "$max" ]
then
max=$id
fi
done
((id=max+1))
read ... | <p>The <code>exec</code> command redirects standard input for the remainder of the script, so all the <code>read</code> commands end up reading from your file handle, which is quickly starting to return empty lines when all the data in the file is consumed.</p>
<p>You also want to avoid resetting IFS for the remainder ... | Can't read from user after using exec <file to read from file | bash|shell | 1 | 53 | 1 | 72,347,676 | 72,347,676 | 3 | true | 2022-05-23T11:04:59.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't read from user after using exec <file to read from file<p>I have the following code</p>
<pre><code>#!/bin/bash
declare -i max
exec < lista.csv
read ... |
72,240,204 | "Cannot borrow `*arr` as immutable because it is also borrowed as mutable" in a function call<p>Please someone explain the code below and how can it be unsafe and why is borrowchecker complaining here? I am very new to rust and I come from a little bit of c/c++ background.</p>
<pre><code>fn test(a: &mut [i32], plac... | <p>The problem occurs because you are trying to do two different things to <code>values</code> in two different argument positions and the current Rust implementation is not smart enough to determine that this use case is not problematic.</p>
<p>You can fix this by doing this instead:</p>
<pre><code>fn test(a: &mut... | "Cannot borrow `*arr` as immutable because it is also borrowed as mutable" in a function call | rust|borrow-checker | 1 | 53 | 1 | 72,240,307 | 72,240,307 | 4 | true | 2022-05-14T12:29:31.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
"Cannot borrow `*arr` as immutable because it is also borrowed as mutable" in a function call<p>Please someone explain the code below and how can it be unsaf... |
72,265,245 | What causes this bug to be non-deterministic<p>Recently, I wrote the following, buggy, c code:</p>
<pre class="lang-c prettyprint-override"><code>#include <stdio.h>
struct IpAddr {
unsigned char a, b, c, d;
};
struct IpAddr ipv4_from_str (const char * str) {
struct IpAddr res = {0};
sscanf(str, "%d.%... | <p>Undefined behavior means that anything can happen, even inconsistent results.</p>
<p>In practice, this inconsistency is most likely due to <a href="https://www.techtarget.com/searchsecurity/definition/address-space-layout-randomization-ASLR" rel="nofollow noreferrer">Address Space Layout Randomization</a>. Depending... | What causes this bug to be non-deterministic | c|memory | 4 | 53 | 1 | 72,265,446 | 72,265,446 | 4 | true | 2022-05-16T20:27:52.853Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What causes this bug to be non-deterministic<p>Recently, I wrote the following, buggy, c code:</p>
<pre class="lang-c prettyprint-override"><code>#include &l... |
72,367,208 | Is it possible to run worksheet functions on arrays rather than cell ranges?<p>For example, instead of finding standard deviation for the range of cells in the example below, is it possible to apply this same function to the elements of an array?</p>
<p>I could copy all the array elements to a working sheet, but hoping... | <p>Yes, <code>StDev</code> can be used with arrays.</p>
<p>1-D array:</p>
<pre><code>Dim x As Variant
x = Array(1, 2, 3, 4)
Debug.Print WorksheetFunction.StDev(x) ' returns 1.29099444873581
</code></pre>
<p>2-D array:</p>
<pre><code>Dim x As Long
ReDim x(1 To 10, 1 To 10)
Dim i As Long, j As Long
For i = 1 To... | Is it possible to run worksheet functions on arrays rather than cell ranges? | excel|vba|worksheet-function | -1 | 53 | 2 | 72,367,268 | 72,367,268 | 4 | true | 2022-05-24T17:39:02.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to run worksheet functions on arrays rather than cell ranges?<p>For example, instead of finding standard deviation for the range of cells in t... |
72,296,493 | Add the number of columns that have a value above a certain value pandas<p>Assuming I have the following toy model, <code>df</code>:</p>
<pre><code>product customer1 customer2 customer3
apple 40 110 120
banana 200 150 180
coconut 10 ... | <p>Try this</p>
<pre><code>df = pd.DataFrame({'product': ['apple', 'banana', 'coconut', 'daq', 'eclair'],
'customer1': [40, 200, 10, 120, 45],
'customer2': [110, 150, 5, 10, 190],
'customer3': [120, 180, 25, 30, 35]})
# among the customer columns, count the num... | Add the number of columns that have a value above a certain value pandas | python|pandas | 0 | 53 | 2 | 72,296,548 | 72,296,548 | 5 | true | 2022-05-18T22:02:58.167Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add the number of columns that have a value above a certain value pandas<p>Assuming I have the following toy model, <code>df</code>:</p>
<pre><code>product ... |
72,341,654 | When does a change to TextContent get displayed?<p>I'm working on Rock/Paper/Scissors game for the Odin Project. I display the result of a game in a div resultMsg, and a running tally based on that result in countMsg. Both those items are divs in the HTML and they work correctly. After a total of 5 games are won or los... | <p><code>alert()</code> will block the current script execution, but it seems to also blocks the DOM update. That's why even though the assignement to textContent is before the alert, the text is only shown after the alert has been clicked, and the execution has resumed.</p>
<p>You can use a very small setTimeout to al... | When does a change to TextContent get displayed? | javascript|uitextcontenttype | 1 | 53 | 1 | 72,341,742 | 72,341,742 | 5 | true | 2022-05-22T22:17:13.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When does a change to TextContent get displayed?<p>I'm working on Rock/Paper/Scissors game for the Odin Project. I display the result of a game in a div resu... |
72,396,311 | With python; Getting index of wrong item of list<p>I'm trying to get the indeces of the items of my list but on one item it returns a wrong index. There are two numbers who are the same in the list, maybe it confuses it with the first one.</p>
<p>The list is: [0,1,0,0,0,0,0,0,0,0,6,1,0]</p>
<pre><code>for i in neu:
... | <p>Use enumerate:</p>
<pre class="lang-py prettyprint-override"><code>for i, value in enumerate(neu):
if (value > 0):
zahl = i + 7
print(zahl)
browser.find_element_by_xpath("//*[@id='tabelle_merkliste']/tbody/tr['zahl']/td[10]/img")
print("found")
</code></pre> | With python; Getting index of wrong item of list | python|indexing | -3 | 53 | 1 | 72,396,429 | 72,396,429 | -1 | true | 2022-05-26T18:16:25.333Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
With python; Getting index of wrong item of list<p>I'm trying to get the indeces of the items of my list but on one item it returns a wrong index. There are ... |
72,981,129 | Django : retrieve data from models<p>I have a serious problem, I need to retrieve a query set from an unrelated model</p>
<p>my model:</p>
<pre><code># problem/models.py
User = get_user_model()
class Problem(models.Model):
name = models.CharField(max_length=50)
description = models.CharField(max_length=1000)
... | <p>If I'm understanding your question correctly, what you're trying to do isn't possible in your current code. If you want to pull back all <code>Submission</code> objects filtered by a specific <code>Contest</code> id, you'll need to connect the two.</p>
<p>For instance, here's an example of what the call should be:</... | Django : retrieve data from models | python|django|django-models|django-queryset|django-orm | 1 | 53 | 1 | 72,981,531 | 72,981,531 | 1 | true | 2022-07-14T13:14:24.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django : retrieve data from models<p>I have a serious problem, I need to retrieve a query set from an unrelated model</p>
<p>my model:</p>
<pre><code># probl... |
72,949,485 | How to amalgamate an array of Nodelists into a single array<p>I have a function that takes elements from the DOM to update a db on button click. Currently, there is one id for one value...</p>
<pre><code> <input class='total' doc-id='12345678' value='${whateverCurrent.value}'>user updates</field>
<input... | <p>I'm not really sure if this is what you're looking for. Can you be more specific in what the updateDoc function expects as arguments?</p>
<p>Anyway, I coded something that collects all the quarterly values per doc-id and produces an object of following form:</p>
<pre><code>{
1234 :
{
q1 : 7
q2 : 9
},
... | How to amalgamate an array of Nodelists into a single array | javascript|arrays|nodelist | 0 | 53 | 1 | 72,950,582 | 72,950,582 | 1 | true | 2022-07-12T08:50:04.777Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to amalgamate an array of Nodelists into a single array<p>I have a function that takes elements from the DOM to update a db on button click. Currently, t... |
72,995,966 | How to find filenames with a specific extension using regex?<p>How can I grab 'dlc3.csv' & 'spongebob.csv' from the below string via the absolute quickest method - which i assume is regex?</p>
<pre><code>4918, fx,fx,weapon/muzzleflashes/fx_m1carbine,3.3,3.3,|sp/zombie_m1carbine|weapon|../zone_source/dlc3.csv|csv|.... | <p>You can use this pattern: <code>[^/]*\.csv</code></p>
<p>Breakdown:</p>
<ul>
<li><code>[^/]</code> - Any character that's not a forward slash (or newline)
<ul>
<li><code>*</code> - Zero or more of them</li>
</ul>
</li>
<li><code>\.</code> - A literal dot. (This is necessary because the dot is a special character in ... | How to find filenames with a specific extension using regex? | python|regex | -3 | 53 | 1 | 72,996,391 | 72,996,391 | 1 | true | 2022-07-15T15:01:33.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to find filenames with a specific extension using regex?<p>How can I grab 'dlc3.csv' & 'spongebob.csv' from the below string via the absolute quickes... |
72,846,665 | How to enter value when radio input is selected?<p>I have a line of code for custom radio <code>input</code> like this.
When selecting a radio the function will enter a random phone number into the hyperlink button, this works fine.</p>
<p>But how do you make a phone number non-randomized? So that I want to make in ord... | <p>You need to put your <code>switch</code> case inside a <code>select</code> change handler
and change your random <code>phoneNumber</code> function into that <code>switch</code> case</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre cl... | How to enter value when radio input is selected? | javascript|html | 1 | 53 | 1 | 72,846,730 | 72,846,730 | 1 | true | 2022-07-03T12:52:18.973Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to enter value when radio input is selected?<p>I have a line of code for custom radio <code>input</code> like this.
When selecting a radio the function w... |
72,943,952 | Sibling Selectors not working correctly with Emotion<p>I have the following code:</p>
<pre><code>const CardContainer = styled(Flex)`
flex-direction: column;
padding: 12px;
width: 100%;
max-width: 450px;
height: auto;
border-radius: 32px;
overflow: hidden;
z-index: 1;
background: rgba(218, 228, 242);
... | <p>You need to do this instead:</p>
<pre><code>& + ${() => CardContainer} {
transform: translateX(var(--distance));
}
</code></pre>
<p>Also your <code>import styled from "@emotion/styled</code> has to be <code>import styled from "@emotion/styled/macro</code> in order to support the above.</p>
<p><str... | Sibling Selectors not working correctly with Emotion | reactjs|styled-components|emotion|css-in-js | 0 | 53 | 1 | 72,944,555 | 72,944,555 | 1 | true | 2022-07-11T19:52:59.497Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sibling Selectors not working correctly with Emotion<p>I have the following code:</p>
<pre><code>const CardContainer = styled(Flex)`
flex-direction: column... |
72,777,402 | Type 'string' is not assignable to type 'never' in obj[key]<p>Help me, please. I don't understand what's wrong.
I have a function that edits a form. I tried to set the param value of function "editCloneStateForm" type <code>typeof this.form</code>
but it doesn't work too. My code:</p>
<pre><code>editCloneStat... | <h1>Updated answer</h1>
<p>The original answer would allow you to add any key to your object which might be something you want to avoid, you might only want those specific key/value pairs.</p>
<p>This would keep your interface strict to the specified keys:</p>
<pre><code>editCloneStateForm(value: string, key: IServiceD... | Type 'string' is not assignable to type 'never' in obj[key] | typescript | 2 | 53 | 1 | 72,777,796 | 72,777,796 | 1 | true | 2022-06-27T19:26:27.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Type 'string' is not assignable to type 'never' in obj[key]<p>Help me, please. I don't understand what's wrong.
I have a function that edits a form. I tried ... |
73,006,871 | How to open(), read() and write() contents of file from input?<p>I need to read contents from a file whose name is passed when executing the program, and I have no idea how to do it. I can only use the functions <code>open()</code>, <code>read()</code>, and <code>write()</code>. How can I do it in an easy way that I ca... | <blockquote>
<p>How can I do it in an easy way that I can understand?</p>
</blockquote>
<p>This part of the question makes writing an answer a bit tricky. All I can do is show you how it is done usually - using the depicted set of functions. And leave the second part (whether you can understand it) to your own judgemen... | How to open(), read() and write() contents of file from input? | c | -3 | 53 | 1 | 73,007,309 | 73,007,309 | 1 | true | 2022-07-16T18:50:49.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to open(), read() and write() contents of file from input?<p>I need to read contents from a file whose name is passed when executing the program, and I h... |
72,817,572 | How to remove duplicate values based on another column?<p>I have a dataset that looks like this:</p>
<pre><code> Study_ID Stage
1 100 Early Stage
2 100 Stable
3 200 Stable
4 300 Early Stage
5 400 Early Stage
6 400 Stable
7 500 Early Stage
8 500 ... | <p>You can use the following code:</p>
<pre class="lang-r prettyprint-override"><code>data<-data.frame(Study_ID=c("100","100","200","300","400","400","500","500","600","700"),Stage=c("Early Stage","Stab... | How to remove duplicate values based on another column? | r|duplicates|subset | 0 | 53 | 3 | 72,817,695 | 72,817,695 | 1 | true | 2022-06-30T14:28:28.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove duplicate values based on another column?<p>I have a dataset that looks like this:</p>
<pre><code> Study_ID Stage
1 100 Early Sta... |
73,013,437 | Clickable divs not working with javascript<p>I want my divs to run a function when clicking them but they dont seem to want to do anything. I am new to javascript and the function I am trying to run is just a test. Please check it out and tell me what needs to be changed and anything wrong with the rest of the code.</p... | <p>by using <code>querySelectorAll()</code>, you are selecting all the html elements that are <code><weapons></weapons></code> and such. instead of selecting using the tag name, set them all to the same class, e.g</p>
<pre><code><div class='weapons'>...</div>
</code></pre>
<p>and doing <code>get... | Clickable divs not working with javascript | javascript | 1 | 53 | 2 | 73,013,463 | 73,013,463 | 1 | true | 2022-07-17T16:17:54.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Clickable divs not working with javascript<p>I want my divs to run a function when clicking them but they dont seem to want to do anything. I am new to javas... |
72,916,007 | The separator in pandas.read_csv() does not separate<p>Good afternoon! <br/>
I have a .csv file like this (when opened with Notepad):</p>
<pre><code>"2,"" Lorem ipsum dolor sit amet, consectetur adipiscing elit.
"""
"2,"" Proin a tortor leo. Morbi dictum laoreet nulla sit am... | <p>You can iterate over the lines and try <code>parts = s.split(',""', 1)</code> to split the input into 2 values and strip the bogus "" from the Review column value.</p>
<p>Assuming the format of each line in your "CSV" file is the same then you can parse the file like this.</p>
<pre cla... | The separator in pandas.read_csv() does not separate | python|python-3.x|pandas|csv | 0 | 53 | 1 | 72,916,267 | 72,916,267 | 1 | true | 2022-07-08T19:11:19.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The separator in pandas.read_csv() does not separate<p>Good afternoon! <br/>
I have a .csv file like this (when opened with Notepad):</p>
<pre><code>"2,... |
72,784,783 | Why is my np.arccos not working in my for loop?<p>I have a for loop with a formula whit gives the following error:</p>
<pre><code> RuntimeWarning: invalid value encountered in arccos
test3[i] = np.arccos(temp.x[i])
</code></pre>
<p>If I perform the formula withouth the np.arccos, it works. Does anyone know why the np... | <p><code>arccos</code> only takes values between -1 and 1 inclusive because otherwise you fall afoul of the range of the <code>cos</code> function.</p>
<p><a href="https://i.stack.imgur.com/bMdb1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bMdb1.png" alt="arccos" /></a> <a href="https://commons.w... | Why is my np.arccos not working in my for loop? | python|numpy|for-loop|trigonometry | 0 | 53 | 3 | 72,785,250 | 72,785,250 | 1 | true | 2022-06-28T10:27:14.907Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is my np.arccos not working in my for loop?<p>I have a for loop with a formula whit gives the following error:</p>
<pre><code> RuntimeWarning: invalid va... |
72,949,856 | How do I save images in storage particular folder (gallery) & Get image from storage in above android 11 or below with java?<p>As in my Drawing art project I want Save Painted images to storage or retrieval same image in my app Recycler view with Android Java & I got & save images from below android 11 but not ... | <p>Hi First add below line to manifest in application tab</p>
<p>for make directory in android 10 & solve error in android 8</p>
<pre><code><application
android:requestLegacyExternalStorage="true"
android:hardwareAccelerated="false"
android:largeHeap="true" />
</co... | How do I save images in storage particular folder (gallery) & Get image from storage in above android 11 or below with java? | android|image|get|save|storage | 1 | 53 | 1 | 72,975,670 | 72,975,670 | 1 | true | 2022-07-12T09:15:23.653Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I save images in storage particular folder (gallery) & Get image from storage in above android 11 or below with java?<p>As in my Drawing art project I... |
72,798,242 | Javascript regex to select import statements in react project<p>I want to search for the import statements of npm packages, but not the local imports,</p>
<p>for eg:
I want to search for these types of strings:</p>
<pre><code>import axios from 'axios';
import ApolloLinkTimeout from 'apollo-link-timeout';
import { RestL... | <pre><code>^import\s.*?\sfrom\s+['"](@[\w\/\-]+|[^.]+?)(?:\/.*?)?['"];?$
</code></pre>
<h4>Explanation</h4>
<ul>
<li><code>^</code> Start of a string</li>
<li><code>import\s.*?\s</code> Match string that starts with <code>import</code> keyword then module default or exports after a space character till to <co... | Javascript regex to select import statements in react project | javascript|regex | -2 | 53 | 1 | 72,800,907 | 72,800,907 | 1 | true | 2022-06-29T08:33:21.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript regex to select import statements in react project<p>I want to search for the import statements of npm packages, but not the local imports,</p>
<p... |
72,886,936 | Convert Date in JavaScript (from a Python Dataset)<p>How do I edit the date format that gets returned from a dataset from Python via a Flask App in Javascript?</p>
<p>It currently shows up as datetime, but I want it to show up as a custom date format.</p>
<p>The best type of answer would help me to understand how to ac... | <p>I recommend using the <a href="https://momentjs.com" rel="nofollow noreferrer">MomentJS</a> library to change the format of the date.<br />
Just include the library in the header.</p>
<pre><code><!-- MomentJS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.3/moment.min.js"&g... | Convert Date in JavaScript (from a Python Dataset) | javascript|python|html|date|flask | 0 | 53 | 1 | 72,888,910 | 72,888,910 | 1 | true | 2022-07-06T16:23:11.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert Date in JavaScript (from a Python Dataset)<p>How do I edit the date format that gets returned from a dataset from Python via a Flask App in Javascrip... |
72,847,675 | Complexity of reconstructing shortest path tree of Djikstra Algorithm<p>I am currently reading <a href="https://rads.stackoverflow.com/amzn/click/com/1118290275" rel="nofollow noreferrer" rel="nofollow noreferrer">Data Structures and Algorithms in Python </a> and I am in Chapter 14 page 669. The book says that reconstr... | <p>Lets consider pseudocode for the code you showed:</p>
<pre><code>for each node
visit node
get its edges
visit the node connected
</code></pre>
<p>You can see that each edge adds one more visit to a node.</p>
<p>imagine m = 0, the exact number of visits is number of nodes</p>
<p>imagine m = 1, th... | Complexity of reconstructing shortest path tree of Djikstra Algorithm | python|algorithm|graph-theory|directed-acyclic-graphs | 0 | 53 | 1 | 72,862,275 | 72,862,275 | 1 | true | 2022-07-03T15:20:11.497Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Complexity of reconstructing shortest path tree of Djikstra Algorithm<p>I am currently reading <a href="https://rads.stackoverflow.com/amzn/click/com/1118290... |
73,023,804 | ArrayIndexOutOfBoundsException when creating dynamic DataFrame on Spark<p>My goal is to create a dataframe dynamically from columns and values from an external dataframe. This is how the dataframe is created with manual schema and data definitions:</p>
<pre><code>val columnSufix: String = "isNull"
val data ... | <p>The problem is, for each column, you're instantiating a row object:</p>
<pre class="lang-scala prettyprint-override"><code>val data = cols.map(column => Row(details.filter(col(column).isNull).count())).toList
</code></pre>
<p>So at the end, you'll have:</p>
<pre><code>Seq(
Row(0),
Row(0),
Row(0),
Row(8384... | ArrayIndexOutOfBoundsException when creating dynamic DataFrame on Spark | dataframe|scala|apache-spark | 0 | 53 | 2 | 73,027,339 | 73,027,339 | 1 | true | 2022-07-18T14:15:38.057Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ArrayIndexOutOfBoundsException when creating dynamic DataFrame on Spark<p>My goal is to create a dataframe dynamically from columns and values from an extern... |
72,769,724 | React Routes Problem website only in production<p>I am working on my personal website and i have found a problem only happening in production, the problem does not happen in my locale environment.</p>
<p>This is the scenario</p>
<p>I have configure the routes like the following</p>
<pre><code>const Routes = () => (
... | <p>When you use BrowserRouter you are making use of <a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API" rel="nofollow noreferrer">the History API</a> which lets you write code that says:</p>
<p><em>Hey browser. I'm going to change the DOM using JavaScript now. It is going to change the page so it is ... | React Routes Problem website only in production | javascript|reactjs|routes|react-router|react-router-dom | 0 | 53 | 2 | 72,769,804 | 72,769,804 | 2 | true | 2022-06-27T09:22:12.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React Routes Problem website only in production<p>I am working on my personal website and i have found a problem only happening in production, the problem do... |
72,777,943 | How to properly extract blocks of data from a file using my RegEx string?<p><strong>Introduction</strong></p>
<p>I am trying to parse information using RegEx which is structured like this:</p>
<pre><code>1. Data
A. Data sub 1
B. Data sub 2
2. Data
A. Data sub 1
B. Data sub 2
C. Data sub 3
D. Data sub 4
3.... | <p>I would use <a href="https://docs.python.org/3/library/re.html#re.split" rel="nofollow noreferrer"><code>re.split</code></a> here, splitting on a newline if it is followed by <code>\d\.</code>:</p>
<pre><code>text = '''1. Data
A. Data sub 1
B. Data sub 2
2. Data
A. Data sub 1
B. Data sub 2
C. Data sub 3
... | How to properly extract blocks of data from a file using my RegEx string? | python|regex | 1 | 53 | 1 | 72,777,963 | 72,777,963 | 2 | true | 2022-06-27T20:27:30.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to properly extract blocks of data from a file using my RegEx string?<p><strong>Introduction</strong></p>
<p>I am trying to parse information using RegEx... |
72,777,570 | R CRAN submission - URLs check<p>I can not find how to replicate the internal CRAN test for the URLs healthy.
It is important that this test is run only on the Debian winbuilder (yes, debian under winbuilder). As this test is not run on the Windows machine so we could NOT use the <code>https://win-builder.r-project.org... | <p>(Promoting comment to answer as suggested...)</p>
<p>The test code has been pulled out of R itself and made into <a href="https://cran.r-project.org/package=urlchecker" rel="nofollow noreferrer">a package you can install</a>. Other than that it is of course part of any (recent enough) R or R-devel build.</p>
<p>FWIW... | R CRAN submission - URLs check | r|cran | 0 | 53 | 1 | 72,778,390 | 72,778,390 | 2 | true | 2022-06-27T19:46:22.530Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R CRAN submission - URLs check<p>I can not find how to replicate the internal CRAN test for the URLs healthy.
It is important that this test is run only on t... |
72,779,376 | How to implement try-catch block in racket?<p>I try to write a <code>try-catch</code> block in racket, from the boilerplate provided <a href="https://docs.racket-lang.org/try-catch/index.html#%28form._%28%28lib._try-catch%2Fmain..rkt%29._try%29%29" rel="nofollow noreferrer">here</a>, however when I run it throws me an ... | <p>You're requiring <a href="https://docs.racket-lang.org/try-catch-match/index.html" rel="nofollow noreferrer">try-catch-match</a> library, but your example comes from <a href="https://docs.racket-lang.org/try-catch/index.html" rel="nofollow noreferrer">try-catch</a> library. These two are different and if you use the... | How to implement try-catch block in racket? | exception|try-catch|lisp|racket | 0 | 53 | 1 | 72,780,725 | 72,780,725 | 2 | true | 2022-06-27T23:51:09.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to implement try-catch block in racket?<p>I try to write a <code>try-catch</code> block in racket, from the boilerplate provided <a href="https://docs.ra... |
72,783,187 | Can someone help me what's wrong with this bubble sort?<p>sort.hpp -> we sort station names</p>
<pre><code> struct _element {
char icao_code[5];
char station_name[100];
};
typedef struct _element element;
void bubbleSort(element* stations, int size);
</code></pre>
<p>bubblesort (doesn't work)</p>
<pre><... | <p>This is not the correct way to compare C strings</p>
<pre><code>if (pElement[j].station_name > pElement[j + 1].station_name)
</code></pre>
<p>The problem is that you are comparing the pointers, not the characters that are pointed at.</p>
<p>Use <code>strcmp</code> instead</p>
<pre><code>if (strcmp(pElement[j].sta... | Can someone help me what's wrong with this bubble sort? | c|sorting|bubble-sort | 0 | 53 | 2 | 72,783,266 | 72,783,266 | 2 | true | 2022-06-28T08:32:22.683Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can someone help me what's wrong with this bubble sort?<p>sort.hpp -> we sort station names</p>
<pre><code> struct _element {
char icao_code[5];
... |
72,795,116 | Replace column value in one Panda Dataframe with column in another Panda Dataframe with conditions<p>I have the following 3 Panda Dataframe. I want to replace company and division columns the ID from their respective company and division dataframe.</p>
<pre><code>pd_staff:
id name company division
P001... | <p>You can do:</p>
<pre><code>pd_staff['company'] = pd_staff['company'].map(pd_company.set_index('name')['id'])
pd_staff['division'] = pd_staff['division'].map(pd_division.set_index('name')['id'])
</code></pre>
<p>print(pd_staff):</p>
<pre><code> id name company division
0 P001 John 1 1
1 ... | Replace column value in one Panda Dataframe with column in another Panda Dataframe with conditions | python|pandas | 0 | 53 | 4 | 72,795,316 | 72,795,316 | 2 | true | 2022-06-29T02:25:16.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace column value in one Panda Dataframe with column in another Panda Dataframe with conditions<p>I have the following 3 Panda Dataframe. I want to replac... |
72,794,386 | error: the method `set_bit` exists for type `u8`, but its trait bounds were not satisfied (works for usize?)<p>I'm working on some bit manipulation code that converts primitive integers into a newtype called <code>struct Bits(Vec<bool>)</code> where the bools in the vec each represent a single bit. I implemented... | <p>The error is quite sizeable but I'll pick out one particular problematic portion and highlight it:</p>
<pre class="lang-none prettyprint-override"><code>note: the following trait bounds were not satisfied:
`&mut u8: From<usize>`
`&u8: From<usize>`
`u8: From<usize>`
--&g... | error: the method `set_bit` exists for type `u8`, but its trait bounds were not satisfied (works for usize?) | rust | -2 | 53 | 1 | 72,795,606 | 72,795,606 | 2 | true | 2022-06-29T00:05:20.543Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
error: the method `set_bit` exists for type `u8`, but its trait bounds were not satisfied (works for usize?)<p>I'm working on some bit manipulation code that... |
72,787,280 | What's the most reliable way to get the week day from a utc Date<p>This is how I'm getting the date's week day</p>
<pre><code>const date = new Date('2022-06-25T'+hour+':00:00.951Z')
const day1 = date.toLocaleString('en-US', { weekday: 'short' })
</code></pre>
<p>And this is how I'm constructing the date</p>
<pre><code... | <blockquote>
<pre><code>new Date('2022-06-25T'+hour+':00:00.951Z')
</code></pre>
</blockquote>
<p>Is parsed as UTC (provided <em>hour</em> is padded to 2 digits), so far so good.</p>
<blockquote>
<pre><code>date.toLocaleString('en-US', { weekday: 'short', timeZone: 'Asia/Tbilisi' })
</code></pre>
</blockquote>
<p>Gets ... | What's the most reliable way to get the week day from a utc Date | javascript|date|utc|dayofweek | 1 | 53 | 2 | 72,796,214 | 72,796,214 | 2 | true | 2022-06-28T13:26:03.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What's the most reliable way to get the week day from a utc Date<p>This is how I'm getting the date's week day</p>
<pre><code>const date = new Date('2022-06-... |
72,799,283 | how do I disconnect a specific event<p>I have a module script that looks something like this:</p>
<pre><code>return {
coolfunc = function(object)
RunService.Stepped:Connect(function()
print(object)
end)
end
}
</code></pre>
<p>and I call this script multiple times, how do I disconnect a specific connec... | <p>The <code>Connect</code> method will return an connection object.</p>
<pre><code>return {
coolfunc = function(object)
return RunService.Stepped:Connect(function()
print(object)
end)
end
}
</code></pre>
<p>And you need store it somewhere.</p>
<pre><code>connection = xxx.coolfunc(obj)
</code></pre>
<... | how do I disconnect a specific event | lua|roblox | 1 | 53 | 1 | 72,800,135 | 72,800,135 | 2 | true | 2022-06-29T09:48:03.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how do I disconnect a specific event<p>I have a module script that looks something like this:</p>
<pre><code>return {
coolfunc = function(object)
RunSe... |
72,801,487 | React: Child don't update parent's state<p>I'm new to React and I was trying to create a Modal using mui that opens and closes based on parent's state.
The problem is that the modal opens well based on state but upon closing, the modal onClose function works well, but when I click on Button that has the same with the s... | <p>The problem is that your <code><ActionModal></code> component is <em>inside</em> the <code><button></code> tag. So when clicking the <strong>Cancel</strong> button in the modal you first get the call to <code>handleModalClose</code>, immediately followed by the call to <code>handleModalOpen</code>, becau... | React: Child don't update parent's state | reactjs|material-ui|state | 0 | 53 | 1 | 72,802,408 | 72,802,408 | 2 | true | 2022-06-29T12:31:42.930Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React: Child don't update parent's state<p>I'm new to React and I was trying to create a Modal using mui that opens and closes based on parent's state.
The p... |
72,804,479 | Difference between --parameter-overrides and --tags<p>I am having a hard time understanding the difference between --parameter-overrides and --tags when deploying an AWS stack using CloudFormation.
I tried to read through the documentation but I still do not understand, I seem to get exactly the same behaviour when I u... | <p><code>--tags</code> set arbitrary <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html" rel="nofollow noreferrer">Tags</a> on the Stack. Tags are key-value metadata for labelling and categorizing AWS resources. Tags are optional. They do not affect how CloudFormation deploys the stack.</p>
<p>... | Difference between --parameter-overrides and --tags | amazon-web-services|amazon-cloudformation|aws-cli | 1 | 53 | 1 | 72,805,231 | 72,805,231 | 2 | true | 2022-06-29T15:58:44.193Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Difference between --parameter-overrides and --tags<p>I am having a hard time understanding the difference between --parameter-overrides and --tags when depl... |
72,825,334 | I have a little problem with a certain command in discord.js<p>So I'm making a bot for myself to do stuff, and I tried to make a kill command</p>
<pre><code>if (CMD_NAME == "kill") {
let target = message.mentions.members.first()
message.reply(`${target} is die`)
}
</code></pre>
<p>and I came to the co... | <p>Based on comments under your question, I think your problem might be somewhere else.</p>
<pre class="lang-js prettyprint-override"><code>const PREFIX = "!"
let str = "!a b c"
const [CMD_NAME, ...args] = str.trim().substring(PREFIX.length).split(/\/s+/)
console.log(CMD_NAME)
console.log(args)
</co... | I have a little problem with a certain command in discord.js | javascript|discord.js | 0 | 53 | 1 | 72,829,704 | 72,829,704 | 2 | true | 2022-07-01T06:47:51.730Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I have a little problem with a certain command in discord.js<p>So I'm making a bot for myself to do stuff, and I tried to make a kill command</p>
<pre><code>... |
72,833,623 | Changing Multiple Values in PySpark Dataframe<p>The sample of the dataset I am working on:</p>
<pre class="lang-py prettyprint-override"><code>test = sqlContext.createDataFrame([(1,2),
(1,3),
(4,5)],
['cod_item_2','a... | <p>You can do 2 joins. <code>test_2</code> with <code>test</code> and then again with <code>test_2</code> (self join). For this to work reliably I use <code>alias</code> on dataframes.</p>
<pre class="lang-py prettyprint-override"><code>from pyspark.sql import functions as F
test_3 = (
test_2.alias('a')
.join(... | Changing Multiple Values in PySpark Dataframe | dataframe|apache-spark|join|pyspark|apache-spark-sql | 0 | 53 | 1 | 72,833,832 | 72,833,832 | 2 | true | 2022-07-01T19:00:42.637Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Changing Multiple Values in PySpark Dataframe<p>The sample of the dataset I am working on:</p>
<pre class="lang-py prettyprint-override"><code>test = sqlCont... |
72,838,888 | Unable to display multiple readonly fields in Django admin, only one will display<p>I'm trying to display two new rows (fields) in the "posts" section of django admin which are read-only fields that take data from two other database columns. My code works, but it will not create two new fields, it only displa... | <p>I believe you need to specify the <code>excluded</code> and <code>readonly_fields</code> once.</p>
<pre><code>@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
form = JBForm
exclude = ["est_completion_time", "downtime"]
readonly_fields = ["placeholder_1", "pla... | Unable to display multiple readonly fields in Django admin, only one will display | python|django | 0 | 53 | 1 | 72,839,057 | 72,839,057 | 2 | true | 2022-07-02T12:03:06.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to display multiple readonly fields in Django admin, only one will display<p>I'm trying to display two new rows (fields) in the "posts" sect... |
72,846,571 | manipulate nested array of objects to access children values<p>I have a nested array of objects:</p>
<pre><code>const nestArray = [
{
title: "title 1",
children: [
{
title: "title 1-1",
children: [
{ title: "title 1-1-1", child... | <p>Presented below is one possible way to achieve the desired objective.</p>
<p><strong>Code Snippet</strong></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 addKeysTo = ... | manipulate nested array of objects to access children values | javascript|arrays|typescript | 1 | 53 | 2 | 72,846,952 | 72,846,952 | 2 | true | 2022-07-03T12:38:21.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
manipulate nested array of objects to access children values<p>I have a nested array of objects:</p>
<pre><code>const nestArray = [
{
title: "t... |
72,846,838 | If not exists, create a folder - Error in makefile<p>I searched over the internet for a command to create a folder if it doesn't exist. I found it and put in my makefile</p>
<pre><code>.DEFAULT_GOAL := all
folder := "myfolder"
createfolder:
[ ! -d ${folder} ] && mkdir -p ${folder}
nextstep:
... | <p>this is what make is for.</p>
<pre><code>${folder}:
mkdir -p ${folder}
</code></pre> | If not exists, create a folder - Error in makefile | linux|shell|makefile | 0 | 53 | 3 | 72,847,322 | 72,847,322 | 2 | true | 2022-07-03T13:18:59.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
If not exists, create a folder - Error in makefile<p>I searched over the internet for a command to create a folder if it doesn't exist. I found it and put in... |
72,850,311 | Keep text in BasicTextField on back navigation<p>I have a BasicTextField in my jetpack compose function. When i click(user has input some text into the textfield by now) on a button to navigate to another composable in my NavHost, and from that new view click on back to the composable which i came from which has the te... | <p><code>remember</code> saves the value over <a href="https://developer.android.com/jetpack/compose/mental-model#recomposition" rel="nofollow noreferrer">recomposition</a> (i.e., when your state changes, your composable automatically recomposes with the new state).</p>
<p>As per the <a href="https://developer.android.... | Keep text in BasicTextField on back navigation | android|kotlin|android-jetpack-compose|android-jetpack-navigation|android-jetpack-compose-text | 1 | 53 | 1 | 72,850,558 | 72,850,558 | 2 | true | 2022-07-03T22:28:49.240Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Keep text in BasicTextField on back navigation<p>I have a BasicTextField in my jetpack compose function. When i click(user has input some text into the textf... |
72,852,014 | Split text and populate columns<p>I use a sheet that gets auto-populated by addition of rows by a 3rd party app.
Once a row gets added, I wish to split the text to the following empty columns, the separator being " "(double space).
My app script is able to process a static sheet correctly, but in case of a d... | <p>This appears to be the default behavior of the text to columns feature in Google sheets. It does the same if you select the functionality from the menu in Google Spreadsheets. To avoid it, you could loop through the range and split the cells individually. That way, no cells will be overwritten. Example:</p>
<pre><co... | Split text and populate columns | google-apps-script|google-sheets | 0 | 53 | 1 | 72,852,492 | 72,852,492 | 2 | true | 2022-07-04T05:11:04.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Split text and populate columns<p>I use a sheet that gets auto-populated by addition of rows by a 3rd party app.
Once a row gets added, I wish to split the t... |
72,804,296 | Generic mapped type property based on another property<p>I have an <strong>ElementCategory</strong> type that contains an array of elements. Those elements can be of different types.</p>
<p>Each element has several properties, more notably a <code>type</code> property of type <code>ElementType</code>, which is simply a... | <p>You simply need to create a union of all possible combinations by mapping over the <code>ElementType</code> enum.</p>
<pre><code>type ScriptElement = {
name: string
} & {
[K in ElementType]: {
type: K,
data: ElementsData[K]
}
}[ElementType]
</code></pre>
<p>Now there will be an error ... | Generic mapped type property based on another property | typescript|types|typescript-generics | 1 | 53 | 1 | 72,855,342 | 72,855,342 | 2 | true | 2022-06-29T15:44:37.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Generic mapped type property based on another property<p>I have an <strong>ElementCategory</strong> type that contains an array of elements. Those elements c... |
72,857,750 | check if mouse wheel is scrolled in python<p>In my project I am required to do a task when the mouse is scrolled upwards.</p>
<p>I am using pynput and doing a task on Right click but I am not sure how to trigger something when the mouse wheel is scrolled upwards. Anny idea how to do it? I am open to using any other pac... | <p>I assume if you are calling a method on right click and you are able to do it without any problem then the issue is not with the code i think you need to look at the link mentioned in comment by Yevhen.<br></p>
<p>I think you did but still confused how to do it so let me put an example here.</p>
<pre><code>
def meth... | check if mouse wheel is scrolled in python | python|winapi|automation|pynput | 0 | 53 | 2 | 72,860,087 | 72,860,087 | 2 | true | 2022-07-04T13:45:29.530Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
check if mouse wheel is scrolled in python<p>In my project I am required to do a task when the mouse is scrolled upwards.</p>
<p>I am using pynput and doing ... |
72,875,177 | Error using Eigen: Perform element-wise multiplication between a vector and matrix<p>I am trying to perform an element-wise multiplication of a row vector with matrix. In MATLAB this would be simply done by the "dot" operator or:</p>
<pre><code> deriv = 1i * k .* fk;
</code></pre>
<p>where <code>k</code> is... | <p>Eigen doesn't do broadcasting the same way Matlab or Numpy do unless you explicitely ask for it, for example with <code>matrix.array().rowwise() * vector.array()</code></p>
<p>The IMHO clearer form is to interpret the vector as a diagonal matrix.</p>
<pre><code>Eigen::VectorXd eK = ...;
Eigen::Map<Eigen::MatrixXc... | Error using Eigen: Perform element-wise multiplication between a vector and matrix | c++|eigen|elementwise-operations | 0 | 53 | 1 | 72,875,849 | 72,875,849 | 2 | true | 2022-07-05T20:27:04.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error using Eigen: Perform element-wise multiplication between a vector and matrix<p>I am trying to perform an element-wise multiplication of a row vector wi... |
72,884,912 | Why non async function is running asynchronously?<p>I have a function that must validate some artist from Spotify API, but when I run it artists[] remains empty because the function is running asynchronously, it fills the variable user without having set artists.</p>
<pre><code>let artists = []
function setArtists(inp... | <p>The <code>async</code> (and <code>await</code>) keywords are tools to <strong>manage</strong> promises which are, in turn, tools to manage asynchronous code in a standard way.</p>
<p>The use of the <code>async</code> keyword doesn't make a function run asynchronously and not using the keyword doesn't prevent asynch... | Why non async function is running asynchronously? | javascript|arrays|async-await|es6-promise|fetch-api | 1 | 53 | 1 | 72,884,956 | 72,884,956 | 2 | true | 2022-07-06T13:59:31.117Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why non async function is running asynchronously?<p>I have a function that must validate some artist from Spotify API, but when I run it artists[] remains em... |
72,887,038 | Typescript - Type narrowing when looping on keys of object<p>When I have to iterate on the keys of mappedTypes, I always struggle to make Typescript narrow the type of the value associated with the key I am iterating on and always finish with a <code>ts-ignore</code> ...</p>
<p>A code sample demonstrating the issue wor... | <p>I have added one more type <code>Updatetable<Type></code> and another function <code>update</code> to make assignment type safe. I hope this works for you:</p>
<pre><code>type Person = {
firstName?: string;
lastName?: string;
age?: number;
};
type Update<T> = {
before: T;
after: T;
}... | Typescript - Type narrowing when looping on keys of object | typescript | 2 | 53 | 2 | 72,887,724 | 72,887,724 | 2 | true | 2022-07-06T16:32:56.370Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typescript - Type narrowing when looping on keys of object<p>When I have to iterate on the keys of mappedTypes, I always struggle to make Typescript narrow t... |
72,894,171 | How to import a Kotlin Library in IntelliJ<p>So i want to use the Serialization Library in my kotlin project, and from what i can gather from this <a href="https://kotlinlang.org/docs/serialization.html#example-json-serialization" rel="nofollow noreferrer">page</a>, i must use this: "org.jetbrains.kotlinx:kotlinx-... | <p>Apparently you can indeed use IntelliJ IDEA as a build system without maven or gradle, but I don't think this is a supported way to use kotlinx-serialization.</p>
<p>I'd advise to pick either maven or gradle as your build system for your project (this can be done through IntelliJ, just create a new project and pick ... | How to import a Kotlin Library in IntelliJ | kotlin|intellij-idea | 0 | 53 | 1 | 72,894,385 | 72,894,385 | 2 | true | 2022-07-07T07:54:29.217Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to import a Kotlin Library in IntelliJ<p>So i want to use the Serialization Library in my kotlin project, and from what i can gather from this <a href="h... |
72,890,625 | Twilio Conference - Hear the ringing when Calling to a Number<p>I am developing a conference application using Twilio. My outbound call scenario is like this. The agent calls a customer and once the customer answers the call he will join a conference that the agent was waiting for.</p>
<p>What I did was,</p>
<ol>
<li>T... | <p>Use the conference participants API to add them to the conference so the conference participant(s) can hear call progress tones.</p>
<p><a href="https://www.twilio.com/docs/voice/api/conference-participant-resource" rel="nofollow noreferrer">https://www.twilio.com/docs/voice/api/conference-participant-resource</a></... | Twilio Conference - Hear the ringing when Calling to a Number | twilio|twilio-api|twilio-programmable-voice|twilio-conference | 0 | 53 | 1 | 72,898,971 | 72,898,971 | 2 | true | 2022-07-06T22:50:45.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Twilio Conference - Hear the ringing when Calling to a Number<p>I am developing a conference application using Twilio. My outbound call scenario is like this... |
72,899,115 | Group array data by first character and create subarrays in each group<p>I have an array something like this:</p>
<pre><code>$array = array(
'Actual Hours' => 'http://www.example.com/actual',
'Algorithm' => 'http://www.example.com/algorithm',
'Time Clock App' => 'http://www.example.com/time',
)
</c... | <p>Here you go !</p>
<pre><code>
$array = array(
'Actual Hours' => 'http://www.example.com/actual',
'Algorithm' => 'http://www.example.com/algorithm',
'Time Clock App' => 'http://www.example.com/time',
);
$new_array = [];
foreach( $array as $key => $value ) {
$char = strtoupper(substr($key... | Group array data by first character and create subarrays in each group | php|arrays|grouping | 0 | 53 | 2 | 72,899,198 | 72,899,198 | 2 | true | 2022-07-07T13:55:21.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Group array data by first character and create subarrays in each group<p>I have an array something like this:</p>
<pre><code>$array = array(
'Actual Hour... |
72,902,891 | Variable declaration syntax error in the for next loop<p>Following code is working properly.</p>
<pre><code>Private Sub Button1_Click(sender As Object, e As RoutedEventArgs) Handles Button1.Click
Dim Dictionary1 As New Dictionary(Of String, Integer)
Dim Dictionary2 As New Dictionary(Of String, Integer)
Dim ... | <p>List of Dictionary</p>
<pre><code> Dim Dictionary1 As New Dictionary(Of String, Integer)
Dim Dictionary2 As New Dictionary(Of String, Integer)
Dim Dictionary3 As New Dictionary(Of String, Integer)
Dim Dictionary4 As New Dictionary(Of String, Integer)
Dim Dictionary5 As New Dictionary(Of String, In... | Variable declaration syntax error in the for next loop | vb.net|for-loop|variables|declaration | -1 | 53 | 1 | 72,903,886 | 72,903,886 | 2 | true | 2022-07-07T18:53:48.727Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Variable declaration syntax error in the for next loop<p>Following code is working properly.</p>
<pre><code>Private Sub Button1_Click(sender As Object, e As ... |
72,903,316 | Arraylist index out of bounds in lotto ticket class<p>I made a simple lottery game with 3 classes, one to create a lottery "ticket", one to create the objects to put in said class and another to test things. In my lottery ticket class, the user inputs 5 numbers and these numbers are added to a holder list whe... | <p>You are overcomplicating things way too much. There are obviously simpler approaches to achieve what you are trying to do. I will share a solition below where your code should work, with little modification in your current code as possible, but at the same time encourage you to refactor and try better aproaches.</p>... | Arraylist index out of bounds in lotto ticket class | java | 1 | 53 | 2 | 72,904,036 | 72,904,036 | 2 | true | 2022-07-07T19:33:44.687Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Arraylist index out of bounds in lotto ticket class<p>I made a simple lottery game with 3 classes, one to create a lottery "ticket", one to create ... |
72,907,813 | req.body is unidentified in express api<p>I am implementing stripe payment in my react native app and created express api to get clientSecret Intent. So I want to make payment of the amount which I send from my api to api. But in api, I am getting nothing in the request body.</p>
<p>This is how I am calling my Apis</p>... | <p>I see two issues with the frontend code you shared.</p>
<p>First, you should replace <code>totalAmount: amount</code> by <code>amount: amount</code>, since the backend code is using <code>req.body.amount</code>.</p>
<p>Second, you can't directly send a JavaScript object using fetch, you need to convert it into a str... | req.body is unidentified in express api | react-native|express|stripe-payments | 1 | 53 | 2 | 72,908,315 | 72,908,315 | 2 | true | 2022-07-08T07:04:56.497Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
req.body is unidentified in express api<p>I am implementing stripe payment in my react native app and created express api to get clientSecret Intent. So I wa... |
72,924,904 | Stratified Sampling in Python without scikit-learn<p>I have a vector which contains 10 values of sample 1 and 25 values of sample 2.</p>
<pre><code>Fact = np.array((2,2,2,2,1,2,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,1,1,2,1,2,2,2,2,2,2,1,2,2))
</code></pre>
<p>I want to create a stratified output vector where :</p>
<p>sample ... | <p>Here is one way to get your desired result, with reproducibility of output added. We draw random index values for each of the two groups from the input (<code>fact</code>) array, without replacement. Then, we create a new output array where we assign <code>1</code>'s in locations corresponding to the drawn index v... | Stratified Sampling in Python without scikit-learn | python|numpy | 0 | 53 | 1 | 72,925,667 | 72,925,667 | 2 | true | 2022-07-09T22:05:59.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Stratified Sampling in Python without scikit-learn<p>I have a vector which contains 10 values of sample 1 and 25 values of sample 2.</p>
<pre><code>Fact = np... |
72,919,556 | VS Code Keybinding for Line Break<p>I would like to add a key binding for inserting a line break in the editor (<code>textInputFocus</code>). Normally the Return key does this (VS Code calls the key <code>Enter</code>). Which command in VS Code can I use?</p>
<p>There is <code>lineBreakInsert</code> but this does not b... | <p>Is this what you are looking for:</p>
<pre><code>{
"key": "ctrl+o",
"command": "type",
"args": {
"text": "\n"
},
"when": "textInputFocus"
}
</code></pre> | VS Code Keybinding for Line Break | visual-studio-code|vscode-keybinding | 0 | 53 | 2 | 72,929,818 | 72,929,818 | 2 | true | 2022-07-09T06:57:32.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
VS Code Keybinding for Line Break<p>I would like to add a key binding for inserting a line break in the editor (<code>textInputFocus</code>). Normally the Re... |
72,940,204 | I am new to python and am having trouble printing an element of a list<p>the result looks like this:</p>
<pre><code>[([[17, 11], [57, 11], [57, 61], [17, 61]], '2', 1.0)]
</code></pre>
<p>I just want the 2 printed (second element of the list?) but keep getting "list index out of range" error.</p>
<p>Here is t... | <p>The list has only one tuple in it (<code>[(...)]</code>) so accessing <code>result[1][0]</code> will give an <code>IndexError</code>. You can solve by changing your code to this -</p>
<pre><code>number = 1
sresult = ''
reader = easyocr.Reader(['en'])
for number in range (1,82):
result = reader.readtext(datadrop+... | I am new to python and am having trouble printing an element of a list | python|list|printing | -1 | 53 | 2 | 72,940,249 | 72,940,249 | 2 | true | 2022-07-11T14:30:46.107Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I am new to python and am having trouble printing an element of a list<p>the result looks like this:</p>
<pre><code>[([[17, 11], [57, 11], [57, 61], [17, 61]... |
72,940,259 | How to join rows in pandas dataframe based on column value?<p>I have a dataframe which looks like this:</p>
<pre><code>time text
01.01.1970 abc
01.01.1970 cde
01.01.1970 fgh
01.01.1980 abc
01.01.1980 xyz
</code></pre>
<p>I would like to join the content in <code>text</code> based on column <code>time</code>. I want to ... | <pre><code>df.groupby('time')['text'].apply(lambda x: x.str.cat(sep='\n'))
</code></pre>
<p>output:</p>
<pre><code>time text
01.01.1970 "abc\ndef"
01.01.1980 "ghi\njkl"
</code></pre> | How to join rows in pandas dataframe based on column value? | python|pandas | 1 | 53 | 3 | 72,940,404 | 72,940,404 | 2 | true | 2022-07-11T14:34:48.997Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to join rows in pandas dataframe based on column value?<p>I have a dataframe which looks like this:</p>
<pre><code>time text
01.01.1970 abc
01.01.1970 cd... |
72,938,920 | AWS Site-to-Site VPN- Local/remote ipv4 cidr mandatory?<p><a href="https://i.stack.imgur.com/224bd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/224bd.png" alt="enter image description here" /></a></p>
<p>I am creating a site-to-site vpn to make a request from aws to my on premises.
Here, is the sc... | <p>By default, it is <code>0.0.0.0/0</code> as it states under your AWS Console when you are trying to create a connection.</p>
<p><a href="https://i.stack.imgur.com/xwCTT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xwCTT.png" alt="aws-vpn-s2s-network-cidr-optional" /></a></p>
<p>I believe that i... | AWS Site-to-Site VPN- Local/remote ipv4 cidr mandatory? | amazon-web-services|amazon-vpc|aws-vpn | 1 | 53 | 1 | 72,940,461 | 72,940,461 | 2 | true | 2022-07-11T12:52:46.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AWS Site-to-Site VPN- Local/remote ipv4 cidr mandatory?<p><a href="https://i.stack.imgur.com/224bd.png" rel="nofollow noreferrer"><img src="https://i.stack.i... |
72,947,511 | google script create file from external blob<p>I'm getting a PDF file from an external web resource using ajax.
I want to store this PDF in the google drive using google script API from within google docs.</p>
<p>Sample of that ajax call:</p>
<pre><code> $.ajax({
url: "<fancyurl>",
contentTy... | <p>In my experience, when the binary data is retrieved using ajax, the binary data is converted to the text data. By this, I'm worried that <code>responsetype</code> of <code>blob</code> and <code>arraybuffer</code> might not be able to be used. I thought that this might be the reason of your issue. So, in this answer,... | google script create file from external blob | javascript|ajax|google-apps-script | 1 | 53 | 1 | 72,947,871 | 72,947,871 | 2 | true | 2022-07-12T05:42:59.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
google script create file from external blob<p>I'm getting a PDF file from an external web resource using ajax.
I want to store this PDF in the google drive ... |
72,953,498 | How can I securely sign transactions from my code? (Algorand)<p>I'm writing smart contracts on Algorand, and want to know how to make them production-ready. How can I securely pass private key, for example when creating smart a contract and sending it to chain? It feels insecure to store the passphrase or private key t... | <p>Key management is an extremely complex topic and if you are writing an application that is expecting to move millions of Algos, I would strongly recommend consulting a security expert and do a full audit.</p>
<p>There are many questions to ask and I'm just highlighting a few there:</p>
<ol>
<li><p>Do you want a cust... | How can I securely sign transactions from my code? (Algorand) | security|smartcontracts|private-key|algorand | 2 | 53 | 1 | 72,953,607 | 72,953,607 | 2 | true | 2022-07-12T13:52:56.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I securely sign transactions from my code? (Algorand)<p>I'm writing smart contracts on Algorand, and want to know how to make them production-ready. ... |
72,956,844 | Why is React state not updated inside functions?<p>I have a component that renders a table with objects. This component shows a button that, when pressed, sends the parent a specific object. The parent must set it in the state to display some graphical stuff. The rendering is working correctly, what I don't understand ... | <p>I think this is an issue with the way Javascript closures work.</p>
<p>When you execute a function, it gets bundled with all the data that pertains to it and then gets executed.</p>
<p>The issue is that you call this:</p>
<pre><code>setTimeout(() => {
getData();
}, 1500);
</code></pre>
<p>inside <code>s... | Why is React state not updated inside functions? | javascript|reactjs|react-hooks | 1 | 53 | 2 | 72,957,014 | 72,957,014 | 2 | true | 2022-07-12T18:25:41.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is React state not updated inside functions?<p>I have a component that renders a table with objects. This component shows a button that, when pressed, se... |
72,957,821 | Cascade variadic template template parameters<p>How can I cascade variadic types? I.e.:</p>
<pre class="lang-cpp prettyprint-override"><code>template <typename... T>
using Cascade = ???; // T1<T2<T3<...>>>
</code></pre>
<p>Example:</p>
<pre class="lang-cpp prettyprint-override"><code>using Vecto... | <p>You cannot have CascadeRight. T1 is not a typename, it is a template, and so are most of the others, but the last one is a typename. You cannot have different parameter kinds (both types and templates) in the same parameter pack. You also cannot have anything after a parameter pack.</p>
<p>You can have CascadeLeft l... | Cascade variadic template template parameters | c++|c++17|variadic-templates|template-templates | 1 | 53 | 2 | 72,958,071 | 72,958,071 | 2 | true | 2022-07-12T20:05:28.727Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cascade variadic template template parameters<p>How can I cascade variadic types? I.e.:</p>
<pre class="lang-cpp prettyprint-override"><code>template <typ... |
72,960,971 | Fetching data from firestore and displaying it in my flutter code<p>I'am making a user profile in flutter. I wanted to display the data from my database that I made in Firebase. I get an error in my text saying that the operator [] isn't defined for the type QuerySnapshot. How can I resolve this. Thank you</p>
<pre><co... | <p>Try this:</p>
<pre><code>StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance
.collection(AppConfig.instance.cUser)
.snapshots(),
builder: (BuildContext context,
AsyncSnapshot<QuerySnapshot> chatSnapshot) {
... | Fetching data from firestore and displaying it in my flutter code | flutter | 2 | 53 | 2 | 72,961,707 | 72,961,707 | 2 | true | 2022-07-13T04:30:46.193Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fetching data from firestore and displaying it in my flutter code<p>I'am making a user profile in flutter. I wanted to display the data from my database that... |
72,961,590 | Write multiple lists to different columns in a single cell in CSV<p>I have multiple lists and I want to write all those lists under different column names; the list written should be in single-cell only.</p>
<pre><code>columns = [c1, c2, c3]
list1 = ['a', 'b', 'c', 'd']
list2 = [1,2,3,4,5,6]
list3 = ['h', 'j', 'm', ... | <p>Another version, pass <code>columns=</code> parameter and list of rows into a DataFrame constructor:</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame([[list1, list2, list3]], columns=columns)
print(df)
</code></pre>
<p>Prints:</p>
<pre class="lang-none prettyprint-override"><code> c1... | Write multiple lists to different columns in a single cell in CSV | python|python-3.x|pandas|dataframe|csv | 2 | 53 | 2 | 72,961,913 | 72,961,913 | 2 | true | 2022-07-13T06:02:25.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Write multiple lists to different columns in a single cell in CSV<p>I have multiple lists and I want to write all those lists under different column names; t... |
72,962,698 | Excel VBA - msoEffectBlur<p>Can someone help me with following action?
I want to loop 100 pictures in excel sheet and set them to Blur with a specific Radius value.</p>
<pre><code>ActiveSheet.Shapes("Picture 412").Fill.PictureEffects.Insert msoEffectBlur
</code></pre>
<p>This statement is working but I don't ... | <p>I upvoted the answer of <strong>antca230</strong> because it shows how to set the radius. However, the rest of the code will not work, there are some issues:</p>
<p><strong>(a)</strong> It loops over all shapes of the Activesheet using the variable <code>picture</code>, however within the loop it uses another variab... | Excel VBA - msoEffectBlur | excel|vba | 0 | 53 | 2 | 72,963,114 | 72,963,114 | 2 | true | 2022-07-13T07:51:37.463Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Excel VBA - msoEffectBlur<p>Can someone help me with following action?
I want to loop 100 pictures in excel sheet and set them to Blur with a specific Radius... |
72,965,347 | Shopware 6 webhook for mail_template update<p>in shopware 6 is there a app webhook for every entity update (like MailTemplate )?
or only for the ones from here <a href="https://developer.shopware.com/docs/resources/references/app-reference/webhook-events-reference" rel="nofollow noreferrer">https://developer.shopware.c... | <p>As of today these are the only write operation based events you can hook on to. The documentation will be kept up to date but you can also use the constant <a href="https://github.com/shopware/platform/blob/b2f36aac774ecbe50932df8da6228f06c7ef2512/src/Core/Framework/Webhook/Hookable/HookableEventCollector.php#L27" r... | Shopware 6 webhook for mail_template update | shopware6|shopware6-api | 1 | 53 | 1 | 72,970,063 | 72,970,063 | 2 | true | 2022-07-13T11:15:56.930Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Shopware 6 webhook for mail_template update<p>in shopware 6 is there a app webhook for every entity update (like MailTemplate )?
or only for the ones from he... |
72,973,443 | User input always true using the .is_ok functions<p>How can I read from the console and avoid crashing if the user presses enter without entering anything?</p>
<pre><code>let mut objectnumber = String::new();
println!("mennyi súlyt szeretnél megnézni? 3.=255 int");
if io::stdin().read_line(&mut objectnumb... | <p>Fixes I made:</p>
<ul>
<li><code>read_line</code> returns a <code>Result</code> indicating whether or not there was an error reading from <code>stdin</code>. Usually this only happens in very specific circumstances, so let's just <code>unwrap</code> this for now.</li>
<li><code>objectnumber.len()</code> gives you th... | User input always true using the .is_ok functions | rust|user-input | 0 | 53 | 1 | 72,973,905 | 72,973,905 | 2 | true | 2022-07-13T22:48:14.167Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
User input always true using the .is_ok functions<p>How can I read from the console and avoid crashing if the user presses enter without entering anything?</... |
72,973,859 | Why can't I change the svg pathlengh at all?<p>I can't change the pathLength of the following svg at all. I tried it with framer-motion, but also by adding the pathLength attribute manually. Nothing, the path doesn't grow, shrink or do anything at all. Here's the code:</p>
<pre><code><motion.svg className={styles.lo... | <p>As Robert Longson pointed out, using <code>pathLength</code> in CSS is currently not supported. But even if it was, the result of an animation would not be what you expect. The <a href="https://www.w3.org/TR/SVG2/paths.html#PathLengthAttribute" rel="nofollow noreferrer">spec</a> defines:</p>
<blockquote>
<p>This val... | Why can't I change the svg pathlengh at all? | svg|framer-motion | 0 | 53 | 1 | 72,981,405 | 72,981,405 | 2 | true | 2022-07-14T00:01:55.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can't I change the svg pathlengh at all?<p>I can't change the pathLength of the following svg at all. I tried it with framer-motion, but also by adding t... |
72,982,405 | Why can I use an enum as a XAML tag?<p>Why does the WPF/XAML code below work? Why can an enum be used as a XAML tag? Also, why can the converter parameter be more than one enum value? See below how I pass in <code>Running</code> and <code>Setup</code>. I haven't been able to find any documentation online that explains ... | <h2>Why can an enum be used as a XAML tag?</h2>
<p>It is designed like this, see the documentation for reference: <a href="https://docs.microsoft.com/en-us/dotnet/desktop/wpf/advanced/xaml-syntax-in-detail?view=netframeworkdesktop-4.8" rel="nofollow noreferrer">XAML Syntax In Detail</a>.</p>
<p>Defining objects by usin... | Why can I use an enum as a XAML tag? | c#|.net|wpf|xaml|enums | -2 | 53 | 1 | 72,990,717 | 72,990,717 | 2 | true | 2022-07-14T14:43:56.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can I use an enum as a XAML tag?<p>Why does the WPF/XAML code below work? Why can an enum be used as a XAML tag? Also, why can the converter parameter be... |
73,007,745 | Kotlin Android - adding values to data class error, Why would it cause my app to crash<p>I am trying to have a grid layout in a recyclerview to show and image text and a double variable. The goal is to add a search bar that will display the results to the recycleView. I am new to kotlin so forgive me if the problem is... | <p>Start by deleting:</p>
<pre class="lang-kotlin prettyprint-override"><code>import kotlinx.android.synthetic.main.food_search_list.*
</code></pre>
<p>(and consider moving away from Kotlin synthetic accessors, as they are deprecated)</p>
<p>That is not the activity's layout; do not attempt to reference widgets using t... | Kotlin Android - adding values to data class error, Why would it cause my app to crash | android|kotlin|android-recyclerview | 1 | 53 | 1 | 73,007,772 | 73,007,772 | 2 | true | 2022-07-16T21:25:43.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kotlin Android - adding values to data class error, Why would it cause my app to crash<p>I am trying to have a grid layout in a recyclerview to show and ima... |
72,978,488 | Knockout.js Cannot read properties of undefined inside ViewModel<p>I have an object inside the viewModel where the "visible" property will have the value of the loadingVisible variable declared inside the viewModel as an observable.</p>
<p>My problem is that I always get the following error: Cannot read prope... | <p>Easiest way I know is to have a property that both things can reference.</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>var loadingVisible = ko.observable(false);
var viewM... | Knockout.js Cannot read properties of undefined inside ViewModel | javascript|html|knockout.js | 1 | 53 | 1 | 73,009,500 | 73,009,500 | 2 | true | 2022-07-14T09:44:23.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Knockout.js Cannot read properties of undefined inside ViewModel<p>I have an object inside the viewModel where the "visible" property will have the... |
73,009,818 | RxJS Execute Requests Based on Prior Data Responses (Involves Looping Through Array of Objects)<p>I have an object of the following structure:</p>
<pre><code>{
parent1: [
{childId: 1},
{childId: 2}
],
parent2: [
{childId: 3},
{childId: 4}
],
parent3: [
{childId: 5},
{childId: 6}... | <p>What if you break down the problem into smaller composable blocks? I can see 3 functions:</p>
<ol>
<li><code>createFamily</code> will call <code>addFamily()</code>, then use <code>createParent</code> for each parent of that family.</li>
<li><code>createParent</code> will call <code>addParent()</code>, then use <code... | RxJS Execute Requests Based on Prior Data Responses (Involves Looping Through Array of Objects) | angular|rxjs|observable|rxjs-pipeable-operators | 2 | 53 | 2 | 73,019,270 | 73,019,270 | 2 | true | 2022-07-17T07:06:24.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
RxJS Execute Requests Based on Prior Data Responses (Involves Looping Through Array of Objects)<p>I have an object of the following structure:</p>
<pre><code... |
72,854,867 | ASP.NET Core | Compare two Ids from different models in Controller<p>I want to get specific data by comparing two Ids from different model classes.</p>
<p>I want to get the "DeskId" from the "Booking"-Model class. I don't know how to reach the Booking class from the DeskController.</p>
<p>DeskContro... | <p>I guess you need to use <code>.Where</code> LINQ method:</p>
<pre><code>var bookings = await _context.Booking
.Where(booking => booking.DeskId == desk.Id)
.Where(booking => booking.End >= start)
.Where(booking => booking.Start < end)
.ToListAsync();
</code></pre>
<p>UPD: As @Young Shun sug... | ASP.NET Core | Compare two Ids from different models in Controller | c#|asp.net-core|entity-framework-core|asp.net-core-mvc | 0 | 53 | 2 | 72,854,912 | 72,854,912 | 2 | true | 2022-07-04T09:55:36.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ASP.NET Core | Compare two Ids from different models in Controller<p>I want to get specific data by comparing two Ids from different model classes.</p>
<p>I ... |
72,880,301 | Create column summary in df<pre><code>ACTION_NAME ACTION_REASON CH PT SK CZ UK
Add Name Name Change No Yes ? Yes
Add Job Job Change Yes No No ?
Add Position Postion Change Yes No No ?
</code></pre>
<... | <p>First create a mapping dict to rename values (Yes, No, ?, '') then use <code>melt</code> to flatten your dataframe and finally <code>pivot_table</code> to reshape it:</p>
<pre><code>MAPPING = {'Yes': 'Countries using this action',
'No': 'Countries not Using this Action',
'?': 'Countries with Qu... | Create column summary in df | python|pandas|dataframe|count|lookup | 1 | 53 | 1 | 72,880,520 | 72,880,520 | 2 | true | 2022-07-06T08:35:57.110Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create column summary in df<pre><code>ACTION_NAME ACTION_REASON CH PT SK CZ UK
Add Name Name Change No ... |
72,939,383 | swap icons by adding class to element only in pure CSS<p>I have a page than contain a read more button. When click on it, display some hidden content. Next to this button I have an icon represent by an arrow up or down in function if the button is set to show more or less. I take icons from library which allow to take ... | <p>Use <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:checked" rel="nofollow noreferrer">the <code>:checked</code> pseudo-selector</a> to check if the <code>checkbox</code> is checked or not and then hide/show the span by means of the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_siblin... | swap icons by adding class to element only in pure CSS | html|css|icons | 0 | 53 | 1 | 72,939,597 | 72,939,597 | 2 | true | 2022-07-11T13:29:45.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
swap icons by adding class to element only in pure CSS<p>I have a page than contain a read more button. When click on it, display some hidden content. Next t... |
72,985,319 | PyVista: Why does the callback only draw the 3d entities and not the 2d one on the second time?<p>I have a question and hope that you can help me.
I put together a small MCVE below.</p>
<p>When you click the button for the first time,
you can see that the 3d data (add_mesh, add_points) and 2d data (chart.scatter) show ... | <p>I think you've found a bug, thanks for the great example! This is now fixed in PyVista version 0.35.2, updating the package should make things working. Original (pre-fix) version of the answer below.</p>
<hr />
<p>What happens with charts is that they are stored in a private attribute called <code>__charts</code>, a... | PyVista: Why does the callback only draw the 3d entities and not the 2d one on the second time? | python|qvtkwidget|pyvista | 2 | 53 | 1 | 72,986,637 | 72,986,637 | 2 | true | 2022-07-14T18:45:34.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PyVista: Why does the callback only draw the 3d entities and not the 2d one on the second time?<p>I have a question and hope that you can help me.
I put toge... |
73,007,252 | Is there a way to write this in a single Dplyr statement / more efficiently?<p>My (simplified) dataset consists of donor occupation and contribution amounts. <strong>I'm trying to determine what the average contribution amount by occupation is</strong> (note: donor occupations are often repeated in the column, so I use... | <p>We may need both <code>sum</code> and <code>mean</code> along with <code>n()</code> which gives the number of observations in the grouped data. According to <code>?context</code></p>
<blockquote>
<p>n() gives the current group size.</p>
</blockquote>
<p>and `?mean</p>
<blockquote>
<p>mean - Generic function for the... | Is there a way to write this in a single Dplyr statement / more efficiently? | r|dplyr|equivalent | 1 | 53 | 1 | 73,007,284 | 73,007,284 | 2 | true | 2022-07-16T19:56:42.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to write this in a single Dplyr statement / more efficiently?<p>My (simplified) dataset consists of donor occupation and contribution amounts.... |
72,904,485 | Improve the execution time of a function which manage std::map objects, how?<p>I have a header file <code>header.hpp</code> in which is declared this function:</p>
<pre><code>#ifndef COMMON_HPP
#define COMMON_HPP
#include <string>
#include <map>
extern std::string func( const std::map <std::string, std... | <p>Given how small the code is, there is really not many changes you can make to it, but there are a few:</p>
<ul>
<li><p>use the <code>iterator</code> that <code>map::find()</code> returns, you don't need to call <code>map::at()</code> afterwards. You are actually performing the same search 2 times, when you really w... | Improve the execution time of a function which manage std::map objects, how? | c++|performance|optimization|c++17 | 1 | 53 | 3 | 72,904,555 | 72,904,555 | 2 | true | 2022-07-07T21:36:27.030Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Improve the execution time of a function which manage std::map objects, how?<p>I have a header file <code>header.hpp</code> in which is declared this functio... |
72,868,012 | pandas iterate over column values at once and generate range<p>I have a pandas dataframe like as below</p>
<pre><code>df1 = pd.DataFrame({'biz': [18, 23], 'seg': [30, 34], 'PID': [40, 52]})
</code></pre>
<p>I would like to do the below</p>
<p>a) pass all the values from each column at once to for loop</p>
<p>For ex:</p... | <p>The mistake is in the innermost forloop.</p>
<p>You are requesting an iterator over a 1-dimensional array of values, this iterator yields scalar values and hence they can not be unpacked.</p>
<p>If your dataframe only has 2 items per column, then this should suffice</p>
<pre><code>cols = ['biz','seg','PID']
for col ... | pandas iterate over column values at once and generate range | python|pandas|list|dataframe|tuples | 0 | 53 | 2 | 72,868,121 | 72,868,121 | 2 | true | 2022-07-05T10:38:06.493Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pandas iterate over column values at once and generate range<p>I have a pandas dataframe like as below</p>
<pre><code>df1 = pd.DataFrame({'biz': [18, 23], 's... |
72,868,172 | delete blurred part of online website to be visible, without paying<p>Recently I am visiting a website,
<br> but that website makes not visible a section by blurring it (and wants me to pay to see what there is)</p>
<p>I want that I can read through the blurred part of that website.</p>
<p>I read on the internet that t... | <blockquote>
<p>like he said @Dai, is better to pay if you really want that content. <br>this is my suggestion, but I will help you the same</p>
</blockquote>
<hr />
<p><strong>one line answer</strong></p>
<p>just add a <code>*</code> selector with this css code <code>filter: blur(0) !important;</code></p>
<p>so it wi... | delete blurred part of online website to be visible, without paying | html|css | -1 | 53 | 1 | 72,868,188 | 72,868,188 | 2 | true | 2022-07-05T10:50:43.490Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
delete blurred part of online website to be visible, without paying<p>Recently I am visiting a website,
<br> but that website makes not visible a section by ... |
72,834,725 | How to obtain iterator type from template parameter, if template parameter is a reference type<p>The question title may not be super clear, but hopefully the below explains what is my problem.</p>
<p>Let's say I have the following (simplified) class template:</p>
<pre><code>template <typename T, typename Container =... | <p>The <code>std::remove_reference</code> will work here. Or you need <a href="https://en.cppreference.com/w/cpp/types/remove_reference" rel="nofollow noreferrer"><code>std::remove_reference_t</code></a> version of it</p>
<pre><code>using iterator = std::remove_reference_t<Container>::iterator;
// ... | How to obtain iterator type from template parameter, if template parameter is a reference type | c++|templates|iterator|containers | -1 | 53 | 1 | 72,834,877 | 72,834,877 | 2 | true | 2022-07-01T21:22:20.293Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to obtain iterator type from template parameter, if template parameter is a reference type<p>The question title may not be super clear, but hopefully the... |
72,786,965 | How can I create objects of a nested class inside the parent class but in another header file?<p>I have a class <code>Dmx</code> with a nested class <code>touchSlider</code>. So before I had these classes in my <code>main.cpp</code> file and just created an object array of <code>touchSlider</code> within the <code>Dmx<... | <p>To be able to create an array:</p>
<pre><code>touchSlider slider[10] = {50,130,210,290,370,50,130,210,290,370};
</code></pre>
<p>You need the class definition available, because the compiler needs to know</p>
<ol>
<li>the size of the struct or class in use and</li>
<li>if there's a suitable constructor available.</l... | How can I create objects of a nested class inside the parent class but in another header file? | c++|class|object|nested | 3 | 53 | 2 | 72,787,744 | 72,787,744 | 2 | true | 2022-06-28T13:04:02.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I create objects of a nested class inside the parent class but in another header file?<p>I have a class <code>Dmx</code> with a nested class <code>to... |
72,978,752 | Create a counter that iterates over a column in a dataframe, and counts when a condition in the column is met<p>I currently have a column in my dataframe called <code>step</code>, that I want to use to set a counter on. It contains a bunch of repeating numbers. I want to create a new column against this, that has a cou... | <p>You can convert your <code>step</code> column into categories and then count on the category codes:</p>
<pre><code>import pandas as pd
df = pd.DataFrame({"step": [1,1,1,2,2,2,2,3,3,3,4,4,4,5,5,5,5,6,6,6,7,7,7,7,8,8,8,8,8,9,9,9,9,10]})
df["counter"] = df.step.astype("category").values.c... | Create a counter that iterates over a column in a dataframe, and counts when a condition in the column is met | python|pandas|dataframe | 2 | 53 | 2 | 72,979,055 | 72,979,055 | 2 | true | 2022-07-14T10:05:12.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create a counter that iterates over a column in a dataframe, and counts when a condition in the column is met<p>I currently have a column in my dataframe cal... |
72,909,158 | Delete duplicate file based on modified time, remaining first created file<p>First I have video files that record from webcam camera. It will got many file of videos but I want to delete duplicate file base on modification time, limited by minutes.</p>
<p>For example,
I have 3 video files as below. base on (hour : minu... | <p>Here is my suggested solution. See the comments in the code itself for an detailed explanation, but the basic idea is that you build up a nested dictionary of lists of 2-element tuples, where the keys of the dictionary are the number of minutes since the start of Unix time, and the 2-tuples contain the filename and ... | Delete duplicate file based on modified time, remaining first created file | python|datetime|filemtime | 0 | 53 | 3 | 72,909,524 | 72,909,524 | 2 | true | 2022-07-08T09:10:35.793Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Delete duplicate file based on modified time, remaining first created file<p>First I have video files that record from webcam camera. It will got many file o... |
72,840,836 | Sorting Elements in a List Based on Values<p>I have a dictionary and I need the keys to be sorted according to their corresponding values. But the keys should not change the preset order when sorting is applied</p>
<p>The below example shows exactly what I am trying to do. The code returns the keys of first 3 highest v... | <p>I don't think the heap is necessary here:</p>
<pre><code>lookup_set = set(sorted(val.keys(), key=lambda x: val[x], reverse=True)[:3])
[i for i in val if i in lookup_set]
</code></pre>
<p>First creating a set of wanted keys, then filtering val.keys() to get the correct order.</p>
<p>yields:</p>
<pre><code>['c', 'd', ... | Sorting Elements in a List Based on Values | python|python-3.x|dictionary|heapq | 1 | 53 | 2 | 72,840,938 | 72,840,938 | 2 | true | 2022-07-02T16:51:04.267Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sorting Elements in a List Based on Values<p>I have a dictionary and I need the keys to be sorted according to their corresponding values. But the keys shoul... |
72,811,600 | Create Xpath using scrapy<pre><code>import scrapy
from scrapy.http import Request
from scrapy.crawler import CrawlerProcess
class TestSpider(scrapy.Spider):
name = 'test'
start_urls = ['https://rejestradwokatow.pl/adwokat/list/strona/1/sta/2,3,9']
custom_settings = {
'CONCURRENT_REQUESTS_PER_DOMAIN... | <p>Why not selecting your element more specific by its <code>text</code> and getting the text from its next sibling:</p>
<pre><code>//span[text()[contains(.,'Status')]]/following-sibling::div/text()
</code></pre>
<p>Example: <a href="http://xpather.com/ZUWI58a4" rel="nofollow noreferrer">http://xpather.com/ZUWI58a4</a>... | Create Xpath using scrapy | python|web-scraping|xpath|scrapy | 0 | 53 | 2 | 72,812,339 | 72,812,339 | 2 | true | 2022-06-30T07:08:08.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create Xpath using scrapy<pre><code>import scrapy
from scrapy.http import Request
from scrapy.crawler import CrawlerProcess
class TestSpider(scrapy.Spider):... |
72,939,018 | Sum data and merge results by updating table<p>I have a table with the following data:</p>
<p>Table1</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>UniqueKey</th>
<th>Text A</th>
<th>Text B</th>
<th>Value 1</th>
<th>Value 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Key1</td>
<td>ABC</td>
<td>AB... | <p>You can create a new table with the current query</p>
<pre><code>SELECT [UniqueKey], [Text A], [Text B], SUM([Value 1]) AS Value1, SUM([Value 2]) AS Value2
INTO Table2
FROM Table1
GROUP BY [UniqueKey], [Text A], [Text B]
</code></pre>
<p>drop the original source</p>
<pre><code>DROP TABLE Table1
</code></pre>
<p... | Sum data and merge results by updating table | sql-server|tsql | 0 | 53 | 2 | 72,939,185 | 72,939,185 | 2 | true | 2022-07-11T12:59:39.427Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sum data and merge results by updating table<p>I have a table with the following data:</p>
<p>Table1</p>
<div class="s-table-container">
<table class="s-tabl... |
72,860,959 | Determine number of entrants and exits in each year in panel data<p>I have three data frames with the same variables for the same firms but corresponding to different years (2016, 2017, 2018). The ID variable corresponds to a firm ID.</p>
<pre><code>df2016 = pd.DataFrame({"ID": [99,101,102,103,104], "A&q... | <p>You can use a <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.merge.html" rel="nofollow noreferrer"><code>merge</code></a> on the shifted years, if the value is found then we have a 0, then fill the NaNs with 1:</p>
<pre><code>dfs = [df2016, df2017, df2018]
df = pd.concat(dfs)
cols = ['ID', '... | Determine number of entrants and exits in each year in panel data | pandas|multi-index|panel-data | 1 | 53 | 2 | 72,861,105 | 72,861,105 | 2 | true | 2022-07-04T18:51:59.653Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Determine number of entrants and exits in each year in panel data<p>I have three data frames with the same variables for the same firms but corresponding to ... |
72,804,201 | xUnit test fails while comparing Lists<p>Here is my unit test and it fails with a message.
Kindly help me fix this.</p>
<p>Update Question:</p>
<p>It looks like i am trying to unit test the <code>JsonSerializer.Deserialize</code> method. So is this a legitimate unit test?</p>
<p>Message:</p>
<pre><code> Expected got... | <p>You should to use <a href="https://fluentassertions.com/objectgraphs/" rel="nofollow noreferrer">BeEquivalentTo</a></p>
<pre class="lang-cs prettyprint-override"><code>got.Should().BeEquivalentTo(want);
</code></pre>
<p>Quoting <code>BeEquivalentTo</code> source code:</p>
<pre><code> // Summary:
// Assert... | xUnit test fails while comparing Lists | c#|linq|asp.net-core|linq-to-entities|xunit | 1 | 53 | 1 | 72,804,676 | 72,804,676 | 2 | true | 2022-06-29T15:37:57.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
xUnit test fails while comparing Lists<p>Here is my unit test and it fails with a message.
Kindly help me fix this.</p>
<p>Update Question:</p>
<p>It looks l... |
72,784,036 | Cannot redeclare block-scoped variable, even though they are inside different cases<p>Inside a controller method I have the code block below. Visual Studio Code gives the error:</p>
<blockquote>
<p>Cannot redeclare block-scoped variable 'count' and 'rows'</p>
</blockquote>
<p>But I don't understand this because these v... | <p>The switch statement doesn't have different scopes by default, in fact if you don't use the <code>break</code> keyword at the end of a <code>case</code> the script will execute all the code in all the cases until it finds a break or the <code>switch</code> statement ends.</p>
<p>For example:</p>
<pre><code>switch(1)... | Cannot redeclare block-scoped variable, even though they are inside different cases | node.js|visual-studio-code|sequelize.js | 0 | 53 | 1 | 72,784,625 | 72,784,625 | 2 | true | 2022-06-28T09:34:49.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cannot redeclare block-scoped variable, even though they are inside different cases<p>Inside a controller method I have the code block below. Visual Studio C... |
72,846,252 | How can I sum the sum of a property of an javascript array in an array of objects?<p>I'm making a game where each player can submit an answer on a given question and other players can vote on an answer of another player. I store these results in an array of game rounds which may look something like the following:</p>
<... | <p>Presented below is one possible way to achieve the desired objective.</p>
<p><strong>Code Snippet</strong></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 getPlayerTot... | How can I sum the sum of a property of an javascript array in an array of objects? | javascript|arrays | 1 | 53 | 1 | 72,846,369 | 72,846,369 | 2 | true | 2022-07-03T11:50:02.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I sum the sum of a property of an javascript array in an array of objects?<p>I'm making a game where each player can submit an answer on a given ques... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.