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,063,182 | How to render avoiding safeareaview?<p>I want the status bar and at the bottom to be white (Same as root background color), but no idea, do i need to get status bar height and add margin top and bottom?</p>
<p>Here is my code and the preview below</p>
<pre><code>import SwiftUI
struct ContentView: View {
var body: ... | <p>If it were me tackling this kind of UI, I would use some other nice Views that SwiftUI provides for us (like <code>ZStack</code>).
The <code>ZStack</code> places objects one on top of another from the bottom up. So you would want your color first, then the <code>VStack</code> after. It would look something like this... | How to render avoiding safeareaview? | swift|xcode|swiftui | 0 | 35 | 3 | 72,063,617 | 72,063,617 | 1 | true | 2022-04-29T20:04:39.073Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to render avoiding safeareaview?<p>I want the status bar and at the bottom to be white (Same as root background color), but no idea, do i need to get sta... |
72,180,900 | Notion access token returns 401 unauthorized<p>After I got the temporary code, I send it to exchange access token, but it returns 401 unauthorized error.
Here is my code:</p>
<pre><code>const resp = await fetch("https://api.notion.com/v1/oauth/token", { method:'POST',
client_id: notionClientId, client_se... | <p>@Nithur:</p>
<p>I went through this process a while ago. I'd recommend running this process via <a href="https://web.postman.co" rel="nofollow noreferrer">Postman</a>. There you can setup everything easily, refer <a href="https://developers.notion.com/docs/authorization" rel="nofollow noreferrer">Notion's Authorizat... | Notion access token returns 401 unauthorized | notion-api | 0 | 418 | 1 | 72,222,629 | 72,222,629 | 1 | true | 2022-05-10T04:52:55.777Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Notion access token returns 401 unauthorized<p>After I got the temporary code, I send it to exchange access token, but it returns 401 unauthorized error.
Her... |
72,215,624 | Getting indices using conditional list comprehension<p>I have the following np.array:</p>
<pre><code>my_array=np.array([False, False, False, True, True, True, False, True, False, False, False, False, True])
</code></pre>
<p>How can I make a list using list comprehension of the indices corresponding to the True elements... | <p>why specifically a list comprehension?</p>
<pre><code>>>> np.where(my_array==True)
(array([ 3, 4, 5, 7, 12]),)
</code></pre>
<p>this does the job and is quicker. The list solution would be:</p>
<pre><code>>>> [index for index, feature_condition in enumerate(my_array) if feature_condition == True... | Getting indices using conditional list comprehension | python-3.x|list|list-comprehension | 0 | 32 | 2 | 72,215,715 | 72,215,715 | 1 | true | 2022-05-12T12:29:22.593Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting indices using conditional list comprehension<p>I have the following np.array:</p>
<pre><code>my_array=np.array([False, False, False, True, True, True... |
72,190,027 | How to evaluate the value of derivative at a point in Python using SymPy?<p>I am learning SymPy which is a useful tool for doing complicated mathematics in Python. I wrote the following code to calculate the derivative of a function:</p>
<pre><code>x = sympy.symbols('x')
f = x**2
dx_f = diff(f)
print(dx_f)
</code></pre... | <p>Three ways to do it:</p>
<ol>
<li>The quickest (in terms of writing code, but the slowest in terms of computation speed), but less reliable, using the <code>subs</code> method:</li>
</ol>
<pre><code>dx_f.subs(x, 2)
</code></pre>
<ol start="2">
<li>using the <code>evalf</code> method:</li>
</ol>
<pre><code>dx_f.evalf... | How to evaluate the value of derivative at a point in Python using SymPy? | python|sympy | 0 | 32 | 1 | 72,190,269 | 72,190,269 | 1 | true | 2022-05-10T16:35:34.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to evaluate the value of derivative at a point in Python using SymPy?<p>I am learning SymPy which is a useful tool for doing complicated mathematics in P... |
72,195,024 | Drawing shaded areas on map with Python's plotly<p>I'm trying to draw some shaded areas on a map using <a href="https://plotly.com/python/filled-area-on-mapbox/" rel="nofollow noreferrer">plotly</a>. The coordinates are contained in a pandas dataframe where each cell shows a specific area to be plotted. A problem arise... | <p>For each area, you should add a <code>Scattermapbox</code> trace. Here is how I would do it:</p>
<pre><code>import pandas as pd
import plotly.graph_objects as go
# my test dataset
df = pd.DataFrame(data={'names':['area1','area2','area3'], 'coords': 0})
df['coords'] = df['coords'].astype(object)
df.at[0,'coords'] = ... | Drawing shaded areas on map with Python's plotly | python|pandas|plotly|plotly-python | 0 | 88 | 1 | 72,197,559 | 72,197,559 | 1 | true | 2022-05-11T03:22:45.727Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Drawing shaded areas on map with Python's plotly<p>I'm trying to draw some shaded areas on a map using <a href="https://plotly.com/python/filled-area-on-mapb... |
72,205,704 | Plotly - drawing both cube and cylinder items<p>I am dealing with an issue of drawing cylinder item as a result of a 3D bin packing model. There is a simple example drawing cylinder item which can be referenced at: <a href="https://stackoverflow.com/questions/72182976/plotly-how-to-plot-cylinder/72183849?noredirect=1#c... | <p><strong>EDIT</strong>: let's use a different method to generate the cylinder.</p>
<pre><code>from py3dbp import Packer, Bin, Item, Painter
import time
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import plotly
import pandas as pd
start = time.time()
import numpy as np
#-----------thi... | Plotly - drawing both cube and cylinder items | python|plotly | 0 | 162 | 1 | 72,206,765 | 72,206,765 | 1 | true | 2022-05-11T18:08:17.030Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Plotly - drawing both cube and cylinder items<p>I am dealing with an issue of drawing cylinder item as a result of a 3D bin packing model. There is a simple ... |
72,215,380 | Merge 2 algebraic expression using Sympy<p>How to merge 2 or more expressions
example: 3x + 2y - 2 and 2x + 3y -1 (3x + 2y -2 = 2x + 3y -1)
which gives x-y-1</p> | <pre class="lang-py prettyprint-override"><code>from sympy import *
# declare symbols
var("x, y")
# write the two expressions
expr1 = 3*x + 2*y - 2
expr2 = 2*x + 3*y - 1
# subtract them
result = expr1 - expr2
result
# out: x - y - 1
</code></pre>
<p>EDIT: Alternatively, we can also create an <code>Equality... | Merge 2 algebraic expression using Sympy | sympy | 0 | 28 | 1 | 72,215,446 | 72,215,446 | 1 | true | 2022-05-12T12:13:57.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Merge 2 algebraic expression using Sympy<p>How to merge 2 or more expressions
example: 3x + 2y - 2 and 2x + 3y -1 (3x + 2y -2 = 2x + 3y -1)
which gives x-y-... |
72,143,501 | Adding Pandas column in custom function not working when using numpy<p>I have the following function:</p>
<pre><code>def create_col4(df):
df['col4'] = df['col1'] + df['col2']
</code></pre>
<p>If I apply this function within my jupyter notebook as in</p>
<pre><code>create_col4(df_test)
</code></pre>
<p>, <code>df_te... | <pre><code>import numpy as np
def create_col4(df_test):
df['col4'] = np.where(df[col1] == 1, True, False)
</code></pre>
<p>Without inspecting further what I first saw was this.
Either <code>df_test</code> or <code>df</code> but you mix names here.</p>
<p>Change it to:</p>
<pre><code>import numpy as np
def create_co... | Adding Pandas column in custom function not working when using numpy | python|pandas|dataframe|numpy | 0 | 53 | 1 | 72,143,587 | 72,143,587 | 1 | true | 2022-05-06T14:53:56.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding Pandas column in custom function not working when using numpy<p>I have the following function:</p>
<pre><code>def create_col4(df):
df['col4'] = df... |
72,156,264 | How can I add two for loop list to one?<p>So, I creating two list with a for loop, but I don't know how can I add them together.</p>
<pre><code> def month_changed(cls):
df = pd.read_excel("income.xlsx")
df1 = df.iloc[:13].values
for x in range(12):
try:
df2 = sum(int(i) fo... | <p>You can do that a lot easier than looping through lists. You already have the dataframe df1 after <code>pd.read_csv</code>.</p>
<pre><code>
df1['sum'] = df1[df1.columns[1:]].sum(axis=1)
# 'sum' will be new column
# df1[df1.columns[1:]] will skip the first column
# sum(axis=1) will add all values together along the a... | How can I add two for loop list to one? | python | 0 | 40 | 1 | 72,156,394 | 72,156,394 | 1 | true | 2022-05-07T20:48:02.067Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I add two for loop list to one?<p>So, I creating two list with a for loop, but I don't know how can I add them together.</p>
<pre><code> def month... |
72,163,270 | how to use 'for' loop to create multiple figures, not all data in one figure?<p>I want to plot some statistics results for each region. I have nested 'for' loops, where in the inner loop it generates the statistics, in the outer loop it selects the regions and plot the respective statistic results. Not sure why my code... | <p>The problem wasn't the figure, the script saves a <code>png</code> file for each region in an own plot which is correct. The problem is your data.
You intitialize <code>Yrstat=[]</code> outside of both loops. Then you append data to it in every step of the inner loop (and also all outer loops) and plot the data of t... | how to use 'for' loop to create multiple figures, not all data in one figure? | python|matplotlib | 0 | 181 | 1 | 72,163,462 | 72,163,462 | 1 | true | 2022-05-08T16:56:54.150Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to use 'for' loop to create multiple figures, not all data in one figure?<p>I want to plot some statistics results for each region. I have nested 'for' l... |
72,114,609 | Add Table To Markdown File Via Windows Command Line<p>I'm trying to append a table in a markdown file via command line. First, I make a new directory, <code>cd</code> into the directory, and then create an MD file, and then add a table. I'm getting an error with this command that says: <code>| was unexpected at this ti... | <p>The PIPE <code>|</code> symbol has other functions within command line</p>
<p>So you would need to use quotes to place those character into your file</p>
<p><code>echo "|Name|Position|email|phone|website 1|website 2|website 3| |---|---|---|---|---|---|---|"</code></p>
<p>Use of the escape character to use ... | Add Table To Markdown File Via Windows Command Line | windows|command-line | 0 | 35 | 1 | 72,114,770 | 72,114,770 | 1 | true | 2022-05-04T14:21:00.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add Table To Markdown File Via Windows Command Line<p>I'm trying to append a table in a markdown file via command line. First, I make a new directory, <code>... |
72,132,067 | How to check for null on onWillPop values?<p>I need to do a null check:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>onWillPop: () async {
return !await listOfKeys[t... | <p>when you use the null safety operator ´??´ you should provide a fallback value:</p>
<pre><code> onWillPop: () async {
return tabController != null
? !(await listOfKeys[tabController?.index].currentState?.maybePop() ?? false)
: false;
},
</code></pre> | How to check for null on onWillPop values? | flutter|dart | 0 | 35 | 1 | 72,133,914 | 72,133,914 | 1 | true | 2022-05-05T18:31:36.237Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check for null on onWillPop values?<p>I need to do a null check:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data... |
72,151,536 | The element that is selected in the DropdownButton is not displayed in button<p>Guys please tell me how to solve the problem. I'm using <code>DropdownButton</code> with <code>Checkboxlisttile</code> and ran into a problem that when selecting items, the selected item is not shown in the DropdownButto in the button itsel... | <p>as you are using a Dropdown widget as a workaround, I prepared a real solution for you that achieves exactly what you are looking for:</p>
<pre><code>return Container(
width: 150,
child: PopupMenuButton(
offset: Offset(0, 50),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 10,
... | The element that is selected in the DropdownButton is not displayed in button | flutter|dart | 0 | 47 | 2 | 72,152,534 | 72,152,534 | 1 | true | 2022-05-07T10:14:06.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The element that is selected in the DropdownButton is not displayed in button<p>Guys please tell me how to solve the problem. I'm using <code>DropdownButton<... |
72,225,697 | How can I encapsulate code dealing with matrices and make it reusable?<p>At my course we are getting tasks that always start with filling a random matrix size <em>nxm</em> with random numbers.</p>
<p>I want to create(a library?, a class?) some structure so than any time I want to generate a matrix <em>A</em> I would ne... | <p>Below is an outline of what you can do to achieve that:</p>
<ol>
<li>Define a class e.g. <code>MyMatrix</code>. A <a href="https://en.cppreference.com/w/cpp/language/classes" rel="nofollow noreferrer">class</a> can encapsulate data and operations related to it. The class can be placed in separate files (h and cpp). ... | How can I encapsulate code dealing with matrices and make it reusable? | c++|function|class|header|structure | 0 | 48 | 1 | 72,225,838 | 72,225,838 | 1 | true | 2022-05-13T07:12:31.117Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I encapsulate code dealing with matrices and make it reusable?<p>At my course we are getting tasks that always start with filling a random matrix siz... |
72,154,684 | Printing decimal precision upto desiired number in cpp<p>I have an application I want to print the precision of the calculated prime number up to the desired number. But the number is omitted on the terminal as shown below.</p>
<p><a href="https://i.stack.imgur.com/BbbHj.png" rel="nofollow noreferrer"><img src="https:/... | <p>use <code>iomanip</code>. first add <code>#include <iomanip></code> and then <code>std::setprecision(num_steps)</code> like this program:</p>
<p>This code was written based on <a href="https://www.geeksforgeeks.org/calculate-pi-with-python/" rel="nofollow noreferrer">Calculate Pi</a> from Geeks For Geeks.</p>
... | Printing decimal precision upto desiired number in cpp | c++|decimal | 0 | 55 | 1 | 72,156,665 | 72,156,665 | 1 | true | 2022-05-07T17:00:04.967Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Printing decimal precision upto desiired number in cpp<p>I have an application I want to print the precision of the calculated prime number up to the desired... |
72,179,731 | A dialog's position changed after closing a QMessageBox in PyQt<p>I wrote a <code>QMainWindow</code>, two <code>QDialog</code>, and one <code>QMessageBox</code>. The code is as follows:</p>
<pre class="lang-py prettyprint-override"><code>from PyQt5.QtWidgets import QDialog, QVBoxLayout, QPushButton, QMessageBox, QAppli... | <p>You should set <code>Qt.Popup</code> Flag for your Dialog :</p>
<p>This makes your Dialog always on top of others.</p>
<pre class="lang-py prettyprint-override"><code>from PyQt5.QtWidgets import QDialog, QVBoxLayout, QPushButton, QMessageBox, QApplication, QAction, QMainWindow
from PyQt5.QtCore import *
class MainW... | A dialog's position changed after closing a QMessageBox in PyQt | python|qt|pyqt | 0 | 76 | 1 | 72,180,254 | 72,180,254 | 1 | true | 2022-05-10T01:18:18.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
A dialog's position changed after closing a QMessageBox in PyQt<p>I wrote a <code>QMainWindow</code>, two <code>QDialog</code>, and one <code>QMessageBox</co... |
72,167,639 | Parsing multiple xml files in python and appending the data to a Python DataFrame<p>I'm trying to create a data frame from multiple nested xml files and append the data to a single data frame. I know the structure of the data frame and have defined it.</p>
<pre><code>tree_list = []
details = ['FirstName','LastName','Ci... | <p>So now when I have your data sample, I tested this and it works for me just as I think you want it to be:</p>
<pre><code>def parse_XML(list_of_trees, df_cols):
def get_el(el_list):
if len(el_list) > 1:
return [el_text.text for el_text in el_list]
else:
return el_list[0... | Parsing multiple xml files in python and appending the data to a Python DataFrame | python|pandas|xml|dataframe | 0 | 169 | 2 | 72,167,892 | 72,167,892 | 1 | true | 2022-05-09T06:13:16.103Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Parsing multiple xml files in python and appending the data to a Python DataFrame<p>I'm trying to create a data frame from multiple nested xml files and appe... |
72,184,518 | Add a second legend to display markers - matplotlib<p>I am attempting to add a 2nd legend to display the max values (via markers).</p>
<p>However, only the marker type in <code>mrkr</code> is given in the 2nd legend and not the desired symbol corresponding to <code>mrkr</code>.</p>
<pre><code>import pandas as pd
from m... | <pre><code>legend_elements = []
for x, y, m, line in zip(idx_mx_vals, mx_vals, mrkr, ax.lines):
line2 = ax.plot(x, y, marker=m, c=line.get_color(), markersize=20)
legend_elements.append(Line2D([0], [0], c=line.get_color(), marker=m, label=m))
leg1 = ax.legend(loc='upper right')
leg2 = ax.legend(handles=legend_... | Add a second legend to display markers - matplotlib | python|matplotlib | 0 | 54 | 1 | 72,202,270 | 72,202,270 | 1 | true | 2022-05-10T10:18:12.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add a second legend to display markers - matplotlib<p>I am attempting to add a 2nd legend to display the max values (via markers).</p>
<p>However, only the m... |
72,185,858 | How to update postgresql using json sub-element<p>How can I update "A" named value with 10.2 where ID equal 1003 in to a postgresql database table.</p>
<p><strong>Json Data Table</strong></p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Id</th>
<th>Column</th>
</tr>
</thead>
<tbody... | <p>It isn't a simple query, was able to make it with CTE only. I refer to your example table as <code>test</code>:</p>
<pre><code>with item_in_list_pos as (
select
pos - 1 as pos
from test, jsonb_array_elements(column1->'results') with ordinality a(elem, pos)
where (
id = 1003... | How to update postgresql using json sub-element | postgresql | 0 | 49 | 1 | 72,197,310 | 72,197,310 | 1 | true | 2022-05-10T11:54:28.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to update postgresql using json sub-element<p>How can I update "A" named value with 10.2 where ID equal 1003 in to a postgresql database table.... |
72,145,244 | Update array of ManyToMany field in Django REST framework<p>I have a Model <code>Plot</code> which looks like this:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>from django.... | <p>There are a couple of ways to solve this:</p>
<p>1- send the entire array in the request</p>
<p>2- add logic to the serializer using some validator. Refer to <a href="https://stackoverflow.com/a/66293267/9459826">https://stackoverflow.com/a/66293267/9459826</a></p>
<p>UPDATE: I've removed #3 as I forgot SerializerMe... | Update array of ManyToMany field in Django REST framework | python|django|django-rest-framework | 0 | 147 | 1 | 72,145,634 | 72,145,634 | 1 | true | 2022-05-06T17:17:06.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Update array of ManyToMany field in Django REST framework<p>I have a Model <code>Plot</code> which looks like this:</p>
<p><div class="snippet" data-lang="js... |
72,141,917 | Generating List Items from an Array with Javascript<p>I am trying to generate a list of names from an Array with this piece of script</p>
<pre><code>const names = ["John", "Hanna", "Luis", "Halley", "Maive"]
const list = document.getElementById('my_list')
names.forEach... | <p>You're code works fine
I suggest you a slightly different implementation with just one DOM update</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const names = ["John", "Han... | Generating List Items from an Array with Javascript | javascript|html|arrays | 0 | 41 | 1 | 72,142,042 | 72,142,042 | 1 | true | 2022-05-06T13:03:34.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Generating List Items from an Array with Javascript<p>I am trying to generate a list of names from an Array with this piece of script</p>
<pre><code>const na... |
72,162,036 | Why is my date wrong with Carbon::createFromFormat()?<p>When I create the Carbon object from an existing string, it is making a completely wrong date out of it.</p>
<pre><code>$dateString = "2022-04-01 21:24:00";
$carbon = Carbon::createFromFormat("Y-m-d H:i:s", $dateString);
echo $carbon->format... | <p>I think that the code that you post it's not what you are using
it seems month is using minutes</p>
<p>so 24 as month become 12 of the next year</p>
<p>probably you are using "Y-m-d H:m:s" instead of "Y-m-d H:i:s"</p> | Why is my date wrong with Carbon::createFromFormat()? | php|laravel|datetime|php-carbon | 0 | 177 | 1 | 72,162,116 | 72,162,116 | 1 | true | 2022-05-08T14:34:57.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is my date wrong with Carbon::createFromFormat()?<p>When I create the Carbon object from an existing string, it is making a completely wrong date out of ... |
72,175,615 | Please help change keys nested inside dictionary<p>Hello I am beginner in javascript it would be great if you could help me</p>
<pre><code>topicMessage = { topic: 'some_topic', messages: [{ 'myKey': '{"data": {"my name is ":"aman", "age": 22, "my ed": "btech"}... | <p>It came out pretty ugly but it works</p>
<p>take a look</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const topicMessage = {
topic: 'some_topic',
messages: [{
'myK... | Please help change keys nested inside dictionary | javascript|dictionary|parsing|nested|key | 0 | 59 | 1 | 72,175,814 | 72,175,814 | 1 | true | 2022-05-09T16:53:41.853Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Please help change keys nested inside dictionary<p>Hello I am beginner in javascript it would be great if you could help me</p>
<pre><code>topicMessage = { t... |
72,210,812 | Repeat component for each key and value in Map<p>I have a JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map" rel="nofollow noreferrer">Map</a> of key/value pairs. I want to repeat render some React components, to display each key/value from the Map inside a table. ... | <p>you can do it like this using <code>Map.prototype.entries</code></p>
<pre><code>export const KeyValueTable = (props) => {
const myProp = props.myProp;
const myMap = getMyMap(myProp);
return (
<Table>
<Head>
<Cell><Text>Key</Text></Cell>
<Cel... | Repeat component for each key and value in Map | javascript|reactjs | 0 | 61 | 2 | 72,211,072 | 72,211,072 | 1 | true | 2022-05-12T06:10:38.283Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Repeat component for each key and value in Map<p>I have a JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Object... |
72,197,947 | How to return null in all section in dictionary in python<p>im using fastapi and python and need to check in dictionary if value is null.</p>
<p>i have a json like this:</p>
<pre><code>{
"id": null,
"first_name": null,
"last_name": null,
"email": null,
... | <p>Python's <code>None</code> is equivalent to JSON's <code>null</code>.</p>
<p>So what you should do is the following:</p>
<pre><code> if n['id'] is None:
user = None
else:
user= {"id": n['id'],
"first_name": n['first_name'],
"last_name&qu... | How to return null in all section in dictionary in python | python|fastapi | 0 | 185 | 1 | 72,198,021 | 72,198,021 | 1 | true | 2022-05-11T08:40:43.550Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to return null in all section in dictionary in python<p>im using fastapi and python and need to check in dictionary if value is null.</p>
<p>i have a jso... |
72,148,147 | Fetch Google Drive File path in Google Sheet<p>Want to fetch Google Drive File path, by exact <strong>File Name</strong> search with <strong>Extension</strong> and update in other column "Drive File Path"
<a href="https://i.stack.imgur.com/aTvGl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.c... | <p>Try</p>
<pre><code>function copypath() {
const sh = SpreadsheetApp.getActiveSheet()
var data = sh.getDataRange().getValues()
data.forEach((d, i) => { try { if (i > 0) d[2] = getPath(d[1]) } catch (e) { } })
sh.getDataRange().setValues(data)
}
function getPath(fileNameWithExtension) {
parents = DriveA... | Fetch Google Drive File path in Google Sheet | google-apps-script|google-sheets | 0 | 474 | 2 | 72,148,805 | 72,148,805 | 1 | true | 2022-05-06T22:57:35.707Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fetch Google Drive File path in Google Sheet<p>Want to fetch Google Drive File path, by exact <strong>File Name</strong> search with <strong>Extension</stron... |
72,201,133 | Field 'urlVar' has not been initialized. error in Flutter<p>I have a settings page. On this page I configure "Url". I write it down and save it. Everything is simple. But I want to make sure that the next time I visit this page I have already seen the saved Url. I download it through the shared_preferences pa... | <p>Check this out:
First Page</p>
<pre><code>import 'package:debounce/my_new_page.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
class WritePage extends StatefulWidget {
const WritePage({Key? key}) : super(key: key);
@override
State<WritePage> c... | Field 'urlVar' has not been initialized. error in Flutter | flutter|dart | 0 | 41 | 1 | 72,201,753 | 72,201,753 | 1 | true | 2022-05-11T12:32:53.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Field 'urlVar' has not been initialized. error in Flutter<p>I have a settings page. On this page I configure "Url". I write it down and save it. Ev... |
72,106,679 | Why doesn't the button for a slide open menu work when i go to a different page but on the main page it works?<p>Basically, I'm making a site on repl.it. On my main page, I have this drop-down menu that allows me to go to the other pages, but for some reason when I paste the same exact code into another page and I try ... | <p>the reason is because after redirection the script.js file is not loaded it has taken the wrong path,try with absolute path</p>
<pre><code><script src="https://warfare.blackenxrgy.repl.co/script.js"></script>
</code></pre>
<p>For the link to work, in your script.js, please like this - I have ad... | Why doesn't the button for a slide open menu work when i go to a different page but on the main page it works? | javascript|html|web | 0 | 21 | 1 | 72,106,812 | 72,106,812 | 1 | true | 2022-05-04T00:15:05.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why doesn't the button for a slide open menu work when i go to a different page but on the main page it works?<p>Basically, I'm making a site on repl.it. On ... |
72,214,798 | Pyspark toPandas ValueError: Found non-unique column index<p>I get the following error when I try to convert pyspark dataframe to pandas dataframe with the method <code>toPandas</code>. I don't understand the reason for the error:</p>
<pre><code> -------------------------------------------------------------------------... | <p>You can check columns of pyspark dataframe, There is repeat column name in your dataframe according to your error.</p> | Pyspark toPandas ValueError: Found non-unique column index | pandas|dataframe|pyspark | 0 | 799 | 1 | 72,214,834 | 72,214,834 | 1 | true | 2022-05-12T11:35:04.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pyspark toPandas ValueError: Found non-unique column index<p>I get the following error when I try to convert pyspark dataframe to pandas dataframe with the m... |
72,203,660 | How Do I Return a Different Value When Iterating Over a List of Lists<p><strong>ISSUE</strong></p>
<p>I have a FOR loop that creates a list of lists where each entry consists of the input and associated output. I can't figure out how to iterate over the outputs after the list is created and return the corresponding in... | <p>So you have a list of [leaf, MAE] and you want to get the item from that list with the minimum MAE?
You can do it like this:</p>
<pre class="lang-py prettyprint-override"><code>scores = [
[5, 35044.51299744237],
[25, 29016.41319191076],
[50, 27405.930473214907],
[100, 27282.50803885739],
[250, 27893.822225701646],
[... | How Do I Return a Different Value When Iterating Over a List of Lists | python-3.x|pandas|list | 0 | 49 | 2 | 72,203,955 | 72,203,955 | 1 | true | 2022-05-11T15:24:28.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How Do I Return a Different Value When Iterating Over a List of Lists<p><strong>ISSUE</strong></p>
<p>I have a FOR loop that creates a list of lists where ea... |
72,151,053 | Strtok returning the same and incorrect string infinitly<p>So I am studying system calls in c and I am doing this exercise that I have to make a simple program that search for a file in the <code>PATH</code> (kinda similar to <code>which</code> in Linux) and this is what I have done:</p>
<pre><code>int main(int ac, cha... | <p>strtok modifies the 1st parameter, for every call it is called a static pointer is moved inside to point to another part of the parameter that was passed.</p>
<p>So when you do like this</p>
<pre><code> temp = token;
</code></pre>
<p>it sets temp to point to a substring in the array that was passed and next t... | Strtok returning the same and incorrect string infinitly | c|strtok | 0 | 41 | 1 | 72,151,103 | 72,151,103 | 1 | true | 2022-05-07T09:08:34.923Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Strtok returning the same and incorrect string infinitly<p>So I am studying system calls in c and I am doing this exercise that I have to make a simple progr... |
72,145,772 | jest TypeError: Cannot read property 'createRef' of undefined<p><strong>ImageSlider.tsx</strong></p>
<pre><code>const ImageSlider = (props: INF_ImageSlider) => {
const [idx, setIdx] = useState(0);
const imgRef = React.createRef<HTMLImageElement>(); // <---- Error here
// ...
}
</code></pre>
<p><... | <p>I've checked the documentation about using and creating ref's and so far I've seen that it can not take a value like you have it...</p>
<p>What you have</p>
<pre><code>const imgRef = React.createRef<HTMLImageElement>();
</code></pre>
<p>I believe it's throwing an error because you are trying to squeeze in an ... | jest TypeError: Cannot read property 'createRef' of undefined | reactjs|jestjs|react-testing-library | 0 | 156 | 2 | 72,146,279 | 72,146,279 | 1 | true | 2022-05-06T18:12:17.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jest TypeError: Cannot read property 'createRef' of undefined<p><strong>ImageSlider.tsx</strong></p>
<pre><code>const ImageSlider = (props: INF_ImageSlider) ... |
72,147,085 | is it possible to write an es6 onChange arrow function?<p>What's the correct syntax for the onChange es6 function?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function myEv... | <blockquote>
<p>I was just wondering if it was possible to have a multi line function embedded in the html. Appears the answer is n</p>
</blockquote>
<p>You can. The value of the <code>on*</code> attributes become <em>the body</em> of a function. Therefore you can define a function inline but you also have to call it.<... | is it possible to write an es6 onChange arrow function? | ecmascript-6 | 0 | 107 | 4 | 72,155,442 | 72,155,442 | 1 | true | 2022-05-06T20:33:57.857Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
is it possible to write an es6 onChange arrow function?<p>What's the correct syntax for the onChange es6 function?</p>
<p><div class="snippet" data-lang="js"... |
72,166,520 | ERC721 NFT not showing in opensea (related to the metadata)<p>I was creating the DApp and succeeded to mint NFT in Rinkeby using IPFS (pinata) & Nethereum (C#).</p>
<p>Now, I can get TokenURI using tokenURI function in ERC721URIStorage.sol, like <code>ipfs://QmRH9pTTADs3BCqMLqXEAMP83FoaeMD8CUkNgtxZ5HKTLq</code>.</p... | <p>Oh, I find that my json in ipfs is not a json, because it is surrounded with "".</p>
<p>It means that opensea will fail to get something from my metadata because it is string.</p>
<p>I used another sample metadata (<a href="https://ipfs.io/ipfs/bafybeibnsoufr2renqzsh347nrx54wcubt5lgkeivez63xvivplfwhtpym/me... | ERC721 NFT not showing in opensea (related to the metadata) | json|solidity|ipfs | 0 | 695 | 2 | 72,179,619 | 72,179,619 | 1 | true | 2022-05-09T02:49:34.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ERC721 NFT not showing in opensea (related to the metadata)<p>I was creating the DApp and succeeded to mint NFT in Rinkeby using IPFS (pinata) & Nethereu... |
72,175,754 | Converting a Google Sheets Filter Formula to Excel 2016<p>I need convert a sheet I built in google sheets to Excel 2016 since my team does not know google sheets. I wrote a formula to check multiple columns and then build a new array from any data in the selected columns. I understand filter is not available in Excel 2... | <p>I managed to get a similar thing as the stacking filter using AGGREGATE it will list all data if the left column contains a value:</p>
<p>(Enter with <code>ctrl+shift+enter</code>, copied down and one cell to the right)</p>
<pre><code>=IFERROR(INDEX(D$1:D$5,AGGREGATE(15,6,ROW($D$1:$D$5)/($D$1:$D$5<>""... | Converting a Google Sheets Filter Formula to Excel 2016 | excel|google-sheets|excel-formula|excel-2016 | 0 | 75 | 1 | 72,197,567 | 72,197,567 | 1 | true | 2022-05-09T17:04:33.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting a Google Sheets Filter Formula to Excel 2016<p>I need convert a sheet I built in google sheets to Excel 2016 since my team does not know google sh... |
72,234,497 | Getting CWWKF0044E incompatible feature error using Open Liberty with Maven, but I didn't configure incompatible features<p>When using Open Liberty version 22.0.0.5 and liberty-maven-plugin version 3.3 with a server config (server.xml) configuring just a single feature:</p>
<pre><code> <featureManager>
... | <h2>SOLUTION</h2>
<p>This is a bug. To resolve, update liberty-maven-plugin to the latest version (or at least to version 3.4, where this was <a href="https://github.com/OpenLiberty/ci.maven/issues/1236" rel="nofollow noreferrer">fixed</a>).</p>
<p>The bug is described <a href="https://github.com/OpenLiberty/open-liber... | Getting CWWKF0044E incompatible feature error using Open Liberty with Maven, but I didn't configure incompatible features | websphere-liberty|open-liberty|liberty-maven-plugin | 0 | 73 | 1 | 72,234,498 | 72,234,498 | 1 | true | 2022-05-13T19:19:49.517Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting CWWKF0044E incompatible feature error using Open Liberty with Maven, but I didn't configure incompatible features<p>When using Open Liberty version 2... |
72,181,026 | how do I pass all these function using only one context<p>I have these all context created, but now I want to make it optimized. How do I pass all the created functions using only one context provider.
I have three functions to handle the cart options</p>
<ol>
<li>handleAddProduct</li>
<li>handleRemoveProduct</li>
<li>... | <p>The Provider component accepts a value prop to be passed to consuming components that are descendants of this Provider. you could provide it with an object that carries the properties of the functions. and hence you only need to consume the <code>Product</code></p>
<p>this answers your question</p>
<pre><code> <&... | how do I pass all these function using only one context | javascript|java|html|css|reactjs | 0 | 51 | 2 | 72,181,096 | 72,181,096 | 1 | true | 2022-05-10T05:13:25.003Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how do I pass all these function using only one context<p>I have these all context created, but now I want to make it optimized. How do I pass all the create... |
72,147,908 | Mutually exclusive types in a function signature<p>Is this possible to achieve with conditional types in TypeScript?</p>
<pre><code>type Type1 = {
field: string,
}
type Type2 = {
field: number,
}
// I would like to make sure that if arg1 is Type1 then arg2 is Type2
// and vice versa
const func = (arg1: Type1 | Ty... | <p>There are a few ways you could approach this, but you'll probably find it's easier to just overload the signature and be done with it.</p>
<p>You could use a union of tuples:</p>
<pre><code>const func = (...args: [arg1: Type1, arg2: Type2] | [arg1: Type2, arg2: Type1]) => {
const arg1 = args[0]
// Type... | Mutually exclusive types in a function signature | typescript | 0 | 41 | 2 | 72,148,314 | 72,148,314 | 1 | true | 2022-05-06T22:20:06.187Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mutually exclusive types in a function signature<p>Is this possible to achieve with conditional types in TypeScript?</p>
<pre><code>type Type1 = {
field: s... |
72,139,939 | what is the bset IDE and course or book for jakartaEE and spring?<p>I am new to spring5 and I saw that in order to learn spring well, first, it is better to learn a little JEE and become more familiar with its basics, so I have two questions:</p>
<ol>
<li>First, what is the best idea for both spring and JakartaEE? Is i... | <h2>First, what is the best IDE for both spring and JakartaEE?</h2>
<p>Neither of these really require you to use a specific IDE so you can try out IntelliJ, VSCode, Netbeans and Eclipse to see what you like the best. If you're just starting out it might be best to use whatever is used by the instructor or in the book.... | what is the bset IDE and course or book for jakartaEE and spring? | spring|jakarta-ee|ide | 0 | 134 | 1 | 72,184,835 | 72,184,835 | 1 | true | 2022-05-06T10:22:10.657Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
what is the bset IDE and course or book for jakartaEE and spring?<p>I am new to spring5 and I saw that in order to learn spring well, first, it is better to ... |
72,192,107 | how to delete/destroy/unset a specific php session<p>I need to delete/destroy/unset a specific session</p>
<pre><code>$('#btnlogout').on('click', function(){
$.post('pro.php', {fn: 'btn_logout'}, function(data){
location.href = location.href;
});
});
</code></pre>
<p><strong>pro.php</strong>... | <p>The unset method itself does the trick but until the page is refreshed it echo the last instance. you can try this</p>
<pre><code>session_start();
if(isset(($_SESSION['id'])){
unset($_SESSION['id']);
die();
header ('Location: index.php'); //optional line, any other page can be used
}
</code></pre> | how to delete/destroy/unset a specific php session | php|session | 0 | 33 | 1 | 72,192,159 | 72,192,159 | 1 | true | 2022-05-10T19:40:22.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to delete/destroy/unset a specific php session<p>I need to delete/destroy/unset a specific session</p>
<pre><code>$('#btnlogout').on('click', function(){... |
72,153,797 | how to flutterfire web site (document)?<p>sorry i'dont no english (i'm use google translation)</p>
<p>a month ago</p>
<p>i'm use site page
<a href="https://i.stack.imgur.com/T2jMi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T2jMi.png" alt="enter image description here" /></a></p>
<p>but now go to... | <p>Try this: <a href="https://firebase.google.com/docs/auth/flutter/federated-auth" rel="nofollow noreferrer">Federated identity and social auth</a></p>
<p>Edited:</p>
<p>Here's the screenshot from the page: left side all auth methods, right side all contents in the page. In the form of a menu list, both. In the pages ... | how to flutterfire web site (document)? | firebase|flutter | 0 | 124 | 1 | 72,153,971 | 72,153,971 | 1 | true | 2022-05-07T15:13:04.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to flutterfire web site (document)?<p>sorry i'dont no english (i'm use google translation)</p>
<p>a month ago</p>
<p>i'm use site page
<a href="https://i... |
72,170,180 | Execute multiple RegExp patterns in "one shot" using TypeScript<p>I am in the process of slowly rewriting my blog and part of it is adding support for comments. In my mind I want to take the commenting a step further and allow people to use <a href="https://en.wikipedia.org/wiki/BBCode" rel="nofollow noreferrer">BBcode... | <p>I ended up using the following solution:</p>
<pre><code>const STRONG = '(?:\\[b\\]([a-zA-Z\\s\\d,.\\\'";:\\-_=+*?!\\(\\)\\{\\}\\\\\\/|@]+)\\[\\/b\\])+';
const regexSTRONG = new RegExp(`${STRONG}`, 'gi');
const substSTRONG = '<strong>$1</strong>';
const ITALIC = '(?:\\[i\\]([a-zA-Z\\s\\d,.\\\'"... | Execute multiple RegExp patterns in "one shot" using TypeScript | javascript|typescript | 0 | 44 | 1 | 72,177,061 | 72,177,061 | 1 | true | 2022-05-09T10:00:15.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Execute multiple RegExp patterns in "one shot" using TypeScript<p>I am in the process of slowly rewriting my blog and part of it is adding support for commen... |
72,176,066 | is there a function in Excel to apply the below logic<p>if the column value is 1, I need to print 1.0000 and</p>
<p>if the column value is 1.1 , i need to print 1.0001</p>
<p>if 1.10 -> 1.0010</p>
<p>if 1.100 -> 1.0100</p>
<p>I am trying to think with regex, is there a way to code like this in excel?</p>
<p>if c... | <p>You didn't provide enough details about your problem, but I tried to solve it as I understood it.
Firstly, you have to store your inputs as TEXT since 1.1 is equal to 1.10, 1.100, 1.1000
Then you can use the following formula to get the required outputs</p>
<pre><code>=IF(LEN(A1)=3,CONCATENATE(LEFT(A1,2),"000&q... | is there a function in Excel to apply the below logic | excel|regex|function|if-statement | 0 | 65 | 1 | 72,176,413 | 72,176,413 | 1 | true | 2022-05-09T17:34:34.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
is there a function in Excel to apply the below logic<p>if the column value is 1, I need to print 1.0000 and</p>
<p>if the column value is 1.1 , i need to pr... |
72,208,499 | Very blurry scale transform animations in Firefox and connection with hover/tap<p>The code snippet involves four identical patterns that use animations to adjust the scale.</p>
<p>In Firefox they begin extremely blurry and remain like that until you hover the mouse over anywhere in the window or if you tap anywhere in ... | <p>According to jaffa question <a href="https://stackoverflow.com/questions/60796102/css-animation-scale-transform-starts-blurry-in-firefox">(60796102)</a></p>
<p>It's a Firefox issue for optimization, and you can solve it by adding <code>backface-visibility: hidden;</code> property to the target class.
I tested it on... | Very blurry scale transform animations in Firefox and connection with hover/tap | firefox|css-transforms | 0 | 103 | 1 | 72,241,052 | 72,241,052 | 1 | true | 2022-05-11T23:06:16.123Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Very blurry scale transform animations in Firefox and connection with hover/tap<p>The code snippet involves four identical patterns that use animations to ad... |
72,151,168 | Laravel relationship HasMany<p>I keep multiple address records belonging to a user. but when i write with dd i can't access other table's data.</p>
<p>Following my code:</p>
<p><code>user</code> Table</p>
<pre><code>id | name | country |
--- -------------- ----------
7 | Mr. Lenny Bins| Belgium
2 | Dalt... | <p>Firstly you are using get that will return collection, In Following you will get all users with their addresses.</p>
<p><code>$users = User::where('id' ,7)->with('getAddress')->get();</code></p>
<p>You can use <code>first()</code> instead of <code>get()</code> as you are finding only one user</p>
<pre><code>$u... | Laravel relationship HasMany | php|laravel | 0 | 68 | 3 | 72,151,479 | 72,151,479 | 1 | true | 2022-05-07T09:23:07.530Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Laravel relationship HasMany<p>I keep multiple address records belonging to a user. but when i write with dd i can't access other table's data.</p>
<p>Follow... |
72,184,289 | Is there an R function for displaying only a subset of legend keys?<p>Building off of my previous question, with thanks to @AndrewGB for the code modifications (<a href="https://stackoverflow.com/questions/72145589/specifying-fill-color-independent-of-mapping-aesthetics-in-boxplot-r-ggplot/72145717?noredirect=1#comment... | <p>You can use the <code>breaks</code> argument of <code>scale_fill_manual</code> to limit the number of legend entries without limiting the actual plotted colors.
However, you need to name the colors in the <code>values</code> argument explicitly:</p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
l... | Is there an R function for displaying only a subset of legend keys? | r|ggplot2|boxplot|legend-properties | 0 | 36 | 1 | 72,185,661 | 72,185,661 | 1 | true | 2022-05-10T10:01:05.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there an R function for displaying only a subset of legend keys?<p>Building off of my previous question, with thanks to @AndrewGB for the code modificatio... |
72,197,094 | How to make only mondays selectable in daterangeinput in shiny R?<p>Is there a way to imitate the daysofweekdisabled found in dateInput?</p>
<p>I want people to select only mondays.</p> | <p>Unfortunately, there is no built-in feature of function <code>dateRangeInput</code>. However, one can create a hook to evaluate if a given input is valid or not i.e. both start and end date is on a Monday:</p>
<pre><code>library(shiny)
library(lubridate)
ui <- fluidPage(
dateRangeInput("daterange1", ... | How to make only mondays selectable in daterangeinput in shiny R? | r|shiny | 0 | 26 | 1 | 72,197,226 | 72,197,226 | 1 | true | 2022-05-11T07:33:55.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make only mondays selectable in daterangeinput in shiny R?<p>Is there a way to imitate the daysofweekdisabled found in dateInput?</p>
<p>I want people... |
72,083,671 | How to combine member of a column, collect them in a data frame and give them a new name, in R?<p>I want to make a new data frame based on my old data frame and combine members of a specific column while I give them a new name:
for example, this is my old data frame:</p>
<pre><code>df <- structure(list(ID= c("x... | <p>Create groups with <code>case_when</code> and then use <code>summarise</code> to collapse rows by groups and compute the sum of <code>col3</code> by group.</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
df %>%
group_by(col1, gp = case_when(col2 %in% c("a", "b", "c&qu... | How to combine member of a column, collect them in a data frame and give them a new name, in R? | r|group-by|merge|count | 0 | 27 | 2 | 72,083,730 | 72,083,730 | 1 | true | 2022-05-02T07:41:46.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to combine member of a column, collect them in a data frame and give them a new name, in R?<p>I want to make a new data frame based on my old data frame ... |
72,097,799 | Going from a dataframe with a factor column and numeric column to a dataframe with factor levels as columns and corresponding numeric values as rows<p>If I take the following two-column dataframe, with one column being a factor and the other being a numeric vector:</p>
<pre><code>data <- data.frame(x=c("a"... | <p>With base R, use <code>rbind.data.frame</code>:</p>
<pre class="lang-r prettyprint-override"><code>d <- rbind.data.frame(data$y)
colnames(d) <- data$x
a b c d e f g h
1 1 2 3 3 2 1 5 6
</code></pre>
<p>With <code>pivot_wider</code>:</p>
<pre class="lang-r prettyprint-override"><code>tidyr::pivot_wider(data,... | Going from a dataframe with a factor column and numeric column to a dataframe with factor levels as columns and corresponding numeric values as rows | r|dataframe|row|factors|columnsorting | 0 | 29 | 3 | 72,098,038 | 72,098,038 | 1 | true | 2022-05-03T10:04:24.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Going from a dataframe with a factor column and numeric column to a dataframe with factor levels as columns and corresponding numeric values as rows<p>If I t... |
72,208,439 | cypress returning "undefined" argument when using fixture and POM<p>after fixing some issues with my fixtures I am playing around with cypress scripts using POM but whenever I want my function to type some data I have in my JSON file I get the following message</p>
<blockquote>
<p>cy.type() can only accept a string or ... | <p>Your problem is that your <code>credentials</code> variable is an array, but you are trying to directly access properties the variable does not have. (Additionally, the properties you call don't exist on the objects even if they were referenced correctly. You should either switch to finding the data by an index, or ... | cypress returning "undefined" argument when using fixture and POM | javascript|cypress | 0 | 210 | 1 | 72,216,770 | 72,216,770 | 1 | true | 2022-05-11T22:56:08.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cypress returning "undefined" argument when using fixture and POM<p>after fixing some issues with my fixtures I am playing around with cypress scripts using ... |
72,222,666 | Is it possible to send a message out to Log Stream (App Insights Logs) Inside Azure Function App<p>I feel like it must be possible, but I've yet to find an answer.</p>
<p>I navigate here inside of my Function App:</p>
<p><a href="https://i.stack.imgur.com/9kwC2.png" rel="nofollow noreferrer"><img src="https://i.stack.i... | <p>I believe, there is no different place to write log info, but we need to change the log levels accordingly in <code>host.json</code> for getting different types of logs.</p>
<p>I tried to log the information level logs in this workaround.</p>
<ol>
<li>In VS Code, Created Azure Functions - Python Stack.</li>
<li>Adde... | Is it possible to send a message out to Log Stream (App Insights Logs) Inside Azure Function App | python|azure|azure-functions|azure-application-insights | 0 | 92 | 1 | 72,224,958 | 72,224,958 | 1 | true | 2022-05-12T22:23:44.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to send a message out to Log Stream (App Insights Logs) Inside Azure Function App<p>I feel like it must be possible, but I've yet to find an a... |
72,140,255 | Tokenize a std::string to a struct<p>Let's say I have the following string that I want to tokenize as per the delimiter '>':</p>
<pre><code>std::string veg = "orange>kiwi>apple>potato";
</code></pre>
<p>I want every item in the string to be placed in a structure that has the following format:</p>
... | <p>You don't need an intermediate variable.</p>
<pre><code>pack_item pitem;
std::stringstream veg_ss(veg);
std::getline(veg_ss, pitem.it1, '>');
std::getline(veg_ss, pitem.it2, '>');
std::getline(veg_ss, pitem.it3, '>');
std::getline(veg_ss, pitem.it4, '>');
</code></pre>
<p>You might want to make that a ... | Tokenize a std::string to a struct | c++|data-structures|tokenize | 0 | 75 | 5 | 72,140,567 | 72,140,567 | 1 | true | 2022-05-06T10:48:17.383Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Tokenize a std::string to a struct<p>Let's say I have the following string that I want to tokenize as per the delimiter '>':</p>
<pre><code>std::string ve... |
72,186,025 | How to pass a function with parameter pack to a function with parameter pack<p>I'm working on a C++14 project and I don't know how to pass a function with parameter pack to another with parameter pack.</p>
<pre><code>template <typename F, typename... Args, typename Callback, typename ... Args2>
bool doAsyncRpc(F ... | <p>You can't deduce two packs from the arguments to a call, so you'll have to wrap at least <code>Args...</code> in a tuple, but it's probably easier to do both.</p>
<p>You then need to shove your other arguments into tuples with those.</p>
<pre><code>template <typename F, typename... Args, typename Callback, typena... | How to pass a function with parameter pack to a function with parameter pack | c++11|c++14|variadic-functions | 0 | 157 | 1 | 72,186,510 | 72,186,510 | 1 | true | 2022-05-10T12:06:56.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to pass a function with parameter pack to a function with parameter pack<p>I'm working on a C++14 project and I don't know how to pass a function with pa... |
72,204,492 | Python: Recursivly get the length of file path<p>Trying to recursively scan a given directory and get the length of the file or directory path not the file or directory size</p>
<p>If the length is more than say 35 characters, Just to test, output the path and length to a log file</p>
<p>If Directory Path is > 35 th... | <p>You want to log the file name but you are actually logging the <code>fname</code> variable which is a list of all files.</p>
<p>You can change the code to log the 'fp' variable instead of the 'fname' and it will work:</p>
<pre><code>for fp in fname:
Len = len(fp)
if Len > 35:
print("fname =... | Python: Recursivly get the length of file path | python | 0 | 36 | 1 | 72,213,848 | 72,213,848 | 1 | true | 2022-05-11T16:24:31.397Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Recursivly get the length of file path<p>Trying to recursively scan a given directory and get the length of the file or directory path not the file o... |
72,234,481 | How do I observe changes on an array with Combine framework?<p>How can I observe changes on an array with Combine framework but without SwiftUI?</p>
<p>Basically, I want this sink block to get called when an element is added or removed.</p>
<pre><code>import Combine
var list = ["A", "B", "C&qu... | <p>Combine is a completely separate framework from SwiftUI, so it can be used on its own.</p>
<p>I would add a publisher for the list by using the <code>@Published</code> attribute. You can then receive events off of that.</p>
<p>You'll need to have the resulting <code>AnyCancellable</code> stored (such as in a set) so... | How do I observe changes on an array with Combine framework? | ios|swift|combine | 0 | 135 | 1 | 72,236,104 | 72,236,104 | 1 | true | 2022-05-13T19:17:13.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I observe changes on an array with Combine framework?<p>How can I observe changes on an array with Combine framework but without SwiftUI?</p>
<p>Basic... |
72,176,127 | python pod not printing environmental variables injected<p>we have python application deployed in aks cluster but it is not printing the env variables passed to the container . we are using aks cluster version 1.24 , if I use busy box image instead on this image , I am able to see env varibles .</p>
<pre><code>kubectl ... | <p>it's because of '-' (dash) in environment variable's name.</p>
<pre><code> env:
- name: client_secret
value: test-val
- name: client_secret2
value: test-val2
</code></pre>
<p>will work.</p>
<p>please refer to <a href="https://stackoverflow.com/questions/21525424/how-to-declare-variable-name-wi... | python pod not printing environmental variables injected | python|docker|kubernetes|docker-compose | 0 | 64 | 1 | 72,180,809 | 72,180,809 | 1 | true | 2022-05-09T17:40:34.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
python pod not printing environmental variables injected<p>we have python application deployed in aks cluster but it is not printing the env variables passed... |
72,200,663 | Testing promise resolving returned from service<p>I've got a problem with testing promise resolving of promise returned from function. The problem is that .then() isn't executed.</p>
<p>Components method that I'm testing:
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div... | <blockquote>
<p>Which means (I believe so) that .then() isn't executed. Why?</p>
</blockquote>
<p>Your test is entirely synchronous, so it's not giving time for <code>this.test()</code> to be called. The promise returned by MockToastService may be in a resolved state, but the <code>.then</code> callback still runs asyn... | Testing promise resolving returned from service | angular|jasmine|karma-jasmine | 0 | 19 | 1 | 72,200,822 | 72,200,822 | 1 | true | 2022-05-11T11:57:52.193Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Testing promise resolving returned from service<p>I've got a problem with testing promise resolving of promise returned from function. The problem is that .t... |
72,202,863 | React.useCallback : it doesn't prevent continuos re-rendering<p>I'm trying to use <code>React.useCallback</code> functions within <code>React.useEffect</code> in order to avoid continuous re-rendering.</p>
<p>My objective is, once selected a sorting option, keep the list sorted even when new elements are added. But wit... | <pre><code> const memoizedIncrByName = React.useCallback(() => {
let new_data = [...data].sort((a, b) => {
if (b.name < a.name) return 1;
if (b.name > a.name) return -1;
return 0;
});
setData(new_data);
}, [data]);
</code></pre>
<p>Every time the data changes, the memoization... | React.useCallback : it doesn't prevent continuos re-rendering | reactjs|react-usecallback | 0 | 89 | 1 | 72,203,050 | 72,203,050 | 1 | true | 2022-05-11T14:30:29.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React.useCallback : it doesn't prevent continuos re-rendering<p>I'm trying to use <code>React.useCallback</code> functions within <code>React.useEffect</code... |
72,178,177 | Get records of the last X days<p>The code below returns me all data that are present in <em>CollectionA</em> but NOT in <em>CollectionB</em>. (Using the <code>mainID</code> as reference).</p>
<pre class="lang-js prettyprint-override"><code> return this.aggregate([
{
$lookup: {
from: 'CollectionB',
... | <p>You can simply use <code>$or</code> in the <code>$expr</code> in <code>$match</code></p>
<pre class="lang-js prettyprint-override"><code>db.CollectionA.aggregate([
{
"$lookup": {
"from": "CollectionB",
"localField": "mainId",
"foreignFiel... | Get records of the last X days | node.js|mongodb|mongoose|mongodb-query|aggregation-framework | 0 | 37 | 1 | 72,178,321 | 72,178,321 | 1 | true | 2022-05-09T21:00:06.860Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get records of the last X days<p>The code below returns me all data that are present in <em>CollectionA</em> but NOT in <em>CollectionB</em>. (Using the <cod... |
72,207,909 | Concat array into other one inside same document MongoDB<p>Is there any way to insert the contents inside the nested field: "urls2.url_breed" inside "url_alternative.url" ?? I have many documents to process like this</p>
<pre class="lang-json prettyprint-override"><code> { "_id": { ... | <p>This could be complicated in query due to your highly nested structure, but the idea is simple. Construct tuples of the 2 arrays by <code>$zip</code>, iterate the result and use <code>$concatArrays</code> to "flatten them into an array.</p>
<pre class="lang-js prettyprint-override"><code>db.collection.update({}... | Concat array into other one inside same document MongoDB | mongodb|mongodb-query|aggregation-framework | 0 | 35 | 1 | 72,208,000 | 72,208,000 | 1 | true | 2022-05-11T21:42:52.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Concat array into other one inside same document MongoDB<p>Is there any way to insert the contents inside the nested field: "urls2.url_breed" insid... |
72,231,235 | c++ queue implementation not working as expected<p>Today I am looking to make my own dequeue in c ++ using pointers. Well, in the program, I want to create two dequeues in which to add different elements. Unfortunately, this is not what happened. On screen i got <strong>6 5</strong> insted only <strong>6</strong>. Why?... | <p>Such a class might look like this:</p>
<pre><code>class /* or struct, if you really want to... */ Dequeue
{
public:
void push(int value);
bool pop(int& value); // if you return 1 for success and 0 for error
// bool is the more appropriate type...
private:
struct elem // it's a... | c++ queue implementation not working as expected | c++ | 0 | 33 | 1 | 72,231,511 | 72,231,511 | 1 | true | 2022-05-13T14:30:38.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
c++ queue implementation not working as expected<p>Today I am looking to make my own dequeue in c ++ using pointers. Well, in the program, I want to create t... |
72,211,821 | change from eth0 to eth1 in scapy<p>Hy, i need to sniff the packets from the net, actually i am on virtual machine (with Kali Linux as SO) and i attached 2 network, one is internal network, in communication with vulnerable machine <strong>(192.168.8.0/24) on eth1</strong> and the second one comunicate with the internet... | <p>In function sniff you can provide interface on which one you want to sniff the packets.
In your case change this line</p>
<pre><code>pkt=sniff(prn=self.print_pkt, count=theCount, store=0)
</code></pre>
<p>To</p>
<pre><code>pkt=sniff(iface="eth1", prn=self.print_pkt, count=theCount, store=0)
</code></pre>
<... | change from eth0 to eth1 in scapy | python|linux|networking|configuration|scapy | 0 | 60 | 1 | 72,368,640 | 72,368,640 | 1 | true | 2022-05-12T07:46:42.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
change from eth0 to eth1 in scapy<p>Hy, i need to sniff the packets from the net, actually i am on virtual machine (with Kali Linux as SO) and i attached 2 n... |
72,170,178 | How to render Array of coordinates for line map using OpenLayers?<p>I have a endpoint <code>/geomap_data/</code> that I am using to return <code>customer_sites</code> in the console log in browser which shows the following which is <code>Sites Coordinates, Customer coordinates</code>:</p>
<pre><code>0: "[53.501196... | <p>You could parse the data directly into a MultiLineString geometry. Use <code>.reverse()</code> to swap the coordinate order.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><... | How to render Array of coordinates for line map using OpenLayers? | openlayers|openstreetmap|geojson|openlayers-3 | 0 | 188 | 1 | 72,170,811 | 72,170,811 | 1 | true | 2022-05-09T10:00:08.803Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to render Array of coordinates for line map using OpenLayers?<p>I have a endpoint <code>/geomap_data/</code> that I am using to return <code>customer_sit... |
72,171,735 | ActiveMQ Artemis and multiple DLQs<p>I have many queues, i.e</p>
<pre><code>my.queue.no.1
my.queue.no.2
my.queue.no.3
my.queue.no.4
</code></pre>
<p>And I want to redirect unsuccessful messages to DLQ, but I don't want to mix messages from all queues to a one DLQ.</p>
<p>Is it possible to have multiple DLQs?</p>
<p>i.e... | <p>ActiveMQ Artemis can automatically create the defined dead-letter-address and a corresponding dead-letter queue when a message is undeliverable enabling the <code>auto-create-dead-letter-resources</code> <a href="https://activemq.apache.org/components/artemis/documentation/latest/address-settings.html" rel="nofollow... | ActiveMQ Artemis and multiple DLQs | activemq-artemis | 0 | 93 | 1 | 72,172,404 | 72,172,404 | 1 | true | 2022-05-09T12:06:22.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ActiveMQ Artemis and multiple DLQs<p>I have many queues, i.e</p>
<pre><code>my.queue.no.1
my.queue.no.2
my.queue.no.3
my.queue.no.4
</code></pre>
<p>And I wa... |
72,057,277 | How can I avoid control character interpretation in Javascript template string interpolation?<p>I have a string variable containing a control character (newline). I want to output that variable but with the control character as its literal representation and not interpreted:</p>
<pre class="lang-js prettyprint-override... | <p>You could remove the double quotes, and use <code>JSON.stringify</code> which also produces those quotes, and which encodes newline characters (and more, such as TAB, BS, FF, and escapes double quote and backslash):</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
... | How can I avoid control character interpretation in Javascript template string interpolation? | javascript|string|newline|template-strings | 0 | 30 | 1 | 72,057,322 | 72,057,322 | 1 | true | 2022-04-29T11:30:49.360Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I avoid control character interpretation in Javascript template string interpolation?<p>I have a string variable containing a control character (newl... |
72,221,730 | Iterate over a csv and change the values of a column that meets a condition<p>I have to use bash to iterate over a CSV file and replace the values of a column that meets a condition. Finally, the results have to be stored in an output file.</p>
<p>I have written this code, which reads the file and stores the content in... | <p>You don't need <code>sed</code>. Just replace <code>$array[13]</code> with <code>0</code>. Then print the entire array with <code>;</code> separators between the fields.</p>
<pre><code>( # in a subshell
IFS=';' # set IFS, that affects `read` and `"${array[*]}"`
while read -ra array
... | Iterate over a csv and change the values of a column that meets a condition | bash|sed | 0 | 549 | 3 | 72,221,891 | 72,221,891 | 1 | true | 2022-05-12T20:28:47.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Iterate over a csv and change the values of a column that meets a condition<p>I have to use bash to iterate over a CSV file and replace the values of a colum... |
72,155,806 | Getting bad request error when updating a number in MongoDB<p>I was trying to update a single element(which is a number) that is stored in mongodb.
here is the request I sent to the DB:</p>
<pre><code>const handleDelivered = (num) =>{
const total = service.quantity;
const final = parseInt(total) + num;
... | <p>This should work for you:</p>
<p>In you request body do this:</p>
<pre><code>body : JSON.stringify({quantity: final})
</code></pre>
<p>Instead, send an object as a string whit:</p>
<pre><code>res.send(result);
</code></pre>
<p>Send as a JSON like this:</p>
<pre><code>res.status(200).json(result);
</code></pre>
<p>An... | Getting bad request error when updating a number in MongoDB | javascript|mongodb|express | 0 | 46 | 1 | 72,155,953 | 72,155,953 | 1 | true | 2022-05-07T19:31:13.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting bad request error when updating a number in MongoDB<p>I was trying to update a single element(which is a number) that is stored in mongodb.
here is t... |
72,177,641 | SubmitFormData as Json (Update w/o page refresh<p>I am working on my submit form w/o a page refresh. Below is my code which is working perfectly. How ever it would be easier if i can send data to my back.php file in Json format so i dont need to declare al variables in the script section. Is there a way to send the dat... | <p>this should work for you:</p>
<p>with <code>JQuery</code> you could use <code>$("#idOfYourForm").serialize()</code> to the form;</p>
<p>The <code>.serialize()</code> method creates a text string in standard URL-encoded notation.</p>
<p>So in your script, you will do something like:</p>
<pre><code>function ... | SubmitFormData as Json (Update w/o page refresh | json|ajax|forms|submit | 0 | 26 | 1 | 72,177,799 | 72,177,799 | 1 | true | 2022-05-09T20:04:19.123Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SubmitFormData as Json (Update w/o page refresh<p>I am working on my submit form w/o a page refresh. Below is my code which is working perfectly. How ever it... |
72,187,719 | How to update a field in a document in my monogoose model with Model.updateOne and $inc<p>I'm making a digital currency app (for a closed community) and after making a transaction, I want to update the balance of the receiver in mongodb.</p>
<pre><code>const create = (req, res) => {
let transaction = new Transac... | <p>This should work: saveOne return a promise to you:</p>
<pre><code>const create = (req, res) => {
let transaction = new Transaction();
transaction.sender = req.body.sender;
transaction.receiver = req.body.receiver;
transaction.amount = req.body.amount;
transaction.save(async (err, doc) => {
if(!er... | How to update a field in a document in my monogoose model with Model.updateOne and $inc | node.js|mongodb|mongoose | 0 | 26 | 1 | 72,187,846 | 72,187,846 | 1 | true | 2022-05-10T13:57:51.057Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to update a field in a document in my monogoose model with Model.updateOne and $inc<p>I'm making a digital currency app (for a closed community) and afte... |
72,190,192 | What is the best way to download mulitple images using jquery<p>I have a section in which I have multiple images now on click I would like to download all.</p>
<p>Here is what my images look like</p>
<p><a href="https://i.stack.imgur.com/uG0cL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uG0cL.pn... | <p>If you only need download the images without zip:</p>
<p>Just map the array and click:</p>
<pre><code>function downloadImages() {
$(".grcode-image").each(function (index, currentElement) {
currentElement.click();
});
}
</code></pre> | What is the best way to download mulitple images using jquery | javascript|html|jquery|arrays|object | 0 | 35 | 1 | 72,190,277 | 72,190,277 | 1 | true | 2022-05-10T16:48:56.730Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the best way to download mulitple images using jquery<p>I have a section in which I have multiple images now on click I would like to download all.</... |
72,037,669 | Run through points within a given circumference, and if something is there remove it<p>I am working on a rather simple game, but I'm struggling with implementing a feature where when a player has a weapon and chooses to attack, I want to find if any players are within the weapon's attack distance (within the circumfere... | <p>Seem you just need to compare distance (here squared euclidean distance):</p>
<pre><code>for player in self.listOfPlayers:
if (player.x-plyr.x)**2+(player.y-plyr.y)**2 <= grenaderadius**2:
self.listOfPlayers.remove(player)
</code></pre>
<p>Also note that removing players from the list during iteration... | Run through points within a given circumference, and if something is there remove it | python|python-3.x|geometry | 0 | 26 | 1 | 72,037,864 | 72,037,864 | 1 | true | 2022-04-28T03:25:25.617Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Run through points within a given circumference, and if something is there remove it<p>I am working on a rather simple game, but I'm struggling with implemen... |
72,230,039 | Script linux loop for multiple number<p>I have a list of Linux commands that I need to repeat up to 670. How can I automate the commands, so I don't have to do the 670 times. I don't know how to do all the operations from C1, C2, C3 .... to C670?</p>
<pre><code>#START C1
mkdir C1
cd C1
awk '/Prymnesium_parvum_Genom... | <p>Not tested:</p>
<pre><code>#!/bin/bash
for C in {1..670};do
echo START ${C}
mkdir -p ${C} && cd ${C}
awk '/Prymnesium_parvum_GenomeV1.0_Contig_'${C}'\t/' ../Methy_670.txt | cut -f 2 > IllU_${C}.txt
awk '/Prymnesium_parvum_GenomeV1.0_Contig_'${C}'\t/' ../TE/TEannotation_Prymnesium_parvum_GenomeV1.0.gff... | Script linux loop for multiple number | linux|bash|repeat|script | 0 | 51 | 2 | 72,230,121 | 72,230,121 | 1 | true | 2022-05-13T13:02:06.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Script linux loop for multiple number<p>I have a list of Linux commands that I need to repeat up to 670. How can I automate the commands, so I don't have to ... |
72,157,458 | Why am I getting an incorrect result from multiplying an inverted matrix by a vector?<p>I'm trying to learn Python for basic work in linear algebra. I'm running into the following problem with a simple system of linear equations:</p>
<pre><code>import scipy.linalg as la
import numpy as np
A = np.array([[186/450, 54/21... | <p>There is a typo in <code>l</code> instantiation in your python code. (30/36 should be 30/60).</p>
<p>This code with the typo fixed produces the same result as in Julia.</p>
<pre><code>import scipy.linalg as la
import numpy as np
A = np.array([[186/450, 54/21, 30/60],
[12/450, 6/21 , 3/60],
... | Why am I getting an incorrect result from multiplying an inverted matrix by a vector? | python|arrays|numpy|matrix-multiplication | 0 | 39 | 1 | 72,157,510 | 72,157,510 | 1 | true | 2022-05-08T01:30:17.103Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why am I getting an incorrect result from multiplying an inverted matrix by a vector?<p>I'm trying to learn Python for basic work in linear algebra. I'm runn... |
72,233,316 | Draw line between 2 elements in reactJS<p>I'm working on a flights agency website, and at some point I need to draw some lines between elements that are being added dynamically.</p>
<p>See the image to understand what I'm trying to do:
<a href="https://i.stack.imgur.com/k97oM.png" rel="nofollow noreferrer"><img src="ht... | <p>You can use the <code><hr</code> element in HTML. This draws a line between the two elements.</p>
<p>You can see more information about it on</p>
<p><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr</a></p> | Draw line between 2 elements in reactJS | javascript|html|css|reactjs | 0 | 100 | 1 | 72,233,398 | 72,233,398 | 1 | true | 2022-05-13T17:19:30.820Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Draw line between 2 elements in reactJS<p>I'm working on a flights agency website, and at some point I need to draw some lines between elements that are bein... |
72,058,847 | How to handle error unsupported operand type(s)<p>There is lists :</p>
<pre><code>l_figure_s= [5, 9, 21, 25, 30, 34, 43]
l_figure_e= [8, 16, 24, 28, 33, 37, 46]
</code></pre>
<p>Of lists created dataframe :</p>
<pre><code>df1 = pd.DataFrame.from_dict({'starts':l_figure_s,'ends':l_figure_e},dtype=int,orient='index').tr... | <p>You have to use parenthesis:</p>
<pre><code>df1[(df1['starts']<df1['ends']) & (df1['starts'].shift(-1)>=df1['ends'])]
</code></pre>
<hr />
<p>EDIT:
As <a href="https://stackoverflow.com/users/16343464/mozway">@mozway</a> says in the comments section, it is called "<a href="https://docs.python.org/3/re... | How to handle error unsupported operand type(s) | python-3.x|pandas | 0 | 30 | 2 | 72,058,923 | 72,058,923 | 1 | true | 2022-04-29T13:36:31.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to handle error unsupported operand type(s)<p>There is lists :</p>
<pre><code>l_figure_s= [5, 9, 21, 25, 30, 34, 43]
l_figure_e= [8, 16, 24, 28, 33, 37,... |
72,150,379 | php list files to array and save array stringified to disk<p>In my web app I want to list in php the contents of a directory "archives/*-pairings.txt"
So I have a php file (below) that is supposed to read those contents into an array and write the file "archives/contents.json" containing json.</p>
<... | <pre><code>function list_contents($dir) {
$contents = array();
$dir = realpath($dir);
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $file) {
if ($file != '.' && $file != '..' && $file != 'contents.json') {
$contents[] = $file;
}
}
}
$c... | php list files to array and save array stringified to disk | php|arrays|json | 0 | 42 | 1 | 72,150,655 | 72,150,655 | 1 | true | 2022-05-07T07:25:37.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
php list files to array and save array stringified to disk<p>In my web app I want to list in php the contents of a directory "archives/*-pairings.txt&qu... |
72,198,321 | Change ordering in WooCommerce Shop Page to be random but going via category<p>I need to make my WooCommerce shop page have a different type of randomizing. Basically I want it to randomize by category and display that method going forward. So one category of items then another category of items but the products in tho... | <p>Once you have added the code above to your active theme’s "functions" file, head to Appearance > Customise to configure your Woo Commerce product catalogue sorting options.</p>
<pre><code>add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woo_catalog_ordering_args' );
function custom_woo_ca... | Change ordering in WooCommerce Shop Page to be random but going via category | php|wordpress|woocommerce | 0 | 23 | 1 | 72,199,127 | 72,199,127 | 1 | true | 2022-05-11T09:07:35.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change ordering in WooCommerce Shop Page to be random but going via category<p>I need to make my WooCommerce shop page have a different type of randomizing. ... |
72,191,607 | Why does my python loop give a different array every run, and how to make it produce the same result everytime?<p>You can see the loop below, which gives a different plot everytime, and approximately 1 out of 20 runs is the result that I want, which is a triangular Fourier series. How to make it so that the outcome is ... | <p>This line</p>
<pre><code>s=np.empty(N+1)
</code></pre>
<p>produces an array filled with undefined(arbitrary) value. You should be using a new array filled with zero instead:</p>
<pre><code>s=np.zeros(N+1)
</code></pre> | Why does my python loop give a different array every run, and how to make it produce the same result everytime? | python|numpy|matplotlib|while-loop | 0 | 56 | 2 | 72,191,860 | 72,191,860 | 1 | true | 2022-05-10T18:48:38.103Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does my python loop give a different array every run, and how to make it produce the same result everytime?<p>You can see the loop below, which gives a d... |
72,202,555 | conditionally call a function with its params<p>Having several functions, I would like do not call them if there is no need (logic in <code>needToCalculate</code>), used by a generic function <code>calculateIfNeeded</code></p>
<pre><code>// helper functions
function sum(a: number, b: number) { return a + b; } // compl... | <p>Extending upon my comment, you will have to add a parameter type, constraint it to the type of the function you want to use as <code>func</code>, and infer the type of <code>args</code> from that:</p>
<pre><code>/**
* This represents not just _any function_, but one that can be
* given as the second parameter (`fu... | conditionally call a function with its params | javascript|typescript | 0 | 63 | 2 | 72,204,311 | 72,204,311 | 1 | true | 2022-05-11T14:09:23.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
conditionally call a function with its params<p>Having several functions, I would like do not call them if there is no need (logic in <code>needToCalculate</... |
72,186,618 | Keep reading data while updating GUI tkinter in a non blocking way<p>I'm new to asyncio, threading, subrocess and I'm trying to build an app that reads data from the serial continuesly, put them inot a queue used by another process/thread/asyncio function to consume them and show into a tkinter GUI.</p>
<p>I was able t... | <p>Try making a blocking calls in a separate thread. Inside update_screen, you should make calls fast enough to not no freeze GUI. That means, you should not read the input there.</p>
<pre class="lang-py prettyprint-override"><code>import tkinter as tk
import time
import queue
import logging
import serial
import sys
im... | Keep reading data while updating GUI tkinter in a non blocking way | python|tkinter|python-asyncio|pyserial | 0 | 115 | 2 | 72,187,131 | 72,187,131 | 1 | true | 2022-05-10T12:48:58.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Keep reading data while updating GUI tkinter in a non blocking way<p>I'm new to asyncio, threading, subrocess and I'm trying to build an app that reads data ... |
72,219,499 | get list of files edited and type of edit using git<p>is there a way to get a list of all files that have been edited in a commit using git?
the info I would need are:</p>
<pre><code>file1 edited
file2 deleted
file3 edited
file4 created
</code></pre>
<p>I tried
<code>git show <sha></code>
but gives info about a... | <p>What you are looking for is</p>
<pre><code>git show --name-status the-commit-id
</code></pre> | get list of files edited and type of edit using git | git | 0 | 17 | 1 | 72,219,748 | 72,219,748 | 1 | true | 2022-05-12T16:56:21.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
get list of files edited and type of edit using git<p>is there a way to get a list of all files that have been edited in a commit using git?
the info I would... |
72,190,424 | How to create a popup component with all background blured/disabled?<p>I am building a react app.</p>
<p>I want to show a popup window in the center of screen in which user can give review to the product.</p>
<p>While showing that window how to prevent scrolling of background and disable all background such that if use... | <ol>
<li>To prevent background, pop a black div that overides entire window.</li>
</ol>
<pre><code>width: 100vw;
height: 100vh;
position: fixed;
z-index: 99;
</code></pre>
<ol start="2">
<li>in that div, place another div with your content to be displayed.</li>
</ol>
<h2>Here is a working example:</h2>
<p><div class="s... | How to create a popup component with all background blured/disabled? | javascript|css|reactjs | 0 | 67 | 1 | 72,190,551 | 72,190,551 | 1 | true | 2022-05-10T17:06:57.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a popup component with all background blured/disabled?<p>I am building a react app.</p>
<p>I want to show a popup window in the center of scree... |
72,215,013 | Subquery can return 1 column only<p>The purpose of this query would be to do a calculation based on if today's date is a weekday or a weekend and use it after with Union All, however I am getting</p>
<blockquote>
<p>Msg 116 error:<br />
Only one expression can be specified in the select list when the subquery is not in... | <p>You are trying to return two columns from your subquery, into a single column of your main query.</p>
<p>Instead, you need to make two (very similar) subqueries. One for each column in your main query.</p>
<pre><code>SELECT(
SELECT(
CASE WHEN DATENAME(weekday, GETDATE()) IN (N'Saturday', N'Sunday') THEN... | Subquery can return 1 column only | sql-server|subquery|case|datediff|union-all | 0 | 46 | 1 | 72,215,407 | 72,215,407 | 1 | true | 2022-05-12T11:48:27.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Subquery can return 1 column only<p>The purpose of this query would be to do a calculation based on if today's date is a weekday or a weekend and use it afte... |
72,139,649 | Make choregraphe app predefined Pepper naoqi 2.5<p>I have an application to host a webpage that will be the menu of the robot so I need it to be executing all the time unless my other apps are on use.
I have tried with trigger condition = 1:</p>
<ul>
<li>Nature = Interactive: The app block other interactive apps such a... | <p>I solved it by using:</p>
<ol>
<li><a href="http://doc.aldebaran.com/2-4/ref/life/state_machine_management.html" rel="nofollow noreferrer">Interactive nature</a> with trigger condition as "1": makes the app run under any circumstances. (Solved in <a href="https://stackoverflow.com/questions/55688892/how-ca... | Make choregraphe app predefined Pepper naoqi 2.5 | pepper|choregraphe | 0 | 74 | 3 | 72,289,193 | 72,289,193 | 1 | true | 2022-05-06T10:01:00.223Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Make choregraphe app predefined Pepper naoqi 2.5<p>I have an application to host a webpage that will be the menu of the robot so I need it to be executing al... |
72,143,834 | Mongodb $ operator for nested documents<p>there is a wfs collection as follows:</p>
<pre><code>{
_id:'1',
transitions:
[
{
_id:'11',
checkLists:
[
{
_id:'111',
name:'One',
},
{
_id:'112',
name:'Two',
}
]
}
]
}
</cod... | <p>You can use:</p>
<pre><code>db.collection.aggregate([
{
$match: {"transitions.checkLists._id": "111"}
},
{
$project: {
transitions: {
$reduce: {
"input": "$transitions",
initialValue: [],
in: {$concatArrays: ["$$va... | Mongodb $ operator for nested documents | mongodb|mongoose|aggregate-functions | 0 | 34 | 1 | 72,144,052 | 72,144,052 | 1 | true | 2022-05-06T15:18:48.607Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mongodb $ operator for nested documents<p>there is a wfs collection as follows:</p>
<pre><code>{
_id:'1',
transitions:
[
{
_id:'11',
checkLis... |
72,142,779 | MongoDB aggregate and then flatten<p>FULL DISCLOSURE: I'm a MongoDB noob</p>
<p>I'm dealing with a legacy DB structure. A part of my MongoDB looks like this currently:</p>
<ul>
<li>Events (_id, name (string), ...)</li>
<li>Orders (_id, eventId (as string), products (array of {prodIdentifier (string), quantity (number)}... | <p>You can do something like:</p>
<pre><code>db.orders.aggregate([
{$match: {eventId: "6218b9266487367ba1c20258"}},
{
$lookup: {
from: "products",
localField: "orderItems.productCode",
foreignField: "tag",
as: "orderItemsB"
}
},
{... | MongoDB aggregate and then flatten | node.js|mongodb|rest|mongoose|backend | 0 | 77 | 1 | 72,150,419 | 72,150,419 | 1 | true | 2022-05-06T14:03:38.490Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MongoDB aggregate and then flatten<p>FULL DISCLOSURE: I'm a MongoDB noob</p>
<p>I'm dealing with a legacy DB structure. A part of my MongoDB looks like this ... |
72,157,020 | Neo4j querying over 2 relationships and compute an aggregate function on the 2 relationship<p>I have this data model:</p>
<p><a href="https://i.stack.imgur.com/mu3OA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mu3OA.png" alt="Graph model" /></a></p>
<p>With nodes:</p>
<ul>
<li>Client</li>
<li>Ven... | <p>You can do something like:</p>
<pre><code>MATCH (p:Product)<-[b:Buy]-(:Client)
WITH p, count(b) AS qty
MATCH (:Client)-[r:Recommend]->(p)
RETURN p, qty, avg(r.qualification) AS average_qualification
ORDER BY qty DESC
</code></pre>
<p>Which with this sample data:</p>
<pre><code>MERGE (a:Client{name: 'A'})
MERGE... | Neo4j querying over 2 relationships and compute an aggregate function on the 2 relationship | neo4j|cypher | 0 | 31 | 1 | 72,161,510 | 72,161,510 | 1 | true | 2022-05-07T23:20:16.690Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Neo4j querying over 2 relationships and compute an aggregate function on the 2 relationship<p>I have this data model:</p>
<p><a href="https://i.stack.imgur.c... |
72,183,365 | How to use aggregation/ lookup in mongoDB with multi results?<p>I have an "Image" collection below ( Note: labels field is an array, because 1 Image maybe have many labels)</p>
<pre><code>{
"_id" : ObjectId("624d182b6a4e7f001ed5cd9f"),
"is_deleted" : false,
"labe... | <p>The <code>$lookup</code> operation can get multiple records. In your data you have only one (<code>ObjectId("624d14d76a4e7f001ed5c6ca")</code>), which all your labels are referring to. This is the reason you get only one document in the <code>labelDocuments</code> array.</p>
<p>If your goal is to merge the... | How to use aggregation/ lookup in mongoDB with multi results? | node.js|mongodb|mongoose|mongodb-query|aggregation-framework | 0 | 39 | 2 | 72,184,374 | 72,184,374 | 1 | true | 2022-05-10T08:57:24.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use aggregation/ lookup in mongoDB with multi results?<p>I have an "Image" collection below ( Note: labels field is an array, because 1 Imag... |
72,195,091 | (n)->(on)<-(n) cypher query gives me a cartesian product<p>I have a Cypher query that goes something like this:</p>
<pre><code>MATCH (t1:Team)-[:PLAYS_ON]->(m:Match)<-[:PLAYS_ON]-(t2:Team)
RETURN t1 AS "Team 1", m AS "Match", t2 as "Team 2"
</code></pre>
<p>My goal is to have a query... | <p>One way to do it is:</p>
<pre><code>MATCH (t:Team)-[:PLAYS_ON]->(m:Match)
WITH collect(t) AS t, m
RETURN t[0] AS t1, m, t[1] AS t2
</code></pre>
<p>Which on this sample data:</p>
<pre><code>MERGE (a:Team{name: 'Team1'})
MERGE (b:Team{name: 'Team2'})
MERGE (c:Team{name: 'Team3'})
MERGE (d:Match{Date: '2022-05-11'}... | (n)->(on)<-(n) cypher query gives me a cartesian product | database|neo4j|cypher | 0 | 23 | 2 | 72,195,908 | 72,195,908 | 1 | true | 2022-05-11T03:33:15.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
(n)->(on)<-(n) cypher query gives me a cartesian product<p>I have a Cypher query that goes something like this:</p>
<pre><code>MATCH (t1:Team)-[:PLAYS_ON]-&g... |
72,198,185 | MongoDB $lookup with conditional foreignField<p>Playground: <a href="https://mongoplayground.net/p/OxMnsCFZpmQ" rel="nofollow noreferrer">https://mongoplayground.net/p/OxMnsCFZpmQ</a></p>
<p>My MongoDB version: 4.2.</p>
<p>I have a collection <code>car_parts</code> and <code>customers</code>.
As the name suggests <code... | <p><strong>EDIT</strong>: One way to do it is:</p>
<pre><code>db.car_parts.aggregate([
{
$project: {
topLevel: {$concatArrays: [{$ifNull: ["$sub_parts", []]}, ["$_id"]]},
sub_parts: 1
}
},
{$unwind: "$topLevel"},
{
$group: {
_id: "$topLevel",... | MongoDB $lookup with conditional foreignField | mongodb|aggregation | 0 | 78 | 1 | 72,199,707 | 72,199,707 | 1 | true | 2022-05-11T08:57:14.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MongoDB $lookup with conditional foreignField<p>Playground: <a href="https://mongoplayground.net/p/OxMnsCFZpmQ" rel="nofollow noreferrer">https://mongoplaygr... |
72,213,420 | Neo4j find all that match X but don't match Y<p>I have a simple domain of Students and Courses. A student can be registered for multiple courses.</p>
<p>I want to <strong>find all students registered for course 1234 that were not registered for course 5678</strong>.</p>
<p>So I tried this attempt:</p>
<pre><code>MATCH ... | <p>You can do:</p>
<pre><code>MATCH (sUnwnated:Student)-[r:REGISTRATION]->(:Course{code: "5678"}) // get all students in "5678"
WITH COLLECT(sUnwnated) AS sUnwnated // group them to a list
MATCH (sWanted:Student)-[r:REGISTRATION]->(:Course{code: "1234"}) // get all st... | Neo4j find all that match X but don't match Y | neo4j|cypher | 0 | 20 | 2 | 72,213,566 | 72,213,566 | 1 | true | 2022-05-12T09:48:24.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Neo4j find all that match X but don't match Y<p>I have a simple domain of Students and Courses. A student can be registered for multiple courses.</p>
<p>I wa... |
72,229,539 | Access root document map in the $filter aggregation (MongoDb)<p>I apologize for the vague question description, but I have quite a complex question regarding filtration in MongoDB aggregations. Please, see my data schema to understand the question better:</p>
<pre><code>Company {
_id: ObjectId
name: string
}
</code>... | <p>How about something simple like:</p>
<pre><code>db.usersCollection.aggregate([
{
$lookup: {
from: "licensesCollection",
localField: "_id",
foreignField: "userId",
as: "licensedUsers"
}
},
{$match: {"licensedUsers.0": {$exists: fa... | Access root document map in the $filter aggregation (MongoDb) | mongodb|mongodb-query|aggregation-framework|filtering | 0 | 167 | 2 | 72,235,296 | 72,235,296 | 1 | true | 2022-05-13T12:21:30.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Access root document map in the $filter aggregation (MongoDb)<p>I apologize for the vague question description, but I have quite a complex question regarding... |
72,216,593 | Rails sum all prices inside a record<p>I have a model <code>Products</code> that <code>belongs_to</code> model <code>Kit</code></p>
<p>Kit <code>has_many</code> <code>Products</code></p>
<p>¿How can I sum all of the prices of each product that belongs to a kit?</p>
<p><strong>I tried with no luck:</strong></p>
<pre><co... | <p>Try this:</p>
<pre><code>@kitprice = kit.products.sum(:price)
</code></pre>
<p>In my case i have wallet with many operations</p>
<pre><code>wallet = Wallet.first
amount = wallet.operations.sum(:amount)
</code></pre> | Rails sum all prices inside a record | ruby-on-rails | 0 | 37 | 4 | 72,216,943 | 72,216,943 | 1 | true | 2022-05-12T13:34:16.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rails sum all prices inside a record<p>I have a model <code>Products</code> that <code>belongs_to</code> model <code>Kit</code></p>
<p>Kit <code>has_many</co... |
72,222,354 | Ruby / Pundit -> user.owner_of?<p>I saw below in the pundit documentation and was wondering if that is part of some ruby or pundit magic based on user_id being present in a given model.
Or if it's just something they used to get a point across
<a href="https://github.com/varvet/pundit" rel="nofollow noreferrer">https:/... | <p>It seems to me that this is just an example of the use of a function in the user that you have to implement yourself.</p>
<p>For example:</p>
<pre><code>class User < ApplicationRecord
...
def owner_of?(resource)
self.id == resource.user.id
end
...
end
</code></pre>
<p>First condition <code>use... | Ruby / Pundit -> user.owner_of? | ruby-on-rails|pundit | 0 | 45 | 1 | 72,225,478 | 72,225,478 | 1 | true | 2022-05-12T21:41:00.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ruby / Pundit -> user.owner_of?<p>I saw below in the pundit documentation and was wondering if that is part of some ruby or pundit magic based on user_id bei... |
72,230,244 | Rails Rake Task - Delete records by passing model name and ids as params<p>I am intending to write a generic rake task that allows me to destroy a model's records after taking in model name and ids as input params</p>
<pre><code> #lib/tasks/import.rake
task :destroy_model_records, [:params] => :environment do |t... | <p>Try to load the model with <code>Object.const_get(model)</code> Then it will read the class on which the 'where' method should work. To verify the parameters, you can write them out using the <code>puts</code> method.</p>
<pre><code>#lib/tasks/import.rake
task :destroy_model_records, [:model_name, :ids] => :envi... | Rails Rake Task - Delete records by passing model name and ids as params | ruby-on-rails|rake-task | 0 | 54 | 3 | 72,230,511 | 72,230,511 | 1 | true | 2022-05-13T13:18:51.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rails Rake Task - Delete records by passing model name and ids as params<p>I am intending to write a generic rake task that allows me to destroy a model's re... |
72,226,786 | change seaborn scatter plot legend from number to text<p>Here is how I plot the decision boundary of my SVC` classifier.</p>
<pre class="lang-py prettyprint-override"><code>X, y = make_classification(n_samples=100, n_features=2, n_redundant=0,
n_clusters_per_class=1, weights=[0.9], flip_y=0, random_state=1)
# fit ... | <p>Replace last line as...</p>
<pre><code>plt.plot(x_points, y_points, c='r')
plt.legend(["Cat", "Dog"])
</code></pre>
<p>If you need the same shape, you will need to create custom legend. Show below...</p>
<pre><code>ax=plt.plot(x, y, c='r')
from matplotlib.lines import Line2D
custom = [Line2D([]... | change seaborn scatter plot legend from number to text | python|python-3.x|matplotlib|seaborn | 0 | 40 | 1 | 72,227,075 | 72,227,075 | 1 | true | 2022-05-13T08:46:18.917Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
change seaborn scatter plot legend from number to text<p>Here is how I plot the decision boundary of my SVC` classifier.</p>
<pre class="lang-py prettyprint-... |
72,100,529 | Is it possible in python to specify that a generic type has some attributes and methods<p>In python I would like to create a function that would accept a generic parameter and that would return a value of the same type and I would like to somehow specify that the generic has some attributes and methods. I thought that ... | <p>Your code is almost fine. There's nothing wrong with <code>TypeVar</code> bound to <code>Protocol</code>, you use it exactly as expected. The problem is in protocol definition: <code>int</code> is not compatible with <code>ComparableProto</code>, because it has <code>def __lt__(self, __other: int) -> bool</code>.... | Is it possible in python to specify that a generic type has some attributes and methods | python-3.x|types|mypy | 0 | 34 | 1 | 72,101,374 | 72,101,374 | 1 | true | 2022-05-03T13:56:48.500Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible in python to specify that a generic type has some attributes and methods<p>In python I would like to create a function that would accept a gen... |
72,234,933 | Character Class Method issues<p>So I'm currently working on a school assignment which is to design a program that allows the user to enter some text, and then the program checks:</p>
<ol>
<li>The first letter of the first word is a capital letter (it needs to be lowercase)</li>
<li>That there are only letters and numbe... | <p>You forgot to reset to true your <code>legal</code> and <code>style</code> boolean variables.</p>
<p>At every iteration, the <code>legal</code> and <code>style</code> variables will keep containing the result of the previous input. For example, if on your first input you immediately write a variable name with an ill... | Character Class Method issues | java|character-class | 0 | 58 | 2 | 72,235,005 | 72,235,005 | 1 | true | 2022-05-13T20:08:57.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Character Class Method issues<p>So I'm currently working on a school assignment which is to design a program that allows the user to enter some text, and the... |
72,193,103 | Create a new sheet by filtering and reordering existing sheet in LibreOffice Calc<p>I am using LibreOffice Calc and I have some data that looks like this:</p>
<p><a href="https://i.stack.imgur.com/yuQ45.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yuQ45.png" alt="enter image description here" /></... | <p>JohnSUN is correct that you can achieve what you want using Pivot Table function. Here are the steps on how you can do this:</p>
<ol>
<li>Select your entire sheet or range of your data.</li>
<li>Data --> Pivot Table --> Insert or Edit.</li>
<li>In the Column Fields, remove "Data"</li>
<li>In the Colu... | Create a new sheet by filtering and reordering existing sheet in LibreOffice Calc | macros|formula|libreoffice|calc | 0 | 93 | 1 | 72,196,934 | 72,196,934 | 1 | true | 2022-05-10T21:23:20.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create a new sheet by filtering and reordering existing sheet in LibreOffice Calc<p>I am using LibreOffice Calc and I have some data that looks like this:</p... |
72,222,342 | Kubernetes can't pull private image from docker<p>I hope somebody can help me.
I'm trying to pull a private docker image with no success. I already tried some solutions that I found, but without success.</p>
<p>Docker, Gitlab, Gitlab-Runner, Kubernetes all run on the same server</p>
<p>Insecure Registry</p>
<pre><code>... | <p>First, you need to create a file in /etc/containerd/config.toml</p>
<pre><code># Config file is parsed as version 1 by default.
# To use the long form of plugin names set "version = 2"
[plugins.cri.registry.mirrors]
[plugins.cri.registry.mirrors."10.0.10.20:5555"]
endpoint = ["http://1... | Kubernetes can't pull private image from docker | docker|kubernetes|gitlab|gitlab-runner | 0 | 240 | 1 | 72,231,446 | 72,231,446 | 1 | true | 2022-05-12T21:39:09.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kubernetes can't pull private image from docker<p>I hope somebody can help me.
I'm trying to pull a private docker image with no success. I already tried som... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.