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,259,763 | Run cmd command from within R<p>I want to trigger/run a certain cmd command from within R. I found the functions <code>system</code>, <code>system2</code> and <code>shell</code>, but am a bit lost on how to exactly use them.</p>
<p>So if I would do it directly in Windows, I'd open the cmd and then run the following com... | <p>Use <code>r"{...}"</code> if there are backslashes within the literal string as we do here or else double each backslash (see <code>?Quotes</code>) or in some cases using forward slash in place of backslash will work. Then use <code>sprintf</code> to generate <code>batchline</code>.</p>
<pre><code>program_... | Run cmd command from within R | r|command-line | 0 | 63 | 2 | 72,261,029 | 72,261,029 | 1 | true | 2022-05-16T13:09:32.693Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Run cmd command from within R<p>I want to trigger/run a certain cmd command from within R. I found the functions <code>system</code>, <code>system2</code> an... |
72,257,004 | How to create a name similarity column?<p>I've a sample dataframe <br></p>
<pre class="lang-py prettyprint-override"><code>pid = [1,2,3,4,5]; name = ['abc', 'def', 'bca', 'fed', 'pqr']; match_score = [np.nan, np.nan, np.nan, np.nan, np.nan]
sample_df = pd.DataFrame(zip(pid,name,match_score), columns=['pid', 'name', 'm... | <p>managed to apply <code>fuzzywuzzy</code> to get the result you need.</p>
<p>I also just started, - so my approach is most likely not the best, but works for the data you presented:</p>
<pre><code>import pandas as pd
import numpy as np
from fuzzywuzzy import process, fuzz
pid = [1,2,3,4,5]; name = ['abc', 'def', 'bc... | How to create a name similarity column? | python|python-3.x|pandas|dataframe | 1 | 63 | 2 | 72,257,314 | 72,257,314 | 1 | true | 2022-05-16T09:30:56.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a name similarity column?<p>I've a sample dataframe <br></p>
<pre class="lang-py prettyprint-override"><code>pid = [1,2,3,4,5]; name = ['abc', ... |
72,287,774 | How can I get the text from the TextBox_KeyDown event? WPF C#<p>I have this event and I would like to get the text from the user input dynamically ( real time ) , so when the user type any character, it should be added to the currently text and I have the possibility to get it .</p>
<pre><code> public void TextBox_KeyD... | <p>From the <a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.textbox?view=windowsdesktop-6.0#remarks" rel="nofollow noreferrer">documentation</a></p>
<blockquote>
<p>Usually the TextChanged event should be used to detect whenever the text in a TextBox or RichTextBox changes rather then KeyDo... | How can I get the text from the TextBox_KeyDown event? WPF C# | c#|wpf | -1 | 63 | 1 | 72,287,906 | 72,287,906 | 1 | true | 2022-05-18T10:48:06.077Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I get the text from the TextBox_KeyDown event? WPF C#<p>I have this event and I would like to get the text from the user input dynamically ( real tim... |
72,320,061 | count word frequency with out dictionary in python<p>I have file input which is alphabetically sorted</p>
<pre><code>Asburn 9
Ashley 10
Ashley 11
Bojourn 12
</code></pre>
<p>I want the output like</p>
<pre><code>Asburn 9
Ashley 21
Bojourn 12
</code></pre>
<p>Code I have used :</p>
<pre><code>counts = defaultdict(int... | <p>Try this:</p>
<pre><code>prev_word = None
prev_count = 0
for line in sys.stdin:
word, count = line.split()
count = int(count)
if word != prev_word:
if prev_word is not None:
print(prev_word, str(prev_count))
prev_count = count
prev_word = word
else:
prev_c... | count word frequency with out dictionary in python | python|algorithm | -3 | 63 | 3 | 72,320,278 | 72,320,278 | 1 | true | 2022-05-20T13:50:48.637Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
count word frequency with out dictionary in python<p>I have file input which is alphabetically sorted</p>
<pre><code>Asburn 9
Ashley 10
Ashley 11
Bojourn 12
... |
72,303,856 | Can't able to perform two actions in a javascript on select box<p>Can't able to perform two actions (i.e,I need to disable and need to unselect the selected option from the select)</p>
<ol>
<li>I have two select boxes i.e, select_one box is ('1','2','3') & select_two box is ('please select', 'test1', 'test2','test3... | <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>function checkFun(value) {
const s2 = document.getElementById("select_two");
s2.value = "";
s2.disabled = (value == '1' || va... | Can't able to perform two actions in a javascript on select box | javascript|select | 1 | 63 | 3 | 72,304,415 | 72,304,415 | 1 | true | 2022-05-19T11:36:45.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't able to perform two actions in a javascript on select box<p>Can't able to perform two actions (i.e,I need to disable and need to unselect the selected ... |
72,251,940 | Snakemake runs rule too many times using config.yaml<p>I'm trying to create this snakemake workflow which would evaluate raw reads quality using FastQc and create a raport using MultiQC. I use 4 input files and get expected results, however I just noticed that each rule gets run 4 times and takes all 4 inputs each time... | <p>Your problem is using <code>expand()</code> in the input of each rule. Because <code>expand</code> fills in wildcard values, you only need to do that in the <code>all</code> rule since wildcard values are passed on to upstream rules.</p>
<p>Snakefile:</p>
<pre><code>configfile: "config.yaml"
rule all:
... | Snakemake runs rule too many times using config.yaml | python|bioinformatics|snakemake|transcription | 1 | 63 | 1 | 72,254,110 | 72,254,110 | 1 | true | 2022-05-15T20:27:03.267Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Snakemake runs rule too many times using config.yaml<p>I'm trying to create this snakemake workflow which would evaluate raw reads quality using FastQc and c... |
72,280,252 | Filtering an array of nested objects by string value<p>I'm trying to filter an array with nested objects like this:</p>
<pre><code>const items = [
{
"id": 1,
"name": "test1",
"subitems": [
{
"id": 2,
... | <p>If I'm understanding correctly, the process is:</p>
<ol>
<li>If the current level's <code>name</code> includes the search value, include the current level and all children in the <code>subitems</code> or <code>subsubitems</code> arrays as available.</li>
<li>Otherwise, repeat the same check for each item in the <cod... | Filtering an array of nested objects by string value | javascript|arrays|filter | 0 | 63 | 2 | 72,280,656 | 72,280,656 | 1 | true | 2022-05-17T20:23:54.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filtering an array of nested objects by string value<p>I'm trying to filter an array with nested objects like this:</p>
<pre><code>const items = [
{
... |
72,245,609 | How to let Pix2Pix with p5.js run?<p>I would like to try the <a href="https://learn.ml5js.org/#/reference/pix2pix?id=examples" rel="nofollow noreferrer">ml5.js Pix2Pix example for p5.js</a>. If I just copy the code, update the paths, and try to let it run on my local server, it doesn't work.</p>
<p>Same here:</p>
<p><d... | <p>I think I was able to get the 'callback' example to work locally with some tinkering:</p>
<ol>
<li>Download files from the example: <a href="https://github.com/ml5js/ml5-library/tree/main/examples/p5js/Pix2Pix/Pix2Pix_callback" rel="nofollow noreferrer">https://github.com/ml5js/ml5-library/tree/main/examples/p5js/Pi... | How to let Pix2Pix with p5.js run? | javascript|p5.js|ml5.js | 2 | 63 | 1 | 72,250,195 | 72,250,195 | 2 | true | 2022-05-15T04:58:16.520Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to let Pix2Pix with p5.js run?<p>I would like to try the <a href="https://learn.ml5js.org/#/reference/pix2pix?id=examples" rel="nofollow noreferrer">ml5.... |
72,258,536 | Generate YYYYMM for each month quarter and between two dates<p>I want to generate Yearmonth (YYYYMM) for each quarters between two years and associate a rank number for each line.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Date_Begin</th>
<th>Date_End</th>
</tr>
</thead>
<tbody>
<tr>
<... | <p>Try this one:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT RANK() OVER (ORDER BY y, q) AS period_rank,
FORMAT('%d%02d', y, q) AS yearmonth,
FROM UNNEST(GENERATE_ARRAY(2021, 2023)) y, UNNEST([3, 6, 9, 12]) q
;
</code></pre>
<p>output:</p>
<p><a href="https://i.stack.imgur.com/oavCn.png" rel="... | Generate YYYYMM for each month quarter and between two dates | date|google-bigquery | 0 | 63 | 1 | 72,260,208 | 72,260,208 | 2 | true | 2022-05-16T11:32:05.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Generate YYYYMM for each month quarter and between two dates<p>I want to generate Yearmonth (YYYYMM) for each quarters between two years and associate a rank... |
72,261,163 | How to rewrite this sql query, that updates multiple rows in a single column, WITHOUT using CASE<p>I am working on a new project and am trying to update multiple rows in a single column. It appears any query using the CASE syntax is throwing an error. I am needing to rewrite this query so that the CASE syntax is not ... | <p>Not sure what a reason to not use CASE (coz imo it's a more useful option), but <a href="https://dbfiddle.uk/?rdbms=postgres_14&fiddle=5104d274fa85cfd12dd48d81ab48be83" rel="nofollow noreferrer">here's dbfiddle</a> with a couple of alternatives for the UPDATE statement (REPLACE and CTE):</p>
<pre><code>-- replac... | How to rewrite this sql query, that updates multiple rows in a single column, WITHOUT using CASE | sql|postgresql|sql-update | 1 | 63 | 2 | 72,261,934 | 72,261,934 | 2 | true | 2022-05-16T14:51:12.657Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to rewrite this sql query, that updates multiple rows in a single column, WITHOUT using CASE<p>I am working on a new project and am trying to update mult... |
72,249,172 | Variables of Spock test are not accessible in Evaluate Expression dialog while debugging in IntelliJ IDEA<p>In the following Spock test:</p>
<pre><code>def 'simple assertion'() {
expect:
Math.max(a, b) == max
where:
a | b | max
3 | 5 | 5
4 | 9 | 9
}
</code></pre>
<p>When setting a breakpoin... | <p>It worked for me when I declared the parameters explicitly.</p>
<pre><code>def 'simple assertion'(int a, int b, int max) {
expect:
Math.max(a, b) == max
where:
a | b | max
3 | 5 | 5
4 | 9 | 9
}
</code></pre> | Variables of Spock test are not accessible in Evaluate Expression dialog while debugging in IntelliJ IDEA | java|intellij-idea|groovy|spock | 0 | 63 | 1 | 72,277,114 | 72,277,114 | 2 | true | 2022-05-15T14:27:45.803Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Variables of Spock test are not accessible in Evaluate Expression dialog while debugging in IntelliJ IDEA<p>In the following Spock test:</p>
<pre><code>def '... |
72,290,949 | Round a range in pandas<p>I have df_surf_dist=</p>
<pre><code> index surface_relle_bati
0 (8.718, 27.733] 442
1 (27.733, 46.467] 1485
2 (46.467, 65.2] 1296
3 (65.2, 83.933] 927
4 (83.933, 102.667] 288
... | <p>You can use a custom function to recreate the intervals:</p>
<pre><code>def round_interval(i, ndigits=2):
return pd.Interval(round(i.left, ndigits), round(i.right, ndigits), i.closed)
df['range'].apply(round_interval, ndigits=1)
</code></pre>
<p>output:</p>
<pre><code>0 (8.7, 27.7]
1 (27.7, 46.5]
2 (4... | Round a range in pandas | python|pandas | 2 | 63 | 1 | 72,291,193 | 72,291,193 | 2 | true | 2022-05-18T14:20:59.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Round a range in pandas<p>I have df_surf_dist=</p>
<pre><code> index surface_relle_bati
0 (8.718, 27.733] 442
1 (27... |
72,295,793 | disable Appbar paddings from top and bottom<p>I want to make a box inside the Appbar that takes the full height, as demonstrated below:</p>
<p><a href="https://i.stack.imgur.com/CFMo0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CFMo0.jpg" alt="demo" /></a></p>
<p>However, the Appbar by default is... | <p><code>Use align-self: stretch</code></p>
<p>Or you could set your parent div as <code>alignItems: 'stretch'</code>, but this would effect all the elements (if that's what you might want)</p>
<pre><code>import * as React from "react";
import AppBar from "@mui/material/AppBar";
import Box from &quo... | disable Appbar paddings from top and bottom | javascript|css|reactjs|material-ui | 1 | 63 | 1 | 72,295,939 | 72,295,939 | 2 | true | 2022-05-18T20:46:32.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
disable Appbar paddings from top and bottom<p>I want to make a box inside the Appbar that takes the full height, as demonstrated below:</p>
<p><a href="https... |
72,303,222 | Git removes file when switching branches<p>If I checkout a git branch, sometimes a file <code>path/to/File</code> is deleted. I can see this as an unstaged change after the operation. It is always the same text file, which has not been edited for a long time. So it should be the same file at each branch. (But one bran... | <p>This is a case sensitivity issue : <code>git</code> expects a file with a certain letterCase, but your system is fine with having a different Lettercase.</p>
<p>There may be two variants of bugs related to that :</p>
<ul>
<li><code>git</code> may have only one "version" of <code>filename</code> in its stor... | Git removes file when switching branches | git|atlassian-sourcetree | 2 | 63 | 1 | 72,308,635 | 72,308,635 | 2 | true | 2022-05-19T10:50:27.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Git removes file when switching branches<p>If I checkout a git branch, sometimes a file <code>path/to/File</code> is deleted. I can see this as an unstaged c... |
72,308,714 | pandas: increment based on a condition in another column<p>I have a dataframe that has one column only like the following.(a minimal example)</p>
<pre><code>import pandas as pd
dataframe =pd.DataFrame({'text': ['##weather','how is today?', 'we go out', '##rain',
'my day is rainy', 'I am not feelin... | <p>You can try <code>groupby</code> with <code>ngroup</code></p>
<pre class="lang-py prettyprint-override"><code>m = dataframe['text'].str.contains('##').cumsum()
dataframe['id'] = dataframe.groupby(m).ngroup() + 100
</code></pre>
<pre><code>print(dataframe)
text id
0 ##weather 1... | pandas: increment based on a condition in another column | python|pandas|increment | 0 | 63 | 1 | 72,308,781 | 72,308,781 | 2 | true | 2022-05-19T17:22:43.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pandas: increment based on a condition in another column<p>I have a dataframe that has one column only like the following.(a minimal example)</p>
<pre><code>... |
72,310,464 | Is there a more idiomatic way to specialise behaviour using flags passed via template?<p>Apologises for the ambiguous title.</p>
<p>Here is my code:</p>
<pre class="lang-cpp prettyprint-override"><code>struct LowHigh
{
};
struct HighLow
{
};
template < class LookupScheme>
struct ladder_base
{
using value_typ... | <p>These algorithms take a comparison object as their last parameter - so you can use that to your advantage.</p>
<pre class="lang-cpp prettyprint-override"><code>template < class Compare >
struct ladder_base
{
using value_type = price_depth;
using ladder_type = std::vector< value_type >;
... | Is there a more idiomatic way to specialise behaviour using flags passed via template? | c++|templates|c++20 | 1 | 63 | 2 | 72,310,747 | 72,310,747 | 2 | true | 2022-05-19T20:01:46.530Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a more idiomatic way to specialise behaviour using flags passed via template?<p>Apologises for the ambiguous title.</p>
<p>Here is my code:</p>
<pre... |
72,311,809 | How to achieve optimal inheritance-like with C struct?<p>I come from an OOP background and have struggle with what is the optimal (speed wise) way of implementing what I need.</p>
<p>I define the below struct:</p>
<pre><code>struct Vehicle {
int A;
int B;
}
</code></pre>
<p>And I want some other struct like:</p... | <p>It's mostly been said in the comments, but here's a workup of what's been said (and I have not used any <code>typedef</code>s, but personally I would).</p>
<p>So, point 1, use an <code>enum</code> for your <code>vehicleType</code>, and point 2, a <code>vehicle</code> can't be both a <code>Car</code> and a <code>Bike... | How to achieve optimal inheritance-like with C struct? | arrays|c|inheritance|struct | -1 | 63 | 3 | 72,311,911 | 72,311,911 | 2 | true | 2022-05-19T22:42:07.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to achieve optimal inheritance-like with C struct?<p>I come from an OOP background and have struggle with what is the optimal (speed wise) way of impleme... |
72,311,056 | ALSA not found - github actions unit testing, setting env/envvars correctly<p>I have the following yaml in my .github/workflows folder.</p>
<pre class="lang-yaml prettyprint-override"><code>name: Run Python Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs... | <p>A github actions computer doesn't have any speakers to output audio to, and no display to output video to. It's an headless system.</p>
<p>The solution is to set</p>
<pre><code> env:
SDL_VIDEODRIVER: "dummy"
SDL_AUDIODRIVER: "disk"
</code></pre>
<p>See <a href="https://github.com/p... | ALSA not found - github actions unit testing, setting env/envvars correctly | python|unit-testing|github|pygame|github-actions | 0 | 63 | 1 | 72,313,363 | 72,313,363 | 2 | true | 2022-05-19T21:04:49.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ALSA not found - github actions unit testing, setting env/envvars correctly<p>I have the following yaml in my .github/workflows folder.</p>
<pre class="lang-... |
72,328,204 | How to delete redundant values based on other value?<p>In the below dataframe, there are several <code>apartments</code> with different <code>job</code>'s:</p>
<pre class="lang-none prettyprint-override"><code>+---+---------+------+
|id |apartment|job |... | <p>I think you first need to find out how many 'anyl' do you have for every 'apartment' and then use it to delete all the excess 'dev'. So, first, aggregation, then <code>join</code> and then window function <code>row_number</code> before you can filter out what you don't need.</p>
<p>Setup:</p>
<pre class="lang-py pre... | How to delete redundant values based on other value? | apache-spark|pyspark|filter|apache-spark-sql|window-functions | 2 | 63 | 2 | 72,330,185 | 72,330,185 | 2 | true | 2022-05-21T09:16:06.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to delete redundant values based on other value?<p>In the below dataframe, there are several <code>apartments</code> with different <code>job</code>'s:</... |
72,340,289 | In a ListView how to send the clicked object back to the command in the view model - Xamarin Forms<p>Given the following <code>ListView</code>, I'd like to have a command that would send the clicked object, in this case the Address, back to a command in the view model - <code>SelectNewAddress</code> or <code>DeleteAddr... | <p>First make sure you have included your view model as <code>DataType</code> and view as <code>Class</code> inside the <code>ContentPage</code>:</p>
<pre class="lang-xml prettyprint-override"><code>xmlns:pages="clr-namespace:your.namespace.ViewModels"
x:DataType="pages:AddressSelectionViewModel"
x:... | In a ListView how to send the clicked object back to the command in the view model - Xamarin Forms | xaml|xamarin|xamarin.forms|mvvm | 2 | 63 | 2 | 72,340,290 | 72,340,290 | 2 | true | 2022-05-22T18:29:36.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In a ListView how to send the clicked object back to the command in the view model - Xamarin Forms<p>Given the following <code>ListView</code>, I'd like to h... |
72,341,555 | Do latter keys in an hash assignment from an array always override earlier keys?<p>Given this:</p>
<pre class="lang-perl prettyprint-override"><code>%h = (a => 3, b => 4, a => 5);
</code></pre>
<p>Imperically <code>$h{a} == 5</code> holds true, but are there cases where <code>$h{a} == 3</code> because of inter... | <p>Yes, you can rely that the assignment list will be evaluated left to right as surely as you could rely on an assignment to an array occurring in the correct order.</p>
<pre><code>sub DebugHash::TIEHASH { bless {}, shift }
sub DebugHash::CLEAR { %{shift} = (); }
sub DebugHash::STORE {
my ($tied, $key, $value) = @... | Do latter keys in an hash assignment from an array always override earlier keys? | perl|associative-array | 3 | 63 | 2 | 72,341,814 | 72,341,814 | 2 | true | 2022-05-22T21:59:05.560Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Do latter keys in an hash assignment from an array always override earlier keys?<p>Given this:</p>
<pre class="lang-perl prettyprint-override"><code>%h = (a ... |
72,263,435 | Remove all but specific part of image<p>I am using Python face-recognition library to detect faces in an image, it returnes coordenates of faces in the image. i would like to delete all but the coordenates returned by the face-recognition function</p>
<pre><code>import face_recognition
image1 = face_recognition.load_i... | <p>thanks to @Mark Setchell and @Bohdan 's help</p>
<pre><code> count2=0
for file in image_folder:
loc=f"image extract/frame{count2}.jpg"
image1 = face_recognition.load_image_file("image extract/"+file)
face_locations = face_recognition.face_locations(image1)
w... | Remove all but specific part of image | python|image-processing|face-recognition | 1 | 63 | 1 | 72,344,241 | 72,344,241 | 2 | true | 2022-05-16T17:41:47.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove all but specific part of image<p>I am using Python face-recognition library to detect faces in an image, it returnes coordenates of faces in the image... |
72,358,299 | Special char jquery<p>I have a problem with <code>&gt;</code> and jquery datatable shows '>' fine but when I click on the row I get the character <code>&gt;</code> and I'm desperate.</p>
<p>Any solution?</p>
<pre><code>$('#sample tbody').on('click', 'tr', function() {
//console.log(table.row(this).data()... | <p>The issue is because you're using <code>text()</code>, which does not encode HTML entities. To get the output you expect use <code>html()</code> instead.</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... | Special char jquery | html|jquery|datatable|special-characters|html-entities | 1 | 63 | 1 | 72,358,770 | 72,358,770 | 2 | true | 2022-05-24T06:45:59.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Special char jquery<p>I have a problem with <code>&gt;</code> and jquery datatable shows '>' fine but when I click on the row I get the character <cod... |
72,370,307 | How to use map in JS and Vue to create a new array<p>I am attempting to set up a map method in JavaScript and Vue that creates a new array of objects while returning only selected items in each object. To accomplish this, I set up a UI with 2 checkboxes corresponding to 2 separate objects:</p>
<pre><code> <div v-... | <p>There is no syntax of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer">map function</a> that filters the fields by 2nd argument:</p>
<pre><code> // This parameter will not work
... | How to use map in JS and Vue to create a new array | javascript|arrays|vue.js|object|vuejs3 | 0 | 63 | 1 | 72,371,341 | 72,371,341 | 2 | true | 2022-05-24T23:00:33.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use map in JS and Vue to create a new array<p>I am attempting to set up a map method in JavaScript and Vue that creates a new array of objects while r... |
72,376,336 | How to copy files from a bucket on one AWS account to a bucket on another AWS account?<p>I am facing a change in project requirement where until now I had to copy files between 2 buckets under the same AWS account, and now I need to copy the files into a bucket in another account.</p>
<p>Current code:</p>
<pre><code>pu... | <p>In order to copy between buckets using S3's CopyObject API, the (single) role performing the copy must have <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html" rel="nofollow noreferrer">read access to the source and write access to the destination buckets</a>. The fact that they are in diff... | How to copy files from a bucket on one AWS account to a bucket on another AWS account? | java|amazon-web-services|amazon-s3 | 0 | 63 | 2 | 72,376,521 | 72,376,521 | 2 | true | 2022-05-25T10:56:16.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to copy files from a bucket on one AWS account to a bucket on another AWS account?<p>I am facing a change in project requirement where until now I had to... |
72,394,420 | Override computed property in Ember 4 adapter<p>In the "new" class style of Ember / JavaScript (at least new to me), I am having trouble adapting old tutorials to set a computed property in my <code>JSONAPIAdapter</code>.</p>
<pre><code>export default class ApplicationAdapter extends JSONAPIAdapter {
@servi... | <p>Not sure exactly what error you're seeing, but you should be able to replace this with a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get" rel="nofollow noreferrer">getter</a></p>
<pre class="lang-js prettyprint-override"><code>get headers() {
if (this.session.isAuthenticate... | Override computed property in Ember 4 adapter | ember.js|ember-data | 0 | 63 | 1 | 72,394,935 | 72,394,935 | 2 | true | 2022-05-26T15:38:07.503Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Override computed property in Ember 4 adapter<p>In the "new" class style of Ember / JavaScript (at least new to me), I am having trouble adapting o... |
72,394,435 | How to fix shell script that works at the command line? Script uses `mv`, quotation marks, parameter expansion, and variables<p>I have a set of files in a directory. Some of the filenames contain an eight-digit date, like so:</p>
<pre><code>test_file_20220101.txt
...
test_file_20220110.txt
</code></pre>
<p>I want to us... | <p>The <code>set -v</code> output may not help you, but it tells <em>me</em> that the script goes sideways when trying to extract the number from the filename. In bash, at least, that's because you have quoted the <code>!</code> in your bracket expression. That is, <code>[\!0-9]</code> matches one character from the ... | How to fix shell script that works at the command line? Script uses `mv`, quotation marks, parameter expansion, and variables | bash|shell|zsh | 1 | 63 | 2 | 72,395,075 | 72,395,075 | 2 | true | 2022-05-26T15:39:23.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to fix shell script that works at the command line? Script uses `mv`, quotation marks, parameter expansion, and variables<p>I have a set of files in a di... |
72,390,258 | Prolog implementation of "Which answer in this list is the correct answer to this question?"<p>I came across <a href="https://math.stackexchange.com/questions/2217248/which-answer-in-this-list-is-the-correct-answer-to-this-question">this</a> post on Math Exchange, asking for the solution to the following logic puzzle:<... | <p>This feels like a good use of <a href="https://www.swi-prolog.org/pldoc/man?section=clpb" rel="nofollow noreferrer">library(clpb)</a> for defining and solving a direct solution using boolean variables:</p>
<pre><code>:- use_module(library(clpb)).
solve(Answer) :-
Options = [A1, A2, A3, A4, A5, A6],
sat(*([... | Prolog implementation of "Which answer in this list is the correct answer to this question?" | prolog|logic | 1 | 63 | 1 | 72,396,878 | 72,396,878 | 2 | true | 2022-05-26T10:19:20.653Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Prolog implementation of "Which answer in this list is the correct answer to this question?"<p>I came across <a href="https://math.stackexchange.com/question... |
72,396,988 | Rshiny Highcharter how can I create a piechart that drills down into another pie chart?<p>Examples I've seen are bar charts drilling down into bar charts. But I can't seem to find an example of a pie chart that drills down into another pie chart in RShiny.</p> | <p>You can specify the <code>type</code> parameter in <code>hc_drilldown()</code> as shown by editing the example from the <a href="https://jkunst.com/highcharter/reference/hc_drilldown.html" rel="nofollow noreferrer">highcharter reference page</a>.</p>
<pre><code>library(highcharter)
library(dplyr)
library(purrr)
df ... | Rshiny Highcharter how can I create a piechart that drills down into another pie chart? | r|shiny|highcharts|r-highcharter | 0 | 63 | 1 | 72,397,133 | 72,397,133 | 2 | true | 2022-05-26T19:22:14.820Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rshiny Highcharter how can I create a piechart that drills down into another pie chart?<p>Examples I've seen are bar charts drilling down into bar charts. Bu... |
72,335,003 | Opencv matchTemplate couldn't find bush inside map<p>I want to find 2d images of bush inside a 2d map. According to their website I used this code</p>
<pre><code>image = cv2.imread('images/Pallet_Town.png', cv2.IMREAD_UNCHANGED)
image_gray = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
template = cv2.imread('images/Bush (sma... | <p>I have actually found the answer, As fmw42 suggested me in comments making a mask of the bush and hence using this code I got the answer. Later I also had to increase the threshold to 0.9. Alternatively reducing threshold to 0.24 also worked but for different images it would have different thresholds which I didn't ... | Opencv matchTemplate couldn't find bush inside map | python|opencv|image-processing | 0 | 63 | 2 | 72,335,515 | 72,335,515 | 2 | true | 2022-05-22T05:26:40.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Opencv matchTemplate couldn't find bush inside map<p>I want to find 2d images of bush inside a 2d map. According to their website I used this code</p>
<pre><... |
72,318,271 | Replace attribute value in a Javascript Object<p>I have an array in this format:</p>
<pre><code>var arr = [{id: 1, age: 25, money: 2500},{id: 10, age: 10, money: 100},{id: 115, age: 80, money: 1350}]
</code></pre>
<p>What I want is to replace every id value with null. My first idea would have been to build a regex im c... | <p>See <a href="https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer">map</a> method.</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 prettypri... | Replace attribute value in a Javascript Object | javascript | -3 | 63 | 3 | 72,318,290 | 72,318,290 | 2 | true | 2022-05-20T11:32:50.687Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace attribute value in a Javascript Object<p>I have an array in this format:</p>
<pre><code>var arr = [{id: 1, age: 25, money: 2500},{id: 10, age: 10, mo... |
72,291,750 | How to calculate time taken to execute C++ program excluding time taken to user input?<p>I'm using the below code to calculate the time for execution. It works well when I take input from <code>./a.out < input.txt</code>. But when I manually write my input it also includes that time. Is there a way to exclude the ti... | <p>A straightforward approach would be to "Freeze time" when user input is required, so instead of creating the <code>end</code> variable after the input lines, create it before the input lines and restart time calculation again after the input:</p>
<pre><code>double total = 0;
auto begin = chrono::high_reso... | How to calculate time taken to execute C++ program excluding time taken to user input? | c++|g++|stdin|cin|chrono | -2 | 63 | 1 | 72,291,972 | 72,291,972 | 2 | true | 2022-05-18T15:12:15.167Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to calculate time taken to execute C++ program excluding time taken to user input?<p>I'm using the below code to calculate the time for execution. It wor... |
72,362,024 | How to sort list of floats using brute force algorithm in python<p>I am trying to use <code>cv2.matchShapes</code> where I am using dataset of images so when I compare their contours, then store all <code>ret</code> values in an float array and images in another one, so the final result that I want is sorted array of ... | <p>You need to "pair" your 'ret' values with their associated images. Do this with a tuple and build a list of those tuples. You can then sort that list using the built-in. Here's your code edited appropriately:</p>
<pre><code>import glob
import sys
from PIL import Image
import cv2
dataset = "dataset/*.... | How to sort list of floats using brute force algorithm in python | python|sorting|opencv|brute-force | 0 | 63 | 1 | 72,362,246 | 72,362,246 | 2 | true | 2022-05-24T11:24:48.170Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to sort list of floats using brute force algorithm in python<p>I am trying to use <code>cv2.matchShapes</code> where I am using dataset of images so whe... |
72,256,196 | if there is at least one Na in the line, make the line Na<p>my data:</p>
<pre><code> structure(list(col1 = 1:6, col2 = c(NA, NA, 3L, 4L, 5L, 6L),
col3 = c(1L, 1L, NA, 1L, NA, 1L), col4 = c(2L, 2L, 2L, 2L,
NA, 2L), col5 = c(3L, 3L, 3L, NA, 3L, 3L), GROUP = c(1L,
1L, 1L, 2L, 2L, 2L)), class = "data... | <p>You can do:</p>
<pre class="lang-r prettyprint-override"><code>l <- lapply(list(c(1,2), c(3,4,5)), \(i) df[, i])
cbind.data.frame(lapply(l, \(y) t(apply(y, 1, \(x) {
if(any(is.na(x))) x[1:length(x)] <- NA
x
}))))
# col1 col2 col3 col4 col5
#1 NA NA 1 2 3
#2 NA NA 1 2 3
#3 3 ... | if there is at least one Na in the line, make the line Na | r|dataframe | 2 | 63 | 1 | 72,256,311 | 72,256,311 | 2 | true | 2022-05-16T08:27:43.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
if there is at least one Na in the line, make the line Na<p>my data:</p>
<pre><code> structure(list(col1 = 1:6, col2 = c(NA, NA, 3L, 4L, 5L, 6L),
col... |
72,320,019 | Script shuffles cell values instead of formulas<p>I got the following code to shuffle multiple columns with a script.</p>
<pre><code> var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('SheetToShuffle');
var ranges = ['A1:A32','B1:B47','C1:C39','D1:D87'];
ranges.forEach(r => shuffl... | <p>I suppose I can be done this way:</p>
<pre><code>function main() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheetByName('SheetToShuffle');
const ranges = ['A1:A32','B1:B47','C1:C39','D1:D87'];
ranges.forEach(r => shuffleColumn(r, sheet));
}
function shuffleColumn(rng,sheet) {... | Script shuffles cell values instead of formulas | google-apps-script | 1 | 63 | 1 | 72,322,557 | 72,322,557 | 2 | true | 2022-05-20T13:48:35.177Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Script shuffles cell values instead of formulas<p>I got the following code to shuffle multiple columns with a script.</p>
<pre><code> var ss = SpreadsheetAp... |
72,370,283 | New to GO. Having invalid memory access related errors<p>extremely green in the world of GO - infact this is my first ever program in GO. I'm writing an algorithm that reverses a linked list, specifically from this <a href="https://leetcode.com/problems/reverse-linked-list/" rel="nofollow noreferrer">leetcode</a>. The ... | <p>The basic problem is that you're never allocating memory for your struct pointers. When you write:</p>
<pre><code>var list *ListNode
</code></pre>
<p>You have created a pointer-to-ListNode type, but you haven't actually allocated any memory for it. So when you try to write...</p>
<pre><code>list.Val = i
</code></pre... | New to GO. Having invalid memory access related errors | go | 1 | 63 | 2 | 72,370,455 | 72,370,455 | 2 | true | 2022-05-24T22:56:23.720Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
New to GO. Having invalid memory access related errors<p>extremely green in the world of GO - infact this is my first ever program in GO. I'm writing an algo... |
72,245,022 | list of strings exist within a list of dict keys?<p>I have a list of strings:</p>
<pre class="lang-py prettyprint-override"><code>ignore_list = ["new job", "encountered error", "SLA"]
</code></pre>
<p>and a list of dictionaries:</p>
<pre class="lang-py prettyprint-override"><code>ticket_li... | <p>Another option is to replace your <code>ignore_list</code> iterator with <code>any()</code> and generator expression.</p>
<p>For example, using a set comprehension:</p>
<pre class="lang-py prettyprint-override"><code>action_tickets_list = set(ticket['Title'] for ticket in ticket_list if not any(s in ticket['Title'] ... | list of strings exist within a list of dict keys? | python|string|list|dictionary | 1 | 63 | 3 | 72,245,241 | 72,245,241 | 2 | true | 2022-05-15T01:46:08.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
list of strings exist within a list of dict keys?<p>I have a list of strings:</p>
<pre class="lang-py prettyprint-override"><code>ignore_list = ["new jo... |
72,245,664 | using declval with reference types<p>I would like to understand how the assignment of <code>int &</code> to <code>double</code> below in conjunction with <code>declval</code> works? Is <code>T</code> deduced to something other than <code>int &</code> ?</p>
<pre class="lang-cpp prettyprint-override"><code>#inclu... | <blockquote>
<p>Is T deduced to something other than <code>int &</code> ?</p>
</blockquote>
<p>T will <em>still</em> be deduced as <code>int&</code>, so <code>std::declval<T>() = std::declval<U>()</code> will be roughly equivalent to</p>
<pre><code>int& f();
double&& g();
f() = g(); // ... | using declval with reference types | c++|templates|c++17 | 0 | 63 | 1 | 72,245,800 | 72,245,800 | 2 | true | 2022-05-15T05:13:23.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
using declval with reference types<p>I would like to understand how the assignment of <code>int &</code> to <code>double</code> below in conjunction with... |
72,316,056 | Global options for python-click MultiCommand<p>I'm implementing a classical CLI toolbox with python and I selected <a href="https://click.palletsprojects.com/" rel="nofollow noreferrer">click</a> as my argument parser. Adding a command should just be adding a file. From there the command is listed in the help and so on... | <p><em>click_example.py</em>:</p>
<pre><code>#!/usr/bin/env python
import os
import pathlib
import typing
import click
class ToolboxCLI(click.MultiCommand):
commands_folder = pathlib.Path.joinpath(
pathlib.Path(__file__).parent, "commands"
).resolve()
def list_commands(self, ctx: clic... | Global options for python-click MultiCommand | python|python-click | 2 | 63 | 1 | 72,316,354 | 72,316,354 | 2 | true | 2022-05-20T08:47:39.293Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Global options for python-click MultiCommand<p>I'm implementing a classical CLI toolbox with python and I selected <a href="https://click.palletsprojects.com... |
72,269,936 | Is there a proper way to hatch QLabel<p>As stated in the title, I do want to know if there is a proper way to hatch the <code>QLabel</code> which in my case is has the Geometry of <code>QRect</code> as you can see in my <a href="https://stackoverflow.com/questions/67192260/is-there-any-way-to-pass-existing-label-to-ano... | <p>You can override <code>QLabel</code>'s <code>paintEvent</code> and use <code>QBrush</code> with predefined <code>BrushStyle</code> <a href="https://doc.qt.io/qt-5/qbrush.html#details" rel="nofollow noreferrer">pattern</a> or define your pattern as tiny pixmap and use as a <code>QBrush</code>.</p>
<p>If you need patt... | Is there a proper way to hatch QLabel | python|pyqt5|qlabel | 0 | 63 | 1 | 72,273,200 | 72,273,200 | 2 | true | 2022-05-17T07:38:11.240Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a proper way to hatch QLabel<p>As stated in the title, I do want to know if there is a proper way to hatch the <code>QLabel</code> which in my case ... |
72,392,571 | In R, from a dataframe, how to split data into groups to plot multiple curves on the same graphic?<p>I have a big dataframe that looks like this:</p>
<pre><code>> dput(sb_data_omit_1950[sample(nrow(sb_data_omit_1950), 50),])
structure(list(lat = c("56", "61", "57", "59", "... | <p>I am not 100% sure what your final output should be, but if you want all the histograms on one plot:</p>
<pre><code>df %>%
ggplot(aes(x=julian_day, fill = decade)) +
geom_histogram(bins=152) +
xlim(0, 155) +
xlab("Day nΒ°") + ylab("Count")
</code></pre>
<p><a href="https://i.stack.imgu... | In R, from a dataframe, how to split data into groups to plot multiple curves on the same graphic? | r|ggplot2|dplyr | 0 | 63 | 3 | 72,392,820 | 72,392,820 | 2 | true | 2022-05-26T13:25:08Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In R, from a dataframe, how to split data into groups to plot multiple curves on the same graphic?<p>I have a big dataframe that looks like this:</p>
<pre><c... |
72,341,163 | IntegrityError at /listing/1/ NOT NULL constraint failed: auctions_comments.user_id. I am trying to save comments and need help resolving this error<p>I am trying to make an e-commerce site (CS50 Project 2) that saves comments. The comments were previously saving, but then I added ForeignKeys to my comment model to lin... | <p>I'm assuming that the form the user is using to post a comment doesn't have them specify their <code>listing</code> ID or <code>user</code> ID. If this is the case, then both <code>listing</code> and <code>user</code> in the <code>Comments</code> would be null which is what gives the error since foreign keys aren't ... | IntegrityError at /listing/1/ NOT NULL constraint failed: auctions_comments.user_id. I am trying to save comments and need help resolving this error | python|django|django-models|django-forms|django-templates | 1 | 63 | 1 | 72,341,233 | 72,341,233 | 2 | true | 2022-05-22T20:43:47.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
IntegrityError at /listing/1/ NOT NULL constraint failed: auctions_comments.user_id. I am trying to save comments and need help resolving this error<p>I am t... |
72,363,129 | Wrapping std::getline()<p>I am struggling with the problem of reading input from file on a per-line basis, in a cross-platform way.</p>
<p>Different platforms use different sequences of characters to represent a new line/end of line.</p>
<p><code>std::getline</code> doesn't deal with these in a cross platform way.</p>
... | <p>You should take the stream by reference because streams typically cannot be copied. Also the string should be passed by reference because you want to write to it.</p>
<p>To be generic you can use the same interface as <code>std::getline</code> does. As you want to use specific delimiters, they need not be passed as ... | Wrapping std::getline() | c++|templates|getline | 0 | 63 | 1 | 72,363,576 | 72,363,576 | 2 | true | 2022-05-24T12:45:10.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wrapping std::getline()<p>I am struggling with the problem of reading input from file on a per-line basis, in a cross-platform way.</p>
<p>Different platform... |
72,325,654 | Converting between two sets scaled between 0 and 100 using overlap<p>I am attempting to scale google trends data that is received by the minute every 10 minutes. If you are not familiar with google trends, every response is scaled between 0 and 100 based on the minimum and maximum in the current response. So two differ... | <p>Let's say that your initial four-hour window and any data that has gone through a scaling process is 'good.'</p>
<p>Let's say our good data ends at time T, and we have a new 4-hour window of data that ends at time T+10.</p>
<p>The only difference between the data in our new window and good data is the scaling factor... | Converting between two sets scaled between 0 and 100 using overlap | algorithm|go|stream|google-trends | 1 | 63 | 1 | 72,326,068 | 72,326,068 | 2 | true | 2022-05-20T23:40:07.497Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting between two sets scaled between 0 and 100 using overlap<p>I am attempting to scale google trends data that is received by the minute every 10 minu... |
72,291,263 | How can I refactor this code snippet to make it more efficient?<p>I'm trying to make a matrix of actions based off game theory. So if two people meet, they can either both share, or one steal, or both steal, etc.</p>
<p>The outline of what I have looks like this (not the whole matrix, just so you get an idea):</p>
<pre... | <p>When I have a situation with multiple options, I like to make a dictionary of functions that handle the different possibilities. The keys are the encoded and normalized inputs. In your case, you can generate a key like this:</p>
<pre><code>def key(first_agent, second_agent):
key = [first_agent.type, second_agent... | How can I refactor this code snippet to make it more efficient? | python | 2 | 63 | 4 | 72,291,419 | 72,291,419 | 3 | true | 2022-05-18T14:40:44.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I refactor this code snippet to make it more efficient?<p>I'm trying to make a matrix of actions based off game theory. So if two people meet, they c... |
72,304,680 | Import a package doesn't return error, but doesn't work<p>I installed SHAP package using pip. when I'm using <code>pip freeze</code> I get:</p>
<pre><code>...
shap==0.40.0
...
</code></pre>
<p>I'm importing the package with <code>import shap</code></p>
<p>when I check what does return <code>shap</code> I get:</p... | <p>Your python script file is called <code>shap.py</code>. What you are doing is actually importing your own script and not the <code>shap</code> module. Python <a href="https://docs.python.org/3/tutorial/modules.html#the-module-search-path" rel="nofollow noreferrer">first looks in the script directory for imports</a>,... | Import a package doesn't return error, but doesn't work | python|import|package|shap | 0 | 63 | 1 | 72,304,767 | 72,304,767 | 3 | true | 2022-05-19T12:36:32.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Import a package doesn't return error, but doesn't work<p>I installed SHAP package using pip. when I'm using <code>pip freeze</code> I get:</p>
<pre><code>.... |
72,319,582 | c++ concat files<p>I am trying to concatenate two binary files into another output file.
I am using the following code:</p>
<pre class="lang-cpp prettyprint-override"><code>std::ofstream outFile("file.out", std::ios::ate );
std::ifstream inFile1(getExeDirectory() / "file.in");
std::ifstream inFile2(... | <p>The issue was, that my files contained null bytes, and I didn't open them in binary mode.
This fixed the issue:</p>
<pre class="lang-cpp prettyprint-override"><code>std::ofstream outFile("file.out", std::ios_base::binary );
std::ifstream inFile1(getExeDirectory() / "file.in", std::ios_base::binar... | c++ concat files | c++ | 1 | 63 | 1 | 72,319,955 | 72,319,955 | 3 | true | 2022-05-20T13:16:34.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
c++ concat files<p>I am trying to concatenate two binary files into another output file.
I am using the following code:</p>
<pre class="lang-cpp prettyprint-... |
72,362,845 | Recursively navigating through dictionary in the django template<p>I have a dictionary of unknown depth which I want to display in my Django template. This dictionary represents the structure of the subfolders inside of a folder. My goal is to display it with the parent subfolders before their children, which would be ... | <p>I think the simplest solution is to use a custom template tag:</p>
<pre><code>from django.utils.safestring import mark_safe
def get_data(data):
text = "<ul>"
for k, v in data.items():
text += f'<li>{k}<li>'
if isinstance(v, dict):
text += get_data(v) # r... | Recursively navigating through dictionary in the django template | python|django|dictionary|for-loop|django-templates | 2 | 63 | 1 | 72,363,092 | 72,363,092 | 3 | true | 2022-05-24T12:24:29.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Recursively navigating through dictionary in the django template<p>I have a dictionary of unknown depth which I want to display in my Django template. This d... |
72,370,923 | Lawvere's fixed point theorem in agda<p>I was struggling to prove a more basic version of <a href="https://ncatlab.org/nlab/show/Lawvere%27s+fixed+point+theorem" rel="nofollow noreferrer">lawvere's fixed point theorem</a> in agda. Precisely I am trying to figure out the proof for the bottom theorem.</p>
<pre><code>surj... | <p>I think my problem was hesitancy to use equational reasoning which I often have trouble with in agda. The solution I eventually found was:</p>
<pre><code>lawvere : {A : _} {B : _}
β (Ο : A β A β B) β (surjective Ο) β (f : B β B) β
fixedPoint f
lawvere {A} {B} Ο surj f = Ο p p , sym proof
where
... | Lawvere's fixed point theorem in agda | proof|agda|theorem-proving|category-theory | 0 | 63 | 1 | 72,381,629 | 72,381,629 | 3 | true | 2022-05-25T00:53:29.910Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Lawvere's fixed point theorem in agda<p>I was struggling to prove a more basic version of <a href="https://ncatlab.org/nlab/show/Lawvere%27s+fixed+point+theo... |
72,380,478 | Can a Python script using xlwings be deployed on a server?<p>We currently have a python script launched locally that periodically generates dozens of Excel files using Xlwings.</p>
<p>How can it be deployed on a cloud server as an ETL that would be linked to a job scheduler, so that no human action is needed anymore?</... | <p>The only way that you can currently do what you have in mind is to install Excel, Python, and xlwings on a Windows Server: xlwings was built for interactive workflows.</p>
<p>You might want to look into OpenPyXL and XlsxWriter to see if you can create the reports by writing the Excel file directly, as opposed to aut... | Can a Python script using xlwings be deployed on a server? | python|xlwings | 5 | 63 | 1 | 72,388,158 | 72,388,158 | 3 | true | 2022-05-25T15:31:34.563Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can a Python script using xlwings be deployed on a server?<p>We currently have a python script launched locally that periodically generates dozens of Excel f... |
72,336,267 | How to delete everything in an array except the first index?<p>I have a collection <code>people</code>. It has an array field <code>numbers</code>, where each document has a varying number of elements in said array.</p>
<p>My goal is to keep the elements in the 0th index and recursively remove the rest. How could I go ... | <p>An alternative solution to @R2D2 is to use <a href="https://mongodb.com/docs/manual/reference/operator/update/slice" rel="nofollow noreferrer"><code>$slice</code></a>. Unlike <code>$first</code>, <code>$slice</code> works for more than one element.</p>
<pre><code>collection.updateMany(
{},
{ $push: { numbers: { ... | How to delete everything in an array except the first index? | mongodb | 1 | 63 | 2 | 72,336,464 | 72,336,464 | 3 | true | 2022-05-22T09:21:59.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to delete everything in an array except the first index?<p>I have a collection <code>people</code>. It has an array field <code>numbers</code>, where eac... |
72,262,597 | Can we achieve the following using an Excel formula? The output of the formula will be the Result column<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Month</th>
<th>Brand</th>
<th>Product</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>January</td>
<td>Apple</td>
<td>Iphone</td>
<td>Appl... | <p>In D2 put:</p>
<pre><code>=BYROW($A$2:$A$8,
LAMBDA(a,
LET(rng,a,
mb,$A$2:$B$8,
m,$A$2:$A$8,
b,$B$2:$B$8,
p,$C$2:$C$8,
TEXTJOIN(";",,UNIQUE(
BYROW(FILTER(mb,m=rng),
LAMBDA(a,INDEX(a,,2)&":"... | Can we achieve the following using an Excel formula? The output of the formula will be the Result column | excel|excel-formula | 0 | 63 | 1 | 72,263,001 | 72,263,001 | 3 | true | 2022-05-16T16:33:28.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can we achieve the following using an Excel formula? The output of the formula will be the Result column<div class="s-table-container">
<table class="s-table... |
72,365,733 | More efficiency creating a new variable using for loop<p>I would like to know if there is a more efficient way to do this since I have a millions-long dataset that has been stuck for days in this step.</p>
<pre><code>for (i in 1:32000000){
if (!exists("df")){
df <- as.data.frame(Properties[[i]])
... | <p>A way will be using <code>rbind</code> in <code>do.call</code>.</p>
<pre><code>do.call(rbind, Properties)
</code></pre>
<p>Benchmark: (Based on @Adam)</p>
<pre><code>set.seed(42)
n <- 1e5
Properties <- replicate(n, setNames(runif(3), c("PP1", "PP2", "PP3")), simplify = FALSE)
ben... | More efficiency creating a new variable using for loop | r|performance | 2 | 63 | 2 | 72,366,694 | 72,366,694 | 3 | true | 2022-05-24T15:39:17.187Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
More efficiency creating a new variable using for loop<p>I would like to know if there is a more efficient way to do this since I have a millions-long datase... |
72,350,996 | Updating Text Boxes in VISIO using an array with VBA<p>I'm trying to update Textbox values using an assigned array. It seems I'm able to update "Item" Itself but not the object? Anyone have some pointers on how to approach this better?</p>
<p>This is what I have so far. I'm not sure how to set objects properl... | <p>My VBA is rusty, but I believe for this purpose things work pretty much the same as in VB.Net, with which I'm a little more current. That disclaimer out of the way, let's continue.</p>
<hr />
<p>If you want to <em>replace</em> the value in the array, as the code in the question is attempting to do, whether an intege... | Updating Text Boxes in VISIO using an array with VBA | arrays|vba|object|shapes|visio | 0 | 63 | 1 | 72,351,131 | 72,351,131 | 3 | true | 2022-05-23T15:19:55.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Updating Text Boxes in VISIO using an array with VBA<p>I'm trying to update Textbox values using an assigned array. It seems I'm able to update "Item&qu... |
72,385,485 | Mapping an element to a list of functions in Haskell<p>The Prelude function <code>map</code> in Haskell applies a function to a list of inputs:</p>
<pre><code>map :: (a -> b) -> [a] -> [b]
</code></pre>
<p>If we would like to apply an element to a list of functions, we could do this with recursion:</p>
<pre><c... | <p>You can <code>map</code> over the <code>functions</code> and apply each to <code>element</code>:</p>
<pre class="lang-hs prettyprint-override"><code>functionMap :: a -> [a -> b] -> [b]
functionMap element functions = map (\f -> f element) functions
</code></pre>
<p>This can be shortened using the <code>$... | Mapping an element to a list of functions in Haskell | haskell | 2 | 63 | 1 | 72,385,527 | 72,385,527 | 4 | true | 2022-05-26T00:35:47.873Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mapping an element to a list of functions in Haskell<p>The Prelude function <code>map</code> in Haskell applies a function to a list of inputs:</p>
<pre><cod... |
72,393,263 | Asynchonous programming for method loops<p>I am trying to learn about asynchronous programming and how I can benefit from it.</p>
<p>My hope is that I can use it to improve performance whenever I'm looping over a method that takes an significant time to complete, like the following method.</p>
<pre><code>string AddStri... | <blockquote>
<p>My hope is that I can use it to improve performance</p>
</blockquote>
<p>Not really. Concurrency (parallel or asynchronous) <em>can</em> improve performance, but asynchronous code on its own is more about freeing up threads. Asynchronous code provides two main benefits:</p>
<ol>
<li>Server-side apps get... | Asynchonous programming for method loops | c#|asynchronous|async-await | 0 | 63 | 1 | 72,393,835 | 72,393,835 | 4 | true | 2022-05-26T14:15:14.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Asynchonous programming for method loops<p>I am trying to learn about asynchronous programming and how I can benefit from it.</p>
<p>My hope is that I can us... |
72,400,704 | Is there a difference in the working of AND operator in JAVA and C?<pre><code>import java.util.Arrays;
import java.util.Scanner;
public class InsertionSort {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int[] arr = new int[s.nextInt()];
for (int i = 0; i ... | <p>No. Its called shortcircuit.</p>
<p>The order can affect your condition because if any of the conditions from left to right fails, it will mark the complete condition as false and doesn't evaluate any more conditions.</p>
<pre><code>while ((j >= 0) && (temp < arr[j]))
</code></pre>
<p>So if <code>j >... | Is there a difference in the working of AND operator in JAVA and C? | java|c | 0 | 63 | 1 | 72,400,756 | 72,400,756 | 4 | true | 2022-05-27T05:09:26.123Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a difference in the working of AND operator in JAVA and C?<pre><code>import java.util.Arrays;
import java.util.Scanner;
public class InsertionS... |
72,281,922 | Convert lists to dict python?<p>I have a list of lists like this :</p>
<pre class="lang-py prettyprint-override"><code>[
["key=djbjd","val=22"],
["key=fvv","val=34"],
...
]
</code></pre>
<p>How can I convert it into one single <code>dict</code> of the following format... | <p>try:</p>
<pre><code>lsts = [["key=fvv","val=34"],["key=djbjd","val=22"]]
result = {i[0].split("=")[1]: i[1].split("=")[1] for i in lsts}
print(result)
</code></pre>
<p>output</p>
<pre><code>{'fvv': '34', 'djbjd': '22'}
</code></pre> | Convert lists to dict python? | python | -7 | 63 | 2 | 72,281,934 | 72,281,934 | 4 | true | 2022-05-18T00:06:53.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert lists to dict python?<p>I have a list of lists like this :</p>
<pre class="lang-py prettyprint-override"><code>[
["key=djbjd","val... |
72,303,498 | Swift filter an array inside a struct by another array<p>I've got an array of Profile's (defined from a custom struct), and inside this, I have a [String] of interests.</p>
<p>I want to filter out any profiles which don't match an array of preferences, but can't seem to get my filtering to work.</p>
<p>The error I get ... | <p>Your problem is that <code>userProfile.interests</code> is an array, so it wouldn't be the element of <code>preferencesInterests</code> which contains <code>String</code>.</p>
<p>If you think about it, you are trying to see if two sets of interests have anything in common. This is <code>Set</code> intersection. <c... | Swift filter an array inside a struct by another array | arrays|swift|filter|contains | 1 | 63 | 2 | 72,304,116 | 72,304,116 | 4 | true | 2022-05-19T11:10:42.047Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift filter an array inside a struct by another array<p>I've got an array of Profile's (defined from a custom struct), and inside this, I have a [String] of... |
72,353,811 | Without changing html make it look like a `table`<p>Having such html as in the picture on the left, is it possible to change its appearance so that it looks like in the picture on the right (the width of the first column is equal to the maximum width of the content inside it)? Without using javascriptm changing only cs... | <p><strong>Solution 1:</strong></p>
<p>A table can have many "bodies", so you can use <code>display: table-row-group</code> in your case. Example below:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css ... | Without changing html make it look like a `table` | html|css | 2 | 63 | 1 | 72,354,286 | 72,354,286 | 4 | true | 2022-05-23T19:21:04.097Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Without changing html make it look like a `table`<p>Having such html as in the picture on the left, is it possible to change its appearance so that it looks ... |
72,347,950 | how to split number into pieces with remaining part<p>I want to split any number to any identical pieces and the last remaining but not dividable piece will be the last piece. I wrote this code but I know that it should be more simple way to do this :) For example; 7500 divided by 2000 and the last modulus part will be... | <p>You can simplify your code like the following:</p>
<pre><code>public static void main(String args[]) {
int x = 7500;
int y = 2000;
for (int i = 0; i < x/y; i++) {
System.out.println("Part " + (i+1) + ": " + y*i + " - " + y*(i+1));
}
if (x%y != 0) {
System.out.p... | how to split number into pieces with remaining part | java | 1 | 63 | 3 | 72,348,074 | 72,348,074 | 6 | true | 2022-05-23T11:41:21.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to split number into pieces with remaining part<p>I want to split any number to any identical pieces and the last remaining but not dividable piece will ... |
72,390,862 | I am trying to write a bool function that checks if the string input has any duplicate characters<p>I wrote this function under <code>main</code> I want to check if the string input has any duplicate characters but when I used the debug feature it turns out that the outer loop only loops once while the inner loop loops... | <p>Reformating your code with a sensible indentation convention makes the mistake obvious:</p>
<pre><code>bool duplicts(string b) {
int length = strlen(b);
int count = 0;
for (int i = 0; i < length; i++) {
for (int k = 1; k < length; k++) {
if ((b[i]) == b[k])
count... | I am trying to write a bool function that checks if the string input has any duplicate characters | c|cs50 | 4 | 63 | 1 | 72,390,940 | 72,390,940 | 6 | true | 2022-05-26T11:09:45.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I am trying to write a bool function that checks if the string input has any duplicate characters<p>I wrote this function under <code>main</code> I want to c... |
72,846,733 | Remove nodes with dead end from path taken by Depth first search<p>If I console.log visited nodes, I get a ton of spare nodes that I don't want.</p>
<p>I just what the nodes necessary to get for start to end node (does not need to be the shortest), But I don't want all the other paths/nodes the algo took before it foun... | <p>The idea here is to track if the node <code>destination</code> you visited leads to correct path or not. Hence, you should return after exhausting a particular node whether end node can be visited through this node or not.</p>
<pre><code>function dfs(start, visited = new Set()) {
visited.add(start);
const d... | Remove nodes with dead end from path taken by Depth first search | javascript|algorithm|graph|nodes|depth-first-search | 0 | 63 | 1 | 72,849,186 | 72,849,186 | 1 | true | 2022-07-03T13:04:12.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove nodes with dead end from path taken by Depth first search<p>If I console.log visited nodes, I get a ton of spare nodes that I don't want.</p>
<p>I jus... |
72,996,333 | What should I type hint 'self' of functions in a Mixin Class with multiple functions depending on each other<p>Assume I have below Mixin class, and it assumes the class inherits it has property value. However, PyLance is not happy with this code given self.value is not defined in foo_mixin</p>
<pre><code>class foo_mixi... | <p>Make <code>foo_mixin</code> an <code>ABC</code>, with <code>value</code> an <code>abstractproperty</code>:</p>
<pre><code>from abc import ABC, abstractproperty
class foo_mixin(ABC):
@abstractproperty
def value(self) -> int: ...
def f1(self, a:int) -> int:
return self.value + a
def f... | What should I type hint 'self' of functions in a Mixin Class with multiple functions depending on each other | python|type-hinting|type-annotation | 0 | 63 | 1 | 72,996,691 | 72,996,691 | 1 | true | 2022-07-15T15:29:43.997Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What should I type hint 'self' of functions in a Mixin Class with multiple functions depending on each other<p>Assume I have below Mixin class, and it assume... |
72,985,967 | Limit how many chars accepted in input - Wordle clone<p>i just finished a project for school and im now polishing some simple things i ignored until the program worked fine. Im almost done but I realized I dont know how to limit the amount of chars i can accept on input. For ex: i have this fragment of code:</p>
<pre><... | <p>In order to read an entire line of input, I recommend that you use the function <a href="https://en.cppreference.com/w/c/io/fgets" rel="nofollow noreferrer"><code>fgets</code></a>. I do not recommend that you use the function <code>scanf</code>, because it is not designed for line-based user input.</p>
<p>The functi... | Limit how many chars accepted in input - Wordle clone | c | 0 | 63 | 2 | 72,987,063 | 72,987,063 | 1 | true | 2022-07-14T19:52:38.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Limit how many chars accepted in input - Wordle clone<p>i just finished a project for school and im now polishing some simple things i ignored until the prog... |
72,782,751 | How to perform torch.meshgrid over multiple tensors in parallel?<p>Let's say we have a tensor x of size [60,9] and a tensor y of size [60,9]
Is it possible to do an operation like <code>xx,yy = torch.meshgrid(x,y)</code> such that xx and yy is of size [60,9,9] and <code>xx[i,:,:], yy[i,:,:]</code> is basically <code>to... | <p>I don't believe you will gain anything since the initialization of the tensors is not done on the GPU. So a proposed approach would indeed be to loop over <code>x</code> and <code>y</code> or using <a href="https://docs.python.org/3/library/functions.html#map" rel="nofollow noreferrer"><code>map</code></a> as an ite... | How to perform torch.meshgrid over multiple tensors in parallel? | python|pytorch|tensor | 0 | 63 | 1 | 72,782,863 | 72,782,863 | 1 | true | 2022-06-28T08:01:42.127Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to perform torch.meshgrid over multiple tensors in parallel?<p>Let's say we have a tensor x of size [60,9] and a tensor y of size [60,9]
Is it possible t... |
72,937,700 | looping and rendering the array of objects<p>I am trying to loop the data from json and display it it in table. I am having array of objects. I am having 3 values in my json file , I need to display all three data in individual cells, the third column is in array format. So the structure of my json is array of object a... | <p>It's easier to break it down into steps within the confines of the component. This example utilises three functions to find the headings, all the rows, and the cells for each of those rows.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
<div class="snippet-code">
... | looping and rendering the array of objects | javascript|reactjs|arrays | 0 | 63 | 3 | 72,938,370 | 72,938,370 | 1 | true | 2022-07-11T11:17:25.393Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
looping and rendering the array of objects<p>I am trying to loop the data from json and display it it in table. I am having array of objects. I am having 3 v... |
73,015,010 | How to import a python script stored in another folder?<p>I have a file named "<strong>generate_tax_report.py</strong>" which is stored at location "<strong>C:\Users\rites\Desktop\crypto-tax-report\van\adam</strong>".</p>
<p><a href="https://i.stack.imgur.com/Gwodf.png" rel="nofollow noreferrer"><im... | <p>Assuming you have not installed <code>van</code> as a package, the problem is that when you run <code>python generate_tax_report.py</code> from <code>Desktop/crypto-tax-report/van/adam</code>, Python does not add <code>Desktop/crypto-tax-report</code> to the path, so <code>from van.adam.inventory_methods import fifo... | How to import a python script stored in another folder? | python|python-3.x|python-module | 0 | 63 | 2 | 73,015,280 | 73,015,280 | 1 | true | 2022-07-17T20:04:53.683Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to import a python script stored in another folder?<p>I have a file named "<strong>generate_tax_report.py</strong>" which is stored at location... |
72,830,281 | How To Add multiple Button Selections to a Div<p>So I have A Table With Buttons and match information, I am trying to script a code when I click on the specific button, it adds my selections to div(cart) for example if i click on the first button (1.59), it should add the match Name to the cart (Arsenal-Chelsea) ,The r... | <p>You need to use DOM traversal to find the content related to the button which was clicked. To get the venue you can get the index of the containing <code>td</code> and then retrieve the matching <code>thead th</code> which holds the text. To get the match you can get the text of the first <code>td</code> in the curr... | How To Add multiple Button Selections to a Div | javascript|html|jquery | 2 | 63 | 1 | 72,830,394 | 72,830,394 | 1 | true | 2022-07-01T13:47:37.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How To Add multiple Button Selections to a Div<p>So I have A Table With Buttons and match information, I am trying to script a code when I click on the speci... |
72,844,446 | AWS NLB - not able to assign Elastic IP to Network Load Balancer<p>Am trying to assign Elastic IP (recently disassociated from EC2 instance ) to an Internet facing Network Load Balancer using Edit IP Address Type option, however Elastic IP is not shown in dropdown Assigned by AWS.Actually no drop down is shown.</p>
... | <p>You <strong>can't change existing IP address</strong> assocciation. You already have assigned all your NLB nodes to AWS provided IP. You can only add Elastic IP for new AZ association in an existing NLB. If you used all associations, you have to create new NLB.</p> | AWS NLB - not able to assign Elastic IP to Network Load Balancer | amazon-web-services|amazon-ec2 | 0 | 63 | 2 | 72,845,036 | 72,845,036 | 1 | true | 2022-07-03T06:47:03.720Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AWS NLB - not able to assign Elastic IP to Network Load Balancer<p>Am trying to assign Elastic IP (recently disassociated from EC2 instance ) to an Internet ... |
72,920,361 | Subtraction between columns in R<p>I have following dataframe.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: center;">act</th>
<th style="text-align: center;">tar</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;">4</td>
<td style="text-align: center;">3</... | <p>Your code is almost right, only a little problem, the "true" and "false" conditions should be the same type, and you missied one ")"</p>
<pre><code> df <- df %>% mutate(diff = if_else((!is.na(act) & !is.na(tar)), as.integer(act - tar), as.integer(NA)))
df
A data.frame: 5 ... | Subtraction between columns in R | r | 0 | 63 | 4 | 72,920,469 | 72,920,469 | 1 | true | 2022-07-09T09:43:05.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Subtraction between columns in R<p>I have following dataframe.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align... |
72,770,160 | nullable context doesn't work properly in c#<p>i am fully aware about nullabe context and how to deal with it in c#, even with this i have review this <a href="https://docs.microsoft.com/en-us/learn/modules/csharp-null-safety/" rel="nofollow noreferrer">microsoft official tutorial</a> and also <a href="https://stackove... | <p>The C# language does not guarantee that the property <code>stepStatus</code> returns the same value when the getter is called multiple times. Therefore null-checking it once is no proof that it will not be null the second time.</p> | nullable context doesn't work properly in c# | c#|null|nullreferenceexception|nullable|nullable-reference-types | 1 | 63 | 1 | 72,771,492 | 72,771,492 | 2 | true | 2022-06-27T09:56:23.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
nullable context doesn't work properly in c#<p>i am fully aware about nullabe context and how to deal with it in c#, even with this i have review this <a hre... |
72,772,478 | Combine list of lambdas in a single one<p>What's the pythonic way to combine a list of lambdas in a single function? For example:</p>
<pre><code>lambdas = [lambda x, k=k: x+k for k in range(3)]
</code></pre>
<p>I would like to get this all in a single lambda similar to this but without having to type it out:</p>
<pre><... | <p>You can do this with <a href="https://docs.python.org/3/library/functools.html#functools.reduce" rel="nofollow noreferrer"><code>functools.reduce</code></a> like below:</p>
<pre><code>from functools import reduce
lambdas = [lambda x, k=k: x+k for k in range(3)]
# x = 0
reduce(lambda x, l: l(x), lambdas, x)
# -> l... | Combine list of lambdas in a single one | python|python-3.x|lambda | 2 | 63 | 3 | 72,772,550 | 72,772,550 | 2 | true | 2022-06-27T12:56:02.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combine list of lambdas in a single one<p>What's the pythonic way to combine a list of lambdas in a single function? For example:</p>
<pre><code>lambdas = [l... |
72,780,994 | Function that does groupby and stats analysis on a Pandas dataframe<p>In the dataset below, I want to write a function that does the following:</p>
<ol>
<li><p>compares fuel consumption <code>mpg</code> of <code>No_of_cylinders</code> for each unique <code>model</code>.</p>
</li>
<li><p>export all results (6 models) a... | <p>As <a href="https://www.statsmodels.org/dev/generated/statsmodels.stats.multicomp.pairwise_tukeyhsd.html" rel="nofollow noreferrer"><code>pairwise_tukeyhsd</code></a> returns a <a href="https://www.statsmodels.org/dev/generated/statsmodels.sandbox.stats.multicomp.TukeyHSDResults.html#statsmodels.sandbox.stats.multic... | Function that does groupby and stats analysis on a Pandas dataframe | pandas|function|for-loop|statsmodels | 2 | 63 | 3 | 72,782,023 | 72,782,023 | 2 | true | 2022-06-28T05:08:49.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Function that does groupby and stats analysis on a Pandas dataframe<p>In the dataset below, I want to write a function that does the following:</p>
<ol>
<li>... |
72,780,984 | Functional React component freezes webpage<p>I'm currently working on a clone of a memory game called Indefinite Interrogation using React (<a href="https://github.com/SirIsaacNeutron/indefinite-interrogation" rel="nofollow noreferrer">GitHub here</a>). I'm trying to improve the algorithm for asking questions, but my r... | <p>(Adding this as a formal answer since it solved the OP's issue).</p>
<p>The bug is in the <code>getInitialQuestionList()</code> function, which currently contains an infinite loop - the length of the array never increases. As you yourself identified, you were using the wrong <code>.text</code> property on the questi... | Functional React component freezes webpage | reactjs | 0 | 63 | 1 | 72,782,617 | 72,782,617 | 2 | true | 2022-06-28T05:07:29.177Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Functional React component freezes webpage<p>I'm currently working on a clone of a memory game called Indefinite Interrogation using React (<a href="https://... |
72,787,278 | Use Different version of package for two nuget package C# .net framework<p>I need to use to use two packages Package1 & Package2 both in same project (same .csproj file)</p>
<p>But both need different version of Bond.Core.CSharp how do i use both packages.
Dependency is like:</p>
<p>Package1
-> dependency -> ... | <p>If the first package requires 9.0.1 and the second 9.0.3, you can try requiring directly version 9.0.3 in you project. I would expect Package1 to be fine with the version you are already requiring.</p>
<p>In other words, add a <code>PackageReference</code> for the desired version of <code>Bond.Runtime.Csharp</code> ... | Use Different version of package for two nuget package C# .net framework | c#|.net|reference|nuget|.net-4.8 | 0 | 63 | 1 | 72,787,866 | 72,787,866 | 2 | true | 2022-06-28T13:25:56.833Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use Different version of package for two nuget package C# .net framework<p>I need to use to use two packages Package1 & Package2 both in same project (sa... |
72,773,932 | LibreOffice Calc Macro - Set two different types of fonts within the same cell<p>Good morning everyone,
I would like to build a Uno Basic macro that allows us to set the formatting one cell in such a way as to have the content first formatted with one character and then subsequently with a different character.
I would ... | <p>Create a text cursor to modify the text inside the cell.</p>
<pre class="lang-vb prettyprint-override"><code>LF = CHR(10)
oDoc = ThisComponent
oSheet = oDoc.getSheets().getByIndex(0)
oCell = oSheet.getCellByPosition(0, 0)
oCurs = oCell.createTextCursor()
oCurs.gotoStart(False)
oCurs.getText().insertString(oCurs, &qu... | LibreOffice Calc Macro - Set two different types of fonts within the same cell | libreoffice|basic|libreoffice-calc | 1 | 63 | 2 | 72,788,933 | 72,788,933 | 2 | true | 2022-06-27T14:39:09.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
LibreOffice Calc Macro - Set two different types of fonts within the same cell<p>Good morning everyone,
I would like to build a Uno Basic macro that allows u... |
72,799,632 | How do I update an array property in a Palantir Foundry Ontology edit Function?<p>I want to modify an array property on an Object using an Ontology Function (a.k.a FoO), but I'm seeing the following error:</p>
<blockquote>
<p>[typescript] Property 'push' does not exist on type 'readonly string[]'.</p>
</blockquote>
<p>... | <p>You need to assign a new value to the property rather than manipulate the existing array in-place.</p>
<p>Array properties on an object type <a href="https://www.palantir.com/docs/foundry/functions/api-objects-links/#array-properties" rel="nofollow noreferrer">have immutable values</a> to make the semantics for edit... | How do I update an array property in a Palantir Foundry Ontology edit Function? | palantir-foundry|foundry-actions | 3 | 63 | 1 | 72,799,633 | 72,799,633 | 2 | true | 2022-06-29T10:13:52.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I update an array property in a Palantir Foundry Ontology edit Function?<p>I want to modify an array property on an Object using an Ontology Function ... |
72,813,507 | median(x) is does not correctly return the middle value of x<p>I have a really frustrating problem with <strong>R</strong>. What I want is fairly easy: I have a vector of numeric values (without <code>NA</code>) and want to calculate the median value. To perform this easy task I wrote the following line:</p>
<pre><code... | <p>Median is the middle value of <strong>sorted</strong> values. Have you sorted that column before finding this middle value? Here is a toy demonstration of what can go wrong if values are unsorted.</p>
<pre><code>## a vector of even length
set.seed(0); x <- sample.int(10)
#[1] 9 4 7 1 2 5 3 10 6 8
## tru... | median(x) is does not correctly return the middle value of x | r|dataframe|statistics|median | 1 | 63 | 1 | 72,813,626 | 72,813,626 | 2 | true | 2022-06-30T09:37:28.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
median(x) is does not correctly return the middle value of x<p>I have a really frustrating problem with <strong>R</strong>. What I want is fairly easy: I hav... |
72,801,296 | MS Access record automatically saved when click into subform<p>I have a typical Order data entry form/subform setup in MS Access / SQL Server 2019. There are 2 buttons within the form: Save / Cancel.</p>
<p>This is the code for the buttons:</p>
<pre><code>Private Sub cmdSave_Click()
On Error Resume Next
DoCmd.... | <p>As long as you are working with bound forms a record will be created as soon as your input focus moves from that record to something else. You have two options. The clean one is to create new orders on separate tables and only transfer them to the main tables on "Save". The easier but dirtier one is to cle... | MS Access record automatically saved when click into subform | sql-server|vba|ms-access | 0 | 63 | 2 | 72,817,630 | 72,817,630 | 2 | true | 2022-06-29T12:17:11.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MS Access record automatically saved when click into subform<p>I have a typical Order data entry form/subform setup in MS Access / SQL Server 2019. There are... |
72,817,456 | ServiceStack request object where a property contains a dash?<p>I'm trying to consume the mailgun webhook data, but their eventdata is sent as "event-data"</p>
<p><a href="https://documentation.mailgun.com/en/latest/user_manual.html#webhooks-1" rel="nofollow noreferrer">https://documentation.mailgun.com/en/la... | <p>You can use .NET's DataContract attributes to customize serialization, e.g:</p>
<pre class="lang-cs prettyprint-override"><code>[DataContract]
public class MailgunWebhookListenerRequest : IReturn<string>
{
[DataMember]
public MailgunWebhookSignature Signature { get; set; }
[DataMember(Name="e... | ServiceStack request object where a property contains a dash? | asp.net|servicestack|mailgun | 2 | 63 | 1 | 72,819,278 | 72,819,278 | 2 | true | 2022-06-30T14:19:53.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ServiceStack request object where a property contains a dash?<p>I'm trying to consume the mailgun webhook data, but their eventdata is sent as "event-da... |
72,823,895 | Disable anti-aliasing in UIKit<p>I've got a pixel art game app that uses UIKit for its menus and SpriteKit for the gameplay scene. The pixels are getting blurred due to anti-aliasing.</p>
<p>With the sprites I can turn off the anti-aliasing using...</p>
<pre class="lang-swift prettyprint-override"><code>node.texture?.f... | <p>To remove all antialiasing on your image view and just use nearest-neighbor filtering, set the <a href="https://developer.apple.com/documentation/quartzcore/calayer/1410907-magnificationfilter" rel="nofollow noreferrer"><code>magnificationFilter</code></a> and <a href="https://developer.apple.com/documentation/quart... | Disable anti-aliasing in UIKit | ios|swift|uikit|antialiasing | 1 | 63 | 1 | 72,824,130 | 72,824,130 | 2 | true | 2022-07-01T02:47:04.283Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Disable anti-aliasing in UIKit<p>I've got a pixel art game app that uses UIKit for its menus and SpriteKit for the gameplay scene. The pixels are getting blu... |
72,830,698 | Draw a dashed transparent box around forecast lines<p>I have 3 forecast plots that are combined together by <code>plotly::subplot</code>. The next step is draw a transparent box (or 3 separate boxes) with red dashed lines around the forecast line of each plot so that they stand out to the reader.</p>
<p>How can I do th... | <p>I actually like one box over all plots more aesthetically. Had a hard time doing this, because there seems to be a known issue with using <code>ggplotly</code> and the layout() function. That's why the shapes are put in <code>p$x$layout$shapes</code> like this.</p>
<pre><code># Combine plots
p <- subplot(AvgTMean... | Draw a dashed transparent box around forecast lines | r|ggplot2 | 1 | 63 | 2 | 72,831,638 | 72,831,638 | 2 | true | 2022-07-01T14:22:11.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Draw a dashed transparent box around forecast lines<p>I have 3 forecast plots that are combined together by <code>plotly::subplot</code>. The next step is dr... |
72,831,981 | Can't get to the end of the list in Flutter/Dart<p>With the help of experienced users of this site, I was able to request data from a csv file and pass it to my application. In particular, when you click on the button, the text changes. First, this is the first item in the list, then the second one, and so on until the... | <p>The problem is not the 5th or 20th items. The problem is you are comparing the length of the list of the first item instead of the length of the list entire CSV. just remove the [0] it will work for you.</p>
<pre><code>void _nextCSV() {
setState(() {
_listData = _listData;
_listCount < _listData.l... | Can't get to the end of the list in Flutter/Dart | flutter|dart | 0 | 63 | 1 | 72,834,311 | 72,834,311 | 2 | true | 2022-07-01T16:07:16.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't get to the end of the list in Flutter/Dart<p>With the help of experienced users of this site, I was able to request data from a csv file and pass it to... |
72,830,332 | How do I use colon to split in the middle of dataset?<p>A quick and easy question, but omehow I couldnt find the answer.
I am trying to split a dataset into training and testing. I have already used the sklearn train_test_split, but I want to try some things and tried to split specific values.
For example:</p>
<pre><co... | <p>A simple <a href="https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html#numpy.concatenate" rel="nofollow noreferrer"><code>concatenate</code></a> is all that's really needed here</p>
<pre><code>import numpy as np
test_set = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
test_set_sample = np.concatenate... | How do I use colon to split in the middle of dataset? | python | 1 | 63 | 3 | 72,836,988 | 72,836,988 | 2 | true | 2022-07-01T13:51:51.257Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I use colon to split in the middle of dataset?<p>A quick and easy question, but omehow I couldnt find the answer.
I am trying to split a dataset into ... |
72,812,084 | AX 365: is it possible to create table relations automatically? Like it was in Ax 2009?<p>I have a table <code>FooGroupTable</code> with a primary key <code>FooGroupId</code> of EDT type <code>FooGroupId</code> (and the EDT references <code>FooGroupTable.FooGroupId</code> through table reference)</p>
<p>I also have an... | <h1>TLDR;</h1>
<p>In short: no, there does not seem to be a way to create table relations automatically like in AX 2009 based on the extended data type's metadata information.</p>
<p>As the warning in <a href="https://docs.microsoft.com/en-us/dynamicsax-2012/developer/extended-data-types-in-the-database" rel="nofollow ... | AX 365: is it possible to create table relations automatically? Like it was in Ax 2009? | axapta|dynamics-ax-2009|dynamics-365-operations | 1 | 63 | 1 | 72,846,602 | 72,846,602 | 2 | true | 2022-06-30T07:49:15.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AX 365: is it possible to create table relations automatically? Like it was in Ax 2009?<p>I have a table <code>FooGroupTable</code> with a primary key <code>... |
72,847,603 | How to use change_presence at on_ready event? (discord.py)<p>I've read online that using <code>change_presence</code> at the <code>on_ready</code> event could cause your Discord bot to be banned due to rate limiting. I presume this is because a lot of API calls are made during this event.</p>
<p>My current solution is ... | <p>The easiest way is to just pass it in when constructing your bot. Example:</p>
<pre class="lang-py prettyprint-override"><code>from discord.ext import commands
bot = commands.Bot(
command_prefix="!",
activity=discord.Activity(type=discord.ActivityType.watching, name="β"),
intents=dis... | How to use change_presence at on_ready event? (discord.py) | python-3.x|discord|discord.py|python-asyncio | 2 | 63 | 1 | 72,848,078 | 72,848,078 | 2 | true | 2022-07-03T15:11:35.397Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use change_presence at on_ready event? (discord.py)<p>I've read online that using <code>change_presence</code> at the <code>on_ready</code> event coul... |
72,856,963 | Is it safe to delete IAM roles created automatically?<p>Amazon newbie here.</p>
<p>I am following along with a book on AWS and I am at the IAM chapter. I noticed that there are roles which got created automatically as I progressed through the book. I would like to ask how safe it is to delete all these roles and start ... | <p>Most of the roles that you're showing are <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html" rel="nofollow noreferrer">service-linked roles</a> which essentially grant a specific service access to perform a list of operations on other resources. For example, your Elastic Bean... | Is it safe to delete IAM roles created automatically? | amazon-web-services|amazon-iam | 0 | 63 | 1 | 72,857,143 | 72,857,143 | 2 | true | 2022-07-04T12:42:08.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it safe to delete IAM roles created automatically?<p>Amazon newbie here.</p>
<p>I am following along with a book on AWS and I am at the IAM chapter. I not... |
72,866,398 | TimescaleDB - Counters<p>My goal is to query the delta of a counter metric over time using a continuous aggreate from TimescaleDB.</p>
<p>I'm following the example from <a href="https://docs.timescale.com/timescaledb/latest/how-to-guides/hyperfunctions/counter-aggregation/counter-aggs/#run-a-counter-aggregate-query-wit... | <p>Thanks to the comments from @greenweeds I worked out this solution which seems to</p>
<ul>
<li>account for counter resets and</li>
<li>ignore the initial counter value (I just want differences over time and the first value would be treated as such a difference although it is not)</li>
</ul>
<p>Hope this helps others... | TimescaleDB - Counters | sql|postgresql|time-series|counter|timescaledb | 2 | 63 | 2 | 72,869,173 | 72,869,173 | 2 | true | 2022-07-05T08:38:35.520Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TimescaleDB - Counters<p>My goal is to query the delta of a counter metric over time using a continuous aggreate from TimescaleDB.</p>
<p>I'm following the e... |
72,880,279 | How do I use summarise properly in R for this simple analysis?<p>Haven't used RStudio in a while, so I am quite rusty.</p>
<p>I want to create a bar chart showing the countries shipping the most freight weight in ascending order.</p>
<p>I have made this simple script that does the job:</p>
<pre><code>df_new %>%
fil... | <p>If you want to find the top 10 countries ordered by their corresponding highest
<code>Freight_weight</code>, one possible solution is,</p>
<p>(Note that, I have created more countries, (denoted by Alphabets) and more data)</p>
<p>Hope this helps.</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
set... | How do I use summarise properly in R for this simple analysis? | r|ggplot2 | 2 | 63 | 1 | 72,881,932 | 72,881,932 | 2 | true | 2022-07-06T08:34:20.503Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I use summarise properly in R for this simple analysis?<p>Haven't used RStudio in a while, so I am quite rusty.</p>
<p>I want to create a bar chart sh... |
72,918,952 | Terraform access to ECS container UUID<p>If I use Terraform to create an ECS task definition...</p>
<pre><code> resource "aws_ecs_task_definition" "ecs_container" {
family = "${var.component}-ecs-${var.variant}"
task_role_arn = "${aws_iam_role.ecs_task_role.arn}"
... | <blockquote>
<p>However, the format of the arn is using the ECS family:version style of the taskdef identity.</p>
<p>...</p>
<p>Is there a way to instead see the "container instance UUID" format?</p>
</blockquote>
<p>This is not an issue of the formatting of the ID. These are two completely separate IDs for t... | Terraform access to ECS container UUID | terraform|containers|amazon-ecs|terraform-provider-aws | 1 | 63 | 1 | 72,921,876 | 72,921,876 | 2 | true | 2022-07-09T04:29:55.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Terraform access to ECS container UUID<p>If I use Terraform to create an ECS task definition...</p>
<pre><code> resource "aws_ecs_task_definition&quo... |
72,933,199 | Python & Sympy : How to plot a dashed line with plot_implicit?<p>I'm trying to plot the graph of <code>x = 1</code> in dashed style using <code>plot_implicit</code> of <code>Sympy</code>. But so far, I can't find a way to do it and can only change its color. Please have a look at my codes and the picture below and guid... | <p>With the current plotting module (Sympy 1.10.1) you cannot set linestyles directly. Moreover, <code>plot_implicit</code> is using matplotlib's <code>fill</code> and <code>contour</code> commands (depending on what expression you are trying to plot and on the value of the <code>adaptive</code> option).</p>
<p>We need... | Python & Sympy : How to plot a dashed line with plot_implicit? | python|matplotlib|math|graph|sympy | 0 | 63 | 1 | 72,935,422 | 72,935,422 | 2 | true | 2022-07-11T02:33:44.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python & Sympy : How to plot a dashed line with plot_implicit?<p>I'm trying to plot the graph of <code>x = 1</code> in dashed style using <code>plot_implicit... |
72,940,183 | Dotted list in lisp<p>I'm trying to recreate this structure with lisp <code>(key . (list of values))</code></p>
<p>Ex: <code>(a . (b c))</code></p>
<p>I managed to recreate the opposite <code>((a b) . c)</code>, but is not what i need.
Is possible?</p> | <pre><code>(cons 'a (list 'b 'c))
</code></pre>
<p>Note that when you print this it will be printed as</p>
<pre><code>(A B C)
</code></pre>
<p>because a cons whose cdr is a list is printed using list notation, not dotted notation.</p> | Dotted list in lisp | list|lisp|cons | 0 | 63 | 1 | 72,940,322 | 72,940,322 | 2 | true | 2022-07-11T14:29:38.223Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dotted list in lisp<p>I'm trying to recreate this structure with lisp <code>(key . (list of values))</code></p>
<p>Ex: <code>(a . (b c))</code></p>
<p>I mana... |
72,944,812 | How to add function decorator to class method that accepts this class as one of decorator call arguments<p>When I try code like this:</p>
<pre><code>def type_check(types):
def decorator(f):
def wrapper(self, v):
if not type(v) in types:
raise TypeError('Value is of type {} but allowed type(s): {}.'.... | <p>You can decorate <code>__init__</code> <strong>after</strong> the class is defined:</p>
<pre><code>class MyList:
def __init__(self, value):
self.data = value[:]
MyList.__init__ = type_check(types=[list, MyList])(MyList.__init__)
</code></pre> | How to add function decorator to class method that accepts this class as one of decorator call arguments | python | 1 | 63 | 1 | 72,944,994 | 72,944,994 | 2 | true | 2022-07-11T21:23:48.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add function decorator to class method that accepts this class as one of decorator call arguments<p>When I try code like this:</p>
<pre><code>def type... |
72,950,263 | Oracle SQL query only not matching values from 2 tables<p>I need a fairly simple query that would only return values from table A that <strong>do not have matching values</strong> in table B.</p>
<p>For example I have</p>
<p>Table A:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>ID</th>
<... | <p>I'd go with <code>not exists</code>:</p>
<pre><code>SQL> with
2 tablea (id, description) as
3 (select 12345, 'aaa' from dual union all
4 select 25678, 'bbb' from dual
5 ),
6 tableb (id, description) as
7 (select 12345, 'aaa' from dual)
8 --
9 select *
10 from tablea a
11 where... | Oracle SQL query only not matching values from 2 tables | sql|oracle|difference|distinct-values | 0 | 63 | 2 | 72,950,342 | 72,950,342 | 2 | true | 2022-07-12T09:45:25.570Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Oracle SQL query only not matching values from 2 tables<p>I need a fairly simple query that would only return values from table A that <strong>do not have ma... |
72,953,117 | How to cleanup useEffect callback?<p>According to <a href="https://www.electronjs.org/de/docs/latest/tutorial/ipc#pattern-3-main-to-renderer" rel="nofollow noreferrer">docs</a>, one should use callbacks to communicate from main to renderer.</p>
<p>When using <code>useEffect</code>, how can one cleanup <code>window.api.... | <p>A common approach when adding event handlers is to return a function that can be used to remove it.</p>
<p>Unfortunately <code>ipcRenderer.on()</code> doesn't do this () but you can create your own</p>
<pre class="lang-ts prettyprint-override"><code>type ListenerCallback = () => void;
type Remover = () => void... | How to cleanup useEffect callback? | reactjs|typescript|electron | 1 | 63 | 1 | 72,959,516 | 72,959,516 | 2 | true | 2022-07-12T13:27:58.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to cleanup useEffect callback?<p>According to <a href="https://www.electronjs.org/de/docs/latest/tutorial/ipc#pattern-3-main-to-renderer" rel="nofollow n... |
72,959,525 | Polars: how to add years as literals?<p>I have a Polars LazyFrame that, after applying several functions, looks like this:</p>
<pre><code>βββββββββββββββββ¬βββββββββββββββ¬ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β citing_patent β cited_patent β cited_patent_issue_date β citing_patent_issue_date β
β --- ... | <p>You can use the <a href="https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.internals.expr.ExprDateTimeNameSpace.offset_by.html#polars.internals.expr.ExprDateTimeNameSpace.offset_by" rel="nofollow noreferrer"><code>offset_by</code></a> function. Starting with this data:</p>
<pre class="lang-py pret... | Polars: how to add years as literals? | python-polars | 1 | 63 | 1 | 72,959,631 | 72,959,631 | 2 | true | 2022-07-13T00:01:42.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Polars: how to add years as literals?<p>I have a Polars LazyFrame that, after applying several functions, looks like this:</p>
<pre><code>βββββββββββββββββ¬ββ... |
72,952,403 | How to take last n elements from BroadcastProcessor, map them and return them via REST?<p>I want to create a method, either reactive or non-reactive, that is capable of taking <em>n</em> elements as a list from a <code>BroadcastProcessor</code>, maps them and returns them via HTTP.</p>
<p>I tried almost everything that... | <p>The <code>.collect().asList()</code> operator accumulates items into a list, but will only emit the list <a href="https://javadoc.io/doc/io.smallrye.reactive/mutiny/latest/io/smallrye/mutiny/groups/MultiCollect.html" rel="nofollow noreferrer">once it has received a completion signal</a> from its upstream/source.</p>... | How to take last n elements from BroadcastProcessor, map them and return them via REST? | java|jax-rs|quarkus|mutiny | 0 | 63 | 1 | 72,966,943 | 72,966,943 | 2 | true | 2022-07-12T12:33:53.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to take last n elements from BroadcastProcessor, map them and return them via REST?<p>I want to create a method, either reactive or non-reactive, that is... |
72,969,625 | Why I get wrong answers from function that should calculate X in power of N?<p>I had to make a recursive function that use only multiplication operation to get the answer of <code>X</code> in power of <code>N</code>.</p>
<p>I wrote this:</p>
<pre><code>#include <stdio.h>
int power(int x, int n);
int main()
{
... | <p>First, the recursion you implemented shouldn't work for small numbers too, since as others have pointed out, <code>x^n = (x^(n/2))^2</code> and not <code>x*(x^(n/2))</code>, and for odd values of n, n/2 will get truncated since the function takes integer arguments. Try 2^3, your code gives answer 4. A simple way to ... | Why I get wrong answers from function that should calculate X in power of N? | c|recursion | 0 | 63 | 2 | 72,969,951 | 72,969,951 | 2 | true | 2022-07-13T16:26:51.913Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why I get wrong answers from function that should calculate X in power of N?<p>I had to make a recursive function that use only multiplication operation to g... |
72,997,603 | A function in pandas or numpy to filter column by list of values that follows it<p>Given a dataframe df:</p>
<pre><code>import pandas as pd
df = pd.DataFrame({"changes":['increase', 'constant', 'constant', 'constant', 'decline', 'constant', 'constant', 'increase', 'constant', 'constant', 'constant','decline',... | <pre><code>df = pd.DataFrame({"changes":['increase', 'constant', 'constant', 'constant', 'decline', 'constant', 'constant', 'increase', 'constant', 'constant', 'constant','decline', 'constant', 'constant', 'constant']})
### Build group
df['group'] = df['changes'].ne(df['changes'].shift()).cumsum()
df
###
... | A function in pandas or numpy to filter column by list of values that follows it | python|pandas|dataframe|numpy | 1 | 63 | 1 | 72,999,045 | 72,999,045 | 2 | true | 2022-07-15T17:17:01.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
A function in pandas or numpy to filter column by list of values that follows it<p>Given a dataframe df:</p>
<pre><code>import pandas as pd
df = pd.DataFrame... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.