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,919,866 | Why doesn't _ui64tow_s work when _ui64tow does?<p>I wrote some code which uses the <code>_ui64tow</code> function, but I'd like to use <code>_ui64tow_s</code>, which is safer. Unfortunately, it seems I can't get it to work properly.</p>
<p>Here's the original code:</p>
<pre><code>#define PERCENT_SHIFT 10000000
#d... | <p>The <code>_ui64tow_s</code> function returns an <code>error_t</code> value <strong>which is zero on success</strong> (unlike the plain <code>_ui64tow</code> function, which returns a copy of the string pointer argument).</p>
<p>So, when changing from using <code>_ui64tow</code> to using <code>_ui64tow_s</code>, you ... | Why doesn't _ui64tow_s work when _ui64tow does? | c++|visual-c++ | 1 | 44 | 1 | 72,919,994 | 72,919,994 | 2 | true | 2022-07-09T07:59:18.837Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why doesn't _ui64tow_s work when _ui64tow does?<p>I wrote some code which uses the <code>_ui64tow</code> function, but I'd like to use <code>_ui64tow_s</code... |
73,016,314 | Using LINQ to group a field value into an array based on an ID<p>I have the following class:</p>
<pre><code>public class LoginGroup
{
public int LoginID{ get; set; }
public int GroupID { get; set; }
public string GroupName{ get; set; }
}
</code></pre>
<p>If I have the following list:</p>
<pre><code>{ LoginID = 1,... | <p>try this</p>
<pre><code>var result = list
.GroupBy(n => n.LoginID)
.Select(r => new { LoginID = r.Key,
GroupIds = r.Select(l => l.GroupID).Distinct().ToArray() })
.ToList();
//or maybe better
var result = list
.GroupBy(n =... | Using LINQ to group a field value into an array based on an ID | c#|linq | 0 | 44 | 1 | 73,016,374 | 73,016,374 | 2 | true | 2022-07-18T00:35:21.857Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using LINQ to group a field value into an array based on an ID<p>I have the following class:</p>
<pre><code>public class LoginGroup
{
public int LoginID{ g... |
72,973,338 | Map values using multiple columns with a specific condition in Python<p>I have a dataset where I would like to map values based on a specific condition.
I would like to add a new column and then map a label to an ID if it meets the condition of:</p>
<pre><code>**If ID == AA AND Date >= to Q121: Status = 'closed' AN... | <p>You can use <a href="https://numpy.org/doc/stable/reference/generated/numpy.where.html" rel="nofollow noreferrer"><code>np.where</code></a> for this:</p>
<pre><code>df['Used'] = np.where(((df.ID == 'AA') & (df.Date >= 'Q121')), '', df['Used'])
df['Status'] = np.where(((df.ID == 'AA') & (df.Date >= 'Q12... | Map values using multiple columns with a specific condition in Python | python|pandas|numpy | -2 | 44 | 1 | 72,973,378 | 72,973,378 | 2 | true | 2022-07-13T22:33:02.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Map values using multiple columns with a specific condition in Python<p>I have a dataset where I would like to map values based on a specific condition.
I wo... |
72,999,585 | Multiple exclusive union type<p>In the following code:</p>
<pre><code>interface IPositionChange {
previousIndex: number;
newIndex: number;
}
interface IVisibilityChange {
index: number;
panel: string;
}
interface IAction {
action: 'paint' | 'clean';
}
interface IActionChange extends IAction, IVis... | <p>There is actually an issue in the Typescript repository <a href="https://github.com/Microsoft/TypeScript/issues/14094" rel="nofollow noreferrer">here</a> regarding this.</p>
<p>One of the answers proposed there is</p>
<pre><code>type Without<T> = { [P in keyof T]?: undefined };
type XOR<T, U> = (Without&... | Multiple exclusive union type | typescript | 0 | 44 | 2 | 72,999,633 | 72,999,633 | 2 | true | 2022-07-15T21:05:02.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple exclusive union type<p>In the following code:</p>
<pre><code>interface IPositionChange {
previousIndex: number;
newIndex: number;
}
interfa... |
73,006,462 | for loop range - result in columns/horizontally<p>How can i get result in columns instead?, i have tried with for [a-c], (a-c), but it will give error message.</p>
<pre><code>for a in range(1,6):
print(f'{a}')
for b in range(1,6):
print(f'{b}')
for c in range(1,6):
print(f'{c}')
</code></pre>
<p><strong>D... | <p>You can change the <code>end</code> from <code>\n</code> to space <code> </code>:</p>
<pre><code>for a in range(1,6):
print(f'{a}', end=' ')
print()
for b in range(1,6):
print(f'{b}', end=' ')
print()
for c in range(1,6):
print(f'{c}', end=' ')
print()
</code></pre>
<p>** UPDATE **:
after updating your... | for loop range - result in columns/horizontally | python|for-loop|range | 0 | 44 | 1 | 73,006,485 | 73,006,485 | 2 | true | 2022-07-16T17:49:19.473Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
for loop range - result in columns/horizontally<p>How can i get result in columns instead?, i have tried with for [a-c], (a-c), but it will give error messag... |
72,793,232 | Comparing Variables within Powershell<p>Ok. So I thought this would have been easy, but I am hitting a snag.</p>
<pre><code>$var = (Get-ItemProperty "HKCU:\SOFTWARE\SAP\General" -Name "BrowserControl")."BrowserControl"
$var2 = "HKCU:\SOFTWARE\SAP\General"
$var3 = @('1','0')
#if ... | <p><strong>You cannot meaningfully use an <em>array</em> as the <em>RHS</em> (right-hand side) of the <code>-eq</code> operator</strong>.<sup>[1]</sup></p>
<p>However, <strong>PowerShell has <em>dedicated operators</em> for testing whether a given single value is <em>contained in</em> a collection</strong> (more accura... | Comparing Variables within Powershell | powershell|variables|equals | 1 | 44 | 1 | 72,793,684 | 72,793,684 | 2 | true | 2022-06-28T21:16:28.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Comparing Variables within Powershell<p>Ok. So I thought this would have been easy, but I am hitting a snag.</p>
<pre><code>$var = (Get-ItemProperty "HK... |
73,029,992 | Assign a decimal value to a REAL8 local variable using MASM<p>I'm trying to assign a decimal value into a REAL8 local variable.
However, the only quirky way I've found is to convert a decimal number to a <a href="https://en.wikipedia.org/wiki/IEEE_754#Basic_and_interchange_formats" rel="nofollow noreferrer">IEEE 754</a... | <blockquote>
<p>I'm trying to assign a decimal value into a REAL8 local variable. However, the only quirky way I've found is to convert a decimal number to a IEEE 754 64 bit number.</p>
</blockquote>
<blockquote>
<pre><code>MOV RAX,4609434218613702656
MOV stop,RAX
FLD QWORD PTR stop
... | Assign a decimal value to a REAL8 local variable using MASM | assembly|floating-point|x86-64|masm|ieee-754 | 1 | 44 | 1 | 73,101,250 | 73,101,250 | 2 | true | 2022-07-19T00:48:20.813Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Assign a decimal value to a REAL8 local variable using MASM<p>I'm trying to assign a decimal value into a REAL8 local variable.
However, the only quirky way ... |
72,770,078 | How can I plot one trend figure with different aes of linetype, shape and color?<p>I want to observe the trend of FTSW. Colors are distinguished by different blocs, and shapes and line types are distinguished by traitement, like the figure below:
<a href="https://i.stack.imgur.com/wyH3R.jpg" rel="nofollow noreferrer"><... | <p>One issue with your code is that you put the closing parenthesis for <code>aes()</code> at the wrong position so that color, shape and linetype were not included in <code>aes()</code>. Also, as your <code>Date_obs</code> column is a categorical you have to <code>group</code> by e.g. <code>interaction(Bloc, traitemen... | How can I plot one trend figure with different aes of linetype, shape and color? | r|ggplot2|aes|geom | 0 | 44 | 1 | 72,771,879 | 72,771,879 | 2 | true | 2022-06-27T09:50:32.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I plot one trend figure with different aes of linetype, shape and color?<p>I want to observe the trend of FTSW. Colors are distinguished by different... |
72,983,067 | Matrix multiplication from the data frame in R<p>I'm studying matrix multiplication in R. I want to do matrix multiplication from the data frame.
Let's say I have <code>df</code> and <code>beta</code> as follows:</p>
<pre><code>df <- data.frame(one = c(1,1,1,1,1),
x1=c(21,34,24,35,42),
... | <p><code>"%*%"</code> has no "data.frame" method. This is reasonable because there is no guarantee that all columns in a data frame are numeric.</p>
<p>To get a result, you need <code>as.matrix(df) %*% beta</code>. But you take full responsibility to ensure the type conversion gives correct result (... | Matrix multiplication from the data frame in R | r|dataframe|matrix|matrix-multiplication | 0 | 44 | 1 | 72,983,097 | 72,983,097 | 2 | true | 2022-07-14T15:29:49.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Matrix multiplication from the data frame in R<p>I'm studying matrix multiplication in R. I want to do matrix multiplication from the data frame.
Let's say I... |
72,983,957 | Regex: searching for words that starts with @ or @<p>I want to create a regex in python that find words that start with @ or @.</p>
<p>I have created the following regex, but the output contains one extra space in each string as you can see</p>
<pre><code>regex = r'\s@\/?[\w\.\-]{2,}'
exp = 'george want@to play @.hdgsk... | <p>In your pattern you are actually matching the leading <code>\s</code> and after the @ there can be an optional <code>/</code> with <code>\/?</code> but it should optionally start with a dot.</p>
<p>You could match for example an optional dot, and then 2 or more times the allowed characters in the character class.</p... | Regex: searching for words that starts with @ or @ | python|regex|nlp | 0 | 44 | 1 | 72,983,995 | 72,983,995 | 2 | true | 2022-07-14T16:41:07.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex: searching for words that starts with @ or @<p>I want to create a regex in python that find words that start with @ or @.</p>
<p>I have created the fol... |
72,928,916 | Pie chart enclosed with a black line (rectangle)<p>Below you can see my data and facet plot in matplotlib.</p>
<pre><code>import pandas as pd
import numpy as np
pd.set_option('max_columns', None)
import matplotlib.pyplot as plt
import matplotlib as mpl
# Data
data = {
'type_sale': ['g_1','g_2','g_3','g_4','g... | <p>After playing around myself, it seems that this is working, but I think the pie gets stretched, which doesn't look that good.</p>
<p><strong>EDIT</strong>
found a better solution with <a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_adjustable.html" rel="nofollow noreferrer"><code>set_adju... | Pie chart enclosed with a black line (rectangle) | python|matplotlib | 1 | 44 | 1 | 72,929,126 | 72,929,126 | 2 | true | 2022-07-10T13:39:33.490Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pie chart enclosed with a black line (rectangle)<p>Below you can see my data and facet plot in matplotlib.</p>
<pre><code>import pandas as pd
import numpy as... |
72,990,463 | How to set JavaFX Dialog Label width<p>I'm trying to set the width of a JavaFX Dialog to fit my Text.</p>
<p>I know <em>how</em> to do it, but there is a "Fudge Factor" of 32 that I would like to understand.</p>
<p>Can anyone explain how I can determine the value empirically?</p>
<p>I'm using the Zulu OpenJDK... | <p>Having delved into the depths of <code>Dialog</code>, I found a very simple solution.<br>
Rather than iterating through the <code>DialogPane</code>'s children, I simply replaced the <code>Label</code> with a new Instance.<br></p>
<p>P.S. "replaced" is not strictly speaking correct: the built-in DialogPane ... | How to set JavaFX Dialog Label width | javafx|dialog|label|width|alert | 2 | 44 | 1 | 72,993,349 | 72,993,349 | 2 | true | 2022-07-15T07:29:15.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to set JavaFX Dialog Label width<p>I'm trying to set the width of a JavaFX Dialog to fit my Text.</p>
<p>I know <em>how</em> to do it, but there is a &qu... |
72,991,855 | Oracle SQL -> nested group functions and weird behaviour<p>I am getting familiar with pl\sql and I have a question about certain task.</p>
<p>I want to find the job with the lowest average salary, this is the solution from the script:</p>
<pre><code>SELECT job_id, AVG(salary)
FROM employees
GROUP BY job_id
HAVING AVG(s... | <p>It is not working as you are effectively doing:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT job_id,
MIN(avg_sal)
FROM (
SELECT job_id,
AVG(salary) AS avg_sal
FROM employees
GROUP BY job_id
)
</code></pre>
<p>And, while there is a <code>GROUP BY</code> clause on the inner sub... | Oracle SQL -> nested group functions and weird behaviour | sql|oracle|plsql | 2 | 44 | 2 | 72,992,190 | 72,992,190 | 2 | true | 2022-07-15T09:27:29.613Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Oracle SQL -> nested group functions and weird behaviour<p>I am getting familiar with pl\sql and I have a question about certain task.</p>
<p>I want to find ... |
72,999,841 | MySQL rejecting date<pre><code>MySQL 8
</code></pre>
<p>My query:</p>
<pre><code>"UPDATE `users` SET `start_date` = '2007-04-09' AND `eligibility` = 1 WHERE `user_id` = 36;
</code></pre>
<p>I am getting the following error:</p>
<pre><code>Warning: #1292 Truncated incorrect DOUBLE value: '2007-04-09'
</code></pre>
... | <p>You are setting start_date to:</p>
<pre><code>'2007-04-09' AND `eligibility` = 1
</code></pre>
<p>You need a comma instead of <code>AND</code> there if you want to set eligibility too.</p>
<p>That specific message comes because <code>'2007-04-09' AND</code> interprets that string as a Boolean, which it is calling a ... | MySQL rejecting date | mysql | 1 | 44 | 1 | 73,000,129 | 73,000,129 | 2 | true | 2022-07-15T21:40:57.533Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL rejecting date<pre><code>MySQL 8
</code></pre>
<p>My query:</p>
<pre><code>"UPDATE `users` SET `start_date` = '2007-04-09' AND `eligibility` = 1 W... |
72,860,548 | PyTorch: Computing the norm of batched tensors<p>I have tensor <code>t</code> with shape (Batch_Size x Dims) and another tensor <code>v</code> with shape (Vocab_Size x Dims). I'd like to produce a tensor <code>d</code> with shape (Batch_Size x Vocab_Size), such that <code>d[i,j] = norm(t[i] - v[j])</code>.</p>
<p>Doin... | <p>Insert unitary dimensions into <code>v</code> and <code>t</code> to make them (1 x Vocab_Size x Dims) and (Batch_Size x 1 x Dims) respectively. Next, take the broadcasted difference to get a tensor of shape (Batch_Size x Vocab_Size x Dims). Pass that to <code>torch.norm</code> along with the optional <code>dim=2</co... | PyTorch: Computing the norm of batched tensors | pytorch|tensor | 0 | 44 | 1 | 72,860,655 | 72,860,655 | 2 | true | 2022-07-04T18:02:28.780Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PyTorch: Computing the norm of batched tensors<p>I have tensor <code>t</code> with shape (Batch_Size x Dims) and another tensor <code>v</code> with shape (Vo... |
72,977,109 | camera has a sort of fisheye<p>I am toying around with p5js, and while generating some cubes, it appeared to me that the "camera" the "render" deforms around the edges, kind of like a fisheye to me.</p>
<p><a href="https://i.stack.imgur.com/us96B.png" rel="nofollow noreferrer"><img src="https://i.st... | <p>In <code>WEBGL</code> mode the default camera projection is <a href="https://p5js.org/reference/#/p5/perspective" rel="nofollow noreferrer">perspective()</a>.
The edges don't curve like they would with fish-eye lens, they are straight, but the edge dimensions change based on depth.</p>
<p>If you want to render the c... | camera has a sort of fisheye | javascript|p5.js | 1 | 44 | 1 | 72,979,361 | 72,979,361 | 2 | true | 2022-07-14T07:58:14.960Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
camera has a sort of fisheye<p>I am toying around with p5js, and while generating some cubes, it appeared to me that the "camera" the "render&... |
72,992,541 | Comparison between Pandas dataframe column values<p>I'm working on a Pandas df that looks like this:</p>
<pre><code> Start End
0 16360 16362
1 16367 16381
2 16374 16399
3 16401 16413
4 16417 16427
5 16428 16437
6 16435 16441
7 16442 16444
8 16457 16463
</code></pre>
<p>In this dataframe, all <cod... | <p>You can use:</p>
<pre><code># is the previous End > to the current Start?
m = df['End'].shift().gt(df['Start'])
# propagate error count
df['Error'] = m.cumsum()
# Length = End - Start if no error, else End - previous End
df['Length'] = df['End'].sub(df['Start'].mask(m, df['End'].shift()))
</code></pre>
<p>output:... | Comparison between Pandas dataframe column values | python|python-3.x|pandas|dataframe | 2 | 44 | 2 | 72,992,686 | 72,992,686 | 2 | true | 2022-07-15T10:23:54.860Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Comparison between Pandas dataframe column values<p>I'm working on a Pandas df that looks like this:</p>
<pre><code> Start End
0 16360 16362
1 16367 ... |
72,840,425 | Passing a function down to child component not working<p>first time asking something here so pardon if it's not in the right template.
I'm trying to pass down a function that I created on App.js to an input component, so on a button click it changes the state in the App component and it returns errors.</p>
<p>App.jsx</... | <p>There are possible problems with your code.</p>
<p><a href="https://codesandbox.io/s/unruffled-elgamal-zdv6i0?file=/src/App.js" rel="nofollow noreferrer">CODESANDBOX DEMO</a></p>
<p>use <code>onChange</code> instead of <code>onInput</code> as</p>
<pre><code>onChange={ ( e ) => setTodoInp( e.target.value ) }
</cod... | Passing a function down to child component not working | reactjs | 0 | 44 | 3 | 72,840,523 | 72,840,523 | 2 | true | 2022-07-02T15:49:38.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing a function down to child component not working<p>first time asking something here so pardon if it's not in the right template.
I'm trying to pass dow... |
73,029,685 | How to account for value counts that doesn't exist in python?<p>I have the following dataframe:</p>
<pre><code> Name
----------
0 Blue
1 Blue
2 Blue
3 Red
4 Red
5 Blue
6 Blue
7 Red
8 Red
9 Blue
</code></pre>
<p>I want to count the number of times "Name" = "Blue"... | <p>In Python 3.9+ you can use <a href="https://peps.python.org/pep-0584/" rel="nofollow noreferrer">PEP 584's Union Operator</a>:</p>
<pre><code>base = {'Blue': 0, 'Red': 0}
counts = df['Name'].value_counts().to_dict()
dictionary = base | counts
# or just
dictionary = {'Blue': 0, 'Red': 0} | df['Name'].value_counts().... | How to account for value counts that doesn't exist in python? | python|pandas|dataframe|count | 1 | 44 | 2 | 73,029,729 | 73,029,729 | 2 | true | 2022-07-18T23:43:51.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to account for value counts that doesn't exist in python?<p>I have the following dataframe:</p>
<pre><code> Name
----------
0 Blue
1 Blue
2 ... |
72,928,680 | Tidying function template to avoid duplication: decltype issues<p>I have the following class which wraps a member function:</p>
<pre><code>#include <cstdio>
#include <type_traits>
#include <utility>
using namespace std;
class testclass {
public:
double get() { return d_; }
void set(double d)... | <p><code>Retriever</code> is supposed to be the value, not the type, of the non-type template argument. So it should be declared as non-type template parameter. Since you want the type to be deduced, the type of the non-type template parameter should be <code>auto</code>. Equivalently for <code>Updater</code>:</p>
<pre... | Tidying function template to avoid duplication: decltype issues | c++|templates | 1 | 44 | 1 | 72,928,730 | 72,928,730 | 2 | true | 2022-07-10T13:04:19.403Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Tidying function template to avoid duplication: decltype issues<p>I have the following class which wraps a member function:</p>
<pre><code>#include <cstdi... |
72,812,062 | Pass by value and memory consumption in JavaScript<p>Let's say I got this code:</p>
<pre><code>function MinMax(list) {
const min = Math.min(...list);
const max = Math.max(...list);
return {
min,
max,
list,
};
}
const massiveList = [
1,
// supposedly a gazillion
// integer values
10000000,
... | <p>You can try the below demo with reference value</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const massiveList = [
1,
// supposedly a gazillion
// integer values
... | Pass by value and memory consumption in JavaScript | javascript|pass-by-value | 0 | 44 | 1 | 72,812,299 | 72,812,299 | 2 | true | 2022-06-30T07:47:34.223Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pass by value and memory consumption in JavaScript<p>Let's say I got this code:</p>
<pre><code>function MinMax(list) {
const min = Math.min(...list);
con... |
72,904,233 | How to get the current value of an input field with innerHTML?<p>I would like to get HTML of an editable <code>div</code>. It contains text and an <code><input></code> tag. See:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre cla... | <p>Changing the value of an input doesn't affect the <code>value</code> attribute in the HTML, because that's used for its default value, not the current value.</p>
<p>You'll need to merge the value of the input into the <code>innerHTML</code> of the DIV to get the result you want.</p>
<p><div class="snippet" data-lang... | How to get the current value of an input field with innerHTML? | javascript | -2 | 44 | 4 | 72,904,267 | 72,904,267 | 2 | true | 2022-07-07T21:07:34.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get the current value of an input field with innerHTML?<p>I would like to get HTML of an editable <code>div</code>. It contains text and an <code><... |
72,853,739 | Sum based on pattern match for multiple rows<p>I have an excel input data like below</p>
<pre><code>purchase revenue FY_1920 FY_2021 FY_2122
PID21 kids & adults (KA) 75 75 80
PID21Elderly and old (EO) 75 75 80
PID76Men or boys 80 75 80
PID52 Women or ladie... | <p>IF your PIDs criteria a few and do not change, you may use several SUMIFS combined:</p>
<p><a href="https://i.stack.imgur.com/5dsN7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5dsN7.png" alt="enter image description here" /></a></p>
<p>for <code>cars</code> output formula is:</p>
<pre><code>=S... | Sum based on pattern match for multiple rows | excel|vba|excel-formula|excel-2019 | 0 | 44 | 1 | 72,853,957 | 72,853,957 | 2 | true | 2022-07-04T08:25:03.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sum based on pattern match for multiple rows<p>I have an excel input data like below</p>
<pre><code>purchase revenue FY_1920 FY_2021 FY_2122
PID21... |
73,009,375 | ERROR #NUM! from sum of largest 5 numbers<p>The aim:</p>
<ol>
<li>Get the largest 5 numbers from (W115:AO115)
e.g. (5,5,5,5,4,3,3)==> Get (5,5,5,5,4)</li>
<li>Add them together ,i.e . 5+5+5+5+4=24</li>
</ol>
<p>My formula is :<code>=LARGE(W115:AO115,1)+LARGE(W115:AO115,2)+LARGE(W115:AO115,3)+LARGE(W115:AO115,4)+LARG... | <p>To avoid errors like <code>#NUM!</code> or <code>#VALUE!</code> need to wrap within <code>IFERROR()</code></p>
<p>Use either,</p>
<pre><code>=SUM(IFERROR(LARGE(IFERROR(W115:AO115,""),ROW($1:$5)),""))
</code></pre>
<p>Or, as mentioned above by Harun Sir, using <code>AGGREGATE()</code> still needs ... | ERROR #NUM! from sum of largest 5 numbers | excel|excel-formula | 0 | 44 | 2 | 73,009,483 | 73,009,483 | 2 | true | 2022-07-17T05:04:55.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ERROR #NUM! from sum of largest 5 numbers<p>The aim:</p>
<ol>
<li>Get the largest 5 numbers from (W115:AO115)
e.g. (5,5,5,5,4,3,3)==> Get (5,5,5,5,4)</li>... |
72,769,500 | How to properly line break long pandas lines?<p>I'm struggling to make my pandas data loading code look "good", I would like to adhere as much as possible to Pep8 with for example at most 80 characters per line. But right now my lines are way too long because of the (unwieldy) way that pandas works. For examp... | <p>My advise is use a formatter tool like <a href="https://black.readthedocs.io/en/stable/" rel="nofollow noreferrer">black</a> across all the team and forget to manually try to format the code. Formatting code consistently by hand is really hard, and shifts the cognitive load to the developer, who has to follow a lot ... | How to properly line break long pandas lines? | python|pandas | 1 | 44 | 2 | 72,769,700 | 72,769,700 | 2 | true | 2022-06-27T09:02:40.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to properly line break long pandas lines?<p>I'm struggling to make my pandas data loading code look "good", I would like to adhere as much as p... |
73,024,108 | Is there any ways to attach some debug fields for a rust struct?<p>For example, I want struct <code>S</code> to have a <code>name_count</code> field only when testing, so I can manipulate <code>last_name</code> to validate some properties about <code>name_count</code> in tests.</p>
<pre><code>pub struct S {
last_na... | <p>You can do that, but <code>#[cfg(test)]</code> is an attribute macro, so it applies to whatever follows it, and doesn't need a block scope like you had written it.</p>
<p>You also need add the <code>#[cfg(...)]</code> attributes to functions and methods to make sure you don't get "missing field"/"no f... | Is there any ways to attach some debug fields for a rust struct? | rust | 3 | 44 | 1 | 73,024,258 | 73,024,258 | 2 | true | 2022-07-18T14:37:17.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there any ways to attach some debug fields for a rust struct?<p>For example, I want struct <code>S</code> to have a <code>name_count</code> field only whe... |
72,843,524 | Use fmt specifier in struct tag<p>Is it possible to use fmt specifier or something like that in the struct tag in Golang, e.g.</p>
<pre class="lang-golang prettyprint-override"><code>type MyReqest struct {
category string fmt.Sprintf(`json:"category" binding:"required,oneof=%s"`, strings.Join(op... | <p>No, this is not possible. Closest possible thing is to use <code>go generate</code> code generator to generate the entire struct including tags. That will be done during build time and not runtime.</p>
<p>See: <a href="https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source" rel="nofollow noreferrer">ht... | Use fmt specifier in struct tag | go | 0 | 44 | 1 | 72,843,655 | 72,843,655 | 2 | true | 2022-07-03T02:04:40.707Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use fmt specifier in struct tag<p>Is it possible to use fmt specifier or something like that in the struct tag in Golang, e.g.</p>
<pre class="lang-golang pr... |
72,930,584 | Firestore - RecycleView - Image holder<p>I don't know how to write a holder for an image. I already have 2 texts set, but I don't know what the holder for the image should look like. Can you help me tell what the writeup for the image should look like in order for it to appear correctly?</p>
<pre><code>holder.artistIma... | <p>You can use a library like <a href="https://github.com/bumptech/glide" rel="nofollow noreferrer">Glide</a> or <a href="https://square.github.io/picasso/" rel="nofollow noreferrer">Picasso</a> to load the image from a given URL. Both libraries have lots of extra options for things like making the image round, adding ... | Firestore - RecycleView - Image holder | java|android|android-recyclerview | 0 | 44 | 1 | 72,930,828 | 72,930,828 | 2 | true | 2022-07-10T17:39:10.613Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firestore - RecycleView - Image holder<p>I don't know how to write a holder for an image. I already have 2 texts set, but I don't know what the holder for th... |
72,787,823 | How to get only 1 of each item in elastic search?<p>I do a search in elastic search and get all the items, sorted by the <code>"prGreater"</code> field, for example. But I can have it multiple times in the query return.</p>
<p>Is it possible to search for all items but in this return get only 1 of each item?<... | <p>You basically want to group the items, say by their "name" and then for each group, get the latest item, sorted in descending order by dhDay.</p>
<p>You need a nested top hits aggregation:</p>
<pre><code>{
"size": 0,
"aggs": {
"name": {
"terms": {
... | How to get only 1 of each item in elastic search? | elasticsearch | 0 | 44 | 1 | 72,788,479 | 72,788,479 | 3 | true | 2022-06-28T13:58:36.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get only 1 of each item in elastic search?<p>I do a search in elastic search and get all the items, sorted by the <code>"prGreater"</code> f... |
72,789,024 | Representing array elements on a square in Python (as image)<p>I have an array <code>A</code> with shape <code>(3,3)</code>. Is there a way to represent the array elements on a square of size 3x3? In general, I would like to represent <code>nxn</code> arrays on a square of size <code>nxn</code>? The expected output is ... | <p>You could use <a href="https://seaborn.pydata.org/generated/seaborn.heatmap.html" rel="nofollow noreferrer"><code>seaborn.heatmap</code></a> that has a nice API:</p>
<pre><code>import numpy as np
import seaborn as sns
from matplotlib.colors import ListedColormap
A = np.array([[10, 20, 30], [40, 50, 60], [70, 80, 90... | Representing array elements on a square in Python (as image) | python|numpy | 2 | 44 | 1 | 72,789,254 | 72,789,254 | 3 | true | 2022-06-28T15:12:01.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Representing array elements on a square in Python (as image)<p>I have an array <code>A</code> with shape <code>(3,3)</code>. Is there a way to represent the ... |
72,807,898 | R elementwise calculations in dataframe which contains lists<p>I have the following dataframe df:</p>
<pre><code> adj_coords
1 2, 3, 4, 5, 6, 7
2 1, 3, 7, 8, 9, 10
3 1, 2, 4, 10, 11, 12
4 1, 3, 5, 12, 13, 14
5 1, 4, 6, 14, 15, 16
6 1, 5, 7, 16, 17, 18
adj_coords_material_amou... | <p>Loop over each paired set of <code>adj_coords</code> and <code>adj_coords__material_amounts</code> using <code>mapply</code> and <code>sample</code> one value with the selection > 0.</p>
<pre><code>##set.seed(1)
mapply(
\(co,ma) sample(co[ma > 0], 1),
df[["adj_coords"]], df[["adj_coords_... | R elementwise calculations in dataframe which contains lists | r|dataframe | 3 | 44 | 2 | 72,808,185 | 72,808,185 | 3 | true | 2022-06-29T21:08:38.113Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R elementwise calculations in dataframe which contains lists<p>I have the following dataframe df:</p>
<pre><code> adj_coords
1 2, 3, 4, 5, 6, 7
... |
72,821,253 | Blazor: Creating a form using partial components<h2>Question</h2>
<p>I have a class:</p>
<pre class="lang-cs prettyprint-override"><code>// Person.cs
public class Person
{
public string Name { get; set; }
public DateTime DateOfBirth { get; set; }
public double Temperature { get; set; }
public double Pulse { get... | <p>I decided to revisit solution 1 and was able to get the sync working. Here's my code:</p>
<pre class="lang-cs prettyprint-override"><code><InputText @bind-Value="Name" />
@code {
[Parameter] public Person Person { get; set; }
[Parameter] public EventCallback<Person> PersonChanged { get; se... | Blazor: Creating a form using partial components | c#|blazor | 1 | 44 | 1 | 72,821,701 | 72,821,701 | 3 | true | 2022-06-30T19:45:36.197Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Blazor: Creating a form using partial components<h2>Question</h2>
<p>I have a class:</p>
<pre class="lang-cs prettyprint-override"><code>// Person.cs
public ... |
72,827,945 | How can I print out the max nos in each column of a numpy array in an object using python?<p>I have the below numpy array</p>
<pre><code>[[7, 0, 0, 6],
[5, 6, 6, 1],
[4, 1, 6, 7],
[5, 3, 4, 7]]
</code></pre>
<p>I want to find the max no in each column using np.max and then print out the result in an object such t... | <p>If <code>arr</code> is your array, then you just need to use the <code>max</code> function, indicating the chosen axis:</p>
<pre><code>arr.max(axis=0)
</code></pre>
<p>Output:</p>
<pre><code>array([7, 6, 6, 7])
</code></pre>
<p>If you want a list instead of a numpy array:</p>
<pre><code>arr.max(axis=0).tolist()
</co... | How can I print out the max nos in each column of a numpy array in an object using python? | python|numpy|indexing | 1 | 44 | 3 | 72,828,012 | 72,828,012 | 3 | true | 2022-07-01T10:32:01.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I print out the max nos in each column of a numpy array in an object using python?<p>I have the below numpy array</p>
<pre><code>[[7, 0, 0, 6],
[5,... |
72,858,152 | Python Pandas - explode only one column in a dataframe<p>I have data that looks like this:</p>
<pre><code>["Col1": {0: "str0", 1: "str1", 2: "str2"}, "Col2": {0: ["sub1"], 1: ["sub1", "sub2"], 2: ["sub1", "sub2", "s... | <p>You still do <code>explode</code> but assign it back , also notice you used capital in column name</p>
<pre><code>df = df.explode('Col2')
</code></pre> | Python Pandas - explode only one column in a dataframe | python|python-3.x|pandas|numpy | -1 | 44 | 2 | 72,858,196 | 72,858,196 | 3 | true | 2022-07-04T14:15:34.860Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Pandas - explode only one column in a dataframe<p>I have data that looks like this:</p>
<pre><code>["Col1": {0: "str0", 1: "s... |
72,871,319 | How to remove duplicates from different columns table in sql<p>I have data in which i have duplicates but in different columns for ex :</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">Column A</th>
<th style="text-align: left;">Column B</th>
</tr>
</thead>
<tbody>
... | <p>We can use a least/greatest trick here:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT DISTINCT LEAST(a, b) AS a, GREATEST(a, b) AS b
FROM yourTable;
</code></pre>
<p>The idea is to, e.g., take the two tuples <code>(1, 2)</code> and <code>(2, 1)</code> and bring them both to <code>(1, 2)</code>, using t... | How to remove duplicates from different columns table in sql | sql|snowflake-cloud-data-platform | 0 | 44 | 1 | 72,871,467 | 72,871,467 | 3 | true | 2022-07-05T14:42:43.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove duplicates from different columns table in sql<p>I have data in which i have duplicates but in different columns for ex :</p>
<div class="s-tab... |
72,887,976 | What is SQL's Keyword order? (Postgresql)<p>Depending on where you put SELECT, FROM, WHERE, etc, I have run into syntax errors. What is the proper order to write queries and code? An example below:</p>
<pre><code>//No error
SELECT count(*)
FROM us_counties_pop_est_2019
WHERE births_2019 - deaths_2019 <=0;
</code></p... | <p>The <em>main clauses</em> of a <code>SELECT</code> statement in PostgreSQL are written in the following order:</p>
<ul>
<li><code>[WITH]</code></li>
<li><code>SELECT</code></li>
<li><code>FROM</code></li>
<li><code>JOIN</code></li>
<li><code>WHERE</code></li>
<li><code>GROUP BY</code></li>
<li><code>HAVING</code></l... | What is SQL's Keyword order? (Postgresql) | sql|database|postgresql|syntax | -1 | 44 | 1 | 72,888,018 | 72,888,018 | 3 | true | 2022-07-06T17:54:51.653Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is SQL's Keyword order? (Postgresql)<p>Depending on where you put SELECT, FROM, WHERE, etc, I have run into syntax errors. What is the proper order to w... |
72,890,039 | Find elements missing from 2nd list from first list, and add them into 2nd list<p>I have two list of list and I want to check what element of l1 is not in l2 and add all this element in a new list ls in l2. For example,</p>
<p>input: <br>
l1 = [[1,2,3],[5,6],[7,8,9,10]]<br>
l2 = [[1,8,10],[3,9],[5,6]]<br></p>
<p>output... | <p>This should work:</p>
<pre><code>l1 = [[1,2,3],[5,6],[7,8,9,10]]
l2 = [[1,8,10],[3,9],[5,6]]
l1n = set([x for xs in l1 for x in xs])
l2n = set([x for xs in l2 for x in xs])
l2.append(list(l1n - l2n))
</code></pre> | Find elements missing from 2nd list from first list, and add them into 2nd list | python|list | 1 | 44 | 3 | 72,890,100 | 72,890,100 | 3 | true | 2022-07-06T21:26:06.127Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find elements missing from 2nd list from first list, and add them into 2nd list<p>I have two list of list and I want to check what element of l1 is not in l2... |
72,781,728 | Why the same mongodb query behaves inconsistently between different client?<p>firstly, let's take this simple query as example:</p>
<p><code>ObjectId('62663def4e578b0a1cb482c5').valueOf();</code></p>
<p>output in DataGrip v2021.3.1:
<code>{"$oid": "62663def4e578b0a1cb482c5"}</code></p>
<p>output in ... | <p>mongosh and MongoDB JDBC driver that is used in DataGrip have the same core so they should be very similar (and your examples show that. <code>{"$oid": "62663def4e578b0a1cb482c5"}</code> is just json representation of ObjectId type).</p>
<p>I don't remember what Navicat uses. I might guess that t... | Why the same mongodb query behaves inconsistently between different client? | javascript|mongodb|datagrip|navicat | 0 | 44 | 1 | 72,913,696 | 72,913,696 | 3 | true | 2022-06-28T06:35:58.760Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why the same mongodb query behaves inconsistently between different client?<p>firstly, let's take this simple query as example:</p>
<p><code>ObjectId('62663d... |
72,919,231 | marking same across rows if one of rows satisfy condition<p>How can I mark as 'abuser' across rows of same ID if one of rows of that ID satisfy a condition?</p>
<p>For example, if I have the following table,</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>ID</th>
<th>social score</th>
</tr>... | <p>First find the <code>ID's</code> having social score <code>0</code>, then use <code>np.where</code> to assign <code>class</code> values:</p>
<pre><code>i = df.loc[df['social score'].eq(0), 'ID']
df['class'] = np.where(df['ID'].isin(i), 'abnormal', 'normal')
</code></pre>
<hr />
<pre><code> ID social score cla... | marking same across rows if one of rows satisfy condition | python|pandas|dataframe | 2 | 44 | 2 | 72,919,272 | 72,919,272 | 3 | true | 2022-07-09T05:41:51.273Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
marking same across rows if one of rows satisfy condition<p>How can I mark as 'abuser' across rows of same ID if one of rows of that ID satisfy a condition?<... |
72,948,999 | Order of block number in Blockchain<p>Assume I started a transaction yesterday which is not yet confirmed (In <strong>Pending</strong> status).
Later four other transactions are Successful and assumed they are having block numbers
1110, 1111, 1112, 1113.</p>
<p>Assume the old transaction got confirmed at this point in ... | <p>The tx will be in a higher block (Assuming it gets accepted by a miner at some point). It is currently in the mempool waiting to be mined. You can query the blockchain to get the status (Depends on client API, special clients like Alchemy and QuickNode may have special tools to explore the mempool e.g. Alchemy have ... | Order of block number in Blockchain | blockchain|ethereum|solidity | 0 | 44 | 1 | 72,949,068 | 72,949,068 | 3 | true | 2022-07-12T08:10:14.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Order of block number in Blockchain<p>Assume I started a transaction yesterday which is not yet confirmed (In <strong>Pending</strong> status).
Later four ot... |
72,950,017 | Tail recursion optimized javascript code performance worse than non optimization, it's counterintuitive,Is it because the compiler doesn't optimize?<pre><code>function factorialNormal(n) {
if (n === 1) {
return n
}
return n + factorialNormal(n - 1)
}
</code></pre>
<pre><code>function factorialWithTail(n, acc)... | <p>There is no TCO on V8 currently.</p>
<p><a href="https://bugs.chromium.org/p/v8/issues/detail?id=4698" rel="nofollow noreferrer">Here is the tracking ticket for this feature</a>.</p> | Tail recursion optimized javascript code performance worse than non optimization, it's counterintuitive,Is it because the compiler doesn't optimize? | javascript|typescript|google-chrome|v8|tail-recursion | 1 | 44 | 1 | 72,950,175 | 72,950,175 | 3 | true | 2022-07-12T09:26:32.243Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Tail recursion optimized javascript code performance worse than non optimization, it's counterintuitive,Is it because the compiler doesn't optimize?<pre><cod... |
72,942,003 | When subclassing "double" with new properties in MATLAB, is there an easy way to access the data value?<p>Say I have a class subclassing double, and I want to add a string (Similar to the 'extendDouble' in the documentation). Is there an easy way to access the actual numeric value without the extra properties, particul... | <p>Short answer: NO. There is no <em>easy</em> way to access a single member of a class when the class contains more than one member. You'll always have to let MATLAB know which part of the class you want to manipulate.</p>
<p>You have multiple questions in your post but let's tackle the most interesting one first:</p>... | When subclassing "double" with new properties in MATLAB, is there an easy way to access the data value? | matlab|indexing|double|variable-assignment|subclass | 3 | 44 | 1 | 72,967,502 | 72,967,502 | 3 | true | 2022-07-11T16:51:41.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When subclassing "double" with new properties in MATLAB, is there an easy way to access the data value?<p>Say I have a class subclassing double, and I want t... |
72,996,774 | Why can't I reassign a list (passed as a paramater) in a function?<p>According to my understanding, both functions should have changed <code>list</code> since lists are mutable but only foo() did so.</p>
<pre><code>def foo(myList):
myList[0] = 3
def bar(myList):
myList = [3,2,1]
list = [1,2,3]
print(list)
foo(... | <p>Print the id may help you to understand it:</p>
<pre class="lang-py prettyprint-override"><code>def foo(myList):
myList[0] = 3
print(id(myList))
def bar(myList):
myList = [3,2,1]
print(id(myList))
list = [1,2,3]
print(list)
print(id(list))
foo(list)
print(list)
print(id(list))
bar(list)
print(list)
pri... | Why can't I reassign a list (passed as a paramater) in a function? | python|list|variables|mutable | 1 | 44 | 1 | 72,996,807 | 72,996,807 | 3 | true | 2022-07-15T16:02:49.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can't I reassign a list (passed as a paramater) in a function?<p>According to my understanding, both functions should have changed <code>list</code> sinc... |
72,997,891 | Python: Subtract two DataFrames<p>I have two DataFrames:</p>
<pre><code>df1:
A B C
Date
2022-01-01 0 100 0
2022-01-04 50 0 0
2022-02-08 0 0 200
df2:
A B C
Date
2022-01-01 0 200 0
2022-01-02 0 200 0
2022-02-03 0 200 0
2022-01-04 50 200 0
2022-01... | <p>You need to add a <code>fill_value</code>:</p>
<pre><code>df1.subtract(df2, fill_value=0)
</code></pre>
<p>However, given the provided output, it looks more like you want an addition and to restrict the index to that of <code>df2</code>:</p>
<pre><code>df2.add(df1.reindex_like(df2), fill_value=0)
</code></pre>
<p>ou... | Python: Subtract two DataFrames | python|pandas|dataframe|subtraction | 1 | 44 | 1 | 72,998,004 | 72,998,004 | 3 | true | 2022-07-15T17:45:12.423Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Subtract two DataFrames<p>I have two DataFrames:</p>
<pre><code>df1:
A B C
Date
2022-01-01 0 100 0
2022-01-04 50 0 0
20... |
73,005,042 | How Async/Await handle multiple calls at same API end point from multiple user at same time<p>I am working on an application where I have used <code>async</code>/<code>await</code> for every endpoint. My question here is how <code>async</code>/<code>await</code> handles multiple requests at the same time on the same AP... | <blockquote>
<p>My question here is how async/await handles multiple requests at the same time on the same API endpoint. For example, if I have an endpoint to save a user record and that endpoint has been hit by two different users at the same time what will happen? Can somebody explain?</p>
</blockquote>
<p>This actua... | How Async/Await handle multiple calls at same API end point from multiple user at same time | .net-core|async-await | 0 | 44 | 2 | 73,007,906 | 73,007,906 | 3 | true | 2022-07-16T14:34:07.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How Async/Await handle multiple calls at same API end point from multiple user at same time<p>I am working on an application where I have used <code>async</c... |
73,025,171 | How to remove duplicates based on missing data in another column?<p>I have a dataset that looks like this:</p>
<pre><code> Study_ID Recurrent_Status
1 100 1
2 100 NA
3 100 NA
4 200 1
5 300 NA
6 400 ... | <p>We could <code>arrange</code> by the non-NA elements in 'Recurrent_Status' along with the first column and then use <code>distinct</code></p>
<pre><code>library(dplyr)
data %>%
arrange(Study_ID, is.na(Recurrent_Status)) %>%
distinct(Study_ID, .keep_all = TRUE)
</code></pre>
<p>-output</p>
<pre><code> Stu... | How to remove duplicates based on missing data in another column? | r|dplyr|filter|duplicates | 4 | 44 | 4 | 73,025,202 | 73,025,202 | 3 | true | 2022-07-18T15:52:10.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove duplicates based on missing data in another column?<p>I have a dataset that looks like this:</p>
<pre><code> Study_ID Recurrent_Status
1 ... |
73,000,182 | githooks(5): what is the Git "null-ref"<p>On the documentation for the <a href="https://git-scm.com/docs/githooks#_post_checkout" rel="nofollow noreferrer"><code>post-checkout</code> hook</a>, it says</p>
<blockquote>
<p>It is also run after <a href="https://git-scm.com/docs/git-clone" rel="nofollow noreferrer">git-clo... | <p>It is the commit ID consisting of all zeros.</p>
<p>I added the following line to <code>~/.config/git/template/hooks/post-checkout</code>:</p>
<pre><code>echo "post-checkout" "$@" 1>&2
</code></pre>
<p>and then cloned a new repository, getting the following output:</p>
<pre><code>post-chec... | githooks(5): what is the Git "null-ref" | git|githooks | 2 | 44 | 3 | 73,000,183 | 73,000,183 | 3 | true | 2022-07-15T22:35:48.853Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
githooks(5): what is the Git "null-ref"<p>On the documentation for the <a href="https://git-scm.com/docs/githooks#_post_checkout" rel="nofollow noreferrer"><... |
72,970,983 | How to print inputted text in x86 assembly<p>I am working on a little assembly project, and I'm running into some issues displaying inputted text. Here's the code I have so far:</p>
<pre><code>[org 0x7c00]
mov ah, 0
int 0x16
mov al, [key]
int 0x10
key:
db 0
jmp $
times 510-($-$$) db 0
db 0x55, 0xaa
</code></pre... | <p>The <code>mov ah, 0</code> <code>int 0x16</code> instructions wait for a keypress.<br />
To store the result you get in the AX register, you need to write <code>mov [key], al</code> with the destination as the leftmost operand.</p>
<p>If you want to output the character then just having <code>int 0x10</code> is not ... | How to print inputted text in x86 assembly | assembly|x86|nasm|qemu|osdev | 1 | 44 | 1 | 72,971,351 | 72,971,351 | 3 | true | 2022-07-13T18:25:48.520Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to print inputted text in x86 assembly<p>I am working on a little assembly project, and I'm running into some issues displaying inputted text. Here's the... |
72,858,640 | Is there a way to use a common method to take Iterable of String and Long<p>I have the following 2 methods:</p>
<pre><code>boolean iterableContainsStr(Iterable<String> iterable, Object matcher) {
return StreamSupport.stream(iterable.spliterator(), false).anyMatch(i -> i.equals(matcher));
}
boolean... | <p>The compile error is because your method expects a class Iterable of type String and you pass it a class Iterable of type Object.</p>
<p>Just use generics (or whildcard as suggested by @Stephen c)</p>
<pre><code><T> boolean iterableContains(Iterable<T> iterable, Object matcher) {
return StreamSuppor... | Is there a way to use a common method to take Iterable of String and Long | java|string|object|iterable | 1 | 44 | 3 | 72,858,748 | 72,858,748 | 3 | true | 2022-07-04T14:55:14.753Z | 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 use a common method to take Iterable of String and Long<p>I have the following 2 methods:</p>
<pre><code>boolean iterableContainsStr(Iterab... |
72,955,820 | how to select integer columns through list comprehension in python<p>I have a dataframe with columns as mentioned</p>
<pre><code>[-10800,
-9000,
-7200,
-5400,
-3600,
-1800,
0,
180,
300,
1200,
1800,
2400,
3600,
'-10800_R',
'-9000_R',
'-7200_R',
'-5400_R',
'-3600_R',
'-1800_R',
'0_R',
'180_R',
'300_R... | <p>Building on @nacho's comment:</p>
<pre><code>[i for i in df.columns.to_list() if isinstance(i,str) and i.endswith("_R")]
</code></pre> | how to select integer columns through list comprehension in python | python|list | 0 | 44 | 2 | 72,955,894 | 72,955,894 | 3 | true | 2022-07-12T16:51:26.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to select integer columns through list comprehension in python<p>I have a dataframe with columns as mentioned</p>
<pre><code>[-10800,
-9000,
-7200,
-5... |
72,920,282 | = in URL changes into %3D<p>I have url with parameters in my static web page</p>
<p><a href="https://www.nejlepsi-skolky.cz/list-map-of-kindergartens-seznam-mapa-skolek-jesli?locationFrom=Velk%C3%A9%20Opatovice,Dlouh%C3%A1%20429;latFrom=49.6120414733887;lonFrom=16.6786785125732" rel="nofollow noreferrer">https://www.ne... | <blockquote>
<p>the problem is that the second and the third equals signs are changed into %3D, when I click on the URL.</p>
</blockquote>
<p>This is <a href="https://en.wikipedia.org/wiki/Percent-encoding" rel="nofollow noreferrer">normal</a>. It should not be a problem if you are reading the URL with something that s... | = in URL changes into %3D | html|url | 0 | 44 | 1 | 72,920,308 | 72,920,308 | 3 | true | 2022-07-09T09:27:21.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
= in URL changes into %3D<p>I have url with parameters in my static web page</p>
<p><a href="https://www.nejlepsi-skolky.cz/list-map-of-kindergartens-seznam-... |
73,005,906 | cannot understand logic of recursion<p>This function has to return reversed string. For example, “dog” -> “god”.
It works correctly but I don’t understand the logic and I need explanation</p>
<pre><code>function reverse (str) {
if (str.length <= 1) return str;
return reverse(str.slice(1)) + str[0]
}
</code>... | <h2>Explaination</h2>
<p>Firstly, you call reverse(“dog”) and it return reverse(“og”)+”d”
Then the reverse(“og”) continue to run again. It returns reverse(“g”)+”o”
The last one, reverse(“g”) only returns “g” since the if statement is true</p>
<p>Then you plug the reverse(“g”) to the reverse(“g”)+”o”, as a result “go” i... | cannot understand logic of recursion | javascript | 3 | 44 | 3 | 73,005,997 | 73,005,997 | 3 | true | 2022-07-16T16:28:39.697Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cannot understand logic of recursion<p>This function has to return reversed string. For example, “dog” -> “god”.
It works correctly but I don’t understand... |
72,927,797 | Typescript - Typing a function with optional argument correctly<p>Suppose we have the following function:</p>
<pre class="lang-ts prettyprint-override"><code>function test<S, T>(obj: S, prop: keyof S, mapper?: (value: S[keyof S]) => T): S[keyof S] | T {
return typeof mapper === 'function'
? mapper(obj[pr... | <p>Just use <a href="https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads" rel="nofollow noreferrer">function overloads</a> !</p>
<pre><code>function test<S, T>(obj: S, prop: keyof S): S[keyof S];
function test<S, T>(obj: S, prop: keyof S, mapper: (value: S[keyof S]) => T): T;... | Typescript - Typing a function with optional argument correctly | typescript | 3 | 44 | 2 | 72,927,873 | 72,927,873 | 3 | true | 2022-07-10T10:32:00.967Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typescript - Typing a function with optional argument correctly<p>Suppose we have the following function:</p>
<pre class="lang-ts prettyprint-override"><code... |
72,801,416 | KVO publisher does not send signal on property change<p>I've just started learning Combine and am quite confused with behaviour of KVO publishers. They just do not publish any events except for the initial value.
Here is the sample code I used:</p>
<pre><code>@objc class SampleClass: NSObject {
@objc var name: NSSt... | <p>You also need to mark the property as <code>dynamic</code> in order for it to be KVO compliant. <code>publisher(for:)</code> only works with KVO compliant properties, since it uses KVO under the hood.</p>
<pre><code>@objc class SampleClass: NSObject {
@objc dynamic var name: NSString = "1"
}
</code></p... | KVO publisher does not send signal on property change | swift|reactive-programming|combine|key-value-observing | -2 | 44 | 1 | 72,801,518 | 72,801,518 | 3 | true | 2022-06-29T12:25:12.220Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
KVO publisher does not send signal on property change<p>I've just started learning Combine and am quite confused with behaviour of KVO publishers. They just ... |
72,869,955 | derived class as a parameter of templated function which is specialized for its base class<pre><code>class Base {};
class Derived : public Base {};
class SomeClass
{
template<typename T>
static void SetContent(T* pChild, OVariant content)
{
LOG_ASSERT(0, "All classes must be specialized... | <p>You can convert a <code>Derived*</code> to a <code>Base*</code>, but I think you rather want to specialize for all <code>T</code> that have <code>Base</code> as base</p>
<pre><code>#include <type_traits>
#include <iostream>
class Base {};
class Derived : public Base {};
template <typename T,typenam... | derived class as a parameter of templated function which is specialized for its base class | c++|templates|template-specialization|derived-class | 0 | 44 | 2 | 72,870,229 | 72,870,229 | 3 | true | 2022-07-05T13:04:34.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
derived class as a parameter of templated function which is specialized for its base class<pre><code>class Base {};
class Derived : public Base {};
class S... |
72,771,401 | Easy way to OR 3 comparisons?<p>I have an <code>if</code> block and I need to put a few comparisons in it for example:</p>
<pre><code>if type(widget1) is tk.Entry or type(widget1) is tk.OptionMenu or type(widget1) is tk.Label:
# do something
</code></pre>
<p>As you can see I am writing type(widget1) thrice. Instead... | <p>I think you can use a list :</p>
<pre><code>if type(widget1) in [tk.OptionMenu, tk.Entry, tk.Label]:
#Do something
</code></pre> | Easy way to OR 3 comparisons? | python|tkinter | 1 | 44 | 2 | 72,771,795 | 72,771,795 | 3 | true | 2022-06-27T11:33:27.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Easy way to OR 3 comparisons?<p>I have an <code>if</code> block and I need to put a few comparisons in it for example:</p>
<pre><code>if type(widget1) is tk.... |
72,777,884 | How do different data types depend on operating system in java?<p>I'm working with audio files in java (Assignment in my laboratory), and i read bytes from file then i convert them to primitive data types int and short. As i know primitive data types depend on compile settings and operating system. So how they depend o... | <p>Java primitives data types are not OS dependent.</p>
<p>These are the values for those types, and they are always the same.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Type</th>
<th>Bytes</th>
<th>Range</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>byte</code></td>
<td>1</td>
<td>-128 t... | How do different data types depend on operating system in java? | java|types | -1 | 44 | 2 | 72,777,971 | 72,777,971 | 4 | true | 2022-06-27T20:20:05.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do different data types depend on operating system in java?<p>I'm working with audio files in java (Assignment in my laboratory), and i read bytes from f... |
72,787,960 | Typescript array of arrays of arrays: protect from undefined<p>I am parsing a complex object in Typescript, so have something like:</p>
<pre><code>const a = reply['price']['value']['total']['value'];
</code></pre>
<p>and I like to ensure that all elements are defined in the chain, otherwise, it should set <code>a=0</co... | <p>If you're using modern JS you can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator" rel="nofollow noreferrer">nullish coalescing</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining" rel="nof... | Typescript array of arrays of arrays: protect from undefined | javascript|typescript | 0 | 44 | 2 | 72,787,998 | 72,787,998 | 4 | true | 2022-06-28T14:06:51.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typescript array of arrays of arrays: protect from undefined<p>I am parsing a complex object in Typescript, so have something like:</p>
<pre><code>const a = ... |
72,790,126 | Remove thousands separator from a line starting with Total Value<p>I have a text file which was generated with Powershell.
There is a line that starts with Total Value: $
That line has a dollar amount which contains a thousands separator comma.
I would like to delete that comma, but only in that line.
I have tried usin... | <p>You can use</p>
<pre><code>foreach ($file in $Files)
{
(Get-Content $file -Raw) -replace '(?m)(?<=^Total\s+Value:\s*\$[\d,]*),','' |
out-file "C:\Users\User\Summary2.csv" -append -encoding ascii
}
</code></pre>
<p>See the <a href="https://regex101.com/r/g7tdEi/1" rel="nofollow noreferrer">regex ... | Remove thousands separator from a line starting with Total Value | regex|powershell | 1 | 44 | 1 | 72,790,207 | 72,790,207 | 4 | true | 2022-06-28T16:28:57.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove thousands separator from a line starting with Total Value<p>I have a text file which was generated with Powershell.
There is a line that starts with T... |
72,797,817 | SQL Server - Breakdown date period<p>I want to create a query that breakdowns a date period into 10 days sub-periods</p>
<p>So a period of <strong>2022-04-15 to 2022-05-01</strong> should be broken into</p>
<pre><code>2022-04-15 2022-04-24
2022-04-25 2022-05-01
</code></pre>
<p>The period could be one day (2022-04-15 ... | <p>A Tally would be a much more performant approach:</p>
<pre class="lang-sql prettyprint-override"><code>DECLARE @Start date = '20220415',
@End date = '20220501',
@Days int = 10;
WITH N AS (
SELECT N
FROM (VALUES(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL))N(N)),
Tally A... | SQL Server - Breakdown date period | sql|sql-server|date|period | -2 | 44 | 3 | 72,798,170 | 72,798,170 | 4 | true | 2022-06-29T08:02:16.907Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL Server - Breakdown date period<p>I want to create a query that breakdowns a date period into 10 days sub-periods</p>
<p>So a period of <strong>2022-04-15... |
72,817,628 | Const constructor is not working on Dart and shows id as 0<p>I'm learning Dart using the <code>Dart Apprentice</code> book. Can you tell me why this code shows <code>0</code> as <code>id</code> even though I have created <code>const</code> object as <code> const vicki = User(id: 24, name: 'Vicki');</code></p>
<p>Please... | <p>The named arguments in your current code are not setting any value in your object. You are therefore just declaring some parameters to the constructor without using any of them.</p>
<p>Your code should instead be written as:</p>
<pre class="lang-dart prettyprint-override"><code>void main() {
const vicki = User(
... | Const constructor is not working on Dart and shows id as 0 | dart | 1 | 44 | 2 | 72,817,689 | 72,817,689 | 4 | true | 2022-06-30T14:32:42.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Const constructor is not working on Dart and shows id as 0<p>I'm learning Dart using the <code>Dart Apprentice</code> book. Can you tell me why this code sho... |
72,826,520 | Man page in C application<p>I'm currently working on a little project to test my knowledge in writing C applications.
I try to create a man page which shall open, once <code>app --help</code> is typed. How do I change the path, so when I send my work to friends they can also run <code>app --help</code> and the man page... | <p><code>run_in_command_line</code> may be a call to <code>system()</code>, but this will work only if run into a terminal.</p>
<p>Launching <code>man ./app.8</code> from your executable is definitely a bad idea, because it would require that the run would be made in the right directory. Such a constraint is considered... | Man page in C application | c|command-line|manpage | 0 | 44 | 1 | 72,826,736 | 72,826,736 | 4 | true | 2022-07-01T08:33:44.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Man page in C application<p>I'm currently working on a little project to test my knowledge in writing C applications.
I try to create a man page which shall ... |
72,839,547 | Margining two arrays of different sizes and placing values next to each other<p>I'm trying to merge two arrays and place thier respective values next to each other. For example, have those two arrays.</p>
<pre><code>Arry1 = [{"key" : "A", "values": [[111], [222]]}]
Arry2 = [333,444,555]
</... | <p>I hate to add another answer when the previous two do the job, but I think that the neatest answer leverage's python's <code>zip</code> function:</p>
<pre class="lang-py prettyprint-override"><code>Arry1 = [{"key" : "A", "values": [[111], [222]]}]
Arry2 = [333,444,555]
for x, y in zip(... | Margining two arrays of different sizes and placing values next to each other | python|arrays | 0 | 44 | 3 | 72,839,666 | 72,839,666 | 4 | true | 2022-07-02T13:51:34.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Margining two arrays of different sizes and placing values next to each other<p>I'm trying to merge two arrays and place thier respective values next to each... |
72,943,943 | Why does `puts {}.class.name` return nothing in Ruby?<p>I've tried this with other classes and they return things. Just this one doesn't.</p>
<pre><code>puts ''.class.name # String
puts 1.class.name # Integer
puts [].class.name # Array
puts {}.class.name
</code></pre>
<p>but <code>{}.class.name</code> just returns bla... | <p>Because <code>puts {}</code> passes a block.</p>
<p>Any method can take a block.</p>
<p><code>puts {}.class.name</code> is really <code>(puts {}).class.name</code>. <code>puts {}</code> ignores the block and prints a newline. It returns <code>nil</code>. <code>class.name</code> is called on <code>nil</code> so the ... | Why does `puts {}.class.name` return nothing in Ruby? | ruby|class | 1 | 44 | 2 | 72,944,101 | 72,944,101 | 4 | true | 2022-07-11T19:51:32.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does `puts {}.class.name` return nothing in Ruby?<p>I've tried this with other classes and they return things. Just this one doesn't.</p>
<pre><code>puts... |
72,962,993 | Regex in .net seems to not work correctly<p>I want strip html from string with regular expression and while this regex works everywhere it does not work in .net I don't understand why.</p>
<pre class="lang-cs prettyprint-override"><code>using System;
public class Program
{
public static voi... | <p>You're missing the correct Regex option:</p>
<pre><code>var res = System.Text.RegularExpressions.Regex.Replace(text, "<.*?>", "", RegexOptions.Singleline);
</code></pre>
<p>The reason you need this is because you have a newline (<code>\n</code>) in your HTML. <code>Singleline</code> will en... | Regex in .net seems to not work correctly | c#|.net|regex|replace | 0 | 44 | 2 | 72,963,071 | 72,963,071 | 4 | true | 2022-07-13T08:16:58.267Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex in .net seems to not work correctly<p>I want strip html from string with regular expression and while this regex works everywhere it does not work in .... |
72,944,527 | Reading in a Table Using rvest<p>This is a link to a table with a table of ~290 Vine Plant names:</p>
<p><a href="https://www.forestryimages.org/browse/catsubject.cfm?cat=51" rel="nofollow noreferrer">https://www.forestryimages.org/browse/catsubject.cfm?cat=51</a></p>
<p>I am trying to read in the table and keep the <c... | <p>It appears that you need JavaScript to scrape that table, but there is a workaround to download the data in JSON form. If you inspect and go to the network tab, there is an API that you can request for the JSON format of the table. Let me know if this answers your question.</p>
<pre><code>library(jsonlite)
json_data... | Reading in a Table Using rvest | r|web-scraping | 0 | 44 | 1 | 72,944,693 | 72,944,693 | 4 | true | 2022-07-11T20:49:48.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reading in a Table Using rvest<p>This is a link to a table with a table of ~290 Vine Plant names:</p>
<p><a href="https://www.forestryimages.org/browse/catsu... |
72,789,648 | How to use string as variable in powershell<p>I have a XAML gui in my powershell script.
I would like to know how I can use a string as a variable name ex. $grid.Name is WPFgrdCopy</p>
<p>This works:</p>
<pre><code>$WPFgrdCopy.Background = "#FF212123"
</code></pre>
<p>This does not:</p>
<pre><code>$grids = Ge... | <p>The objects of type <a href="https://docs.microsoft.com/en-US/dotnet/api/System.Management.Automation.PSVariable" rel="nofollow noreferrer"><code>System.Management.Automation.PSVariable</code></a> that <a href="https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/get-variable" rel="nofollow nor... | How to use string as variable in powershell | powershell | 2 | 44 | 1 | 72,790,032 | 72,790,032 | 4 | true | 2022-06-28T15:53:42.010Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use string as variable in powershell<p>I have a XAML gui in my powershell script.
I would like to know how I can use a string as a variable name ex. $... |
72,847,742 | Storing references on structures and deserializing them<p>I am parsing a toml config file and retrieve it's content into some structs, using <code>serde</code> and <code>toml</code>.</p>
<p>So, a config structure could be defined like:</p>
<pre><code>#[derive(Deserialize, Debug)]
pub struct Config<'a> {
#[ser... | <p>References refer to data owned elsewhere. For this to work, the data being referred to must live at least as long as the reference, otherwise you have a reference to data that no longer exists.</p>
<p>In your <code>load()</code> function, the return type declares that <code>Config</code> will borrow data that is <c... | Storing references on structures and deserializing them | rust|reference|reference-type|owned-types | 0 | 44 | 1 | 72,847,771 | 72,847,771 | 5 | true | 2022-07-03T15:27:58.433Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Storing references on structures and deserializing them<p>I am parsing a toml config file and retrieve it's content into some structs, using <code>serde</cod... |
72,989,975 | Constraining argument of interface method to a few allowed structs?<p>Suppose I have an interface :</p>
<pre><code>type Module interface {
Run(moduleInput x) error // x is the type of moduleInput
}
</code></pre>
<p>where each "module" will fulfill the <code>Run</code> function. However, the <code>moduleIn... | <p>Use a generic interface, constrained to the union of the types you want to restrict:</p>
<pre><code>// interface constraint
type Inputs interface {
moduleAInputs | moduleBInputs
}
// parametrized interface
type Module[T Inputs] interface {
Run(moduleInput T) error
}
</code></pre>
<p>Note that the interface ... | Constraining argument of interface method to a few allowed structs? | go|generics|methods | 2 | 44 | 1 | 72,990,034 | 72,990,034 | 5 | true | 2022-07-15T06:44:12.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Constraining argument of interface method to a few allowed structs?<p>Suppose I have an interface :</p>
<pre><code>type Module interface {
Run(moduleInpu... |
73,016,267 | Casting structs with non-aggregate members<p>I am receiving an segmentation fault (SIGSEGV) when I try to reinterpret_cast a struct that contains an vector. The following code does not make sense on its own, but shows an minimal working (failing) example.</p>
<pre><code>// compiler: g++ -std=c++17
struct Table
{
s... | <p>I see at least three reasons for undefined behavior in the shown code, that fatally undermines what the shown code is attempting to do. One or some combination of the following reasons is responsible for your observed crash.</p>
<pre><code>struct Table
{
std::vector<int> ids;
};
</code></pre>
<p>Reason nu... | Casting structs with non-aggregate members | c++|segmentation-fault | 1 | 44 | 1 | 73,016,419 | 73,016,419 | 5 | true | 2022-07-18T00:26:34.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Casting structs with non-aggregate members<p>I am receiving an segmentation fault (SIGSEGV) when I try to reinterpret_cast a struct that contains an vector. ... |
72,999,850 | C++ Is it safe to change an exported DLL function from int to BOOL?<p>I'm dealing with a legacy DLL that has may things that started from DOS C code back in the day where there was no concept of a boolean. But the DLL is still in active development and still evolving. Many of the older exported methods have signatures ... | <blockquote>
<p><code>BOOL</code> is declared as <code>typedef int BOOL;</code>, so I would think that there should be no difference to the compiler or to already-compiled consumers of exported function, right?</p>
</blockquote>
<p>Yes, <code>typedef</code> is just syntactic sugar and has no impact on the resulting ABI... | C++ Is it safe to change an exported DLL function from int to BOOL? | c++|integer|boolean|dllexport | 0 | 44 | 1 | 72,999,926 | 72,999,926 | 5 | true | 2022-07-15T21:42:31.487Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ Is it safe to change an exported DLL function from int to BOOL?<p>I'm dealing with a legacy DLL that has may things that started from DOS C code back in ... |
72,912,785 | Understanding JSX in React<p>So I get whats going on but I also dont get whats going on. What I mean is this, I got the code below (see below code) from the react website and I am going through the process of understanding react and how to use it properly. So my question is this, why are the variables "firstName&q... | <p>I see two possibilities:</p>
<ol>
<li><p><code>formatName</code> is a helper function that's potentially called multiple times, with different data. If that's the case, then you can't define the data inside the function, since it will be different each time. If this is the scenario we're in, then i think the code yo... | Understanding JSX in React | javascript|html|reactjs|jsx | 0 | 44 | 3 | 72,912,879 | 72,912,879 | 5 | true | 2022-07-08T14:18:40.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Understanding JSX in React<p>So I get whats going on but I also dont get whats going on. What I mean is this, I got the code below (see below code) from the ... |
72,843,567 | Create an alias to a function with a parameter<p>The <code>pprint</code> function includes a parameter <code>sort_dicts=True</code> which doesn’t suit me.</p>
<p>I know that something like:</p>
<pre class="lang-py prettyprint-override"><code>from pprint import pprint
thing = pprint
</code></pre>
<p>will effectively cre... | <p>You're looking for <em>partial application</em> of a function. In Python, there is a standard library function called <a href="https://docs.python.org/3/library/functools.html#functools.partial" rel="noreferrer"><code>functools.partial</code></a> that will do it for you.</p>
<pre><code>from functools import partial
... | Create an alias to a function with a parameter | python|python-3.x|function | 1 | 44 | 2 | 72,843,573 | 72,843,573 | 6 | true | 2022-07-03T02:19:06.283Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create an alias to a function with a parameter<p>The <code>pprint</code> function includes a parameter <code>sort_dicts=True</code> which doesn’t suit me.</p... |
72,983,671 | Why is my move function not working in pygame?<p>IDK why my player.move() is not working here's my main class:</p>
<pre><code>import pygame
from player import *
pygame.init()
WIDTH, HEIGHT = 900, 600
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("MyGame!")
FPS = 60
player_x = 5... | <p><a href="https://www.pygame.org/docs/ref/key.html#pygame.key.get_pressed" rel="noreferrer"><code>pygame.key.get_pressed()</code></a> returns a sequence with the state of each key. If a key is held down, the state for the key is <code>1</code>, otherwise <code>0</code>. The contents of the <code>keys_pressed</code> l... | Why is my move function not working in pygame? | python|pygame | 3 | 44 | 1 | 72,983,944 | 72,983,944 | 6 | true | 2022-07-14T16:16:05.427Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is my move function not working in pygame?<p>IDK why my player.move() is not working here's my main class:</p>
<pre><code>import pygame
from player impor... |
72,796,225 | How to merge data from two different JSON file<p>I have a json file while have multiple data of some products.
For example:</p>
<pre><code>[
{
"id": 11,
"name": "Car"
}
]
</code></pre>
<p>On the other hand, I have another json file. Which have some data matching with the id of the pr... | <p>Create new array which combines propety of the both objects like this:</p>
<pre><code>const json1 = JSON.parse('[{"id": 11,"name": "Car"}]');
const json2 = JSON.parse('[{"id": 11,"price": 50}]');
const mappedObject = [];
await json1.forEach(async item => {
c... | How to merge data from two different JSON file | reactjs | 0 | 44 | 2 | 72,796,411 | 72,796,411 | -1 | true | 2022-06-29T05:33:29.683Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to merge data from two different JSON file<p>I have a json file while have multiple data of some products.
For example:</p>
<pre><code>[
{
"id&qu... |
72,828,713 | No 'Access-Control-Allow-Origin' header is present on the requested resource when sending delete request<p>I'm currently working on a website, which has a backend made in Java Spring Boot. But everytime i make a delete or a put request, the following Error appears in the console:</p>
<blockquote>
<p>Access to fetch at ... | <p>Sending a request from a browser is completely different that sending it with postman. You are not hitting directly your backend like postman, browsers does it for you
To understand it better you can read this one. <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" rel="nofollow noreferrer">crossorigin... | No 'Access-Control-Allow-Origin' header is present on the requested resource when sending delete request | java|spring-boot|http|cors | -1 | 44 | 2 | 72,830,631 | 72,830,631 | -1 | true | 2022-07-01T11:40:26.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
No 'Access-Control-Allow-Origin' header is present on the requested resource when sending delete request<p>I'm currently working on a website, which has a ba... |
72,828,800 | Node.js + Express.js: How to use the root (/) for serving static files?<p>how do we serve a static file located in the root of the directory (/) and not in a folder of it?
I am using Node.js with Express.js, I have tried the following JavaScript code in my <code>index.js</code> file which is located in <code>/</code> (... | <p>There isnt any difference if you use / and no / in the script</p>
<p>for express use</p>
<p>app.use(express.static(process.cwd() + '/'));</p> | Node.js + Express.js: How to use the root (/) for serving static files? | node.js|express | -1 | 44 | 3 | 72,867,467 | 72,867,467 | -1 | true | 2022-07-01T11:47:23.260Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Node.js + Express.js: How to use the root (/) for serving static files?<p>how do we serve a static file located in the root of the directory (/) and not in a... |
72,920,631 | How can I replace values with the continuous count every n rows in R<p>I am a bit stuck with replacing values.
I have a column that counts frames per second.
I appended the file but the appended file starts with the frame "1" again in the [12] column below.</p>
<p>So what I need to do is replace the last four... | <p>I'm not sure I understand the problem; if you have:</p>
<pre class="lang-r prettyprint-override"><code>df <- data.frame(frames = c(rep(1:3, each = 4), rep(1, 4)))
df
#> frames
#> 1 1
#> 2 1
#> 3 1
#> 4 1
#> 5 2
#> 6 2
#> 7 2
#> 8 2
#>... | How can I replace values with the continuous count every n rows in R | r | -1 | 44 | 1 | 72,920,957 | 72,920,957 | -1 | true | 2022-07-09T10:30:38.837Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I replace values with the continuous count every n rows in R<p>I am a bit stuck with replacing values.
I have a column that counts frames per second.... |
72,393,366 | Pycharm on Mac: why Python SDK cache get corrupted regularly?<p>This is the massage that Pycharm gives me almost once a day, and I have to restart it. As I have multiple projects open, it gives this error for each virtualenv repeatedly until I force quit it.</p>
<p>Is there a way to prevent Pycharm from constantly inva... | <p>It turns out the issue was the number of git repositories each with a separate project SDK (i.e. venv interpreter) that I had simultaneously opened in my PyCharm instance (over 10).</p>
<p>The re-indexing of git caches and Python libraries created memory issues and eventually resulted in corruption of index files; t... | Pycharm on Mac: why Python SDK cache get corrupted regularly? | python|macos|pycharm|virtualenv | 0 | 45 | 1 | 72,694,449 | 72,694,449 | 0 | true | 2022-05-26T14:21:46.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pycharm on Mac: why Python SDK cache get corrupted regularly?<p>This is the massage that Pycharm gives me almost once a day, and I have to restart it. As I h... |
72,768,427 | Google Sheets - When clicking on a checkbox, I want the row to be cleared (not deleted), and also for the checkbox to then reset<p>I've been trying to figure this one out and I'm a bit lost...</p>
<p>This is what I have so far:</p>
<pre><code>function deleteCheckedBoxes() {
const sheet = SpreadsheetApp.getActiveSheet(... | <p>When your showing script is modified, how about the following modification?</p>
<h3>From:</h3>
<pre><code>sheet.deleteRow(activeRow);
</code></pre>
<h3>To:</h3>
<pre><code>sheet.getRange(activeRow, 1, 1, sheet.getLastColumn()).clearContent();
</code></pre>
<ul>
<li>When this modified script is run, the row of the ac... | Google Sheets - When clicking on a checkbox, I want the row to be cleared (not deleted), and also for the checkbox to then reset | javascript|google-apps-script | 1 | 45 | 2 | 72,768,655 | 72,768,655 | 0 | true | 2022-06-27T07:30:35.053Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google Sheets - When clicking on a checkbox, I want the row to be cleared (not deleted), and also for the checkbox to then reset<p>I've been trying to figure... |
72,771,163 | How can I set the horizontal stackView according to the width of the first label<p>How can I align the stackview according to the content of the first label on storyboard ?</p>
<p><a href="https://i.stack.imgur.com/MAwIb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MAwIb.png" alt="enter image desc... | <p>Select the left label and then from size inspector change horizontal <strong>Content Hugging Priority</strong> = 1000</p>
<p><a href="https://i.stack.imgur.com/qtwHN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qtwHN.png" alt="enter image description here" /></a></p> | How can I set the horizontal stackView according to the width of the first label | ios|swift|autolayout|stackview | 0 | 45 | 2 | 72,771,344 | 72,771,344 | 0 | true | 2022-06-27T11:14:57.487Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I set the horizontal stackView according to the width of the first label<p>How can I align the stackview according to the content of the first label ... |
72,772,608 | How do I get rid of space between boxes?<p>I'm trying to learn HTML and CSS and trying to figure out how to line up boxes next to each other. I've managed to fit two boxes with "width: 50%;" next to each other but there is still a white space between them and I'm wondering what this white space is and how to ... | <p>So, whitespace in your actual HTML code is (by default) interpreted as text (although multiple white space in a row does get condensed into one singular space, as is happening here). You can tell that this is the case, because if you hover over the gap your cursor changes to the I-beam, and you can actually select t... | How do I get rid of space between boxes? | html|css | -1 | 45 | 3 | 72,772,674 | 72,772,674 | 0 | true | 2022-06-27T13:05:11.337Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I get rid of space between boxes?<p>I'm trying to learn HTML and CSS and trying to figure out how to line up boxes next to each other. I've managed to... |
72,771,352 | How to make my Lua Discord bot sends a Japanese phrase, and how to check if the expected part is null/blank?<p>I'm currently working on a custom Discord bot, written in Lua as a challenge out of pure spite. I started learning Lua recently, so this is a fun challenge for me! But still, I found an obstacle that pretty mu... | <p><code>Content:sub(7,2)</code> is wrong: <a href="https://www.lua.org/manual/5.4/manual.html#pdf-string.sub" rel="nofollow noreferrer"><code>string.sub</code></a> takes a start & end index (both inclusive), not a start index and a length. To get a substring of length 2, you thus have to use <code>8</code> as seco... | How to make my Lua Discord bot sends a Japanese phrase, and how to check if the expected part is null/blank? | lua|discord|bots | 1 | 45 | 1 | 72,773,210 | 72,773,210 | 0 | true | 2022-06-27T11:29:05.200Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make my Lua Discord bot sends a Japanese phrase, and how to check if the expected part is null/blank?<p>I'm currently working on a custom Discord bot,... |
72,772,791 | Snakemake: wildcards do not expand in script line of rule<p>I am running a pipeline and was trying to optimize it by declaring the paths in a config file (config.yaml). The config.yaml file contains the path to find the scripts to run inside the pipeline, but when I expand the wildcard of the path, the pipeline does no... | <p>You cannot define a function like <code>expand()</code> in the script section. Snakemake expects a path to your script.<br />
Like the <a href="https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#external-scripts" rel="nofollow noreferrer">documentation</a> states:</p>
<blockquote>
<p>The script path is... | Snakemake: wildcards do not expand in script line of rule | wildcard|snakemake|external-script | 0 | 45 | 1 | 72,777,075 | 72,777,075 | 0 | true | 2022-06-27T13:17:22.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Snakemake: wildcards do not expand in script line of rule<p>I am running a pipeline and was trying to optimize it by declaring the paths in a config file (co... |
72,791,022 | Flutter get string from list based on index number<p>I have list of string data like:</p>
<pre><code>[
https://example.com/app/audio/14/5/1.mp3,
https://example.com/app/audio/14/5/2.mp3,
https://example.com/app/audio/14/5/3.mp3,
https://example.com/app/audio/14/5/4.mp3,
https://example.com/app/audio... | <p>You are propably looking for this :</p>
<pre><code>StringList[myStaticNumber-1];
</code></pre> | Flutter get string from list based on index number | flutter|dart | 0 | 45 | 1 | 72,791,087 | 72,791,087 | 0 | true | 2022-06-28T17:46:56.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter get string from list based on index number<p>I have list of string data like:</p>
<pre><code>[
https://example.com/app/audio/14/5/1.mp3,
http... |
72,792,431 | How to keep executing code until another function returns value?<pre class="lang-py prettyprint-override"><code>from time import sleep
def foo():
sleep(3)
return True
while True:
print('Running')
if foo() == True:
print('Finished.')
break
</code></pre>
<p>I want to keep printing "... | <pre><code>import threading
from time import sleep
flag = True
def foo()->None:
global flag
sleep(1)
flag = False
if __name__ == "__main__":
t1 = threading.Thread(target=foo)
t1.start()
while flag:
print('Running')
print('Finished')
</code></pre>
<p>Because you wor... | How to keep executing code until another function returns value? | python|function|timer | 0 | 45 | 2 | 72,793,259 | 72,793,259 | 0 | true | 2022-06-28T19:54:13.780Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to keep executing code until another function returns value?<pre class="lang-py prettyprint-override"><code>from time import sleep
def foo():
sleep(... |
72,794,789 | Migration fails after I separated the projects<p>Before I separated my application into other projects, everything related to my Models, Database was inside BulkyBookWeb, and after the projects were separated, it looked like this</p>
<pre><code>BulkyBook
/ BulkyBook.DataAccess
/ BulkyBook.Models
/ BulkyBook.Utility
/ B... | <p>I found the solution. At <code>Program.cs</code> at BulkyBookWeb I needed to put this line pointing to my other project that contains the migrations.</p>
<pre><code>builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
builder.Configuration.GetConnectionString(&qu... | Migration fails after I separated the projects | c#|.net | 1 | 45 | 1 | 72,794,880 | 72,794,880 | 0 | true | 2022-06-29T01:26:41.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Migration fails after I separated the projects<p>Before I separated my application into other projects, everything related to my Models, Database was inside ... |
72,794,659 | creating receivers for logs and pipeline for new receivers<p>In Google Cloud Ops Agent, an example of MySQL config.yaml is given as:</p>
<pre><code>logging:
receivers:
mysql_error:
type: mysql_error
mysql_general:
type: mysql_general
mysql_slow:
type: mysql_slow
service:
pipelines:... | <p>Use <code>file</code> as the <strong>type</strong> and the <code>path</code> you specified in your post as the <strong>value</strong>. Below is a sample code for your use case:</p>
<pre><code>receivers:
RECEIVER_ID:
type: files
include_paths: [/var/log/*.log]
exclude_paths: [/var/log/not-this-one.log]... | creating receivers for logs and pipeline for new receivers | google-cloud-monitoring|google-cloud-ops-agent | 0 | 45 | 1 | 72,799,500 | 72,799,500 | 0 | true | 2022-06-29T00:57:28.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
creating receivers for logs and pipeline for new receivers<p>In Google Cloud Ops Agent, an example of MySQL config.yaml is given as:</p>
<pre><code>logging:
... |
72,799,869 | How to replace NaN in pandas dataframe with calculated value from other columns<p>I have below dataframe where I added last row as latest data.</p>
<pre><code>df.tail()
Open High Low Close %K %D
Date
2022-06-22 23.71 25.45 23.55 24.29 21.74 18.01
2022-06-... | <p>One way to do this would be to use the <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.fillna.html" rel="nofollow noreferrer">pandas fillna() method</a>.<br />
You will still need the first calculations:</p>
<pre><code>df['14-high'] = df['High'].rolling(14).max()
df['14-low'] = df['Low'].rolli... | How to replace NaN in pandas dataframe with calculated value from other columns | python|pandas | 2 | 45 | 1 | 72,800,530 | 72,800,530 | 0 | true | 2022-06-29T10:30:53.793Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to replace NaN in pandas dataframe with calculated value from other columns<p>I have below dataframe where I added last row as latest data.</p>
<pre><cod... |
72,799,853 | My app deployed successfully in Heroku but in times of opening the app show error<p>My app successfully deployed to Heroku..</p>
<blockquote>
<p>****: Deployed 6bc02eb8 Today at 4:19 PM · v23 ·
Compare diff **** ****: Build
succeeded Today at 4:18 PM · View build log</p>
</blockquote>
<p>But It shows error when try to... | <p>you don't provide enought information for us to be able to help you, nobody can or will debug it for you in that regard.</p>
<p>Here, sharing your <code>package.json</code> and the entry file of your application would be useful!</p>
<p>Anyway it seems that <code>npm run start</code> is crashing, you could start by m... | My app deployed successfully in Heroku but in times of opening the app show error | node.js|heroku | 0 | 45 | 1 | 72,800,890 | 72,800,890 | 0 | true | 2022-06-29T10:30:02.803Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
My app deployed successfully in Heroku but in times of opening the app show error<p>My app successfully deployed to Heroku..</p>
<blockquote>
<p>****: Deploy... |
72,785,522 | Laravel 8 - Get search result in friend lists<p>I am Working on laravel 8 version.
I have two Models</p>
<pre><code>User, FriendList
</code></pre>
<p>were table structure is as following.</p>
<p><strong>User</strong></p>
<pre><code>id | name | email | . . . . | is_individual
-------------------------... | <p><strong>I Have found an alternate way using query as following</strong></p>
<pre><code>class MemberController extends Controller {
const TYPE_INDIVIDUAL = 1;
.
.
.
public individualSearch( SearchUserRequest $request ){
$user_id = Auth::user()->id;
$sql = "select * fr... | Laravel 8 - Get search result in friend lists | php|laravel|laravel-8 | 0 | 45 | 2 | 72,802,493 | 72,802,493 | 0 | true | 2022-06-28T11:21:47.820Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Laravel 8 - Get search result in friend lists<p>I am Working on laravel 8 version.
I have two Models</p>
<pre><code>User, FriendList
</code></pre>
<p>were ta... |
72,802,125 | Facing Unknown error (0x80005000) while adding the user t LDAP in C#<p>I am facing Unknown error (0x80005000) while adding user to LDAP server(Apache), the following is my code. Could anyone please let me know where I am doing mistake.</p>
<pre><code>namespace TestMethods
{
public class Program
{
static... | <p>I believe you should use a <code>/</code> to separate the server name from the DN in your path:</p>
<pre><code>LDAP://localhost:10389/o=Company
</code></pre>
<p>The constructor of <code>DirectoryEntry</code> doesn't make any network requests, so your path isn't validated until you actually use it.</p>
<p>However, if... | Facing Unknown error (0x80005000) while adding the user t LDAP in C# | c#|ldap|openldap | 0 | 45 | 1 | 72,806,746 | 72,806,746 | 0 | true | 2022-06-29T13:19:17.037Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Facing Unknown error (0x80005000) while adding the user t LDAP in C#<p>I am facing Unknown error (0x80005000) while adding user to LDAP server(Apache), the f... |
72,807,507 | how to use a list of strings in a sql query<p>Alright, I have tried here this but it clearly doesn't work, I tried to find a similar question, but I didn't find the answer I seek, hence I ask here.</p>
<p>First of all, I have a list of strings that I've made from df columns:</p>
<pre><code>list_cols=df_cols['COLUMN_NAM... | <p>This code below should do the trick. Just use <code>','.join(list_cols)</code> instead of <code>list_cols</code> only.</p>
<pre class="lang-py prettyprint-override"><code>sql=(f'''select
{','.join(list_cols)}
from
big
where
date = '20220501'
''')
</code></pre>
<p>Check out the output:... | how to use a list of strings in a sql query | python|sql|pandas|list|select | 2 | 45 | 1 | 72,808,007 | 72,808,007 | 0 | true | 2022-06-29T20:31:03.067Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to use a list of strings in a sql query<p>Alright, I have tried here this but it clearly doesn't work, I tried to find a similar question, but I didn't f... |
72,788,478 | SQL Delight FTS5 MATCH gives no results<p>I have the following table:</p>
<pre><code>CREATE TABLE IF NOT EXISTS "note" (
"noteid" INTEGER NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT NOT NULL,
PRIMARY KEY("noteid")
);
</code></pre>
<p>Then I ... | <p>I am having a very similar issue at the moment. One reason the MATCH or its equivalent with <code>=</code> is not returning is that the FTS index appears to be corrupt. Somehow it happens even on a "fresh" index table, even when done in DBBrowser.</p>
<ul>
<li><p>Give a look at <a href="https://www.sqlite.... | SQL Delight FTS5 MATCH gives no results | android|sqlite|android-sqlite|sqldelight | 0 | 45 | 1 | 72,811,254 | 72,811,254 | 0 | true | 2022-06-28T14:37:38.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL Delight FTS5 MATCH gives no results<p>I have the following table:</p>
<pre><code>CREATE TABLE IF NOT EXISTS "note" (
"noteid" ... |
72,814,528 | Part of Javascript loop doesn't work when a single variable is changed<p>I am an absolute beginner in Javascript and I am trying to build a table by looping through my data. It works as intended, but as soon as I change the variable <code>myVersion</code> to <code>2</code> instead of <code>1</code>, the cells in the fi... | <p>Your <code>alternatives</code> array has 3 values, with index 0, 1, 2.</p>
<p>Your <code>myData</code> array has 6 values, with index 0, 1, 2, 3, 4, 5.</p>
<p>When you loop over <code>myData</code> (<code>for (var i = 0; i < myData.length; i++)</code>), as the first 3 values have <code>Version: 1</code> they have... | Part of Javascript loop doesn't work when a single variable is changed | javascript|arrays|json|for-loop|if-statement | 0 | 45 | 2 | 72,814,628 | 72,814,628 | 0 | true | 2022-06-30T10:51:50.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Part of Javascript loop doesn't work when a single variable is changed<p>I am an absolute beginner in Javascript and I am trying to build a table by looping ... |
72,815,945 | How to locate the button element using Selenium?<p>I need to find the xpath of the help button for my automation tests.<br />
Here is the HTML element:</p>
<pre><code><button data-component-id="nokia-react-components-iconbutton" tabindex="0" class="ActionComponent__ActionComponentDiv-sc-st36... | <p>If you want to select the <code><button></code> element before the <code><svg></code>, try the following XPath:</p>
<pre><code>//*[@data-component-id="nokia-react-components-iconbutton" and following-sibling::svg[1][contains(@class,"HelpOutline")]]
</code></pre> | How to locate the button element using Selenium? | selenium|selenium-webdriver|xpath | -1 | 45 | 3 | 72,816,061 | 72,816,061 | 0 | true | 2022-06-30T12:34:35.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to locate the button element using Selenium?<p>I need to find the xpath of the help button for my automation tests.<br />
Here is the HTML element:</p>
<... |
72,820,229 | Loop Through Tickers<p>I have a program that opens a stock's data file, feeds it to a function which turns the date into a datetime index, and then returns the file and outputs it as a csv. It works fine, here is the code:</p>
<pre><code>import pandas as pd
def clean_func(f1):
f1['Date'] = pd.to_datetime(f1['Date'... | <p>You can put them in a for loop with format strings (f-strings) like this:</p>
<pre><code>import pandas as pd
def clean_func(f1):
f1['Date'] = pd.to_datetime(f1['Date'])
f1.index = f1['Date']
return f1
tkrs = ['tkr1', 'tkr2', 'tkr3']
for tkr in tkrs:
df = pd.read_csv(f'C:\\path\\{tkr}.csv')
... | Loop Through Tickers | python|pandas|loops | 0 | 45 | 1 | 72,820,283 | 72,820,283 | 0 | true | 2022-06-30T18:05:44.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Loop Through Tickers<p>I have a program that opens a stock's data file, feeds it to a function which turns the date into a datetime index, and then returns t... |
72,818,650 | Undefined symbols error when using mingw to generate dynamic library under windows,but linux does not<p>I have a file called helloworld.c, which depends on an external dynamic library called libhello.dll.</p>
<pre><code>/* helloworld.c */
#include <stdio.h>
void hello(void);
int main() {
hello();
return... | <p>The error makes sense: you have a forward declaration for <code>void hello(void);</code> but no actual implementation of that function.</p>
<p>So the compiler will work (e.g. with <code>gcc -c -o hello_world.o hello_world.c</code>), but the linker doesn't know where to find the <code>hello()</code> function (e.g. wi... | Undefined symbols error when using mingw to generate dynamic library under windows,but linux does not | windows|gcc|dll|linker|mingw | -1 | 45 | 1 | 72,821,787 | 72,821,787 | 0 | true | 2022-06-30T15:47:58.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Undefined symbols error when using mingw to generate dynamic library under windows,but linux does not<p>I have a file called helloworld.c, which depends on a... |
72,820,288 | pd.to_datetime returning wrong Year and wrong Day<p>I have an excel file that I want to open with pandas which contains Dates like that :</p>
<p><a href="https://i.stack.imgur.com/MW6gb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MW6gb.png" alt="enter image description here" /></a></p>
<p>but aft... | <p>I've found a solution : the timestamps were the number of days since 01/01/1900 so I needed to add an origin like :</p>
<pre><code>pd.to_datetime(pd.to_numeric(df['Dates'], errors='coerce'),unit='D',origin='1899-12-30')
</code></pre>
<p>You can also use the xlrd package (see the link) :</p>
<pre><code>date = xlrd.xl... | pd.to_datetime returning wrong Year and wrong Day | python|excel|pandas|date|python-datetime | 1 | 45 | 1 | 72,823,002 | 72,823,002 | 0 | true | 2022-06-30T18:11:21.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pd.to_datetime returning wrong Year and wrong Day<p>I have an excel file that I want to open with pandas which contains Dates like that :</p>
<p><a href="htt... |
72,824,135 | How do I get the content to display in the other menu options?<p>Here is my complete code.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><html>
<head>
... | <ul>
<li>Because you have duplicate <code>id</code> : <code>stations</code>, <code>id</code> should only have 1. You should use <code>class</code> instead of <code>id</code>.</li>
<li><code>id="station"</code> => <code>class="station"</code> and code :</li>
</ul>
<pre><code>$('.station').on('chan... | How do I get the content to display in the other menu options? | javascript|jquery|jquery-mobile|drop-down-menu | 0 | 45 | 1 | 72,824,224 | 72,824,224 | 0 | true | 2022-07-01T03:37:40.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I get the content to display in the other menu options?<p>Here is my complete code.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.