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,304,941 | Regex get matched and unmatched parts<p>I have a string that would containing and tags. I know parsing HTML with Regex is not a good option but here since I would only be getting a handful of tags from a WYSIWYG editor, I am using this approach.</p>
<p>What I want to achieve is split the string into ordinary text and... | <p>The problem is that <code>Regex.Split</code> also outputs captured substrings together with split chunks.</p>
<p>In this scenario, you need to find matches consecutively, and append chunks to the list on the go:</p>
<pre class="lang-cs prettyprint-override"><code>using System;
using System.Collections.Generic;
using... | Regex get matched and unmatched parts | c#|regex | 1 | 48 | 1 | 72,305,699 | 72,305,699 | 1 | true | 2022-05-19T12:54:10Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex get matched and unmatched parts<p>I have a string that would containing and tags. I know parsing HTML with Regex is not a good option but here since ... |
72,305,754 | Use wildcard when searching for sheet name in google sheets combined with clear range. GApp Script<p>I need help because I'm really newbie in this coding stuff.</p>
<p>I have a spreadsheet with lots of sheets, and it takes a lot of work to erase each tab.</p>
<p>I have seen a post here and tried to adapt to my needs bu... | <p>In your situation, how about the following modification?</p>
<h3>Modified script:</h3>
<pre class="lang-js prettyprint-override"><code>function clearTextCicle() {
var search = "Cicle";
var len = search.length;
var ss = SpreadsheetApp.getActive();
var sheets = ss.getSheets().filter(s => s.getName... | Use wildcard when searching for sheet name in google sheets combined with clear range. GApp Script | google-apps-script|wildcard | 1 | 48 | 1 | 72,305,874 | 72,305,874 | 1 | true | 2022-05-19T13:48:07.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use wildcard when searching for sheet name in google sheets combined with clear range. GApp Script<p>I need help because I'm really newbie in this coding stu... |
72,306,756 | Check if a word is a part of another word<p>I have two columns with some text:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>text_1</th>
<th>text_2</th>
</tr>
</thead>
<tbody>
<tr>
<td>astro lumen cosm planet</td>
<td>microcosm astronomy planet magnitude</td>
</tr>
</tbody>
</table>
</div... | <p>You can split the first column into array of words then filter the array using <a href="https://spark.apache.org/docs/3.1.1/api/python/reference/api/pyspark.sql.functions.filter.html" rel="nofollow noreferrer"><code>filter</code></a> function like this:</p>
<pre><code>from pyspark.sql import functions as F
df = spa... | Check if a word is a part of another word | string|postgresql|apache-spark|pyspark|apache-spark-sql | 0 | 48 | 2 | 72,306,949 | 72,306,949 | 1 | true | 2022-05-19T14:52:22.523Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check if a word is a part of another word<p>I have two columns with some text:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>t... |
72,309,166 | plotly python how to show bars where y values are zero<p>I would like to still show all x axis values even when the y values are zero for that bar. What am I doing wrong here?</p>
<pre><code>import plotly.express as px
import plotly.io as pio
threshold_one = ['13%', '13%', '13%', "34%", "34%", &quo... | <p>Use <code>px.bar</code> instead of <code>px.histogram</code>.</p>
<pre class="lang-py prettyprint-override"><code>import plotly.express as px
threshold_one = ['13%', '13%', '13%', "34%", "34%", "34%", "55%", "55%", "55%"]
threshold_two = ["15%", ... | plotly python how to show bars where y values are zero | python|plotly | 1 | 48 | 1 | 72,309,793 | 72,309,793 | 1 | true | 2022-05-19T17:59:53.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
plotly python how to show bars where y values are zero<p>I would like to still show all x axis values even when the y values are zero for that bar. What am I... |
72,303,207 | How to access a dynamic key in Typescript<p>I have the following code:</p>
<pre><code>type StringMapType<K extends string[]> = Record<K[number], string>
const en = {
'general': {
'hi': {
string: 'Aenean ullamcorper neque id elementum commodo. {{firstName}}',
params: ['firstName']
},
... | <p>I have wrote <a href="https://www.typescriptlang.org/play?#code/C4TwDgpgBAysBOBLAdgcwLIEMwBVwQB4BpKCAD2AmQBMBnKWhFVAbQF0A+KAXigCUIAYwD28agQDWEEMIBmUIi2QBXALYAjCPDZQAZAyZoANAaRoOAKAsjkjUsh5QA3hahQA5KipbMAG3cAXM6ubh4AFoiBwaGhjGaoQe4Agt6YDsq+vpiqIvCQ8FDIEACOytCI1KS+EKpUwGpQIqqqwtTCAHTOTrKI8IwActkQAL7D7kYhMWCY8Nm0QSzuPX... | How to access a dynamic key in Typescript | typescript | 1 | 48 | 1 | 72,312,092 | 72,312,092 | 1 | true | 2022-05-19T10:49:14.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to access a dynamic key in Typescript<p>I have the following code:</p>
<pre><code>type StringMapType<K extends string[]> = Record<K[number], str... |
72,314,306 | How to change a global variable from within a for if...?<p>My program tries to guess if an input number or letter is in a specific string. For that I have this simplified piece of code:</p>
<pre><code>obtained = False
for i in range(6+len(chosen_set)):
try_let = input("Input something")
for index, letnum... | <p>Maybe that?</p>
<pre><code>for i in range(6+len(chosen_set)):
try_let = input("Input something")
obtained = False
for index, letnum in enumerate(chosen_set):
if letnum == try_let:
obtained = True
if obtained:
# do something
else:
# do something else
</code></pre> | How to change a global variable from within a for if...? | python | 0 | 48 | 2 | 72,314,412 | 72,314,412 | 1 | true | 2022-05-20T06:13:22.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to change a global variable from within a for if...?<p>My program tries to guess if an input number or letter is in a specific string. For that I have th... |
72,319,252 | Can I make RelativeDateTimeFormatter display more units such year, month and day?<p>Here's my code:</p>
<pre><code>let startDate = Calendar.current.date(from: DateComponents(year: 2022, month: 5, day: 1)) ?? .now
let endDate = Calendar.current.date(from: DateComponents(year: 2020, month: 6, day: 2)) ?? .now
let dateCo... | <p>An alternative is <code>DateComponentsFormatter</code></p>
<pre><code>let startDate = Calendar.current.date(from: DateComponents(year: 2022, month: 5, day: 1)) ?? .now
let endDate = Calendar.current.date(from: DateComponents(year: 2020, month: 6, day: 2)) ?? .now
let dateComponentsFormatter = DateComponentsFormatte... | Can I make RelativeDateTimeFormatter display more units such year, month and day? | swift|nsdate|nsdateformatter | 0 | 48 | 1 | 72,320,725 | 72,320,725 | 1 | true | 2022-05-20T12:52:41.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can I make RelativeDateTimeFormatter display more units such year, month and day?<p>Here's my code:</p>
<pre><code>let startDate = Calendar.current.date(from... |
72,319,824 | Hierarchical query: connect_by_root does not give root value<p>I have a dataset like this one here:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>BP_ID</th>
<th>VALID_FROM</th>
<th>VALID_TO</th>
<th>LIMIT</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>15.05.1999</td>
<td>16.07.2000</td>
... | <p>Correct <code>CONNECT BY</code> version could look like</p>
<pre><code>with pretab as (
select 1 as bp_id,
to_date('15.05.1999', 'dd.mm.yyyy') as valid_from,
to_date('01.01.2000', 'dd.mm.yyyy') as valid_to,
100 as limit
from dual
union
select 1 as bp_id,
to_date('01.01.2000'... | Hierarchical query: connect_by_root does not give root value | sql|oracle|hierarchical-data | 0 | 48 | 4 | 72,321,193 | 72,321,193 | 1 | true | 2022-05-20T13:33:29.403Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hierarchical query: connect_by_root does not give root value<p>I have a dataset like this one here:</p>
<div class="s-table-container">
<table class="s-table... |
72,321,375 | Keep data entered on html form after submit with data saved via AJAX<p>I have an html form:</p>
<pre><code><form id="formfacility">
<input type="text" id="MyName">
<button type="button" id="btnCanxFormFacility">Cancel</button>
<but... | <p>When you call <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reset" rel="nofollow noreferrer"><code>reset()</code></a> on a form, it restores each input's value to its <code>defaultValue</code>.</p>
<p>So to save an "interim" state, you need to update each input's <code>defaultVa... | Keep data entered on html form after submit with data saved via AJAX | javascript|html|jquery | 0 | 48 | 1 | 72,322,090 | 72,322,090 | 1 | true | 2022-05-20T15:24:58.430Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Keep data entered on html form after submit with data saved via AJAX<p>I have an html form:</p>
<pre><code><form id="formfacility">
<i... |
72,320,869 | Column getting lost in LINQ with Method Syntax after group by<p>I'm pretty new to LINQ and trying to figure it out. I have the following statement:</p>
<pre><code>Context.dataset1
.Join(
Context.dataset2,
r => r.ID, o => o.ID,
(r, o) => new { PartID = r.PartID, Quantity = r.Quant... | <p>What if two different part ids exist for the same date? What part id would it show? If you really want the part id, then you need to include the part id in your group by. For example:</p>
<pre><code>column => new { column.PartID, column.Date }
</code></pre>
<p>This will mean that if you have multiple part ids for... | Column getting lost in LINQ with Method Syntax after group by | c#|asp.net|entity-framework|linq | 1 | 48 | 1 | 72,322,144 | 72,322,144 | 1 | true | 2022-05-20T14:46:27.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Column getting lost in LINQ with Method Syntax after group by<p>I'm pretty new to LINQ and trying to figure it out. I have the following statement:</p>
<pre>... |
72,322,630 | Getting Docker run error File does not exist or is non-readable. getwd()=='/'?<p>I got error related to reading file when I run <code>docker run ...</code>, while the shiny app works well in Rstudio.</p>
<h6>All data (Input tables), shiny app .R file and Docker file are in the same folder.</h6>
<p>First line of shiny a... | <p>Most of your Dockerfile is doing package installations (either from Linux or from what I assume is a repository of R modules). The only thing you copy from your own code directory is this file:</p>
<pre><code>COPY /app.R /app.R
</code></pre>
<p>Since the csv file is not copied into the image, it does not exist there... | Getting Docker run error File does not exist or is non-readable. getwd()=='/'? | docker|docker-compose|dockerfile | 0 | 48 | 1 | 72,322,832 | 72,322,832 | 1 | true | 2022-05-20T17:20:23.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting Docker run error File does not exist or is non-readable. getwd()=='/'?<p>I got error related to reading file when I run <code>docker run ...</code>, ... |
72,333,131 | When i try to use Regex.Replace it throws out System.ArgumentException<p>I have this peace of code:</p>
<pre class="lang-cs prettyprint-override"><code>string modz = Regex.Replace(mod, Directory.GetCurrentDirectory(), "");
</code></pre>
<p><code>mod</code> string is essentially like this:</p>
<pre class="lang... | <p>Like @GSerg pointed out, a typical directory path is unlike to be a valid regex pattern, and even if it is, it is unlikely to do the replace like you would expect.
You should use the plain <code>string.Replace</code> instead.</p>
<p>However, there are better approaches than string replacement. Depending on what you ... | When i try to use Regex.Replace it throws out System.ArgumentException | c#|regex|replace|runtime-error|system | -2 | 48 | 1 | 72,333,225 | 72,333,225 | 1 | true | 2022-05-21T20:49:38.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When i try to use Regex.Replace it throws out System.ArgumentException<p>I have this peace of code:</p>
<pre class="lang-cs prettyprint-override"><code>strin... |
72,340,556 | Can't kill robocopy subprocess from python<p>In my project on windows, I would like to start the mirroring of two directories.</p>
<p>I know that I can use python watchdog to do that, but I though that using robocopy would be easier and faster.</p>
<p>To simplify the situation, let's assume I have a GUI with two butto... | <p>By changing this:</p>
<pre><code>self.p = subprocess.Popen(command.split(), shell=True)
</code></pre>
<p>To this:</p>
<pre><code>self.p = subprocess.Popen(command.split(), shell=False)
</code></pre>
<p>... you're ensuring that the process will be started directly from the current process, without starting a new shel... | Can't kill robocopy subprocess from python | python|subprocess|robocopy | 0 | 48 | 1 | 72,343,258 | 72,343,258 | 1 | true | 2022-05-22T19:08:11.090Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't kill robocopy subprocess from python<p>In my project on windows, I would like to start the mirroring of two directories.</p>
<p>I know that I can use p... |
72,292,179 | Visio Org Chart with Connector Text<p>I've tried all day (unsuccessfully) to create an org chart that displays a variable as the connector text.</p>
<p>I am not a developer and new to visio.</p>
<p>Basically, my data looks like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="te... | <p>I don't know Visio's built in Charting solutions enough to say it is not possible out of the box, but I would let Visio generate the chart as it does and only after this would run a macro over the drawing that collects the Reports_to and Connector_text properties, identifies the right connector and finally sets it t... | Visio Org Chart with Connector Text | visio|connector | 0 | 48 | 1 | 72,344,321 | 72,344,321 | 1 | true | 2022-05-18T15:40:30.730Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Visio Org Chart with Connector Text<p>I've tried all day (unsuccessfully) to create an org chart that displays a variable as the connector text.</p>
<p>I am ... |
72,344,294 | Can I access memory location and values ( pointers and reference ) for variables in a loop, in Python 3<pre class="lang-py prettyprint-override"><code>my_num_1 = 10
my_num_2 = 20
# I want to assign value 5 to above two variables like this:
for num in [my_num_1, my_num_2]:
num = 5
</code></pre>
<p>That won't work.... | <h2><strong>Assuming you're a beginner to Python</strong></h2>
<p>What you want is a dictionary or a list. Use a dictionary if you need the variable names, but in this case a list is probably a better idea.</p>
<p><strong>Dictionary sample implementation:</strong></p>
<pre><code>nums={
"my_1": 10,
&qu... | Can I access memory location and values ( pointers and reference ) for variables in a loop, in Python 3 | python|pointers|memory|reference|for-in-loop | 0 | 48 | 1 | 72,344,444 | 72,344,444 | 1 | true | 2022-05-23T06:50:54.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can I access memory location and values ( pointers and reference ) for variables in a loop, in Python 3<pre class="lang-py prettyprint-override"><code>my_num... |
72,336,939 | R function for selecting an x amount of observations per hour\day that are evenly separated<p>I am trying to create a function that selects a defined amount of observations per a defined time frame.</p>
<p>I have managed to create a function that subsets for one observation per hour:</p>
<pre><code>#create example df
... | <p>Here's a solution that creates <code>times_per_hour</code> equally spaced intervals within every hour for every <code>Animal_ID</code>, and then chooses the first observation within that interval. If there aren't any observations within that interval, however, no observation will be chosen. So if you want 3 per hour... | R function for selecting an x amount of observations per hour\day that are evenly separated | r|time|subset | 0 | 48 | 2 | 72,351,801 | 72,351,801 | 1 | true | 2022-05-22T10:57:39.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R function for selecting an x amount of observations per hour\day that are evenly separated<p>I am trying to create a function that selects a defined amount ... |
72,357,535 | PowerShell DownloadFile for File name Changing every day<p>Code below to download a file from website:
<a href="https://www.mcafee.com/enterprise/en-us/downloads/security-updates.html" rel="nofollow noreferrer">https://www.mcafee.com/enterprise/en-us/downloads/security-updates.html</a></p>
<p><a href="https://i.stack.i... | <pre><code>$uri = [uri] "https://download.nai.com/products/datfiles/med"
$wr = Invoke-WebRequest $uri
$file = $wr.ParsedHtml.getElementsByTagName('a') |
Select-Object -Last 1 -ExpandProperty TextContent
$toDownload = [uri]::new($uri, $file)
</code></pre>
<p>is missing trailing '/' in $uri.
It should be... | PowerShell DownloadFile for File name Changing every day | powershell|automation|filenames|webclient|webrequest | 1 | 48 | 2 | 72,359,220 | 72,359,220 | 1 | true | 2022-05-24T05:19:14.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PowerShell DownloadFile for File name Changing every day<p>Code below to download a file from website:
<a href="https://www.mcafee.com/enterprise/en-us/downl... |
72,361,149 | Cut part of path in CSV without deleting rest of csv file<p>I have CSV file which looks like that:</p>
<pre><code>/users/my/temporaryprojects/project1/Assets/file.ttf,Arial Unicode MS,Regular,Arial Unicode MS,ArialUnicodeMS,Version 1.01x,Monotype
/users/my/temporaryprojects/project2/Assets/file2.ttf,Arial Unicode MS,Re... | <p>Using <code>sed</code></p>
<pre><code>$ sed s'~\(\(/[^/]*\)\{4\}\)[^,]*,~\1, ~' input_file
/users/my/temporaryprojects/project1, Arial Unicode MS,Regular,Arial Unicode MS,ArialUnicodeMS,Version 1.01x,Monotype
/users/my/temporaryprojects/project2, Arial Unicode MS,Regular,Arial Unicode MS,ArialUnicodeMS,Version 1.01x... | Cut part of path in CSV without deleting rest of csv file | bash|csv|directory|path | 2 | 48 | 3 | 72,361,403 | 72,361,403 | 1 | true | 2022-05-24T10:17:07.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cut part of path in CSV without deleting rest of csv file<p>I have CSV file which looks like that:</p>
<pre><code>/users/my/temporaryprojects/project1/Assets... |
72,366,253 | Why is my excel Chart not going to a new workbook in VBA<p>I have a excel workbook that has values in them. I'm taking those values and creating a Chart with it using VBA. The chart is then saved to a worksheet on the same excel sheet as the values. I need the Chart to be moved to a different workbook. What am I doing ... | <p>It's unclear if you want to copy the chart WITH the worksheet (and its data), or just copy "the chart" (which would just be a picture). If you copy the <code>Chart</code> object itself, it would link back to the original data in the source workbook (which I'm guessing is not what you want).</p>
<p>Your ori... | Why is my excel Chart not going to a new workbook in VBA | excel|vba|excel-2010|excel-charts|vba7 | 0 | 48 | 1 | 72,381,364 | 72,381,364 | 1 | true | 2022-05-24T16:20:32.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is my excel Chart not going to a new workbook in VBA<p>I have a excel workbook that has values in them. I'm taking those values and creating a Chart with... |
72,382,412 | C# multi level node tree<p>Hello I try to achieve this idea shown in picture:
<a href="https://i.stack.imgur.com/7T5tF.png" rel="nofollow noreferrer">node tree</a></p>
<pre><code>public interface IChildNode
{
public bool IsEnabled { get; set; }
public IParentNode Parent { get; set; }
}
public interface IPare... | <p>You would typically not use types to describe the levels the nodes are in the tree, since that would greatly limit the types of problems you can model. You only really need one interface:</p>
<pre><code>public interface INode
{
public bool? IsEnabled { get; set; }
public INode Parent { get; set; }
pu... | C# multi level node tree | c#|nodes | -2 | 48 | 1 | 72,383,579 | 72,383,579 | 1 | true | 2022-05-25T18:12:22.657Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# multi level node tree<p>Hello I try to achieve this idea shown in picture:
<a href="https://i.stack.imgur.com/7T5tF.png" rel="nofollow noreferrer">node tr... |
72,383,915 | spread key-values across multiple columns with python<p>I'm trying to transpose df into df_spread.</p>
<pre><code>import pandas
df = {"Type": ("A", "B", "B", "C","D"),
"Amount":(220, 68, 1400, 120, 99)
}
df = pandas.DataFrame(df)
</code></pre... | <p>IIUC, you can</p>
<pre class="lang-py prettyprint-override"><code>>>> df.set_index('Type').T
Type A B B C D
Amount 220 68 1400 120 99
</code></pre>
<p>(Possibly followed by some index renaming, but if you're going to concatenate with other dfs, chances are you'll probably ignore the ind... | spread key-values across multiple columns with python | python|pandas|dataframe | 1 | 48 | 2 | 72,384,076 | 72,384,076 | 1 | true | 2022-05-25T20:40:07.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
spread key-values across multiple columns with python<p>I'm trying to transpose df into df_spread.</p>
<pre><code>import pandas
df = {"Type": (&qu... |
72,384,474 | Look for an attribute value in a list of object<p>I've got a list of <code>User</code> and I try to return one of them base on <code>id</code> attributes.</p>
<pre class="lang-py prettyprint-override"><code>from pydantic import BaseModel,ValidationError
import json
class User(BaseModel):
id: int
name: str
... | <p>If you want the fastest search times I would recommend using a dictionary with the key being the id of the user.</p>
<p>I made a python test file to test the different data structures in python to find the fastest solution.</p>
<p>Here are the results from my findings in milliseconds:</p>
<p>List Append Time: 0.862... | Look for an attribute value in a list of object | python | 0 | 48 | 1 | 72,384,999 | 72,384,999 | 1 | true | 2022-05-25T21:44:24.427Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Look for an attribute value in a list of object<p>I've got a list of <code>User</code> and I try to return one of them base on <code>id</code> attributes.</p... |
72,385,260 | TypeError: 'float' object is not callable speedtest python<pre><code>import speedtest
st = speedtest.Speedtest()
print('Loading server...')
st.get_servers()
print('Choosing best server...')
server = st.get_best_server()
print(f'Found: {server["host"]} located in {server["country"]} ')
print('Perf... | <p>I think the issue is that <code>ping</code> is not a function. Try replacing this:</p>
<pre class="lang-py prettyprint-override"><code>resPing = st.results.ping()
</code></pre>
<p>... with this:</p>
<pre class="lang-py prettyprint-override"><code>resPing = st.results.ping
</code></pre> | TypeError: 'float' object is not callable speedtest python | python|variables|speed-test | 0 | 48 | 2 | 72,385,321 | 72,385,321 | 1 | true | 2022-05-25T23:54:27.587Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TypeError: 'float' object is not callable speedtest python<pre><code>import speedtest
st = speedtest.Speedtest()
print('Loading server...')
st.get_servers(... |
72,386,538 | What is the Regex expression for substituting every second occurrence of a word in a string?<p>The string is as below,</p>
<pre><code>LOCATION AQI CATEGORY RANGE Dhaka a 251 VERY UNHEALTHY 195-306 Chittagong b 122 CAUTION 82-162 Gazipur c 237 VERY UNHEALTHY - Narayanganj c 335 EXTREMELY UNHEALTHY - Sylhetc c 159 UNHEAL... | <p>You can use <code>regex</code> to parse your string:</p>
<pre><code>import pandas as pd
import re
s = """LOCATION AQI CATEGORY RANGE Dhaka 172 UNHEALTHY Chittagong 125 CAUTION Gazipur 178 UNHEALTHY Narayanganj 174 UNHEALTHY Sylhetc 129 CAUTION Khulna DNA DNA Rajshahi 118 CAUTION Barisal 118 CAUTION S... | What is the Regex expression for substituting every second occurrence of a word in a string? | python-3.x|regex|pandas|dataframe | 1 | 48 | 3 | 72,386,830 | 72,386,830 | 1 | true | 2022-05-26T04:01:45.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the Regex expression for substituting every second occurrence of a word in a string?<p>The string is as below,</p>
<pre><code>LOCATION AQI CATEGORY R... |
72,387,486 | How far can python go?<p>I've started python a few months ago, for school projects and I was pretty surprised at the file edition power it had without asking for <strong>any</strong> permissions. My question is, how far can python go? Can it delete System files? Can it delete normal files? I also saw a video that I did... | <p>Python can go just as far as the user running Python can. If you have the right to delete a file, then if you start Python and run a script or issue a command that deletes a file, Python will be allowed to. Python will be acting under your user account.</p>
<p>Having said that, it's not always obvious what user is r... | How far can python go? | python|system32 | 0 | 48 | 1 | 72,387,554 | 72,387,554 | 1 | true | 2022-05-26T06:14:32.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How far can python go?<p>I've started python a few months ago, for school projects and I was pretty surprised at the file edition power it had without asking... |
72,793,460 | Python: invalid syntax<p>I have written a code and I am trying to run it with python version 3.9 and I am getting this error:</p>
<pre><code>File "/home/user/hackthebox/blue/42315.py", line 928
def smb_send_file(smbConn, '/home/user/hackthebox/blue/eternalblue.exe', 'C', '/eternalblue.exe'):
</code></pre>
<p>... | <p>You should have variables as arguments to a function. If you want to have variables with default values you just assign them on the function:</p>
<pre><code>def smb_send_file(smbConn, path = '/home/user/hackthebox/blue/eternalblue.exe', lang = 'C', path2 = '/eternalblue.exe'):
</code></pre> | Python: invalid syntax | python|linux | -2 | 48 | 1 | 72,793,502 | 72,793,502 | 1 | true | 2022-06-28T21:44:01.473Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: invalid syntax<p>I have written a code and I am trying to run it with python version 3.9 and I am getting this error:</p>
<pre><code>File "/home... |
72,795,080 | Scala string to Char<p>With Scala 2.12, I am trying to find index of the 1st capitalized letter from a string. Below is my code.</p>
<pre><code>"strCapit".split("").indexWhere(_.toCharArray.head.isUpper)
</code></pre>
<p>or</p>
<pre><code>"strAfte".split("").flatMap(x=>x.toCha... | <pre><code>scala> "strCapiT".indexWhere(_.isUpper)
res1: Int = 3
scala> "str".indexWhere(_.isUpper)
res2: Int = -1
</code></pre> | Scala string to Char | scala|char | 0 | 48 | 1 | 72,795,140 | 72,795,140 | 1 | true | 2022-06-29T02:20:17.187Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scala string to Char<p>With Scala 2.12, I am trying to find index of the 1st capitalized letter from a string. Below is my code.</p>
<pre><code>"strCapi... |
72,793,686 | MVVM: Set a getDrawable from a ViewModel<p>I'm moving all my app's logic from the fragment to the ViewModel and cannot move those methods that set drawables.
Example:</p>
<pre><code>marker.icon = ContextCompat.getDrawable(requireContext(), R.drawable.waypoints_sq_blank)
</code></pre>
<p>The reason being that the <stron... | <p>The best practice for your queestion is using hilt dependency injection and injecting a custom class to your view model constructor</p>
<p>you can create a class to use it in all view models like this:</p>
<pre><code>class AppResourceProvider(private val context: Context) {
fun getString(id: Int): String {
... | MVVM: Set a getDrawable from a ViewModel | android|kotlin|mvvm | 0 | 48 | 1 | 72,796,305 | 72,796,305 | 1 | true | 2022-06-28T22:13:15.947Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MVVM: Set a getDrawable from a ViewModel<p>I'm moving all my app's logic from the fragment to the ViewModel and cannot move those methods that set drawables.... |
72,793,383 | How to retrieve object from database using LINQ expression from many-to-many join table<p>I want to retrieve all <code>players</code> from <code>db</code> for one <code>club</code> where they are in <code>M:M</code> relationship using <code>PlayerClubs</code> join table. My code is working but really doesn't want that ... | <p>Your query:</p>
<pre class="lang-cs prettyprint-override"><code>var query =
from c in _context.Clubs
where c.Id == id
select new ClubViewModel
{
Players = c.PlayerClubs.Select(pc => pc.Player).ToList(),
Club = c,
};
var result = await query.ToListAsync();
</... | How to retrieve object from database using LINQ expression from many-to-many join table | asp.net-mvc|linq|.net-core|entity-framework-core | 0 | 48 | 1 | 72,800,735 | 72,800,735 | 1 | true | 2022-06-28T21:35:22.623Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to retrieve object from database using LINQ expression from many-to-many join table<p>I want to retrieve all <code>players</code> from <code>db</code> fo... |
72,803,336 | cant get api from local web server<p>i want to get data from my api web server. I tested on Postman the data is there, even when I try it on my browser the data is still there. but when i want to use the api in my flutter app why is the api empty.</p>
<p>postman tested <a href="https://i.stack.imgur.com/4KfdO.png" rel=... | <p>You shouldn't need Dio for a simple request like this; just use <code>package:http</code>.</p>
<p>There are a couple of problems with your code. In Postman you are using the POST verb, but GET in Dart. You are also telling the server you are sending JSON, but it want (see your Postman request) form data.</p>
<p>Try ... | cant get api from local web server | laravel|flutter|dart | 0 | 48 | 1 | 72,804,574 | 72,804,574 | 1 | true | 2022-06-29T14:42:41.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cant get api from local web server<p>i want to get data from my api web server. I tested on Postman the data is there, even when I try it on my browser the d... |
72,805,236 | Google App Script : Retrieve value of a cell that is a formula, script is returning [0.0]<p>I actually can't believe that I'm asking for something as simple as this, but anyway.</p>
<p>I have a report hub, with entries to complete, and I'd like to get everyone's number of entries left and send a Slack message. My issue... | <p>Try this:</p>
<pre><code>function Values() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("Summary!B7:B28");
var data = range.getDisplayValues();
Logger.log(JSON.stringify(data))
}
</code></pre> | Google App Script : Retrieve value of a cell that is a formula, script is returning [0.0] | javascript|google-apps-script|google-sheets | 0 | 48 | 1 | 72,805,412 | 72,805,412 | 1 | true | 2022-06-29T17:00:01.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google App Script : Retrieve value of a cell that is a formula, script is returning [0.0]<p>I actually can't believe that I'm asking for something as simple ... |
72,806,145 | Keep columns if column contains string<p>This has been answered similarly at <a href="https://stackoverflow.com/questions/66715267/how-to-keep-a-row-if-any-column-contains-a-certain-substring">How to keep a row if any column contains a certain substring?</a>. However, my problem involves multiple dataframes within a li... | <p>You can booleaing mask <code>df.columns</code> then use <code>df.loc</code> to select the remaining columns</p>
<pre class="lang-py prettyprint-override"><code>dfs = [df.loc[:, df.columns[df.apply(lambda col: col.str.contains('Sepal.Width')).any()]]
for df in reply_pred]
</code></pre>
<pre><code>for df in dfs... | Keep columns if column contains string | python|pandas | 0 | 48 | 1 | 72,806,315 | 72,806,315 | 1 | true | 2022-06-29T18:21:32.380Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Keep columns if column contains string<p>This has been answered similarly at <a href="https://stackoverflow.com/questions/66715267/how-to-keep-a-row-if-any-c... |
72,807,270 | How to convert an array of strings into a number?<p>I'm fetching data from an API which returns currency exchange rates like so:</p>
<pre><code>{"EUR_USD":1.044136}
</code></pre>
<p>I was able to manipulate the fetched data using:</p>
<p><code>const rate = Object.values(data).splice(11,5);</code></p>
<p>which... | <p>The example data you have supplied is an plain old Javascript object literal:</p>
<pre><code>{"EUR_USD":1.044136}
</code></pre>
<p>You just need to access the exchange rate(s) by their name. Assuming it's in a variable called <code>rates</code>, it's just</p>
<pre><code>const rate = rates.EUR_USD;
</code><... | How to convert an array of strings into a number? | javascript|reactjs | 0 | 48 | 3 | 72,807,428 | 72,807,428 | 1 | true | 2022-06-29T20:10:11.217Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert an array of strings into a number?<p>I'm fetching data from an API which returns currency exchange rates like so:</p>
<pre><code>{"EUR_US... |
72,810,741 | Flutter: changing dart SDK<p>I want to change my sdk version from 2.16.2 to 2.17.1 while I'm using android studio <strong>(for a single project only)</strong></p>
<p>could someone please help me with this issue?</p>
<p>Thanks</p> | <p>From File>Settings>Languages&Frameworks>Dart,
Enable Dart support for the project,
write dart sdk path
<a href="https://i.stack.imgur.com/2jvC9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2jvC9.png" alt="enter image description here" /></a></p> | Flutter: changing dart SDK | flutter|dart | 2 | 48 | 4 | 72,811,009 | 72,811,009 | 1 | true | 2022-06-30T05:35:33.230Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter: changing dart SDK<p>I want to change my sdk version from 2.16.2 to 2.17.1 while I'm using android studio <strong>(for a single project only)</strong... |
72,810,921 | Exclude blanks from grid but preserve order of values and their original column<p>See picture or see this <a href="https://docs.google.com/spreadsheets/d/1eOORepGsfmD91y1nhqOI8-S068xE5Ksl4XbkAcpfvB0/edit#gid=0" rel="nofollow noreferrer">sheet</a></p>
<p>Assuming the number of columns can change, how can I remove blank ... | <pre><code>=ArrayFormula(TRANSPOSE(SPLIT(REGEXREPLACE(TRANSPOSE(QUERY(A2:C&"♦",,10^7)),"(♦ )+|♦$","$1"),"♦ ",FALSE)))
</code></pre> | Exclude blanks from grid but preserve order of values and their original column | google-sheets|google-sheets-formula|array-formulas | 0 | 48 | 3 | 72,811,840 | 72,811,840 | 1 | true | 2022-06-30T05:56:14.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Exclude blanks from grid but preserve order of values and their original column<p>See picture or see this <a href="https://docs.google.com/spreadsheets/d/1eO... |
72,812,645 | How to activate TypeScript verification of types?<p>I'm trying to follow a tutorial in which this sample of code is expected to fail. But in my machine it works just fine.</p>
<pre class="lang-js prettyprint-override"><code>// example.ts
let age: number;
age = 15;
console.log(age);
age = "foo";
console.log... | <p><a href="https://deno.com/blog/v1.23#no-type-checking-by-default" rel="nofollow noreferrer">Starting in v<code>1.23</code>, by default, Deno does not type-check your code when executing it.</a></p>
<p>You can type-check your code (without executing it) using the command <code>deno check</code>. You can also type-che... | How to activate TypeScript verification of types? | typescript|deno | 0 | 48 | 1 | 72,812,958 | 72,812,958 | 1 | true | 2022-06-30T08:33:13.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to activate TypeScript verification of types?<p>I'm trying to follow a tutorial in which this sample of code is expected to fail. But in my machine it wo... |
72,812,517 | Adding data points to my dataframe is too slow, is there a faster way with Pandas?<p>I have the following problem. Let's say that I have a <code>dataframe</code> called <code>file_data</code>, which has 3 columns <code>TS_ns</code>, <code>VALUE_NUMBER</code> and <code>Alias</code></p>
<pre class="lang-py prettyprint-ov... | <p>You can achieve this using <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pivot.html" rel="nofollow noreferrer"><code>.pivot()</code></a>:</p>
<pre><code>file_data.pivot(index='Alias', columns='TS_ns', values='VALUE_NUMBER')
TS_ns 3 7 32 34 54
Alias ... | Adding data points to my dataframe is too slow, is there a faster way with Pandas? | python|python-3.x|pandas|dataframe|data-analysis | 0 | 48 | 1 | 72,814,334 | 72,814,334 | 1 | true | 2022-06-30T08:23:52.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding data points to my dataframe is too slow, is there a faster way with Pandas?<p>I have the following problem. Let's say that I have a <code>dataframe</c... |
72,814,411 | How to group by with sum in javascript using the reduce method<p>I have the following array:</p>
<pre><code>let array = [
{ date: '2022-06-29', cost: 3.874886 },
{ date: '2022-06-28', cost: 3.357631 },
{ date: '2022-06-28', cost: 92.24 },
{ date: '2022-06-28', cost: 221.47 },
{ date: '2022-06-28', cost: 164.8... | <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>let array = [
{ date: '2022-06-29', cost: 3.874886 },
{ date: '2022-06-28', cost: 3.357631 },
{ date: '2022-06-28', cost: 92.2... | How to group by with sum in javascript using the reduce method | javascript|arrays | 1 | 48 | 3 | 72,814,484 | 72,814,484 | 1 | true | 2022-06-30T10:43:01.997Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to group by with sum in javascript using the reduce method<p>I have the following array:</p>
<pre><code>let array = [
{ date: '2022-06-29', cost: 3.874... |
72,810,153 | A better way to implement a large amount of cascading roles and authorities in Spring Security?<p>So i'm currently refactoring the backend code for my organization to prep for future upgrades. It currently runs fine, its just that the code is getting quite messy because of the sheer amount of roles and authorizations t... | <p>Here's how I ended up going about this, thanks to M. Deinum for showing me that Hierarchial Roles exist in spring security.</p>
<p>So what I did was create Role Hiearchies like so:</p>
<pre><code>@Bean
public RoleHierarchyImpl roleHierarchy() {
RoleHierarchyImpl roleHierarchy = new RoleHierarchyImpl();
... | A better way to implement a large amount of cascading roles and authorities in Spring Security? | java|spring|spring-boot|spring-security|spring-security-oauth2 | 3 | 48 | 1 | 72,818,394 | 72,818,394 | 1 | true | 2022-06-30T03:58:20.337Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
A better way to implement a large amount of cascading roles and authorities in Spring Security?<p>So i'm currently refactoring the backend code for my organi... |
72,825,651 | Javascript - Sort array of objects by property date<p>I have the following response from a service:</p>
<pre><code>const arrDate = [
{
"id":1,
"birthDate":"2022-06-30T14:38:28.003"
},
{
"id":2,
"birthDate":"2022-06-30T14:36:48.50"
},
... | <p>The problem is that the comparison function is supposed to return a positive number for if a should be after b, negative if b should be after a, and zero if they should keep the same order. Your function is returning true and false, JS converts true to 1 and false to zero. That means you are never telling sort to pu... | Javascript - Sort array of objects by property date | javascript|typescript|sorting | 0 | 48 | 2 | 72,825,921 | 72,825,921 | 1 | true | 2022-07-01T07:19:04.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript - Sort array of objects by property date<p>I have the following response from a service:</p>
<pre><code>const arrDate = [
{
"id":1... |
72,828,489 | Dynamically set variables inside function<p>There is some old script I am trying to use, but with different parameters than the ones that are currently hard-coded.</p>
<p>I thought about putting the code into a function and dynamically set the variables inside.</p>
<pre><code>def run_test(**kwargs):
print(locals())... | <p>You need to use <code>eval()</code> function to correctly access local variable inside the function:</p>
<pre><code>def run_test(**kwargs):
print(locals())
locals().update(kwargs)
print(locals())
print(eval("a"))
run_test(a=2, b=3)
</code></pre>
<p><strong>Output:</strong></p>
<pre><code>... | Dynamically set variables inside function | python|dynamic|local-variables|keyword-argument | 1 | 48 | 1 | 72,828,573 | 72,828,573 | 1 | true | 2022-07-01T11:20:12.500Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dynamically set variables inside function<p>There is some old script I am trying to use, but with different parameters than the ones that are currently hard-... |
72,828,917 | Replace each occurrence of character/word with different word in javascript<pre class="lang-js prettyprint-override"><code>var string = "Please click on dashboard and then open the dashboard details to verify your details on the data";
var stringArray = ["dashboard" , "dashboard" , "d... | <p>I propose to solve this problem using the reduce method and a regular expression, where the regular expression will be the n-element of the stringArray array.</p>
<p>Through reduce, we will achieve that by replacing the word in the variable "string" at each iteration, for the next iteration we will already... | Replace each occurrence of character/word with different word in javascript | javascript|html|jquery | -3 | 48 | 1 | 72,829,059 | 72,829,059 | 1 | true | 2022-07-01T11:56:44.187Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace each occurrence of character/word with different word in javascript<pre class="lang-js prettyprint-override"><code>var string = "Please click on... |
72,830,586 | Compare two timeframes in two tables to receive validated timeframes<p>I have two tables containing the same fields:</p>
<ul>
<li>"<em>(first/second)id</em>", identifying the row</li>
<li>"<em>valid_from</em>", identifying the beginning date - involved in the join</li>
<li>"<em>valid_until</em>... | <p>You should enclose both dates from the table "<em>second</em>" inside dates from the table "<em>first</em>" and you should get your output:</p>
<pre><code>SELECT f.firstid,
s.secondid,
attribute,
attribute2,
CASE WHEN f.valid_from >= COALESCE(s.valid_from, -1)
... | Compare two timeframes in two tables to receive validated timeframes | sql|sql-server | 1 | 48 | 1 | 72,831,103 | 72,831,103 | 1 | true | 2022-07-01T14:13:05.117Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Compare two timeframes in two tables to receive validated timeframes<p>I have two tables containing the same fields:</p>
<ul>
<li>"<em>(first/second)id<... |
72,833,935 | Pandas Scatter Plot Filtered by Multiple Row Conditions and X, Y Column Values<p>Thank you for your ideas - I have been trying to make a scatter plot using a loop to filter for unique (2) row values for x values (column data) and y values (column data). The column data for the scatter plot is made when the 2 row condit... | <p>I think you're very close, here's a solution using matplotlib which is kind of long and unwieldy but I think it's the correct solution. Then I also show using a different library called seaborn which makes plots like this much easier</p>
<pre><code>import pandas as pd
import matplotlib as mpl
import matplotlib.pyplo... | Pandas Scatter Plot Filtered by Multiple Row Conditions and X, Y Column Values | pandas|for-loop|scatter | 1 | 48 | 1 | 72,834,269 | 72,834,269 | 1 | true | 2022-07-01T19:37:58.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas Scatter Plot Filtered by Multiple Row Conditions and X, Y Column Values<p>Thank you for your ideas - I have been trying to make a scatter plot using a... |
72,836,941 | Area not clickable after using ::before<p>I'm trying to imitate a design where I have to add a pattern over the linear gradient. I've used ::before element to do that.</p>
<p>But now the hamburger icon and links are not working. When I inspect the site on the mobile viewport, it shows that body covers the whole area. I... | <p>You've set property <code>z-index: -3;</code> to header and <code>z-index: -1;</code> to it's pseudo element <code>::before</code>. It is clear that <code>header</code> has smaller <code>z-index</code> than it's pseudo element.</p>
<p>So <code>::before</code> has greater stack order than that of <code>header</code>.... | Area not clickable after using ::before | javascript|html|css | 1 | 48 | 2 | 72,837,138 | 72,837,138 | 1 | true | 2022-07-02T06:27:05.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Area not clickable after using ::before<p>I'm trying to imitate a design where I have to add a pattern over the linear gradient. I've used ::before element t... |
72,839,495 | Sort by date and group by name - latest appointment for every person with names in descending order<p>My table in MySQL 8.0.29 looks like this</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Name</th>
<th>Appointment</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bob</td>
<td>2022-06-01</td>
</tr>
<t... | <p>You can use <code>GROUP By</code></p>
<pre><code>SELECT NAme, MAX(Appointment) FROM mytable GROUP BY Name
</code></pre>
<p>Or otu can use Window functions</p>
<pre><code>SELECT Name,Appointment
FROM (
SELECT Name, Appointment, ROW_NUMBER() OVER(PARTITION BY Name ORDER BY Appointment DESC) rn) t1
WHERE rn = 1
</code>... | Sort by date and group by name - latest appointment for every person with names in descending order | mysql|sql | 0 | 48 | 2 | 72,839,525 | 72,839,525 | 1 | true | 2022-07-02T13:42:37.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sort by date and group by name - latest appointment for every person with names in descending order<p>My table in MySQL 8.0.29 looks like this</p>
<div class... |
72,807,985 | all products use only one products details page, information shown should depend on which product was clicked<p>I am coding an e-commerce webpage with HTML, CSS, and JavaScript with the support of PHP and MySQL (mysqli). I have a grid of products on display, what I wanted was that each products when clicked - directs t... | <p>as i understood the problem, you want to create a PHP page for every item that is in your database, i recommend to do a single page that get the URL and ask to the database for all the detail. With an exemple you will understand more easily.</p>
<p>In your main page (where every item is shown) we will imagine an ite... | all products use only one products details page, information shown should depend on which product was clicked | php|html|css | 0 | 48 | 1 | 72,841,481 | 72,841,481 | 1 | true | 2022-06-29T21:19:12.357Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
all products use only one products details page, information shown should depend on which product was clicked<p>I am coding an e-commerce webpage with HTML, ... |
72,842,410 | Error while updating a document in MongoDB<p>I am having an admin portal in which I am handling all the collections that exist in my Mongo database. Now, I am building the update operations. I want to find a user that exist with his username and update the document with the changes that the admin performed.</p>
<p>For ... | <p>You are sending a <code>User</code> object which has an <code>_id</code> field by default. So, unknowingly you are trying to modify the <code>_id</code> field and setting it to zero. To solve this, you can simply send a normal object.</p>
<pre><code>var user = {
firstName: req.body.firstName,
lastName: r... | Error while updating a document in MongoDB | javascript|node.js|mongodb|mongoose | 0 | 48 | 2 | 72,842,594 | 72,842,594 | 1 | true | 2022-07-02T21:05:37.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error while updating a document in MongoDB<p>I am having an admin portal in which I am handling all the collections that exist in my Mongo database. Now, I a... |
72,845,061 | Node.js mongoose schema validation - when using enum, is it case sensitive?<p>when creating a mongoose schema, and using enum in order to validate the values, is it case sensitive?</p>
<p>As in:</p>
<pre><code>const mySchema = new Schema({
animal: {
type: String,
enum: ['cat', 'dog']
}
});
const myModel = d... | <p>Mongoose has several inbuilt validators. Strings have enum as one of the validators. So enum creates a validator and checks if the value is given in an array & these are case sensitive so it will throw validation error, so you can use .toLowerCase() while saving the doc.</p> | Node.js mongoose schema validation - when using enum, is it case sensitive? | node.js|mongoose | -1 | 48 | 2 | 72,845,217 | 72,845,217 | 1 | true | 2022-07-03T08:42:07.107Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Node.js mongoose schema validation - when using enum, is it case sensitive?<p>when creating a mongoose schema, and using enum in order to validate the values... |
72,845,755 | How to check actual type of a union type in Typescript?<p>I am making the following function call:</p>
<pre><code>const page : (Nft | null)[] = await metaplex.nfts().findAllByMintList(mintAddressPage);
</code></pre>
<p>Which returns a type of <code>(Nft | null)[]</code>. I want to be able to check that <code>page</code... | <p>You might want to use <a href="https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates" rel="nofollow noreferrer">predicates</a> to filter your array :</p>
<pre><code>const maybePages: (Nft | null)[] = await metaplex.nfts().findAllByMintList(mintAddressPage);
const pages = maybePages.fil... | How to check actual type of a union type in Typescript? | typescript|typechecking|union-types | 1 | 48 | 1 | 72,845,795 | 72,845,795 | 1 | true | 2022-07-03T10:34:31.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check actual type of a union type in Typescript?<p>I am making the following function call:</p>
<pre><code>const page : (Nft | null)[] = await metaple... |
72,846,330 | How to use widget lists in ListView.builder?<pre><code>
class CardPage extends StatelessWidget {
String title;
String description;
CardPage({Key key,this.title,this.description}) : super(key: key);
@override
Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context);
return Co... | <p>As you can see, you are ignoring the index..<br>
use it like this:<br></p>
<pre><code> return widget.cardList[index];
</code></pre> | How to use widget lists in ListView.builder? | android|flutter|android-widget|flutter-dependencies|flutter-widget | 1 | 48 | 3 | 72,846,458 | 72,846,458 | 1 | true | 2022-07-03T12:01:58.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use widget lists in ListView.builder?<pre><code>
class CardPage extends StatelessWidget {
String title;
String description;
CardPage({Key key,th... |
72,850,320 | How to implement different model fields for different categories?<p>I have 2 models like this:</p>
<pre><code>class Category(MPTTModel):
name = models.CharField(max_length=100)
slug = models.SlugField(unique=True)
class Product(models.Model):
name = models.CharField(max_length=70)
category = models.Fo... | <p>One possible solution to this could be to use JsonField if you're using Postgresql as a database</p>
<pre><code>from django.contrib.postgres.fields import JSONField
class Product(models.Model):
name = models.CharField(max_length=70)
category = models.ForeignKey(Category, null=True, on_delete=mod... | How to implement different model fields for different categories? | python|django|database | 2 | 48 | 1 | 72,850,486 | 72,850,486 | 1 | true | 2022-07-03T22:30:31.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to implement different model fields for different categories?<p>I have 2 models like this:</p>
<pre><code>class Category(MPTTModel):
name = models.Ch... |
72,854,762 | How to turn tensor type to original text (before tokenized) in Pytorch<p>for example, a tensor type data below is tokenized by a kind of English tokenizer.</p>
<pre><code>tensor([[ 2992, 1852, 9439, ..., 2610, 1704, 29189],
[ 1852, 9439, 7, ..., 1704, 29189, 23223],
[ 9439, 7, 2367, ..... | <p>The method you're looking for is <code>tokenizer.decode</code>, which is applied to sequences of numbers to yield the original source text. In your case, you have a batch of sentences (i.e. sequence of sequences) so you'll need to iterate the function over your tensor, i.e.</p>
<pre class="lang-py prettyprint-overri... | How to turn tensor type to original text (before tokenized) in Pytorch | python|pytorch|tensor|huggingface-transformers | 1 | 48 | 1 | 72,855,471 | 72,855,471 | 1 | true | 2022-07-04T09:46:40.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to turn tensor type to original text (before tokenized) in Pytorch<p>for example, a tensor type data below is tokenized by a kind of English tokenizer.</... |
72,857,982 | Create a new column in Spark dataframe that is a list of other column values<p>I have a dataframe called 'df' structured as follows</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: center;">ID</th>
<th style="text-align: center;">name</th>
<th style="text-align: center;">l... | <p>It's probably <a href="https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.array.html#pyspark.sql.functions.array" rel="nofollow noreferrer"><code>array</code></a> function that you're looking for.</p>
<pre class="lang-py prettyprint-override"><code>from pyspark.sql import... | Create a new column in Spark dataframe that is a list of other column values | list|dataframe|apache-spark|pyspark|azure-databricks | 0 | 48 | 1 | 72,858,227 | 72,858,227 | 1 | true | 2022-07-04T14:01:24.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create a new column in Spark dataframe that is a list of other column values<p>I have a dataframe called 'df' structured as follows</p>
<div class="s-table-c... |
72,855,502 | Python to get no. of characters of files ending with .docx from a directory and divide each file's characters by 65 and save them to an Excel File<p>I have more than 100 Files in a directory. Every File Endswith .docx</p>
<p>I want to write a python code which gets the characters count for each and every word document ... | <p>You can do it this way:</p>
<pre class="lang-py prettyprint-override"><code># uses python-docx package
import docx
import os
charCounts = {}
directory = os.fsencode('.')
for file in os.listdir(directory):
filename = os.fsdecode(file)
if filename.endswith(".docx"):
#filename = os.path.join(... | Python to get no. of characters of files ending with .docx from a directory and divide each file's characters by 65 and save them to an Excel File | python|python-3.x|excel|character|python-docx | 1 | 48 | 1 | 72,858,265 | 72,858,265 | 1 | true | 2022-07-04T10:45:34.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python to get no. of characters of files ending with .docx from a directory and divide each file's characters by 65 and save them to an Excel File<p>I have m... |
72,861,112 | Error : File-like object does not have a 'write' method, required for mode 'ostream'<p>I am trying open a fitsfile from my system I open my directory I call a star but when I open this fitsfile I get a Error</p>
<pre><code>Directory=r"C:/Users/sam/Desktop/23may.list", "r"
star1=("EFO... | <pre><code>>>> print(Directory + star1)
('C:/Users/sam/Desktop/23may.list', 'r', 'EFOSC.2021-05-24T06:02:52.743.fits')
</code></pre>
<p>This doesn't look like anything <code>fits.open()</code> expects. Construct file path properly and it will be just fine.</p>
<pre><code>>>> fitsname = 'numpy/core/te... | Error : File-like object does not have a 'write' method, required for mode 'ostream' | python | 0 | 48 | 1 | 72,861,530 | 72,861,530 | 1 | true | 2022-07-04T19:10:42.650Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error : File-like object does not have a 'write' method, required for mode 'ostream'<p>I am trying open a fitsfile from my system I open my directory I call ... |
72,865,629 | Understanding model training and evaluation in Pytorch<p>I am following a Pytorch code on deep learning. Where I saw model evaluation taking place within the training epoch!</p>
<p><strong>Q)</strong> Should the torch.no_grad and model.eval() be out of the training epoch loop?</p>
<p><strong>Q)</strong> And how to dete... | <ol>
<li><p>For each epoch, you are doing train, followed by validation/test.
For validation/test you are moving the model to evaluation model
using <code>model.eval()</code> and then doing forward propagation with
<code>torch.no_grad()</code> which is correct. Again, you are moving back the
model back to train model u... | Understanding model training and evaluation in Pytorch | python|deep-learning|pytorch | 0 | 48 | 1 | 72,865,919 | 72,865,919 | 1 | true | 2022-07-05T07:36:45.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Understanding model training and evaluation in Pytorch<p>I am following a Pytorch code on deep learning. Where I saw model evaluation taking place within the... |
72,863,675 | Display list of the last modified or updated posts in wordpress<p>Currently I have this wordpress code to show a list of the last modified or updated posts, the problem is that I have a contact form plugin, when someone sends a message through the form it is automatically shown in the list of the last modified posts .<... | <p>just add a <code>post_type</code> filter on your query,</p>
<p>should be something like</p>
<pre><code>SELECT ID, post_title
FROM $wpdb->posts
WHERE post_status = 'publish'
AND post_modified_gmt < '$today'
AND post_type = 'post' // or if you want to query both post and page just do -> AND post_type IN ... | Display list of the last modified or updated posts in wordpress | wordpress | 0 | 48 | 1 | 72,865,986 | 72,865,986 | 1 | true | 2022-07-05T03:22:25.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Display list of the last modified or updated posts in wordpress<p>Currently I have this wordpress code to show a list of the last modified or updated posts, ... |
72,867,465 | Solved : Accessing Parent Class Attributes in Child Class as classmethod<p>I have the following code which works fine :</p>
<pre><code>class Person:
def __init__(self, fname, lname) -> None:
self.firstname = fname
self.lastname = lname
def __repr__(self) -> str:
return f'{self.fir... | <p>If method is marked as <code>@classmethod</code>, it has only access to the class and not the instance to the class. Meaning you don't have access to instance variables. It has nothing to do with inheritance, you cannot even access <code>gradyear</code> attribute in that method. Meaning any variables set in <code>__... | Solved : Accessing Parent Class Attributes in Child Class as classmethod | python|python-3.x|class|methods | 0 | 48 | 1 | 72,867,616 | 72,867,616 | 1 | true | 2022-07-05T09:59:02.077Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Solved : Accessing Parent Class Attributes in Child Class as classmethod<p>I have the following code which works fine :</p>
<pre><code>class Person:
def ... |
72,870,198 | How can I get rows with specific conditions in r<p>Say that I have a <code>df</code>.</p>
<p>I want to get the <code>id</code> with two conditions at the same time:</p>
<ol>
<li><p>the <code>id</code>'s <code>code</code> should contaions a capital <code>I</code>, regardless of the number that follows it. For example <c... | <p>You could do:</p>
<pre class="lang-r prettyprint-override"><code>df |>
group_by(id) |>
filter(TRUE %in% str_detect(code, "I") & TRUE %in% (code == "E12")) |>
ungroup()
</code></pre>
<p>Output:</p>
<pre class="lang-r prettyprint-override"><code># A tibble: 10 × 3
id diag ... | How can I get rows with specific conditions in r | r|dplyr | 0 | 48 | 3 | 72,870,347 | 72,870,347 | 1 | true | 2022-07-05T13:21:52.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I get rows with specific conditions in r<p>Say that I have a <code>df</code>.</p>
<p>I want to get the <code>id</code> with two conditions at the sam... |
72,872,872 | LOOP in R: Error: variable lengths differ<p>I tried to build this Loop so that I can test two outcomes at the same time. However, it produced an error message: "Error in model.frame.default(formula = ~outcome + centered.predictor1 + : variable lengths differ (found for 'centered.predictor1')"</p>
<p>But when... | <p>The problem is when you create the rsa.data dataframe inside the loop, specifically with the outcome column. Instead of data01[n] which returns a dataframe, you should use data01[, n], which returns a numeric vector. That way all your data has the same length.</p>
<pre><code>rsa.data<-data.frame(predictor1=data01... | LOOP in R: Error: variable lengths differ | r|loops|for-loop|lme4 | 0 | 48 | 1 | 72,873,902 | 72,873,902 | 1 | true | 2022-07-05T16:39:24.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
LOOP in R: Error: variable lengths differ<p>I tried to build this Loop so that I can test two outcomes at the same time. However, it produced an error messag... |
72,873,397 | Fade out tiles in canvas image<p>Still learning Canvas. How can I fade out each tile in an image that I have as Image Data in an array:</p>
<pre><code> for (let i = 0; i < tilesY; i++) {
for (let j = 0; j < tilesX; j++) {
this.ctxTile.putImageData(this.tileData[itr],... | <p>Usually you'd just play with the <a href="https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalAlpha" rel="nofollow noreferrer"><code>ctx.globalAlpha</code></a> property at the time of drawing to your context to set your tile's alpha. However, <a href="https://developer.mozilla.org/en-US/d... | Fade out tiles in canvas image | javascript|canvas|fade|tiles | -1 | 48 | 1 | 72,876,535 | 72,876,535 | 1 | true | 2022-07-05T17:27:28.860Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fade out tiles in canvas image<p>Still learning Canvas. How can I fade out each tile in an image that I have as Image Data in an array:</p>
<pre><code> ... |
72,875,382 | Any way to make GCP VM machines user-independent?<p>I want to have VM instance that contains installed libraries/dependencies accessible for different users. I grant the roles like Compute Admin, Service Account User etc. for the users accordingly. Although they can see the folders/files/codes from the shared home fold... | <h2>Suggestion for handling login</h2>
<p>You could modify the user roles for those to have compute login on the instance and follow the instructions on <a href="https://cloud.google.com/compute/docs/oslogin/set-up-oslogin" rel="nofollow noreferrer">setting up os-login</a> to allow them to SSH via gcloud (using their o... | Any way to make GCP VM machines user-independent? | google-cloud-platform|google-compute-engine|google-iam | -2 | 48 | 1 | 72,880,393 | 72,880,393 | 1 | true | 2022-07-05T20:51:58.707Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Any way to make GCP VM machines user-independent?<p>I want to have VM instance that contains installed libraries/dependencies accessible for different users.... |
72,880,712 | Animate @GestureState on reset<p>I have a drag gesture, which has a Bool <code>@GestureState</code> that animates some changes in the view when the user is dragging. I'm using <code>@GestureState</code> to make sure the Bool is reset to false if the drag is interrupted or stops. Unfortunately, on the reset of <code>@Ge... | <p>Add animation per value of gesture state, like</p>
<pre><code> VStack {
Text("Hello World")
if isNavigating {
Text("Dragging")
}
}
.animation(.default, value: isNavigating) // << here !!
.gesture(dragGesture)
</code></pre>
<p>Tested with ... | Animate @GestureState on reset | swift|animation|swiftui | 1 | 48 | 1 | 72,880,956 | 72,880,956 | 1 | true | 2022-07-06T09:06:58.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Animate @GestureState on reset<p>I have a drag gesture, which has a Bool <code>@GestureState</code> that animates some changes in the view when the user is d... |
72,883,256 | Function to add fees to cart for Woocommerce subscription<p>I am struggling with a function to add fees to a Woocommerce Subscription, based on the number of other products in the cart. When I run it I get a critical error on the site. Can anyone see why?</p>
<pre><code>add_filter( 'woocommerce_cart_calculate_fees', 'a... | <p>There are few problems with your code.</p>
<ol>
<li><p>This hook is used on cart and checkout page and is_page(some ID) doesnt make sense.</p>
</li>
<li><p>$item is not product object so you cant use is_type()</p>
</li>
</ol>
<p>Since its unclear what you are trying to do this should be a good starting point</p>
<pr... | Function to add fees to cart for Woocommerce subscription | php|wordpress|woocommerce|woocommerce-subscriptions | 0 | 48 | 1 | 72,883,660 | 72,883,660 | 1 | true | 2022-07-06T12:02:59.267Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Function to add fees to cart for Woocommerce subscription<p>I am struggling with a function to add fees to a Woocommerce Subscription, based on the number of... |
72,883,790 | fetching and passing params in react navigation<p>On Press of a button I need to pass params to another screen where value of that button is fetched, code below;</p>
<p>screen:1</p>
<pre><code> <TouchableOpacity
onPress={() => navigation.navigate("Quiz", { fetch: "history" })}
... | <p>The issue is that <code>fetch</code> is a native function in javascript (see <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" rel="nofollow noreferrer">here</a>).</p>
<p>You should rename the param to another name like <code>quizz</code>.</p>
<p>screen:1</p>
<pre><code><TouchableOpacity
... | fetching and passing params in react navigation | javascript|react-native|expo|fetch|react-navigation | 0 | 48 | 1 | 72,884,122 | 72,884,122 | 1 | true | 2022-07-06T12:44:08.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
fetching and passing params in react navigation<p>On Press of a button I need to pass params to another screen where value of that button is fetched, code be... |
72,890,311 | Github action reuse env variable inside other<p>I want to reuse one env variable inside other env variable in YAML Github actions.</p>
<p>I have tried this:</p>
<pre><code>name: BUILD AND PUBLISH
on:
push:
branches: "master"
pull_request:
branches: "master"
jobs:
build:
... | <p>Environment variables are only available in steps after the one they're set in (<a href="https://docs.github.com/en/actions/learn-github-actions/environment-variables#passing-values-between-steps-and-jobs-in-a-workflow" rel="nofollow noreferrer">docs</a>).</p>
<p>You can either use separate steps:</p>
<pre class="la... | Github action reuse env variable inside other | github|yaml|github-actions | 1 | 48 | 1 | 72,890,381 | 72,890,381 | 1 | true | 2022-07-06T22:00:40.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Github action reuse env variable inside other<p>I want to reuse one env variable inside other env variable in YAML Github actions.</p>
<p>I have tried this:<... |
72,890,299 | Get text field and use it to build a Facebook sharing link<p>I am building a free utility to help mobile users share a YouTube video with a manually configured start time (YouTube does not offer this feature in their mobile website and apps).</p>
<p>The user pastes the link to the video and then configures the start ti... | <p>By default I'm hiding the link since it will not have a HREF on load. Then I set the HREF using setAttribute by calling the link by a class.</p>
<p>Then I have a class called active that is added to the link to display the link.</p>
<p>For my answer I removed your image, but you can add that back in.</p>
<p><div cla... | Get text field and use it to build a Facebook sharing link | javascript|jquery|facebook | 1 | 48 | 2 | 72,890,412 | 72,890,412 | 1 | true | 2022-07-06T21:58:51.217Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get text field and use it to build a Facebook sharing link<p>I am building a free utility to help mobile users share a YouTube video with a manually configur... |
72,889,306 | Is there a library for promptForCredentials with firebase?<p>I am trying to learn how to delete users from the Firebase Auth provided, but when I click on the delete button on my html it gives me <code>Uncaught ReferenceError: promptForCredentials is not defined</code>
I can't find any information on if I am suppose to... | <p>It looks like you copied code from the Firebase documentation on re-authenticating a user, which shows:</p>
<pre><code>const user = firebase.auth().currentUser;
// TODO(you): prompt the user to re-provide their sign-in credentials
const credential = promptForCredentials();
user.reauthenticateWithCredential(credent... | Is there a library for promptForCredentials with firebase? | javascript|firebase | 0 | 48 | 1 | 72,890,621 | 72,890,621 | 1 | true | 2022-07-06T20:08:16.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a library for promptForCredentials with firebase?<p>I am trying to learn how to delete users from the Firebase Auth provided, but when I click on th... |
72,892,683 | Replace comma to convert to numeric and introduce NA if there is character entry in r<p>I have a data frame DF in which few columns are having comma and character values in it. I want to remove comma and replace character values with blank. But want to retain col5 as it is. I should convert only col1 to col4 to numeric... | <p>You may try</p>
<pre><code>library(dplyr)
library(stringr)
DF %>%
mutate(across(col1:col4, ~as.numeric(str_remove(.x, ","))))
col1 col2 col3 col4 col5
1 1 33 67345 NA gb
2 45 33345 77 43 rt
3 30 87 90 23 dc
4 35 89 NA 55 ty
</code></pre> | Replace comma to convert to numeric and introduce NA if there is character entry in r | r|gsub | -2 | 48 | 2 | 72,892,704 | 72,892,704 | 1 | true | 2022-07-07T05:27:50.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace comma to convert to numeric and introduce NA if there is character entry in r<p>I have a data frame DF in which few columns are having comma and char... |
72,903,764 | jQuery mobile menu toggle not closing<p>I'm having an issue trying to close my mobile menu with jQuery. It opens fine and changes the attribute of the element as intended but doesn't fire on the second click, so everything after the else doesn't seem to happen.</p>
<p>The only thing I found that may be of consideration... | <p>To do what you require you can just use the <code>toggle()</code> method to alternate the display state of an element. In addition you don't need to use the <code>data</code> attribute to store the state of the element, you can just read it from the DOM using the <code>:visible</code> selector.</p>
<p>Also note that... | jQuery mobile menu toggle not closing | javascript|html|jquery|css|navigation | 1 | 48 | 1 | 72,903,865 | 72,903,865 | 1 | true | 2022-07-07T20:19:03.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jQuery mobile menu toggle not closing<p>I'm having an issue trying to close my mobile menu with jQuery. It opens fine and changes the attribute of the elemen... |
72,905,010 | Error: This expression has a type of 'void' so its value can't be used (Flutter)<p>I got these errors:</p>
<p><a href="https://i.stack.imgur.com/Cuk1n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cuk1n.png" alt="enter image description here" /></a></p>
<p>This is my code:</p>
<pre><code>import 'pa... | <p>The parameters of <code>EntradaTempo</code> for <code>inc</code> and <code>dec</code> are probably some sort of <code>Function</code>, maybe a <code>VoidCallback</code>. The issue here is that you are not passing the function to the parameter, but you are calling the function and passing its return type, which might... | Error: This expression has a type of 'void' so its value can't be used (Flutter) | flutter | 0 | 48 | 2 | 72,905,041 | 72,905,041 | 1 | true | 2022-07-07T22:52:10.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error: This expression has a type of 'void' so its value can't be used (Flutter)<p>I got these errors:</p>
<p><a href="https://i.stack.imgur.com/Cuk1n.png" r... |
72,903,304 | How to access nested values from json api response in React-admin?<p>The API endpoint returns the following json when a front end user visits the http://localhost:3000/#/org/ou-cb2 edit page:</p>
<pre><code>{"orgid":"ou-cb2",
"recordtype":"aws_org",
"arn":"arn:aws:... | <p>React-admin provides the <code><ArrayField></code> and <code><ArrayInput></code> components to visualize and edit nested arrays:</p>
<pre><code>export const OrgEdit = () => (
<Edit title='{<OrgTitle Placeholder />}'>
<SimpleForm>
<TextInput disabled source=... | How to access nested values from json api response in React-admin? | react-admin | 0 | 48 | 1 | 72,908,686 | 72,908,686 | 1 | true | 2022-07-07T19:32:38.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to access nested values from json api response in React-admin?<p>The API endpoint returns the following json when a front end user visits the http://loca... |
72,911,888 | Take user to checkout before upgrading subscription or increasing units<p>I have 3 packages. Free, basic, and premium. They are worth $0.00, $100.99, and $200.99 per year respectively. They are sold on the basis of quantity. For example, you can have 5 basic subscriptions. The user can upgrade number of quantity and pl... | <p>You can tailor <a href="https://stripe.com/docs/billing/subscriptions/upgrade-downgrade" rel="nofollow noreferrer">upgrade</a> behavior with <a href="https://stripe.com/docs/billing/subscriptions/prorations" rel="nofollow noreferrer">prorations</a>. I recommend reading those two links and then also taking a peek at ... | Take user to checkout before upgrading subscription or increasing units | node.js|stripe-payments|payment|subscription|stripe-payments-js | 0 | 48 | 1 | 72,913,387 | 72,913,387 | 1 | true | 2022-07-08T13:08:05.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Take user to checkout before upgrading subscription or increasing units<p>I have 3 packages. Free, basic, and premium. They are worth $0.00, $100.99, and $20... |
72,914,963 | How to save css style of element after refreshing the page in JavaScript?<p>For example, after clicking on <strong>Hide</strong> button some items disappear</p>
<pre><code>function hideItem() {
targList = document.getElementsByClassName("completed");
document.getElementsByClassName(&qu... | <p>You can't store DOM into localStorage. You'd have to save identifying code for each element. For example, <code>id</code>.</p>
<p>Then do the opposite after loading the page.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="sn... | How to save css style of element after refreshing the page in JavaScript? | javascript|html|css | 0 | 48 | 1 | 72,915,107 | 72,915,107 | 1 | true | 2022-07-08T17:28:16.260Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to save css style of element after refreshing the page in JavaScript?<p>For example, after clicking on <strong>Hide</strong> button some items disappear<... |
72,910,804 | Storing array as json in database using codeigniter php not working<p>i am trying to store an array as json in database using codeigniter website like below:</p>
<pre><code>$this->db->insert('orders',
array('orderstatus' => $orderstatus,
'productname' => json_encode(... | <p>For me it works:</p>
<pre><code>$products = [
(object)[
"name" => "Test product",
"attribute1" => "Value1"
]
];
$this->db->table("orders")->insert([
"name" => "Order for client",
"info" ... | Storing array as json in database using codeigniter php not working | php|mysql|json|codeigniter|codeigniter-3 | 0 | 48 | 1 | 72,916,322 | 72,916,322 | 1 | true | 2022-07-08T11:35:50.040Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Storing array as json in database using codeigniter php not working<p>i am trying to store an array as json in database using codeigniter website like below:... |
72,916,828 | (.net) OracleDataReader falsely returning empty array from json_array() (works in sql developer)<p>I am trying to fetch a collection of custom objects from an oracle db (v21) from a .net client. Since i cant do any type mapping i want to fetch it as json.</p>
<p>Here is the query:</p>
<pre><code>select json_array("... | <p>Un<code>COMMIT</code>ted data is only visible within the session that created it (and will <code>ROLLBACK</code> at the end of the session if it has not been <code>COMMIT</code>ted). If you can't see the data from another session (i.e. in C#) then make sure you have issued a <code>COMMIT</code> command in the SQL cl... | (.net) OracleDataReader falsely returning empty array from json_array() (works in sql developer) | c#|.net|oracle|oracle-sqldeveloper|oracle.manageddataaccess | 1 | 48 | 2 | 72,917,013 | 72,917,013 | 1 | true | 2022-07-08T20:45:24.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
(.net) OracleDataReader falsely returning empty array from json_array() (works in sql developer)<p>I am trying to fetch a collection of custom objects from a... |
72,919,467 | Unity problem with creating my own fps controller<p>So I'm making a first person player controller for my game, but I have one small problem. My code works fine until I rotate 180 degrees with my camera, then the movement gets inverted.</p>
<p>Some variable declarations:</p>
<ul>
<li>horizontal is the "Horizontal&... | <p>You need to specify what gameObject the script is attached to and the hierarchy of the gameobjects involved in the scene. Probably you are translating one gameObject based in others gameObject transform and they are not parented, so if they don't move along you dont get the outcome you want.</p>
<pre><code>gameObjec... | Unity problem with creating my own fps controller | c#|unity3d|game-development | 0 | 48 | 1 | 72,919,582 | 72,919,582 | 1 | true | 2022-07-09T06:38:49.597Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unity problem with creating my own fps controller<p>So I'm making a first person player controller for my game, but I have one small problem. My code works f... |
72,899,132 | Redirect debug output of Chromium in Python<p>I have a pywebview, that launches a Qt window utilizing the QtWebEngine with Chromium on Windows.</p>
<p>When starting the webview in debug mode, the following output is of particular interest for me:</p>
<pre><code>DevTools listening on ws://127.0.0.1:8228/devtools/browser... | <p>I have made some findings that, while not directly answering the question, do lead to a conclusion:</p>
<ol>
<li><p>Why is the <code>stderr</code> of Chromium not redirected? This is because Chromium is launched in a child process by the QtWebEngine. While it would be possible, to get the output of a child process i... | Redirect debug output of Chromium in Python | python|chromium|qtwebengine|pywebview | 1 | 48 | 1 | 72,925,493 | 72,925,493 | 1 | true | 2022-07-07T13:56:15.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Redirect debug output of Chromium in Python<p>I have a pywebview, that launches a Qt window utilizing the QtWebEngine with Chromium on Windows.</p>
<p>When s... |
72,929,733 | Handle React render / flickering whilst awaiting useEffect async operaion<p>I have the below code which works really well, but I can't see to handle the fact that 'NOTHING' is displayed with a flicker as the state changes / there is re-rendering before the data is shown.</p>
<p>How can I wait until the state is updated... | <p>Should be able to accomplish this by adding another condition in your spinner return that check that <code>something</code> is available.</p>
<pre><code>import { useEffect, useState } from 'react';
import { useParams, useSearchParams, useNavigate } from 'react-router-dom';
import { useSelector, useDispatch } from 'r... | Handle React render / flickering whilst awaiting useEffect async operaion | reactjs|redux|use-effect | 0 | 48 | 1 | 72,930,177 | 72,930,177 | 1 | true | 2022-07-10T15:37:48.853Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Handle React render / flickering whilst awaiting useEffect async operaion<p>I have the below code which works really well, but I can't see to handle the fact... |
72,935,692 | Can multiple table be formed from a condition in dataframe in python?<p>I have a dataset:</p>
<pre><code> list1 list2
0 [1,3,4] [4,3,2]
1 [1,3,2] [0,4,6]
2 [4,5,8] NA
3 [6,3,7] [8,2,3]
</code></pre>
<p>Is there a process where i can find the count of the comm... | <p>The double loop would go like this:</p>
<pre><code>intersections = []
for l2 in df['list2']:
intersection = []
for l1 in df['list1']:
try:
i = len(np.intersect1d(l1,l2))
except:
i = 0
intersection.append(i)
intersections.append(intersection)
out = (pd.... | Can multiple table be formed from a condition in dataframe in python? | python|pandas|list|dataframe|loops | -1 | 48 | 1 | 72,936,329 | 72,936,329 | 1 | true | 2022-07-11T08:30:28.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can multiple table be formed from a condition in dataframe in python?<p>I have a dataset:</p>
<pre><code> list1 list2
0 [1,3,4] [4,3,... |
72,938,012 | How to show the menu of UIButton().menu only when long pressed in iOS?<p>By setting UIButton().menu, a menu can be shown when tapped.</p>
<p>And a menu is shown when long pressed, too.</p>
<p>I want to execute some another action (for example, change text) when tapped, and show a menu when long pressed.</p>
<p>How to s... | <pre><code>btn.showsMenuAsPrimaryAction = false
</code></pre> | How to show the menu of UIButton().menu only when long pressed in iOS? | ios | -2 | 48 | 1 | 72,938,344 | 72,938,344 | 1 | true | 2022-07-11T11:40:33.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to show the menu of UIButton().menu only when long pressed in iOS?<p>By setting UIButton().menu, a menu can be shown when tapped.</p>
<p>And a menu is sh... |
72,933,527 | Read CSV data from GCS bucket and then insert into a GBQ table got wrong position<p>I am working on a project which need to read the data from the GCS bucket using C# CsvHelper, then create a GBQ table and insert data into this GBQ table. However, the data got saved into GBQ is positioned in wrong places.</p>
<p>First,... | <p>I have never used a GBQ table, but it looks like you are creating a new row for every column value instead of just at the beginning of the reading of the CSV row. Does something like this work?</p>
<pre class="lang-cs prettyprint-override"><code>using (CsvReader csvr = new CsvReader(reader, CultureInfo.CurrentCultu... | Read CSV data from GCS bucket and then insert into a GBQ table got wrong position | c#|google-cloud-platform|csvhelper|gcs | 0 | 48 | 1 | 72,941,705 | 72,941,705 | 1 | true | 2022-07-11T03:51:00.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Read CSV data from GCS bucket and then insert into a GBQ table got wrong position<p>I am working on a project which need to read the data from the GCS bucket... |
72,941,963 | MongoDB - how to do Reverse lookup and get list of related data with particular object<p>I have one Order model in that i have Task subdocument.
and other model of task invites in which there is a reference of task.</p>
<p>Now i want to retrieve all tasks with their invites available.</p>
<p>I have tried with normal lo... | <p>One option is using the <code>$unwind</code> before the <code>$lookup</code>:</p>
<pre><code>db.orders.aggregate([
{$match: {_id: 1}},
{$unwind: {path: "$tasks", preserveNullAndEmptyArrays: true}},
{$lookup: {
from: "taskinvites",
let: {taskId: "$tasks._id"},
pip... | MongoDB - how to do Reverse lookup and get list of related data with particular object | mongodb|nosql|lookup | 1 | 48 | 1 | 72,942,260 | 72,942,260 | 1 | true | 2022-07-11T16:47:38.530Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MongoDB - how to do Reverse lookup and get list of related data with particular object<p>I have one Order model in that i have Task subdocument.
and other mo... |
72,942,849 | How to change field to original value using a "reset" button in wpf<p>I have a class that has several properties, one of which is editable, another of which is calculated based on the editable value. I want to initialize the editable value with something and allow the user to change it however they wish. However, I als... | <p>You can try the following:</p>
<pre><code>private void Button_Click(object sender, RoutedEventArgs e)
{
// What do I put here??
var dc = (fraction_doses ) this.DataContext:
if(dc!=null)
dc.Clear();
}
</code></pre>
<p>in your fraction_doses class add the method that clears the properties</p>
<pre><cod... | How to change field to original value using a "reset" button in wpf | c#|wpf|data-binding | -2 | 48 | 1 | 72,943,034 | 72,943,034 | 1 | true | 2022-07-11T18:03:26.577Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to change field to original value using a "reset" button in wpf<p>I have a class that has several properties, one of which is editable, another of which ... |
72,943,056 | trying to build a simple calculator with react and javascript here is addition function<p>import { Form, InputGroup, Button } from "react-bootstrap";</p>
<p>export default function About() {</p>
<p>---------------------> i want this function to perform addition but it is shown NaN even though i parseInt...... | <p>You can introduce three state for <code>numberOne</code>, <code>numberTwo</code> and for <code>total</code> using <code>useState</code> hook as:</p>
<pre><code> const [numberOne, setNumberOne] = useState(0);
const [numberTwo, setNumberTwo] = useState(0);
const [total, setTotal] = useState(0);
</code></pre>
<p><... | trying to build a simple calculator with react and javascript here is addition function | javascript|reactjs|react-bootstrap|addition | 1 | 48 | 1 | 72,943,192 | 72,943,192 | 1 | true | 2022-07-11T18:26:24.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
trying to build a simple calculator with react and javascript here is addition function<p>import { Form, InputGroup, Button } from "react-bootstrap"... |
72,938,880 | Kafka conumer.poll() argument<p>What does the argument in the .poll method mean?</p>
<pre><code>ConsumerRecords<String, String> records = consumer.poll(100);
</code></pre>
<p>Does it mean that consumer will block the execution for 100ms when there is no data in the partition? Or does it mean that it will keep pol... | <p>The poll call is a blocking call from the kafka consumer. The call will return in one of the two conditions:</p>
<ol>
<li><strong>poll duration times out</strong>: The kafka cluster will return the consumer with all the <em>new</em> messages that have been published to the topic partition (that consumer has subscrib... | Kafka conumer.poll() argument | java|apache-kafka|kafka-consumer-api | 1 | 48 | 2 | 72,943,199 | 72,943,199 | 1 | true | 2022-07-11T12:49:39.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kafka conumer.poll() argument<p>What does the argument in the .poll method mean?</p>
<pre><code>ConsumerRecords<String, String> records = consumer.poll... |
72,943,883 | cannot move out of `guess`, a captured variable in an `Fn` closure Rust<p>today I tried to write this MusicGuesser with GTK for fun and got this error:</p>
<pre><code>error[E0507]: cannot move out of `guess`, a captured variable in an `Fn` closure
--> src/main.rs:63:32
|
15 | let mut guess = Arc::new(get_gu... | <pre><code>let guess = Arc::new(get_guess());
let cloned_guess = Arc::clone(&guess);
// ...
app.connect_activate(move |app| {
// ...
button.connect_clicked(move |_| {
let guess = cloned_guess;
// ...
</code></pre>
<p>If you use something in a <code>move ||</code> closure, you move it <em>into</em> ... | cannot move out of `guess`, a captured variable in an `Fn` closure Rust | rust|mutex | 0 | 48 | 1 | 72,944,296 | 72,944,296 | 1 | true | 2022-07-11T19:46:12.317Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cannot move out of `guess`, a captured variable in an `Fn` closure Rust<p>today I tried to write this MusicGuesser with GTK for fun and got this error:</p>
<... |
72,945,243 | Type error in react using typescript: Type '(user: User) => Element' is not assignable to type '((props: User) => any) & ReactNode'<p>I am receiving the following error on the terminal, please see the attached image. The error is between two-component, I haven't worked with typescript much so it would appreciate any he... | <p><strong>Problem:</strong></p>
<p>Because you wrap the props with PropsWithChildren, it will turn out <code>children: (props: T) => any</code> to <code>children: (props: T) => any & React.ReactNode</code>.</p>
<p>Please checkout this <a href="https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAJQKYEMDGM... | Type error in react using typescript: Type '(user: User) => Element' is not assignable to type '((props: User) => any) & ReactNode' | reactjs|typescript|material-ui | 0 | 48 | 1 | 72,946,341 | 72,946,341 | 1 | true | 2022-07-11T22:23:03.307Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Type error in react using typescript: Type '(user: User) => Element' is not assignable to type '((props: User) => any) & ReactNode'<p>I am receiving the foll... |
72,951,491 | Python: Why can't I add a 3x1 array to one column of a 3x100 array?<p>Variable <code>a</code> has the shape (3,1) and variable <code>b</code> has the shape (3,100). Now, I want to add variable <code>a</code> to just one column of variable <code>b</code>, meaning:</p>
<pre><code>x[:,ii] = a + b[:,ii]
</code></pre>
<p>Ho... | <p>You need to use <a href="https://numpy.org/doc/stable/reference/generated/numpy.ravel.html" rel="nofollow noreferrer"><code>numpy.ravel()</code></a> Because <code>a.shape</code> is <code>(3,1)</code> and you need <code>(3,)</code>.</p>
<pre><code>x[:,ii] = a.ravel() + b[:,ii]
</code></pre> | Python: Why can't I add a 3x1 array to one column of a 3x100 array? | python|arrays|numpy|indexing | 1 | 48 | 1 | 72,951,768 | 72,951,768 | 1 | true | 2022-07-12T11:21:25.317Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Why can't I add a 3x1 array to one column of a 3x100 array?<p>Variable <code>a</code> has the shape (3,1) and variable <code>b</code> has the shape (... |
72,953,864 | How to fix "Specify which project or solution file to use" error where there's only one project in the folder?<p>Doing a <code>dotnet ef dbcontext scaffold</code> command, I got this error I hadn't gotten before in this project:</p>
<blockquote>
<p>MSBUILD : error MSB1011: Specify which project or solution file to use ... | <p>It's unclear why they use that error message for it, but the problem was that I had the project running in Visual Studio. <em>(Doh!)</em> Apparently, when the project is running, this is the error it gives you (as opposed to, say, something telling you the project is running and that it can't do its job when the pro... | How to fix "Specify which project or solution file to use" error where there's only one project in the folder? | c#|.net|entity-framework|dotnet-cli | 1 | 48 | 1 | 72,953,865 | 72,953,865 | 1 | true | 2022-07-12T14:19:43.167Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to fix "Specify which project or solution file to use" error where there's only one project in the folder?<p>Doing a <code>dotnet ef dbcontext scaffold</... |
72,955,883 | eliminate +0000 from retrieved date from FireStore and display in Text in ForEach loop<p>How to get just date and time without +0000 from this date I retrieved from FireStore? if this is possible, can i do all process inside a Text inside ForEach?</p>
<pre><code>return MyBook(bookDate: sub["bookDate"] as? Str... | <p>refer to this post/answer:</p>
<p><a href="https://stackoverflow.com/questions/72694311/swiftui-datepicker-how-to-display-from-firebase-database-date-and-time-without-m/72694450#72694450">swiftui datepicker how to display from firebase database date and time without milliseconds?</a></p>
<p>You can use prefix for th... | eliminate +0000 from retrieved date from FireStore and display in Text in ForEach loop | swift|google-cloud-firestore | -1 | 48 | 2 | 72,956,078 | 72,956,078 | 1 | true | 2022-07-12T16:55:40.517Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
eliminate +0000 from retrieved date from FireStore and display in Text in ForEach loop<p>How to get just date and time without +0000 from this date I retriev... |
72,960,424 | Understanding `extends (...args: unknown[]) => unknown`<p>Why does <code>Bar</code> below return <code>false</code> and how could one make it so that it behaves similarly to <code>Foo</code> - which basically returns true if the type is a function?</p>
<pre class="lang-js prettyprint-override"><code>// type Foo operate... | <p>The arguments of the function behave differently from its return value in terms of subtyping.</p>
<p>Let's see it at more simple example:</p>
<pre><code>type UniversalHandler = (arg: number | string) => number;
type NumberHandler = (arg: number) => number;
</code></pre>
<p>Here, <code>number | string</code> is... | Understanding `extends (...args: unknown[]) => unknown` | typescript | 0 | 48 | 1 | 72,960,523 | 72,960,523 | 1 | true | 2022-07-13T02:57:10.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Understanding `extends (...args: unknown[]) => unknown`<p>Why does <code>Bar</code> below return <code>false</code> and how could one make it so that it beha... |
72,960,530 | How to remove duplicates based on condition?<p>Here is my sample table:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: right;">idmain</th>
<th style="text-align: left;">idtime</th>
<th style="text-align: right;">idperson1</th>
<th style="text-align: left;">idperson2</th>... | <p>first you can use subquery to obtain max value of idperson1.
then use this condition like this:</p>
<pre><code>
select a.* from fact1 a
where idperson1=(select max(b.idperson1) from fact1 b where a.idtime=b.idtime and a.idperson2=b.idperson2);
</code></pre> | How to remove duplicates based on condition? | sql|sql-server | -1 | 48 | 1 | 72,961,030 | 72,961,030 | 1 | true | 2022-07-13T03:15:00.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove duplicates based on condition?<p>Here is my sample table:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="t... |
72,961,843 | How to "press" enter in interactive mode in Emacs Lisp?<p>I would like to press enter in my Elisp script when I am in a REPL window.</p>
<p>but <code>(newline)</code> just moves the cursor to the next line and not simulate the press of the Enter key on my keyboard.</p>
<p>Is there a function in Emacs Lisp that works in... | <p>In Emacs, depending on the mode you are, the same key may have different definitions (that is, it may be bound to different commands). The best way to simulate a key press is to get exactly which function is bound to that key. You can do that with <code>lookup-key</code>. This function will return a <em>function</em... | How to "press" enter in interactive mode in Emacs Lisp? | emacs | 1 | 48 | 1 | 72,962,710 | 72,962,710 | 1 | true | 2022-07-13T06:31:30.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to "press" enter in interactive mode in Emacs Lisp?<p>I would like to press enter in my Elisp script when I am in a REPL window.</p>
<p>but <code>(newlin... |
72,965,820 | How to use java regex to do job like sed?<p>E.g. I've got an input string:</p>
<pre><code>2 + 5* 61.2 -(32.5+7)/ 8
</code></pre>
<p>I want to split this string into tokens of decimals and operators(+-*/and parentheses), remove blanks(space and tab) add commas in between. The expected output:</p>
<pre><code>2,+,5,*,61.2... | <p>You can do that by iterating over matched positions of your regexp like:</p>
<pre class="lang-java prettyprint-override"><code>public static void main(String[] args) throws URISyntaxException {
String input = "2 + 5* 61.2 -(32.5+7)/ 8";
Pattern p = Pattern.compile("\\d+(?:\\.\\d+)?|[()+\\-\\*\... | How to use java regex to do job like sed? | java|regex|sed|match|token | 0 | 48 | 1 | 72,965,988 | 72,965,988 | 1 | true | 2022-07-13T11:52:33.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use java regex to do job like sed?<p>E.g. I've got an input string:</p>
<pre><code>2 + 5* 61.2 -(32.5+7)/ 8
</code></pre>
<p>I want to split this stri... |
72,969,798 | How to do I add date and time to name of folder that is created with python shutil?<p>I'm trying to write a python script that will automatically copy files in my local drive and to my network drive. I want to add a the time and date to the name of the destination folder. This is my code:</p>
<pre class="lang-py prett... | <p>@FObersteiner was correct. The reason why it wasn't working was due to that fact that windows 10 does not allow colons (<code>:</code>) to be used as a character for filenames. I should have seen this myself. Thanks for your help!!</p> | How to do I add date and time to name of folder that is created with python shutil? | python|datetime|shutil | 0 | 48 | 2 | 72,971,315 | 72,971,315 | 1 | true | 2022-07-13T16:42:29.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do I add date and time to name of folder that is created with python shutil?<p>I'm trying to write a python script that will automatically copy files ... |
72,973,712 | Pandas create new column in df2 from another df1 column2 if a value in df1 column1 matches value in a list<p>I need to compare items in a list to a column in df1 and create new column in df2 with value from a different column on the same row in df1, if there is a match between a list item and the compared df1 column</p... | <p>We can make the Numbers column the index of <code>df1</code> with <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.set_index.html" rel="nofollow noreferrer">set_index</a> then <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.reindex.html" rel="nofollow noreferrer">reindex<... | Pandas create new column in df2 from another df1 column2 if a value in df1 column1 matches value in a list | python|pandas|dataframe|python-3.7 | 1 | 48 | 1 | 72,973,883 | 72,973,883 | 1 | true | 2022-07-13T23:35:40.380Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas create new column in df2 from another df1 column2 if a value in df1 column1 matches value in a list<p>I need to compare items in a list to a column in... |
72,973,926 | Azure - Run bicep from registry via ARM REST api<p>I'm looking into publishing bicep templates to a Bicep registry (ACR), and then deploying them via the ARM REST api. However the REST create deployment api only allows me to specify a templateSpec - I don't see any way to reference an ACR url. Is this possible, or do I... | <p>Currently Content in the Bicep module registry can only be deployed from another Bicep file. Template specs can be deployed directly from the API, Azure PowerShell, Azure CLI, and the Azure portal. You can even use UiFormDefinition to customize the portal deployment experience.</p>
<p>You can refer to this <a href="... | Azure - Run bicep from registry via ARM REST api | azure|azure-bicep | 0 | 48 | 1 | 72,975,822 | 72,975,822 | 1 | true | 2022-07-14T00:13:00.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Azure - Run bicep from registry via ARM REST api<p>I'm looking into publishing bicep templates to a Bicep registry (ACR), and then deploying them via the ARM... |
72,965,268 | why a particular variable is undefined only at one place in the complete component<pre><code>import React from 'react';
import { Formik, Form } from "formik";
import { InputField } from "./formui/InputField";
import { applyGharwapasi } from "../../appollo/applyGharwapasi/applyGharwapasi";
... | <p>This is the code of your step 2 component.</p>
<pre><code>fetch("http://localhost:1337/api/upload/", requestOptions)
.then(response => response.text())
.then(result =>{
const output = JSON.parse(result);
console.log(output[0].id);
ApplicantImageId(output[0].id);
... | why a particular variable is undefined only at one place in the complete component | javascript|reactjs|next.js|formik | 0 | 48 | 1 | 72,976,250 | 72,976,250 | 1 | true | 2022-07-13T11:08:51.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why a particular variable is undefined only at one place in the complete component<pre><code>import React from 'react';
import { Formik, Form } from "fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.