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,843,781
How to fix Python TypeError: 'datetime.datetime' object is not callable?<p>Trying to assign the datetime.datetime.now() value to the self.startDate variable, but getting the error:</p> <p><code>TypeError: 'datetime.datetime' object is not callable</code></p> <pre><code>!/usr/bin/python3 import datetime import os cla...
<p>Try with:</p> <pre><code>self.startDate = datetime.datetime.now </code></pre> <p>The problem is that you are already calling the function within your definition and then you're calling it again.</p> <p>If what you want is to set the start date at the time of instantiation, let the first part as it was (as you posted...
How to fix Python TypeError: 'datetime.datetime' object is not callable?
python|datetime
0
56
1
72,843,794
72,843,794
2
true
2022-07-03T03:39:16.827Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to fix Python TypeError: 'datetime.datetime' object is not callable?<p>Trying to assign the datetime.datetime.now() value to the self.startDate variable,...
72,813,347
Returning only most recent audit rows using concatenation of other columns to find the correct grouping<p>I am stuck on what I thought would be a fairly straightforward query in SQL Server (I'm using 2018)</p> <p>I have a table (AUDIT_TABLE) that I have read only access to which looks like this:</p> <div class="s-table...
<p>Does this work?</p> <pre class="lang-sql prettyprint-override"><code>select DimensionA, DimensionB, DimensionC,Amount,UserID,TimeStamp from (select DimensionA, DimensionB, DimensionC,Amount,UserID,TimeStamp, row_number() over(partition by DimensionA,DimensionB,Dim...
Returning only most recent audit rows using concatenation of other columns to find the correct grouping
sql|sql-server
2
56
1
72,813,542
72,813,542
2
true
2022-06-30T09:23:52.737Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Returning only most recent audit rows using concatenation of other columns to find the correct grouping<p>I am stuck on what I thought would be a fairly stra...
72,882,547
How to git archive an untracked directory?<p>I have a CI process that runs a <code>build</code> process on my application which does things like minimizing code, obscufating etc and it outputs the result into a <code>/build</code> folder within my project.</p> <p>I have added the <code>/build</code> path to my .gitigno...
<p>Since your <code>build/</code> directory is not versioned in git (note: which is a perfectly reasonable thing to do), it makes sense to use a non git command to create an archive with that content.</p> <p>You worded, in your comment, your concerns with using a standard command : I would argue that creating a <code>....
How to git archive an untracked directory?
git
0
56
1
72,883,915
72,883,915
2
true
2022-07-06T11:10:14.620Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to git archive an untracked directory?<p>I have a CI process that runs a <code>build</code> process on my application which does things like minimizing c...
72,889,627
Can I use a Batch script to fill form fields in a PDF document?<p>I have a form field fillable PDF that I'd like to fill using a batch script, I can't use JavaScript which seems to be the preferred solution. Is this something that can be done through a batch script?</p> <p>The fields can be tabbed through and assuming ...
<p>Yes you can</p> <p><a href="https://i.stack.imgur.com/WqLlm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WqLlm.png" alt="enter image description here" /></a></p> <p>Result</p> <p><a href="https://i.stack.imgur.com/WIgnt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WIgnt.pn...
Can I use a Batch script to fill form fields in a PDF document?
batch-file|pdf
-1
56
1
72,891,867
72,891,867
2
true
2022-07-06T20:41:17.830Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can I use a Batch script to fill form fields in a PDF document?<p>I have a form field fillable PDF that I'd like to fill using a batch script, I can't use Ja...
72,829,931
Maximum non negative product in a matrix<p>I am trying to solve the following <a href="https://leetcode.com/problems/maximum-non-negative-product-in-a-matrix/" rel="nofollow noreferrer">problem</a> on leetcode.com</p> <p>I found a <a href="https://stackoverflow.com/questions/67766794/maximum-product-in-matrix">resource...
<p>This seems to be a little twist on the classic right-down dynamic program. The problem is that we need two states because our maximum could be constructed from two positives or two negatives. Generally:</p> <pre><code>if grid[i][j] &lt; 0: dp[i][j][positive] = grid[i][j] * min( dp[i-1][j][negative], ...
Maximum non negative product in a matrix
algorithm|recursion|graph|dynamic-programming|backtracking
1
56
1
72,836,283
72,836,283
2
true
2022-07-01T13:20:29.727Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Maximum non negative product in a matrix<p>I am trying to solve the following <a href="https://leetcode.com/problems/maximum-non-negative-product-in-a-matrix...
72,794,932
Perl CLI code cannot do a string line appended<p>I'm trying to use a <code>perl -npe</code> one-liner to surround each line with <code>=</code>.</p> <pre class="lang-none prettyprint-override"><code>$ for i in {1..4}; { echo $i ;} |perl -npe '...' =1= =2= =3= =4= </code></pre> <p>The following is my first attempt. Note...
<p><code>chop</code> returned the removed character, not the remaining string. It modifies the variable in-place. So the following is the correct usage:</p> <pre class="lang-bash prettyprint-override"><code>perl -npe'chop( $_ ); $_ = &quot;=$_=\n&quot;' </code></pre> <p>But we can improve this.</p> <ul> <li>It's safer ...
Perl CLI code cannot do a string line appended
perl|command-line-interface
1
56
1
72,794,977
72,794,977
2
true
2022-06-29T01:52:48.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Perl CLI code cannot do a string line appended<p>I'm trying to use a <code>perl -npe</code> one-liner to surround each line with <code>=</code>.</p> <pre cla...
72,855,833
How to Select multiple elements with the same class name JavaScript<p>what I am trying to do just show some text on click with JavaScript by giving it an active class.as you can see there are two buttons with same class of parent as-well as the children only the contents are different. but only the first button is work...
<p>I would delegate and navigate within the container</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>document.querySelector(".story").addEventListener("click", function(e) { /...
How to Select multiple elements with the same class name JavaScript
javascript|html|css
-2
56
1
72,855,897
72,855,897
2
true
2022-07-04T11:13:22.517Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Select multiple elements with the same class name JavaScript<p>what I am trying to do just show some text on click with JavaScript by giving it an act...
72,821,851
How do I get vscode autocomplete after calling a function with a union as its return type in TypeScript?<p>How do I get proper editor autocomplete after calling a function that returns a union type?</p> <p>For example, in the code below, after calling <code>getProperty&lt;ColorfulOrCircle&gt;()</code> (line 14), the va...
<p>When not specifying the generic type but letting typescript infer it, this works perfectly. But as you can see, this function now requires a generic type in its declaration. If you want to have a function that can take a generic parameter like the original function in your question, check out the playground link whe...
How do I get vscode autocomplete after calling a function with a union as its return type in TypeScript?
typescript|typescript-generics|union-types
3
56
1
72,822,772
72,822,772
2
true
2022-06-30T20:48:44.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get vscode autocomplete after calling a function with a union as its return type in TypeScript?<p>How do I get proper editor autocomplete after call...
72,897,350
Getting list of all columns corresponding to maximum value in each row in a Dataframe<p>How to get list of all columns corresponding to maximum value in each row in a Dataframe? For example, if I have this dataframe,</p> <pre><code>df = pd.DataFrame({'a':[12,34,98,26],'b':[12,87,98,12],'c':[11,23,43,1]}) a b c...
<p>You could try these codes (bot approaches do the same):</p> <pre class="lang-py prettyprint-override"><code>max_cols_df = pd.DataFrame({&quot;max_cols&quot;: [list(df[df==mv].iloc[i].dropna().index) for i, mv in enumerate(df.max(axis=1))]}) max_cols_df = pd.DataFrame({&quot;max_cols&quot;: [list(df.iloc[i][v].index)...
Getting list of all columns corresponding to maximum value in each row in a Dataframe
python|dataframe
3
56
3
72,897,930
72,897,930
2
true
2022-07-07T11:52:55.473Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting list of all columns corresponding to maximum value in each row in a Dataframe<p>How to get list of all columns corresponding to maximum value in each...
73,027,963
Pandas read_csv response codes when using an external url<p>I'm replacing <code>requests.get()</code> with <code>pd.read_csv()</code> and would like to write some exception logic if pandas does not get the equivalent of a status code 200.</p> <p>With requests, I can write:</p> <pre><code>response = requests.get(report_...
<p>You can use <code>url</code> in <code>read_csv()</code> but it has no method to gives you status code. It simply raises error when it has non-200 status code and you have to use <code>try/except</code> to catch it. You have example in other answer.</p> <p>But if you have to use <code>requests</code> then you can lat...
Pandas read_csv response codes when using an external url
python|pandas|python-requests|http-status-codes
1
56
2
73,028,306
73,028,306
2
true
2022-07-18T20:01:15.610Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas read_csv response codes when using an external url<p>I'm replacing <code>requests.get()</code> with <code>pd.read_csv()</code> and would like to write...
72,940,929
multiple CASE when statement<p>are these two statement equivalent in snowflake.</p> <p>Case 1:</p> <pre><code>CASE when VAL='ABC' then 'ALPHA' when VAL='123' then 'NUMERIC' else 'ALPHANUMERIC' end; </code></pre> <p>Case 2:</p> <pre><code>VOBJECTDESCRIPTION = CASE WHEN VAL='ABC' THEN 'ALPHA' ELSE CASE W...
<p>Well, you've got several typos which make these both different, but given the gist of what you're trying to ask: statements like these both have the same behavior.</p> <pre><code>WITH X as ( select VAL from (values ('1'), ('2'), ('ABC')) as x(VAL) ) SELECT CASE when VAL='ABC' then 'ALPHA' when VAL='123' t...
multiple CASE when statement
snowflake-cloud-data-platform|case
1
56
1
72,941,122
72,941,122
2
true
2022-07-11T15:23:12.900Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: multiple CASE when statement<p>are these two statement equivalent in snowflake.</p> <p>Case 1:</p> <pre><code>CASE when VAL='ABC' then 'ALPHA' when VA...
72,827,674
How to display a bar category on the axis when the value is 0<p>I have a dataframe column with the category of the corresponding row blood pressure systolic and diastolic values as obtained by the following function:</p> <pre><code>def classify_bp(row): if row.SYS &lt; 120 and row.DIA &lt; 80: return &quot;...
<p>You can <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.reindex.html?highlight=reindex#pandas.Series.reindex" rel="nofollow noreferrer"><code>reindex</code></a> with a list of all possible categories:</p> <pre><code># your sample data s = pd.Series(index=['normal', 'stage1', 'elevated'], data=[37...
How to display a bar category on the axis when the value is 0
python|pandas|dataframe|seaborn|bar-chart
2
56
2
72,828,073
72,828,073
2
true
2022-07-01T10:09:08.060Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to display a bar category on the axis when the value is 0<p>I have a dataframe column with the category of the corresponding row blood pressure systolic ...
72,869,580
VB how to add a list item to a class<p>No so familiar with VB how would one add to a list in a class item ?</p> <pre><code> public class Demo public Property Id as Integer public RevsList as List (of ProjectItem) end Class public class ProjectItem public Property Rev as Integer public Title as string en...
<p>You just missed out a separator and a dot before the title variable....</p> <pre><code>Dim revision as new Demo With {.id = 1} revision.RevsList.Add(new ProjectItem() With {.rev =33, .title=&quot;description&quot;}) </code></pre> <p>I also notice that you have declared <code>RevsList</code> in your demo class, but n...
VB how to add a list item to a class
vb.net
-1
56
1
72,869,727
72,869,727
2
true
2022-07-05T12:38:16.527Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: VB how to add a list item to a class<p>No so familiar with VB how would one add to a list in a class item ?</p> <pre><code> public class Demo public Prope...
72,847,921
How to select rows of tensor based on condition (tensorflow)<p>Only using tensorflow, how can I select rows of a tensor that satisfy a condition?</p> <p>Example tensor x:</p> <pre><code>&lt;tf.Tensor: shape=(3, 3), dtype=int32, numpy= array([[0, 1, 2], [1, 1, 2], [0, 1, 4]], dtype=int32)&gt; </code></pre>...
<pre><code>import tensorflow as tf x = tf.constant([[0, 1, 2], [1, 1, 2], [0, 1, 4]]) x = tf.constant([i for i in x.numpy() if i[0] == 0) </code></pre> <p>Or only with tensorflow:</p> <pre><code>a = tf.constant([[0, 1, 2], [1, 1, 2], [0, 1, 4]]) mask = tf.where(a[:,0] == 0, True, False) a = tf.boolean_mask(a, mask) <...
How to select rows of tensor based on condition (tensorflow)
python|tensorflow
0
56
1
72,849,357
72,849,357
2
true
2022-07-03T15:50:43.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to select rows of tensor based on condition (tensorflow)<p>Only using tensorflow, how can I select rows of a tensor that satisfy a condition?</p> <p>Exam...
72,894,713
Plot number of persons in each car<p>I have a pandas dataframe which looks like this:</p> <pre><code>car,id 1,1 1,2 2,3 2,4 2,5 and so on </code></pre> <p>What I want to do is make a lineplot in seaborn that shows how many ids there are in each car ( I dont care for which id that are in the car). So on the x axis I wan...
<p>If you specifically need a lineplot then this would work:</p> <pre><code>import pandas as pd import seaborn as sns data = {&quot;car&quot;: [1, 1, 2, 2, 2], &quot;id&quot;: [1, 2, 3, 4, 5]} df = pd.DataFrame(data) sns.lineplot(x=&quot;car&quot;, y=&quot;id&quot;, data=df.groupby('car').nunique()) </code></pre> <p>O...
Plot number of persons in each car
python|pandas|matplotlib|seaborn
-2
56
3
72,895,502
72,895,502
2
true
2022-07-07T08:37:45.320Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Plot number of persons in each car<p>I have a pandas dataframe which looks like this:</p> <pre><code>car,id 1,1 1,2 2,3 2,4 2,5 and so on </code></pre> <p>Wh...
72,923,114
Removing scales in a picture<p><a href="https://i.stack.imgur.com/jPLeU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jPLeU.png" alt="number image" /></a></p> <p>I have attached the picture. On the picture there are these numbers 2.06x and the picture also has white scales.</p> <p>I like to know, u...
<p>If those light stripes in the background are your concern, this might help you (otherwise I misunderstood your question). It takes color samples throughout the image (always skipping 8 pixels for performance, you can increase/decrease this). If figures out the lightest and darkest color and replaces every pixel with...
Removing scales in a picture
java|image|opencv
0
56
1
72,923,643
72,923,643
2
true
2022-07-09T16:41:20.653Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Removing scales in a picture<p><a href="https://i.stack.imgur.com/jPLeU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jPLeU.png" alt="nu...
72,932,391
Suppressing insert of tkinter Text while still allowing other binds<p>I need to be able to bind <code>&lt;Tab&gt;</code> and not have it insert the tab all while not using <code>return &quot;break&quot;</code>. Is there a way to stop the bind of a keypress inserting its character while still allowing other binds? I wil...
<p>What inserts the tab after your binding is the class binding of the <code>Text</code> widget. You can override this class binding to prevent this without affecting any direct binding (which is executed before the class binding)</p> <pre><code> &lt;any_tk_widget&gt;.bind_class(&quot;Text&quot;, &quot;&lt;Tab&gt;&quot...
Suppressing insert of tkinter Text while still allowing other binds
python|tkinter|tkinter-text
0
56
1
72,935,470
72,935,470
2
true
2022-07-10T22:55:19.217Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Suppressing insert of tkinter Text while still allowing other binds<p>I need to be able to bind <code>&lt;Tab&gt;</code> and not have it insert the tab all w...
73,010,411
CUDA customized atomicCAS for floating point types (like double)<p><code>atomicCAS</code> allows using integral types of various lengths (according to specs word sizes of 16/32/64 bit). It works fine for integral types like <code>int</code>, <code>unsigned long long</code>,...</p> <p>I want to use atomic operations for...
<p>As @Homer512 pointed out, <code>atomicCAS</code> is implemented for <code>global</code> and <code>shared</code> memory, as it makes no sense in non concurrent scenarios (like thread local variables used in the example above) to use atomic operations (at least I can't think of any).</p> <p>Following vectorized exampl...
CUDA customized atomicCAS for floating point types (like double)
c++|cuda|atomic|compare-and-swap
1
56
1
73,011,489
73,011,489
2
true
2022-07-17T08:50:13.783Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CUDA customized atomicCAS for floating point types (like double)<p><code>atomicCAS</code> allows using integral types of various lengths (according to specs ...
72,771,246
Remove rows when column values already present as an element of a list in another column<p>I would like to remove the rows entirely when the column values of a specific column like <code>user</code> is already present as an element of a list in another column. How can I best accommpish this?</p> <pre><code> user ...
<p>Your example seems incorrect, as either john should be kept (blacklist is made of all previous friends), or andrew should be removed (blacklist is only the previous list of friends).</p> <p>Here are different options.</p> <p><strong>Remove is the used is present in:</strong></p> <h3>any set of friends</h3> <pre><co...
Remove rows when column values already present as an element of a list in another column
python|python-3.x|pandas|dataframe
1
56
2
72,771,351
72,771,351
2
true
2022-06-27T11:21:17.320Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Remove rows when column values already present as an element of a list in another column<p>I would like to remove the rows entirely when the column values of...
72,772,687
Get sum of two columns based on conditions of other columns in a Pandas Dataframe<p>I have the following dataframe:</p> <pre><code>data = {&quot;Subject&quot;:[&quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;3&quot;,&quot;4&quot;,&quot;5&quot;,&quot;5&quot;], &quot;date&quot;: [&quot;2020-05-01 16:54:25&quot;,&...
<p>IIUC, first slice the rows matching the condition by <a href="https://pandas.pydata.org/docs/user_guide/indexing.html#boolean-indexing" rel="nofollow noreferrer">boolean indexing</a>, then perform a <a href="https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.GroupBy.sum.html" rel="nofollow noreferrer">...
Get sum of two columns based on conditions of other columns in a Pandas Dataframe
python|pandas|dataframe|pandas-groupby
0
56
1
72,772,741
72,772,741
2
true
2022-06-27T13:10:23.170Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get sum of two columns based on conditions of other columns in a Pandas Dataframe<p>I have the following dataframe:</p> <pre><code>data = {&quot;Subject&quot...
72,775,551
Combining thread-last with loop in clojure<p>I write small card game and i want my code to be very explicit and therefore make it clear on a high level, that there are rounds to play. My first implementation was:</p> <pre><code>(defn play-game [] (-&gt; (myio/initialize-cards-and-players) (shuffle-and-share-car...
<p>As Eugene suggested, you want to keep it simple. The following is the structure I normally use</p> <pre><code>(defn play-game [] (let [game-init (-&gt;&gt; (myio/initialize-cards-and-players) (shuffle-and-share-cards myio/myshuffle) (announce))] (lo...
Combining thread-last with loop in clojure
clojure
1
56
1
72,775,946
72,775,946
2
true
2022-06-27T16:37:34.760Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Combining thread-last with loop in clojure<p>I write small card game and i want my code to be very explicit and therefore make it clear on a high level, that...
72,941,777
How to remember state of a class not primary type in jetpack compose<p>Hi developers in jetpack compose if i do this:</p> <pre><code>var model by remember{ mutableStateOf(false)} </code></pre> <p>It works !!</p> <p>but why if i do this:</p> <pre><code> var model by remember{ mutableStateOf(Register())} </code></pre> <p...
<p>For Compose to trigger recomposition you need to change value of</p> <pre><code> var model by remember{ mutableStateOf(Register())} </code></pre> <p>because by default <code>mutableStateOf</code> uses <code>SnapshotMutationPolicy</code> that checks if <strong>two instances are equal</strong></p> <pre><code>fun &lt;T...
How to remember state of a class not primary type in jetpack compose
android-jetpack-compose
0
56
1
72,942,552
72,942,552
2
true
2022-07-11T16:30:49.793Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to remember state of a class not primary type in jetpack compose<p>Hi developers in jetpack compose if i do this:</p> <pre><code>var model by remember{ m...
72,925,119
Using loop to calculate bearings over a list<p>My goal is to apply the geosphere::bearing function to a very large data frame, yet because the data frame concerns multiple individuals, I split it using the purrr package and split function.</p> <p>I have seen the use of 'lists' and 'forloops' in the past but I have no e...
<p>A google search on &quot;pass sf points to geosphere bearings&quot; brings up this SE::GIS answer that seems to address the issue which I would characterize as &quot;how to extract numeric vectors from items that are sf-classed POINTS&quot;: <a href="https://gis.stackexchange.com/questions/416316/compute-east-west-o...
Using loop to calculate bearings over a list
r|dataframe|loops|geosphere
0
56
2
72,925,508
72,925,508
2
true
2022-07-09T22:56:32.017Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using loop to calculate bearings over a list<p>My goal is to apply the geosphere::bearing function to a very large data frame, yet because the data frame con...
72,981,614
Mule esb 3.8 how to add variable into payload?<p>let say I have payload:</p> <blockquote> <p>{ Name=User1, Age=29 }</p> </blockquote> <p>and variable:</p> <blockquote> <p>{ Address=Planet Earth}</p> </blockquote> <p>I want to have a check if that variable not null then add it into payload. So final result will be...
<p>With DataWeave using a Transform component you can use the expression: <code>payload ++ flowVars.variable</code></p> <p>If you don't want or can't use DataWeave then you can use a MEL expression that uses the Java method <code>Map.putAll()</code> of the Map interface. You can not use <code>&lt;set-payload&gt;</code>...
Mule esb 3.8 how to add variable into payload?
mule|dataweave|anypoint-studio|mule-esb
-1
56
1
72,982,675
72,982,675
2
true
2022-07-14T13:49:06.730Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mule esb 3.8 how to add variable into payload?<p>let say I have payload:</p> <blockquote> <p>{ Name=User1, Age=29 }</p> </blockquote> <p>and variable:<...
72,870,933
Iterating through nested dictionaries and find the keywords in the value of dictionary in python<p>I have data in below format.</p> <pre><code>data = {&quot;policy&quot;: {&quot;1&quot;: {&quot;ID&quot;: &quot;ML_0&quot;, &quot;URL&quot;: &quot;www.a.com&quot;, &quot;Text&quot;: &quot;my name is Martin and here is my c...
<p>You could use <a href="https://docs.python.org/3/library/collections.html#collections.Counter" rel="nofollow noreferrer"><code>collections.<b>Counter</b></code></a>:</p> <pre class="lang-py prettyprint-override"><code>from collections import Counter import json # Only for pretty printing `data` dictionary. def ge...
Iterating through nested dictionaries and find the keywords in the value of dictionary in python
python|python-3.x|dictionary|keyword
1
56
2
72,871,146
72,871,146
2
true
2022-07-05T14:14:47.023Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Iterating through nested dictionaries and find the keywords in the value of dictionary in python<p>I have data in below format.</p> <pre><code>data = {&quot;...
72,800,086
Firebase RTDB: Call keepSynced while offline<p>I'm working on a Flutter app that uses Firebase RTDB. I'm a bit unclear on the mechanism of <code>keepSynced()</code>:</p> <p>Our app creates new collections and adds data to these collections. The app also observes these collections to display the data. In the process, we...
<p>You can call <code>keepSynced</code> at any moment, but the client will only be able to download the data from the server when it is connected to the server.</p> <p>If that is not the behavior you're observing, please edit your question to include a <a href="http://stackoverflow.com/help/mcve">minimal repro</a>.</p>...
Firebase RTDB: Call keepSynced while offline
android|ios|flutter|firebase|firebase-realtime-database
0
56
1
72,805,181
72,805,181
2
true
2022-06-29T10:46:44.670Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firebase RTDB: Call keepSynced while offline<p>I'm working on a Flutter app that uses Firebase RTDB. I'm a bit unclear on the mechanism of <code>keepSynced()...
72,943,831
Aync/await workflow: what I'm doing wrong in loading and injecting this external script?<p>The problem is quite simple: some calls to <code>refresh()</code> result in <code>window.grecaptcha</code> to be <code>undefined</code>. Not always as I said, I think because network slowdown. It's quite &quot;hard&quot; to debug...
<p>I made a test with reCAPTCHA v3, and looking at requests in DevTools network panel, it seems reCAPTCHA itself loads another locale-specific script asynchronously. To dynamically load reCAPTCHA the way you're trying to, you need to setup a globally visible callback and pass its name to the <code>onload</code> paramet...
Aync/await workflow: what I'm doing wrong in loading and injecting this external script?
javascript|async-await
1
56
1
72,944,141
72,944,141
2
true
2022-07-11T19:41:18.160Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Aync/await workflow: what I'm doing wrong in loading and injecting this external script?<p>The problem is quite simple: some calls to <code>refresh()</code> ...
72,901,524
How to prevent users from pressing key too early in a reaction time test<p>I try to make a reaction time test in python.</p> <p>The code works fine but users can press enter key too early which results in their reaction time being <code>0.0</code>.</p> <h3>Code</h3> <pre><code>import time import random print('When you...
<h2>Issue supposed</h2> <p>I can't figure out the issue. Seems like if enter pressed it is recorded in the STDIN buffer. When <code>input()</code> is invoked later, it will be returned there immediately - without waiting on a new key pressed. See <a href="https://stackoverflow.com/questions/35018268/python-stdin-user-i...
How to prevent users from pressing key too early in a reaction time test
python|input|stdin|enter
1
56
1
72,903,127
72,903,127
2
true
2022-07-07T16:43:53.860Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to prevent users from pressing key too early in a reaction time test<p>I try to make a reaction time test in python.</p> <p>The code works fine but users...
72,779,483
Is there a "end of heading" or "beginning of transmission" character in Unicode?<p>Unicode has characters for <code>START OF HEADING</code> (␁ <code>U+0001</code>), <code>START OF TEXT</code> (␂ <code>U+0002</code>), <code>END OF TEXT</code> (␃ <code>U+0003</code>), and <code>END OF TRANSMISSION</code> (␄ <code>U+0004<...
<p>The characters U+0000 to U+001F are imported directly from ASCII. If it didn't exist in ASCII, it doesn't exist in Unicode, in that range.</p> <p>Most are obsolete; in-band delimiters are not so much used nowadays. If you're using an existing protocol with in-band delimiters, it'll have rules based on ASCII usage; ...
Is there a "end of heading" or "beginning of transmission" character in Unicode?
unicode|binary|eof|transmission|control-characters
0
56
1
72,779,535
72,779,535
3
true
2022-06-28T00:14:38.363Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a "end of heading" or "beginning of transmission" character in Unicode?<p>Unicode has characters for <code>START OF HEADING</code> (␁ <code>U+0001</...
72,782,765
How to understand complex lists in python<p>Sorry this will be a very basic question, I am learning python.</p> <p>I went through a coding exercise to calculate bmi and went for a straightforward way:</p> <pre><code>def bmi(weight, height): bmi = weight / height ** 2 if bmi &lt;= 18.5: return &quot;Unde...
<p>observe this line carefully</p> <pre class="lang-py prettyprint-override"><code>['Underweight', 'Normal', 'Overweight', 'Obese'][(b &gt; 30) + (b &gt; 25) + (b &gt; 18.5)] </code></pre> <p>Above is line is actually list indexing <code>[(b &gt; 30) + (b &gt; 25) + (b &gt; 18.5)]</code> this gives the index of the li...
How to understand complex lists in python
python
1
56
1
72,782,895
72,782,895
3
true
2022-06-28T08:02:15.207Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to understand complex lists in python<p>Sorry this will be a very basic question, I am learning python.</p> <p>I went through a coding exercise to calcul...
72,799,692
Can git / github / gitlab detect the operating system the commit was sent from?<p>If I have a repo in gitlab. Is it possible to detect the operating system a commit was sent from?</p> <p>Or is this impossible?</p> <p>Unusual request I know! I've googled a lot but finding it difficult to find the right search query. May...
<p>Git doesn't store the OS or version information in the commit, so in the general case, there's no way to know.</p> <p>However, you may be able to use some heuristics to guess the OS. For example, if the repository uses a <code>working-tree-encoding=UTF-16LE-BOM</code> in <code>.gitattributes</code>, it's likely tha...
Can git / github / gitlab detect the operating system the commit was sent from?
git|github|gitlab
0
56
2
72,800,183
72,800,183
3
true
2022-06-29T10:18:06.550Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can git / github / gitlab detect the operating system the commit was sent from?<p>If I have a repo in gitlab. Is it possible to detect the operating system a...
72,813,072
Body Render Issue with NavigationStack in XCode 14 Beta<p>In the following code, background color of the <code>ContentView</code> doesn't change after two seconds.</p> <pre><code>struct ContentView: View { @State private var bool: Bool = false var body: some View { NavigationStack(root: { ...
<p>Who knows... may be it is intentional may be it is a bug, submit feedback to Apple.</p> <p>Meanwhile here is a workaround, tested with Xcode 14 / iOS 16</p> <pre><code> NavigationStack { if bool { Color.red } else { Color.blue } } .id(bool) // &l...
Body Render Issue with NavigationStack in XCode 14 Beta
ios|swift|xcode|swiftui|swiftui-navigationview
2
56
1
72,813,270
72,813,270
3
true
2022-06-30T09:02:51.230Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Body Render Issue with NavigationStack in XCode 14 Beta<p>In the following code, background color of the <code>ContentView</code> doesn't change after two se...
72,831,329
Calculate difference between two dates in python<p>I have two columns date1 and date2 in <code>2/23/2022 12:30:26</code> format ,i want to calculate difference in hours. How to implement .</p>
<p>You can convert two columns to datetime type then subtract at last get hours from timedelta object.</p> <pre class="lang-py prettyprint-override"><code>df['date1'] = pd.to_datetime(df['date1']) df['date2'] = pd.to_datetime(df['date2']) df['diff'] = (df['date1']-df['date2']) / pd.Timedelta(hours=1) </code></pre>
Calculate difference between two dates in python
python|python-3.x|pandas|datetime
-1
56
1
72,831,381
72,831,381
3
true
2022-07-01T15:14:09.103Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calculate difference between two dates in python<p>I have two columns date1 and date2 in <code>2/23/2022 12:30:26</code> format ,i want to calculate differen...
72,838,713
python replace spaces not affacted<p>In a web scraping I'm stuck in <code>replace()</code> function. I want to replace any spaces with dash in a string but it's not working in this sentence, but works in others. I don't know what's wrong with this sentence:</p> <pre><code>description = &quot;Cooler Master MasterLiqu...
<p>The split/join technique proposed by @Rodalm is excellent. However, for the sake of completeness, here's the <em>re</em> approach:</p> <pre><code>import re description = &quot;Cooler Master MasterLiquid Lite 240&quot; print(re.sub('\s+', '-', description)) </code></pre> <p><strong>Output:</strong></p> <pre><cod...
python replace spaces not affacted
python
2
56
4
72,838,854
72,838,854
3
true
2022-07-02T11:32:17.810Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: python replace spaces not affacted<p>In a web scraping I'm stuck in <code>replace()</code> function. I want to replace any spaces with dash in a string but i...
72,918,168
Leetcode 752: Open the Lock TLE with BFS<p>I'm trying to solve the leetcode question <a href="https://leetcode.com/problems/open-the-lock/" rel="nofollow noreferrer">https://leetcode.com/problems/open-the-lock/</a> with BFS and came up with the approach below.</p> <pre class="lang-py prettyprint-override"><code>def ope...
<p>Yes. Absolutely. You need to add the item to <code>visited</code> when it gets added to the queue the first time, not when it gets removed from the queue. Otherwise your queue is going to grow exponentially.</p> <p>Let's look at say 1111. Your code is going to add 1000, 0100, 0010, 0001 (and others) to the queue...
Leetcode 752: Open the Lock TLE with BFS
python|breadth-first-search
2
56
2
72,918,227
72,918,227
3
true
2022-07-09T00:43:30.777Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Leetcode 752: Open the Lock TLE with BFS<p>I'm trying to solve the leetcode question <a href="https://leetcode.com/problems/open-the-lock/" rel="nofollow nor...
72,921,407
Can this array lookup be speeded up?<p>I have a [64x64] table with only two values ( (1,-1), but if adopting other values, like (0,1) is convenient, they can be used)</p> <p>The table looks like this:</p> <p><a href="https://i.stack.imgur.com/C3Ayp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C3Ay...
<p>Assuming your calculations cannot take advantage of numpy vectorization, you can use <a href="https://pypi.org/project/bitarray/" rel="nofollow noreferrer"><code>bitarray</code></a> in a list to improve performance of 2D array access:</p> <pre class="lang-py prettyprint-override"><code>from bitarray import bitarray ...
Can this array lookup be speeded up?
python|arrays|numpy|optimization
0
56
2
72,922,717
72,922,717
3
true
2022-07-09T12:36:21.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can this array lookup be speeded up?<p>I have a [64x64] table with only two values ( (1,-1), but if adopting other values, like (0,1) is convenient, they can...
72,922,803
GroupBy transform median with date filter pandas<p>I have 2 dataframes:</p> <p>df1:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>artist_id</th> <th>concert_date</th> <th>region_id</th> </tr> </thead> <tbody> <tr> <td>12345</td> <td>2019-10</td> <td>22</td> </tr> <tr> <td>33322</td> <td>2...
<p>Here's a way to do this without a python loop:</p> <pre class="lang-py prettyprint-override"><code>df3 = df1.merge(df2, on=['artist_id', 'region_id']) df3 = df3[df3.date &gt;= df3.concert_date - pd.DateOffset(months=3)] df3 = df3.groupby(['artist_id', 'region_id', 'concert_date']).median().rename( columns={'popu...
GroupBy transform median with date filter pandas
python|pandas|loops|group-by
1
56
1
72,923,394
72,923,394
3
true
2022-07-09T15:53:55.600Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GroupBy transform median with date filter pandas<p>I have 2 dataframes:</p> <p>df1:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> ...
72,924,023
Edit row values for many dummy variables<p>This is how my data looks:</p> <p><a href="https://i.stack.imgur.com/YxLLg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YxLLg.png" alt="Input" /></a></p> <p>My dput is given below as:</p> <pre><code>structure(list(id = c(1, 1, 3, 3, 5, 6), country = c(&qu...
<p>One way you can do it using <code>lapply</code> and <code>sapply</code></p> <pre><code>#Get Matches for column name and country variable matches &lt;- lapply(colnames(df[-(1:2)]), \(x) df$country %in% x) #Get the id for each match ids &lt;- lapply(matches, \(x) df$id[x]) #add 1 to each df[-(1:2)] &lt;- sapply(...
Edit row values for many dummy variables
r|dummy-variable
1
56
4
72,924,203
72,924,203
3
true
2022-07-09T19:19:05.297Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Edit row values for many dummy variables<p>This is how my data looks:</p> <p><a href="https://i.stack.imgur.com/YxLLg.png" rel="nofollow noreferrer"><img src...
72,929,272
Using generics with IEnumerable in base class constructor<p>Why does this code gives this error?</p> <blockquote> <p>Argument type 'System.Collections.Generic.IEnumerable&lt;T&gt;' is not assignable to parameter type 'System.Collections.Generic.IEnumerable&lt;[...].IExample&gt;'</p> </blockquote> <pre class="lang-cs pr...
<p>You are missing the <code>class</code> constraint to <code>T</code> within <code>FailingClass</code>. <code>IEnumerable&lt;T&gt;</code> has a type parameter marked as covariant. Covariance enables you to use a more derived type than originally specified. Variance in general applies to reference types only.</p> <p>So...
Using generics with IEnumerable in base class constructor
c#|generics
0
56
1
72,929,498
72,929,498
3
true
2022-07-10T14:35:14.617Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using generics with IEnumerable in base class constructor<p>Why does this code gives this error?</p> <blockquote> <p>Argument type 'System.Collections.Generi...
72,936,565
LINQ Distinct on a particular property and latest<p>Suppose I have the following collection</p> <pre><code>public class User { public string SSN { get; set; } public DateTime StartDate { get; set; } } var users = new List&lt;User&gt; { new User { SSN = &quot;ab&quot;, StartDate = new DateTime(2021, 01, 01...
<p>Since you mentioned that you also need the latest <code>StartDate</code> in the comment,</p> <p>Group by <code>SSN</code> and get the latest <code>StartDate</code> via <code>.Max()</code>.</p> <pre class="lang-cs prettyprint-override"><code>var result = users .GroupBy(g =&gt; g.SSN) .Select(x =&gt; new User ...
LINQ Distinct on a particular property and latest
c#|linq
0
56
4
72,936,689
72,936,689
3
true
2022-07-11T09:45:58.730Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: LINQ Distinct on a particular property and latest<p>Suppose I have the following collection</p> <pre><code>public class User { public string SSN { get; s...
72,940,617
Parse big JSON file with font-encoding cp1252<p>I have to handle a big JSON file (approx. 47GB) and it seems as if I found the solution in ijson.</p> <p>However, when I want to go through the objects I get the following error:</p> <pre><code>byggesag = (o for o in objects if o[&quot;h�ndelse&quot;] == 'Byggesag') ...
<p>The problem is with the python script itself, which is encoded with <code>cp1252</code> but python expects it to be in <code>utf8</code>. You seem to be dealing with the input JSON file correctly (but you won't be able to tell until you actually are able to run your script).</p> <p>First, note that the error is a <c...
Parse big JSON file with font-encoding cp1252
python|json|ijson
0
56
1
72,941,101
72,941,101
3
true
2022-07-11T15:01:23.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parse big JSON file with font-encoding cp1252<p>I have to handle a big JSON file (approx. 47GB) and it seems as if I found the solution in ijson.</p> <p>Howe...
72,979,497
SwiftUI DatePicker format is different on each device, how to make it always display the same chosen version?<p>SwiftUI DatePicker in my app is displayed in three different formats:</p> <p>In Xcode Preview:</p> <p><a href="https://i.stack.imgur.com/kwgqz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.co...
<p>The SwiftUI <code>DatePicker</code> adheres to the user's locale and date settings. On iPhone, you can change them in the system settings <em>General &gt; Language &amp; Region</em> as well as <em>General &gt; Date &amp; Time</em>. Usually, you should not mess with the format of the <code>DatePicker</code> since if ...
SwiftUI DatePicker format is different on each device, how to make it always display the same chosen version?
ios|xcode|swiftui|datepicker
2
56
2
72,979,724
72,979,724
3
true
2022-07-14T11:06:58.600Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SwiftUI DatePicker format is different on each device, how to make it always display the same chosen version?<p>SwiftUI DatePicker in my app is displayed in ...
72,834,679
Flatten a partially nested list in Ansible<p>having such a list:</p> <pre><code>[ [[[6781,&quot;1&quot;]], &quot;a&quot;], [[[6782,&quot;1&quot;]], &quot;b&quot;], [[[6780,&quot;1&quot;]], &quot;c&quot;] ] </code></pre> <p>which filter / query would you use to &quot;partially flatten&quot; the list to:</p> <pre><...
<p>You have a list composed of lists which you want to flatten. Applying the <code>flatten</code> filter to the entire list will not do what you want (as you found out) as it will flatten the entire list to a single level.</p> <p>What you want is to apply that same filter but individually to each element of your top li...
Flatten a partially nested list in Ansible
ansible|json-query
2
56
1
72,841,026
72,841,026
3
true
2022-07-01T21:15:12.710Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flatten a partially nested list in Ansible<p>having such a list:</p> <pre><code>[ [[[6781,&quot;1&quot;]], &quot;a&quot;], [[[6782,&quot;1&quot;]], &quot...
72,840,712
How To Automatically run a powershell cmd on a specific folder on windows 10 start up after a delay (30s) [SOLVED]<p>We are using web project unfinished, and everytime the computer start, we need to go to:</p> <p>c:/wamp64/www/</p> <p>In this folder we have a folder &quot;projectname&quot;, we have to shift right click...
<p>I would use the task scheduler for that purpose.</p> <ul> <li>Open Task Scheduler by pressing “Windows+R” and then typing “taskschd.msc” in the window that opens. Then take the following steps:</li> <li>Click “Create a task” and enter a name and description for the new task. To run the program with administrator pri...
How To Automatically run a powershell cmd on a specific folder on windows 10 start up after a delay (30s) [SOLVED]
node.js|powershell
2
56
1
72,840,816
72,840,816
3
true
2022-07-02T16:31:05.797Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How To Automatically run a powershell cmd on a specific folder on windows 10 start up after a delay (30s) [SOLVED]<p>We are using web project unfinished, and...
72,849,165
Add column that is the sum of other columns<p>Input data:</p> <pre><code>Director= c(&quot;Director A&quot;, &quot;Director B&quot;, &quot;Director C&quot;) Salary = c(40000, 35000, 50000) Listed boards = c(1, 0, 3) Unlisted boards = c(4, 2, 6) Other boards = c(2, 3, 3) Number of qualifications = c(1, 2, 1) df_directo...
<p>We could use <code>rowSums</code> with <code>select</code>:</p> <pre><code>library(dplyr) df_directors %&gt;% transmute(Director, Salary, Boards = rowSums(select(., contains(&quot;boards&quot;))),Number_of_qualifications) </code></pre> <p><strong>First solution:</strong></p> <pre><code>library(dplyr) df_directo...
Add column that is the sum of other columns
r|sum
1
56
3
72,849,204
72,849,204
3
true
2022-07-03T18:59:10.430Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add column that is the sum of other columns<p>Input data:</p> <pre><code>Director= c(&quot;Director A&quot;, &quot;Director B&quot;, &quot;Director C&quot;) ...
72,801,710
How to show the current value of y-axis in gganimate?<p>I have a <code>dataframe</code> <code>df</code>:</p> <pre><code>df = data.frame(name = &quot;bird&quot;, value = seq(0, 1, length.out = 100), step = 1:100) </code></pre> <p>I want to animate this data by showing the variable <code>value</code...
<p>In a similar vein, but without much piping and less computation (simple base R subsetting)</p> <pre class="lang-r prettyprint-override"><code>library(gganimate) #&gt; Loading required package: ggplot2 df &lt;- data.frame( name = &quot;bird&quot;, value = seq(0, 1, length.out = 100), step = 1:100 ) anim &lt;- ...
How to show the current value of y-axis in gganimate?
r|ggplot2|gganimate
3
56
2
72,802,704
72,802,704
3
true
2022-06-29T12:48:22.803Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to show the current value of y-axis in gganimate?<p>I have a <code>dataframe</code> <code>df</code>:</p> <pre><code>df = data.frame(name = &quot;bird&quo...
73,005,738
Loop to check matches in several arrays<p>I have 7 arrays of <code>Strings</code>.</p> <pre><code>var redArray : [String] = [&quot;2022-07-13&quot;, &quot;2022-07-14&quot;,&quot;2022-07-15&quot;] var blueArray : [String] = [&quot;2022-07-13&quot;, &quot;2022-07-14&quot;,&quot;2022-07-16&quot;] ... And five more of the ...
<p>You could simply do that:</p> <pre><code>var colors: [UIColor] = [] if redArray.contains(someData) { colors.append(.red) } if blueArray.contains(someData) { colors.append(.blue) } if greenArray.contains(someData) { colors.append(.green) } return colors.isEmpty ? [.clear] : colors </code></pre> <p>If yo...
Loop to check matches in several arrays
ios|arrays|swift|xcode|loops
1
56
2
73,005,845
73,005,845
3
true
2022-07-16T16:04:29.307Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Loop to check matches in several arrays<p>I have 7 arrays of <code>Strings</code>.</p> <pre><code>var redArray : [String] = [&quot;2022-07-13&quot;, &quot;20...
72,868,052
Method like windows() in rust but for javascript?<p>Is there a method in javascript that does the same thing as windows in rust?</p> <p>I want to iterate over an array in js comparing 2 values each time like you can with windows() in rust but not sure if there is a method for this.</p> <p>Anyone know a method or a simi...
<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator" rel="nofollow noreferrer">generator</a> function is a good fit for this</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snip...
Method like windows() in rust but for javascript?
javascript
2
56
1
72,868,185
72,868,185
3
true
2022-07-05T10:41:37.967Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Method like windows() in rust but for javascript?<p>Is there a method in javascript that does the same thing as windows in rust?</p> <p>I want to iterate ove...
72,936,028
How i can calculate correlation between two data frames in R using dplyr?<p>i have two data frames in R say data1 and data2:</p> <pre><code> a = c(1,2,NA,4,5) b = c(3,4,5,6,7) data1 = tibble(a,b);data1 a = c(4,2,4,4,9) b = c(3,4,4,6,7) d = c(5,9,3,4,2) data2 = tibble(a,b,d);data2 </code></pre> <p>i want to calculat...
<pre class="lang-r prettyprint-override"><code>library(tibble) library(purrr) a = c(1,2,NA,4,5) b = c(3,4,5,6,7) data1 = tibble(a,b) a = c(4,2,4,4,9) b = c(3,4,4,6,7) d = c(5,9,3,4,2) data2 = tibble(a,b,d) matched &lt;- intersect(colnames(data1), colnames(data2)) names(matched) &lt;- matched map_dbl(matched, ~ cor...
How i can calculate correlation between two data frames in R using dplyr?
r|dataframe|dplyr|functional-programming|purrr
1
56
2
72,936,340
72,936,340
3
true
2022-07-11T09:03:20.463Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How i can calculate correlation between two data frames in R using dplyr?<p>i have two data frames in R say data1 and data2:</p> <pre><code> a = c(1,2,NA,4,...
72,804,408
How check instantiation of one type by another with templates?<p>In my case there is func:</p> <pre><code>// msg can be std::string, std::wstring, const char*, const wchar_t*, ... template&lt;typename StrType&gt; void Log(StrType msg) { if std::string(msg) can be created from msg { // do smth } if std::wstr...
<p>Since C++17, you may use a <a href="https://en.cppreference.com/w/cpp/language/if#Constexpr_if" rel="nofollow noreferrer">constexpr <code>if</code></a> to check whether <code>std::string</code> or <code>std::wstring</code> can be constructed from the argument you pass to <code>Log</code>:</p> <pre><code>template &lt...
How check instantiation of one type by another with templates?
c++|templates
1
56
3
72,804,483
72,804,483
3
true
2022-06-29T15:52:18.017Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How check instantiation of one type by another with templates?<p>In my case there is func:</p> <pre><code>// msg can be std::string, std::wstring, const char...
72,912,061
How to plot a multi-indexed dataframe<p>I have a dataframe, <code>DF</code>:</p> <pre class="lang-none prettyprint-override"><code> Data1 Data2 2022/7/8 3 3 2022/7/7 4 2 2022/7/6 5 1 2022/7/5 6 3 2022/7/4 7 2 </code></pre> <p>Doing the following,</p> <pre><code>sns.lineplot(x=DF....
<p>Your columns are a <code>MultiIndex</code>, so reference accordingly:</p> <pre><code>sns.lineplot( x=TenYearGovYieldHist.index, y=TenYearGovYieldHistf[('USGG10YR Index', 'PX_LAST')], ax=Myax ) </code></pre> <p>Or using <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.droplevel.htm...
How to plot a multi-indexed dataframe
python|pandas|seaborn
1
56
1
72,912,180
72,912,180
3
true
2022-07-08T13:21:23.023Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to plot a multi-indexed dataframe<p>I have a dataframe, <code>DF</code>:</p> <pre class="lang-none prettyprint-override"><code> Data1 Data2 202...
72,791,331
Compare two lists and get the indices where the values are different<p>I would like help with the following situation I have two lists:</p> <p>Situation 1:</p> <pre><code>a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] b = [0, 1, 2, 3, 5, 5, 6, 7, 8, 9] </code></pre> <p>I need key output: <strong>Key 4</strong> is different</p> <p>...
<p>You can use a list comprehension with <a href="https://docs.python.org/3/library/functions.html#zip" rel="nofollow noreferrer"><code>zip</code></a>, and <a href="https://docs.python.org/3/library/functions.html#enumerate" rel="nofollow noreferrer"><code>enumerate</code></a> to get the indices. Use <a href="https://s...
Compare two lists and get the indices where the values are different
python|list
1
56
3
72,791,355
72,791,355
3
true
2022-06-28T18:14:26.427Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compare two lists and get the indices where the values are different<p>I would like help with the following situation I have two lists:</p> <p>Situation 1:</...
72,954,115
Python Pandas user friendly table display<p>Still learning python and pandas and having trouble with data display. I have a dataframe that contains an owner id in one column, and a list of dictionaries in another column. I would like to create a more user friendly dataframe that displays (exports to excel) select key...
<p>You can use <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.explode.html" rel="nofollow noreferrer"><code>pandas.DataFrame.explode</code></a> to unravel the list into multiple rows with other columns values repeated. Then you can convert the dictionary to columns using apply <a href="https://p...
Python Pandas user friendly table display
python|pandas|dataframe
1
56
3
72,954,351
72,954,351
3
true
2022-07-12T14:38:14.783Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python Pandas user friendly table display<p>Still learning python and pandas and having trouble with data display. I have a dataframe that contains an owner...
73,026,924
Using `static` keyword with Structured Binding<p>I'm trying to use C++17 structured binding to return a pair of values and I want those values to be both <code>static</code> and <code>const</code> so that they are computed the first time the function they're in is called and then they maintain their uneditable values f...
<p>The error is a bit confusing, but structured binding to static variables is just not supported with c++17. Either use a different solution, or c++2a. A different solution could just be an additional line:</p> <pre><code>static std::pair pr = pairReturn(); auto &amp;[a, b] = pr; </code></pre>
Using `static` keyword with Structured Binding
c++|static|c++17|structured-bindings
2
56
1
73,026,965
73,026,965
3
true
2022-07-18T18:23:19.947Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using `static` keyword with Structured Binding<p>I'm trying to use C++17 structured binding to return a pair of values and I want those values to be both <co...
73,001,491
How to convert a .reduce function of Javascript to Python?<p>I am reading a javascript source and I need to convert it to Python.</p> <p>Here is the code, since I am just a beginner, I dont get <code>.reduce()</code> function at all</p> <pre class="lang-js prettyprint-override"><code>function bin2dec(num){ return n...
<p><strong>Normal Equivalence</strong></p> <ul> <li>Javascript <code>parseInt(x, 2)</code></li> <li>Python <code>int(x, 2)</code></li> </ul> <p><strong>Using Same Method as Posted Code</strong></p> <pre><code>from functools import reduce import math def bin2dec(s): return reduce(lambda x, y_i: x + int(math.pow(2, ...
How to convert a .reduce function of Javascript to Python?
javascript|python
2
56
2
73,001,894
73,001,894
3
true
2022-07-16T04:21:08.900Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert a .reduce function of Javascript to Python?<p>I am reading a javascript source and I need to convert it to Python.</p> <p>Here is the code, si...
72,822,285
Click button to toggle class of parent element - pure javascript<p>I have multiple divs on the page with the class 'item' – I'd like to include a button within the div that when clicked will toggle append/remove the class 'zoom' on the 'item' div…</p> <pre><code>&lt;div class=&quot;item&quot;&gt; &lt;button class=&quot...
<p>You can use <code>querySelectorAll</code> to get all of the <code>buttons</code> and then you can use <code>forEach</code> so you can target the element's <code>item</code> parent.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre cla...
Click button to toggle class of parent element - pure javascript
javascript|html|css
1
56
3
72,822,359
72,822,359
3
true
2022-06-30T21:35:47.417Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Click button to toggle class of parent element - pure javascript<p>I have multiple divs on the page with the class 'item' – I'd like to include a button with...
72,981,024
weird behavior of #undef<pre><code>#include &lt;iostream&gt; #define MY_CONST 10 #define MY_OTHER_CONST MY_CONST #undef MY_CONST int main() { enum my_enum : int { MY_CONST = 100 }; std::cout &lt;&lt; MY_OTHER_CONST; return 0; } </code></pre> <p>I would expect <code>10</code> as an output, but this ...
<p><code>#define MY_OTHER_CONST MY_CONST</code> defines the macro <code>MY_OTHER_CONST</code> to have a replacement list of <code>MY_CONST</code>. No replacement is performed when defining a macro.</p> <p>In <code>std::cout &lt;&lt; MY_OTHER_CONST;</code>, <code>MY_OTHER_CONST</code> is replaced by its replacement list...
weird behavior of #undef
c++|precompile|undef
0
56
1
72,981,052
72,981,052
3
true
2022-07-14T13:06:15.237Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: weird behavior of #undef<pre><code>#include &lt;iostream&gt; #define MY_CONST 10 #define MY_OTHER_CONST MY_CONST #undef MY_CONST int main() { enum my_...
72,781,400
Getting Black Python code formatter to align comments<p>Yes, I'm, of the understanding that <code>black</code> gives very little leeway in getting it to act differently but I was wondering about the best way to handle something like this (my original code):</p> <pre class="lang-py prettyprint-override"><code>@dataclass...
<p>You can wrap your block with <code># fmt: on/off</code>, so Black doesn't touch it.</p> <pre class="lang-py prettyprint-override"><code># fmt: off @dataclass class Thing1: property1: int # The first property. property2: typing.List[int] # This is the second property ...
Getting Black Python code formatter to align comments
python|black-code-formatter
3
56
1
72,811,961
72,811,961
4
true
2022-06-28T05:59:56.873Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting Black Python code formatter to align comments<p>Yes, I'm, of the understanding that <code>black</code> gives very little leeway in getting it to act ...
72,844,799
insertion in unordered map in c++<pre><code>#include&lt;iostream&gt; #include&lt;unordered_map&gt; #include&lt;list&gt; #include&lt;cstring&gt; using namespace std; class Graph { unordered_map&lt;string, list&lt;pair&lt;string, int&gt;&gt;&gt;l; public: void addedge(string x, string y, bool bidir, int wt) { ...
<p>When you use the subscript operator on <code>l</code>, like in <code>l[x]</code>, it returns a reference to the <em>value</em> mapped to the <em>key</em> <code>x</code> (or inserts a default constructed value and returns a reference to that).</p> <p>In this case, the type of the value is a <code>std::list&lt;std::pa...
insertion in unordered map in c++
c++|unordered-map
-4
56
1
72,844,859
72,844,859
4
true
2022-07-03T07:57:26.257Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: insertion in unordered map in c++<pre><code>#include&lt;iostream&gt; #include&lt;unordered_map&gt; #include&lt;list&gt; #include&lt;cstring&gt; using namesp...
72,965,052
How Can I access a property of an object array set in state<p>I am building my first react app for my final react course on scrimba and I am retrieving data from an API and setting a part of the data to an array set in state, but I cant seem to access a property of the array</p> <p><div class="snippet" data-lang="js" d...
<blockquote> <p>but I cant seem to access a property of the array</p> </blockquote> <p>Sure you can, but <em>only when that array element exists</em>. The initial state of the array is empty:</p> <pre><code>const [request, setRequest] = React.useState([]) </code></pre> <p>An empty array has no elements, so this logs <...
How Can I access a property of an object array set in state
javascript|reactjs
1
56
3
72,965,193
72,965,193
4
true
2022-07-13T10:49:45.017Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How Can I access a property of an object array set in state<p>I am building my first react app for my final react course on scrimba and I am retrieving data ...
72,924,110
How can one detect if a github actions runner is running in ubuntu or windows<p>Is it possible to detect which OS a Github actions runner is using? For example, in node one can run <code>process.platform</code> to get the OS. Is there something analogous inside of Github actions?</p>
<p>There is an environment variable <code>$RUNNER_OS</code> containing the operating system; you can specify the shell for a <code>run:</code> independent of the runner operating system, i.e., you can use Bash everywhere.</p> <p>For example, this workflow</p> <pre class="lang-yaml prettyprint-override"><code>name: OS t...
How can one detect if a github actions runner is running in ubuntu or windows
github|operating-system|github-actions
0
56
1
72,926,104
72,926,104
4
true
2022-07-09T19:35:14.813Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can one detect if a github actions runner is running in ubuntu or windows<p>Is it possible to detect which OS a Github actions runner is using? For examp...
72,781,218
When I use "n--" instead of "n-1" why do I get stackoverflow error?<p>In this code which is a program to print elements 1 to 5 recursively, when I use <code>n--</code> instead of <code>n-1</code>, I am getting a stack overflow error. whereas when <code>n-1</code> is used the code worked perfectly. shouldn't <code>n--</...
<p><code>n--</code> returns the value of <code>n</code> first, then decrement <code>n</code>. So in your case, it becomes an infinite loop because <code>n</code> is never changing. You can use <code>--n</code> instead which decrement <code>n</code> first, then returns the value of <code>n</code>. Let's take a simpler e...
When I use "n--" instead of "n-1" why do I get stackoverflow error?
java|recursion
0
56
1
72,781,249
72,781,249
5
true
2022-06-28T05:38:07.203Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: When I use "n--" instead of "n-1" why do I get stackoverflow error?<p>In this code which is a program to print elements 1 to 5 recursively, when I use <code>...
72,860,669
Why do I get a print of a tuple of Nones in the Python console, but not of a single None?<p>While using Python (via cmd) and writing this inside:</p> <pre><code>&gt;&gt;&gt; import random &gt;&gt;&gt; print(&quot;hello&quot;),print(&quot;world&quot;),print(random.randint(5,10)) </code></pre> <p>the output I'm getting i...
<p>Python is interpreting the <code>,</code> in the second input line as creation of a tuple out of the return values of <code>print</code> which are all <code>None</code>. Just have a single line for every print statement. Here is another example of this behavior:</p> <p><code>&gt;&gt;&gt; 5,4,3</code></p> <p>returns<...
Why do I get a print of a tuple of Nones in the Python console, but not of a single None?
python|python-3.x|read-eval-print-loop|nonetype
2
56
1
72,860,688
72,860,688
5
true
2022-07-04T18:16:40.140Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why do I get a print of a tuple of Nones in the Python console, but not of a single None?<p>While using Python (via cmd) and writing this inside:</p> <pre><c...
72,842,195
Error reading charcters of string on the strcpy() return value<p>I tried to print out the <a href="https://stackoverflow.com/questions/3561427/strcpy-return-value">return value of strcpy()</a> and it gave me an &quot;Access violation reading location&quot; exception.</p> <pre><code>char ind[15]; printf(&quot;%s\n&quot...
<p>This can happen if you fail to <code>#include &lt;string.h&gt;</code></p> <p>Without a declaration for <code>strcpy</code>, the compiler uses an implicit declaration of <code>int strcpy()</code>. This is incompatible with the actual return type. Calling a function through an incompatible type triggers <a href="htt...
Error reading charcters of string on the strcpy() return value
c
0
56
1
72,842,258
72,842,258
7
true
2022-07-02T20:21:50.283Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error reading charcters of string on the strcpy() return value<p>I tried to print out the <a href="https://stackoverflow.com/questions/3561427/strcpy-return-...
72,848,967
Making sure that the function I am using returns the correct kind of values in haskell. (i.e does not contain an `error ""` or similar)<p>Haskell is often touted as the language to do proofs in. (Before they start recomnding Agda, Idris or Coq). However, is this piece of code not potentially problematic or am I underst...
<p>If somebody recommended that you do in proofs <em>in Haskell</em>, ask for your money back. (But be sure to double check you understood. Maybe they said to do proofs <em>about Haskell</em> and your memory is bad!)</p> <p>You are correct: it is not very good for checking proofs. Haskell is, as a logic, inconsistent. ...
Making sure that the function I am using returns the correct kind of values in haskell. (i.e does not contain an `error ""` or similar)
haskell|proof|proof-of-correctness
0
56
1
72,849,225
72,849,225
10
true
2022-07-03T18:30:13.920Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Making sure that the function I am using returns the correct kind of values in haskell. (i.e does not contain an `error ""` or similar)<p>Haskell is often to...
72,840,566
Why is an image not showing in a div<p>beginner here! I am following a series of HTML and CSS by Dani Krossing on YouTube, and I followed his series. I reached his video on image in HTML and imported images using div. However for some reason, it's not displaying in my website. I followed the tutorial to a tee but to no...
<p>You have forgot to mention property unit</p> <pre><code>.img-lightning { width: 400px; height: 229px; background-image: url(images/lightning.jpg); } </code></pre>
Why is an image not showing in a div
html|css
-2
56
3
72,840,650
72,840,650
-2
true
2022-07-02T16:10:05.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is an image not showing in a div<p>beginner here! I am following a series of HTML and CSS by Dani Krossing on YouTube, and I followed his series. I reach...
73,026,596
How can I print in one single line after using a for loop<p>I need your help. So, I have to separate the words of a string, then I have to sort the letters of the words alphabetically and print them out in one line.</p> <pre><code>words = &quot;apple pumpkin log river fox pond&quot; words = words.split() for i in word...
<p>You can use use:</p> <pre><code>words = &quot;apple pumpkin log river fox pond&quot; words = words.split() for i in words: print(&quot;&quot;.join(sorted(i)),end= &quot; &quot;) print(&quot;&quot;) </code></pre> <p>The &quot;end&quot; string will be printed after the main string. The default value for it is &qu...
How can I print in one single line after using a for loop
python|sorting|for-loop
-1
56
3
73,026,712
73,026,712
-2
true
2022-07-18T17:54:29.020Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I print in one single line after using a for loop<p>I need your help. So, I have to separate the words of a string, then I have to sort the letters o...
72,998,971
how to create record component using react hook?<p>I need to create react component for recording screen of web browser <br> Is there anybody can know how to do this <br> Please help me <br> Thanks</p>
<p>nice to meet you <br> you can use <strong>react-media-recorder</strong> library in your code<br> please try like below: <br> Install <strong>react-media-recorder</strong> library using <strong>npm</strong></p> <pre><code>npm i react-media-recorder </code></pre> <p>then</p> <pre><code>import { useReactMediaRecorder }...
how to create record component using react hook?
reactjs|react-hooks
-4
56
1
72,999,020
72,999,020
-1
true
2022-07-15T19:48:46.703Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to create record component using react hook?<p>I need to create react component for recording screen of web browser <br> Is there anybody can know how to...
72,999,538
Why does it keep saying initialize variable?<p>Below is the code I wrote. I need to initialize a variable called verificationID for later use. But I keep getting a red squiggly line with the text -</p> <ol> <li>Final variable verificationID must be initialized</li> <li>Non-nullable instance field vdi must be initialize...
<p>Because <code>flutter</code> and <code>dart language</code> are <code>null safety</code>. It means you should initialize your variables, and there will be <code>no error</code> regarding this in <code>runtime</code>. So when you write <code>dart</code> codes you must initialize them as follows:</p> <p>1- In some cas...
Why does it keep saying initialize variable?
flutter|dart
0
56
2
72,999,602
72,999,602
-1
true
2022-07-15T20:58:10.150Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does it keep saying initialize variable?<p>Below is the code I wrote. I need to initialize a variable called verificationID for later use. But I keep get...
72,892,834
Convert Sentence case string<p>i want ask how to Convert Sentence case string in PHP</p> <p>i have variable string</p> <pre><code>$sring = &quot;hello world,world,world heloo&quot;; </code></pre> <p>i want convert Sentence case per &quot;,&quot; to</p> <pre><code>$string = &quot;Hello World,World,World Heloo&quot;; </c...
<p>Uppercase each word after a comma</p> <pre class="lang-php prettyprint-override"><code>&lt;?php $sring = &quot;hello world,world,world heloo&quot;; echo ucwords(strtolower($sring), '\','); </code></pre> <p><strong>UPDATE</strong>: I have added space to the delimiter.</p> <pre class="lang-php prettyprint-override"><c...
Convert Sentence case string
php
-4
56
2
72,892,967
72,892,967
-1
true
2022-07-07T05:49:21.633Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert Sentence case string<p>i want ask how to Convert Sentence case string in PHP</p> <p>i have variable string</p> <pre><code>$sring = &quot;hello world,...
72,770,018
Append object parent key to children<p>I have the following object given:</p> <pre class="lang-json prettyprint-override"><code>{ &quot;groupA&quot;: [ {data: 'foo'}, {data: 'bar'} ], &quot;groupB&quot;: [ {data: 'hi'}, {data: 'mom'} ] } </code></pre> <p>I would like to append the parent object ...
<p>You can loop and set each item</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const obj = { "groupA": [ {data: 'foo'}, {data: 'bar'} ], "groupB": [ {data:...
Append object parent key to children
javascript
1
57
5
72,770,094
72,770,094
0
true
2022-06-27T09:43:49.530Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Append object parent key to children<p>I have the following object given:</p> <pre class="lang-json prettyprint-override"><code>{ &quot;groupA&quot;: [ ...
72,769,720
Dataframe stores duplicate header<p>I have a function that shows the files by size, but when I try to store the results in a dataframe, I get every result in a line with an index=0 the code of the function is:</p> <pre><code>def show_folders_by_size(r): size = 0 calcul_size=[] path=[] for ele in os.scan...
<p>I dont think that you need to create a Dataframe for every iteration. Store the results in an array and turn them into a single Dataframe afterwards like so :</p> <pre><code>results = [] def show_folders_by_size(r): // ... your function logic results.append(dict(path=path, size=size)) </code></pre> <p>And o...
Dataframe stores duplicate header
python|pandas|dataframe
0
57
1
72,770,214
72,770,214
0
true
2022-06-27T09:21:29.543Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dataframe stores duplicate header<p>I have a function that shows the files by size, but when I try to store the results in a dataframe, I get every result in...
72,772,575
Junit Test of Getters. How can I write it<p>I have a class:</p> <pre><code>public final class Core { private final Deque&lt;Double&gt; stack = new ArrayDeque&lt;&gt;(); private final HashMap&lt;String, Double&gt; values = new HashMap&lt;&gt;(); public Deque&lt;Double&gt; getStack() { return stack; ...
<p>You get each property and add something to their collection</p> <p>Then get each property again and verify that what you added is still there</p>
Junit Test of Getters. How can I write it
java|unit-testing|junit|junit5
-1
57
1
72,772,698
72,772,698
0
true
2022-06-27T13:03:30.040Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Junit Test of Getters. How can I write it<p>I have a class:</p> <pre><code>public final class Core { private final Deque&lt;Double&gt; stack = new ArrayD...
72,782,891
setInterval go faster every time it is called<p>This time go faster if is called 2 times, 3 times faster and so on.</p> <pre><code>function startIdleTime() { var ciclo; function startSlidercicle() { ciclo = setInterval( function() { let seconds = parseInt(sessionStorage.getI...
<p>Looks like the interval is not cleared before instantiating a new one. The result will be several intervals that will be executed with a different phase, and it will look like it's running with a shorter interval.</p> <p>The reason for this behavior is that you are not clearing the interval, because you are creating...
setInterval go faster every time it is called
javascript
0
57
1
72,783,087
72,783,087
0
true
2022-06-28T08:10:32.947Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: setInterval go faster every time it is called<p>This time go faster if is called 2 times, 3 times faster and so on.</p> <pre><code>function startIdleTime() {...
72,786,645
Most efficient way to search and manipulate Data: Array, classobject, collection?<p>My goal is to read and manipulate a list of data from different customers in an efficient way.</p> <p>I have data looking like this. With 40+ columns and 500+ rows. <a href="https://i.stack.imgur.com/Ic2xa.png" rel="nofollow noreferrer"...
<p>Please, try to understand the next fast way of data processing. Since your question do not clarify too much about the other columns content, it assumes that in the fourth column the cities exist:</p> <pre><code>Sub ArrayDictionaryApproach() Dim sh As Worksheet, lastR As Long, arr, arrItem, i As Long, dict As Objec...
Most efficient way to search and manipulate Data: Array, classobject, collection?
excel|vba
-3
57
1
72,787,719
72,787,719
0
true
2022-06-28T12:41:35.160Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Most efficient way to search and manipulate Data: Array, classobject, collection?<p>My goal is to read and manipulate a list of data from different customers...
72,312,221
How to run a local cargo-tool?<p>Cargo tools like this <a href="https://github.com/bbqsrc/cargo-ndk" rel="nofollow noreferrer">https://github.com/bbqsrc/cargo-ndk</a> can be installed. If I clone it, how can I run it? Can I also install it?</p> <p>I tried</p> <p><code>RUST_LOG=trace cargo run -- -t arm64-v8a --bindgen ...
<p>For installing when you're in the folder:</p> <pre class="lang-bash prettyprint-override"><code>cargo install --path . </code></pre>
How to run a local cargo-tool?
linux|rust|rust-cargo
0
57
1
72,792,193
72,792,193
0
true
2022-05-20T00:02:58.990Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to run a local cargo-tool?<p>Cargo tools like this <a href="https://github.com/bbqsrc/cargo-ndk" rel="nofollow noreferrer">https://github.com/bbqsrc/carg...
72,795,203
Alternating Direction Loop<p>I am trying to make a snakes and ladders game, and I want to make a grid go left to right then vice versa like a snake, but I'm only able to make it go left to right then reset back to the left like writing text.</p> <pre><code>for i in range(0,100): w = WIDTH / 10 h = HEIGHT / 10...
<p>You can use an if condition in the for loop, to detect whether it's on an odd row or even row. If it's on an even row, then x go from left to right (<code>0*w</code> to <code>9*w</code>); otherwise go from right to left (from <code>9*w</code> to <code>0*w</code>).</p> <pre class="lang-py prettyprint-override"><code>...
Alternating Direction Loop
python
0
57
1
72,795,508
72,795,508
0
true
2022-06-29T02:41:57.563Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Alternating Direction Loop<p>I am trying to make a snakes and ladders game, and I want to make a grid go left to right then vice versa like a snake, but I'm ...
72,798,272
document.querySelectorAll didn't get call from generated html element<p>I'm displaying list of div element that generated from .html function whenever users click a button. The code look like below</p> <p><strong>array</strong></p> <pre><code>const obj = [{&quot;id&quot;:&quot;1&quot;,&quot;section&quot;:&quot;delivery...
<p>The problem is fixed by using answer from Arm144. Attaching onclick attribute into the span</p> <pre><code>createFilterBubblesTemplate = async (obj) =&gt; { let bubbles = '' obj.forEach(e =&gt; { bubbles += `&lt;div class=&quot;filter-btn&quot;&gt; &lt;span&gt;${e.label}&lt;/span&gt; &lt;span class=&...
document.querySelectorAll didn't get call from generated html element
javascript|dom|ecmascript-6|dom-events
0
57
4
72,798,607
72,798,607
0
true
2022-06-29T08:35:05.093Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: document.querySelectorAll didn't get call from generated html element<p>I'm displaying list of div element that generated from .html function whenever users ...
72,798,924
How create similar widget in Flutter?<p>I want to create a similar widget, but I don't know how to do it.</p> <p><img src="https://i.stack.imgur.com/Yu43h.png" alt="How the widget should look like" /></p>
<p>It seems you are looking for a <a href="https://api.flutter.dev/flutter/material/Slider-class.html" rel="nofollow noreferrer">slider</a>, one of Flutters standard controls.</p> <p>You can change it's appearance to match your example more closely as covered by the linked documentation.</p>
How create similar widget in Flutter?
flutter|dart|widget
-1
57
1
72,799,892
72,799,892
0
true
2022-06-29T09:21:53.950Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How create similar widget in Flutter?<p>I want to create a similar widget, but I don't know how to do it.</p> <p><img src="https://i.stack.imgur.com/Yu43h.pn...
72,803,943
element defined in xaml "does not exist" in c# code behind<p>I´ve started to learn xamarin forms and now I'm already starting to apply animation to my Image. But I've got an error in my code.</p> <p>Here's my code in xaml.cs:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System...
<p>This is a common issue with Xamarin on VS, especially on MAC, what happens is that your debug file does not generate the XAML changes onto the xaml.g.cs file. Which is basically the file that is autogenerated where our compiler combines the xaml and xaml.cs file.</p> <p>All you need to do for this to update correctl...
element defined in xaml "does not exist" in c# code behind
c#|visual-studio|xamarin.forms|code-behind
0
57
1
72,804,197
72,804,197
0
true
2022-06-29T15:20:05.590Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: element defined in xaml "does not exist" in c# code behind<p>I´ve started to learn xamarin forms and now I'm already starting to apply animation to my Image....
72,802,796
React event.preventDefault() is not working when uploading attachment<p>I have an attachment upload feature using React-Bootstrap form and unfortunately, every time I upload an attachment, the page keeps refreshing and signs me out of the application. I have inserted <code>e.preventDefault()</code> in all functions; <c...
<p>I found a solution but absolutely have no idea why. I changed from client side to server side (uploaded the files to public/images of server instead of client) and boom, the problem's gone.</p>
React event.preventDefault() is not working when uploading attachment
javascript|reactjs|event-handling
1
57
2
72,805,357
72,805,357
0
true
2022-06-29T14:07:46.353Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React event.preventDefault() is not working when uploading attachment<p>I have an attachment upload feature using React-Bootstrap form and unfortunately, eve...
72,809,486
png image saved in mysql database, doesn't fully show on browser<p>PHP codes of index.php</p> <pre class="lang-php prettyprint-override"><code>&lt;?php include(&quot;connection.php&quot;); $sql = &quot;SELECT prod_cost, prod_name, prod_image FROM products&quot;; $result = mysqli_query($con, $sql); $row...
<p>Verify your data type for <code>prod_image</code> column. Make sure what you save via <code>LOAD_FILE('C:/xampp/htdocs/SNS/Images/products/rooster18.png')</code> has enough space/size to store the complete image. I've used your code and it is working fine in my side(please change data:image/ppg to <code>data:image/p...
png image saved in mysql database, doesn't fully show on browser
php|html|css|mysql
2
57
1
72,810,192
72,810,192
0
true
2022-06-30T01:43:59.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: png image saved in mysql database, doesn't fully show on browser<p>PHP codes of index.php</p> <pre class="lang-php prettyprint-override"><code>&lt;?php i...
72,811,545
Google Sheets/QUERY/Query to count with criteria from another sheet<p>Trying to Perform a Count of specific values across 3 ranges from another Google Sheets Doc.</p> <p>Answered below.</p>
<pre><code>=iferror(index(query({IMPORTRANGE(Source!B2,&quot;TESTING!A2:C&quot;)},&quot;select count(Col1) where Col1 = 'John' and Col2 = 1 and Col3 = date '2022-6-30'&quot;),2),0) </code></pre> <p><a href="https://i.stack.imgur.com/UWgTc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UWgTc.png" alt...
Google Sheets/QUERY/Query to count with criteria from another sheet
google-sheets
1
57
1
72,813,605
72,813,605
0
true
2022-06-30T07:03:48.067Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google Sheets/QUERY/Query to count with criteria from another sheet<p>Trying to Perform a Count of specific values across 3 ranges from another Google Sheets...
72,818,478
Trying to get the string inside of <div> tags using bs4 (python3)<p>Please be patient with me. Brand new to Python and Stackoverflow.</p> <p>I am trying to pull crypto price data into a program in order find out exactly how much I have in usd. I am currently stuck trying to extract the string from the tag that I get b...
<p>You don't need the whole class (which possibly might change), it should just work with <code>price</code>. Try the following:</p> <pre class="lang-py prettyprint-override"><code>from bs4 import BeautifulSoup import requests url = 'https://coinmarketcap.com/currencies/shiba-inu/' response = requests.get(url) soup = ...
Trying to get the string inside of <div> tags using bs4 (python3)
python|html|python-3.x|beautifulsoup
0
57
1
72,818,938
72,818,938
0
true
2022-06-30T15:34:11.813Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trying to get the string inside of <div> tags using bs4 (python3)<p>Please be patient with me. Brand new to Python and Stackoverflow.</p> <p>I am trying to p...
72,819,523
Fastapi scaleup multi-tennent application<p>I am trying to understand how to scale up Fastapi on our app. We have currently application developed like into snippet code bellow. So we dont use async calls. Our application is multi-tennent and we expect to load big requests (~10mbs) per requests.</p> <pre><code>from fast...
<p>First of all: Does this processing need to be sync? I mean, is the user waiting for the response of this processing that takes 2-3 minutes? It is not recommended that you have APIs that take that long to respond.</p> <p>If your user doesn't need to wait until it finishes, you have a few options:</p> <ol> <li>You can...
Fastapi scaleup multi-tennent application
postgresql|fastapi
0
57
1
72,821,561
72,821,561
0
true
2022-06-30T17:00:36.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fastapi scaleup multi-tennent application<p>I am trying to understand how to scale up Fastapi on our app. We have currently application developed like into s...
72,795,190
DNN OpenCV Python using RSTP always crash after few minutes<h2><strong>Description:</strong></h2> <p>I want to create a people counter using DNN. The model I'm using is MobileNetSSD. The camera I use is IPCam from Hikvision. Python communicates with IPCam using the RSTP protocol.</p> <p>The program that I made is good ...
<p>The main problem here is that RSTP always has some corrupted frames in it. The solution is to run video capture on thread 1 and video processing on thread 2.</p> <p><strong>As an example:</strong></p> <pre><code>import cv2 import threading import queue q=queue.Queue() def this_receive(q): cap = cv2.VideoCaptur...
DNN OpenCV Python using RSTP always crash after few minutes
python|opencv|ffmpeg|video-streaming
0
57
1
72,824,364
72,824,364
0
true
2022-06-29T02:37:53.287Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: DNN OpenCV Python using RSTP always crash after few minutes<h2><strong>Description:</strong></h2> <p>I want to create a people counter using DNN. The model I...
72,824,940
Which is the correct way to configure IpAddress condition in Policy document for REST API?<p>I'm trying to allow only specific IP addresses to access my API Gateway REST API without success.</p> <p>I configured the following resource policy:</p> <pre><code>{ &quot;Version&quot;: &quot;2012-10-17&quot;, &quot;St...
<p>I changed <code>&quot;aws.SourceIp&quot;</code> to <code>&quot;aws:SourceIp&quot;</code> and problem solved. Sorry for the typo.</p>
Which is the correct way to configure IpAddress condition in Policy document for REST API?
amazon-web-services|aws-api-gateway|aws-policies|aws-rest-api
0
57
1
72,825,891
72,825,891
0
true
2022-07-01T05:55:16.300Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Which is the correct way to configure IpAddress condition in Policy document for REST API?<p>I'm trying to allow only specific IP addresses to access my API ...
72,826,933
How to create a list of variables in ruby?<p>I’m trying to create something like an inventory in ruby, so I can compare &quot;params&quot; against every line in that inventory, but I’m new to the language and I don’t know what might be the best way to do it.</p> <p>Actually my code looks like this:</p> <pre><code>def p...
<p>To summarise the requirements of your question:</p> <blockquote> <p>If params is equal to any line in <code>inventory.txt</code> then it's valid, otherwise it's invalid</p> </blockquote> <p>You can do this:</p> <pre><code>def parseParams(params) File.read('inventory.txt').split(&quot;\n&quot;).include?(params) end...
How to create a list of variables in ruby?
ruby
0
57
1
72,827,982
72,827,982
0
true
2022-07-01T09:09:09.907Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create a list of variables in ruby?<p>I’m trying to create something like an inventory in ruby, so I can compare &quot;params&quot; against every line...
72,828,510
Weird Python Lambda() syntax<p>As below, I understand <strong>lambda y:...</strong> .</p> <p>But the first <strong>Lambda(...)</strong> is a function?.</p> <pre><code>ds = datasets.FashionMNIST( ... target_transform=Lambda(lambda y: torch.zeros(10, dtype=torch.float).scatter_(0, torch.tensor(y), value=1)) ) </code>...
<p>It's just a function in <a href="https://pytorch.org/vision/stable/generated/torchvision.transforms.Lambda.html" rel="nofollow noreferrer">torchvision</a> for wrapping an arbitrary function as a transform. It's nothing to do with Python syntax, and is spelled <code>Lambda</code> with a capital <code>L</code> instea...
Weird Python Lambda() syntax
python|pytorch
0
57
1
72,828,560
72,828,560
0
true
2022-07-01T11:21:43.087Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Weird Python Lambda() syntax<p>As below, I understand <strong>lambda y:...</strong> .</p> <p>But the first <strong>Lambda(...)</strong> is a function?.</p> <...
72,819,957
call to insert a table in html by python FASTAPI<p>Background: I'm new to html and fastAPI and not sure about the right terminology for the questions I have. I know how to insert a image in html by doing following:</p> <pre><code>&lt;img scr=&quot;create_image&quot; alt=&quot;&quot;&gt; </code></pre> <p>and then on pyt...
<p>the following code in html file will serve the purpose</p> <pre><code>&lt;iframe src=&quot;create_table&quot;&gt;&lt;/iframe&gt; </code></pre>
call to insert a table in html by python FASTAPI
python|html|pandas|fastapi
-1
57
1
72,833,349
72,833,349
0
true
2022-06-30T17:40:47.610Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: call to insert a table in html by python FASTAPI<p>Background: I'm new to html and fastAPI and not sure about the right terminology for the questions I have....
72,837,412
Datatable Show entries box vs export buttons<p>My issue is strange, when i try to put excel export button in datatable then Show entries button will be removed. see below screen shot</p> <p><img src="https://i.stack.imgur.com/N7WfN.png" alt="added excel button" /></p> <p><img src="https://i.stack.imgur.com/27x7t.png" a...
<p>Try adding <strong>lBfrtip</strong> to <strong>dom</strong> property</p> <pre><code>$(document).ready(function() { $('#example').DataTable( { dom: 'lBfrtip', buttons: [ 'copy', 'csv', 'excel', 'pdf', 'print' ] } ); } ); </code></pre> <p>Reference --&gt; <a href="https://da...
Datatable Show entries box vs export buttons
laravel|datatable|laravel-blade
-2
57
1
72,838,587
72,838,587
0
true
2022-07-02T07:49:49.627Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Datatable Show entries box vs export buttons<p>My issue is strange, when i try to put excel export button in datatable then Show entries button will be remov...
72,840,992
Where is the problem in my corde(YML file) or Azure database? Spring Boot and Azure<p>Fist I am start project and create Azure database. After that DB link to my project and it was run. But it is not and indicate run error-&gt;</p> <pre><code>22:40:19.125 [main] ERROR org.springframework.boot.SpringApplication - Applic...
<p>The error coming from the YAML parser is misleading - it is not actually <code>username: javatechi</code> that is incorrect.</p> <p>Please have a read through the <a href="https://yaml.org/spec/1.2.2/#21-collections" rel="nofollow noreferrer">YAML spec, 2.1 Collections</a> and its examples, which is introduced with:...
Where is the problem in my corde(YML file) or Azure database? Spring Boot and Azure
sql-server|spring|database|spring-boot|hibernate
0
57
1
72,843,024
72,843,024
0
true
2022-07-02T17:11:10.147Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Where is the problem in my corde(YML file) or Azure database? Spring Boot and Azure<p>Fist I am start project and create Azure database. After that DB link t...
72,795,737
Is there a way to modify when the kill message is sent to any process all others has to die?<p>Thanks for taking a look at my question.</p> <p>I wrote a code for the question ring problem from the o'reilly francesco cesarini and simpson thompson, Exercise 4-2: The Process Ring.</p> <p>Now here's my question,How can I m...
<p>As was suggested by @BrujoBenavides in a comment, you can <em>link</em> all processes in the ring. If one of the linked processes terminates, Erlang VM will automatically terminate all other linked processes. See <a href="https://www.erlang.org/doc/reference_manual/processes.html#links" rel="nofollow noreferrer">the...
Is there a way to modify when the kill message is sent to any process all others has to die?
erlang|erlang-otp|erlang-shell|erlang-supervisor
1
57
1
72,846,417
72,846,417
0
true
2022-06-29T04:16:01.867Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to modify when the kill message is sent to any process all others has to die?<p>Thanks for taking a look at my question.</p> <p>I wrote a code...
72,802,250
NoSuchModuleError: sqlalchemy-access<p>I have a script that queries and updates an access table. I've used it successfully on my computer, but after installing anaconda and spyder on a different computer (same versions as the original installation on the original computer) it doesn't work on the new computer. To clarif...
<p>I don't know why, but after trying multiple times, I checked again (<code>pip list|findstr access</code>) and found that the installation of sqlalchemy-access, which I managed to find before in the anaconda prompt, has disappeared. I installed it again (for the third or fourth time) and now it works.</p>
NoSuchModuleError: sqlalchemy-access
python|sqlalchemy|spyder|sqlalchemy-access
0
57
2
72,847,405
72,847,405
0
true
2022-06-29T13:28:08.400Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NoSuchModuleError: sqlalchemy-access<p>I have a script that queries and updates an access table. I've used it successfully on my computer, but after installi...
72,848,711
Passing arguments to Python file that is run by PySpark<p>This thread <a href="https://stackoverflow.com/questions/40028919/how-to-run-a-script-in-pyspark">here</a> showed how to run Python script file with <code>pyspark</code>. Particularly, this is the command I am using:</p> <pre><code>% pyspark &lt; script.py </co...
<p>Answering this to get it off the unanswered queue. Use <code>spark-submit</code>in combination with <code>sys.argv</code> to get the input:</p> <pre><code>spark-submit script.py conf.ini </code></pre>
Passing arguments to Python file that is run by PySpark
python|macos|apache-spark|pyspark
0
57
1
72,856,527
72,856,527
0
true
2022-07-03T17:50:06.943Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passing arguments to Python file that is run by PySpark<p>This thread <a href="https://stackoverflow.com/questions/40028919/how-to-run-a-script-in-pyspark">h...
72,857,447
IQueryable async loop<p>Here is a linq to sql query:</p> <pre><code>var query = db.Table1.Where(t =&gt; t.age &gt;= 18); foreach (var item in query) { ... } var query2 = query.Where(t =&gt; t.dept == 1234); foreach (var item in query2) { ... } </code></pre> <p>query and query2 are IQueryable objects. That me...
<p>You can use the <code>await</code> keyword inside the <code>foreach</code> statement like so:</p> <pre><code>foreach (var item in await query2.ToListAsync()) { ... } </code></pre>
IQueryable async loop
c#|linq|async-await
-1
57
2
72,857,527
72,857,527
0
true
2022-07-04T13:20:45.327Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: IQueryable async loop<p>Here is a linq to sql query:</p> <pre><code>var query = db.Table1.Where(t =&gt; t.age &gt;= 18); foreach (var item in query) { .....
72,857,320
Wait for insert function to complete (Coroutine)<p>I have the following function in my ViewModel:</p> <pre><code>fun insertMovie(movie: Movie): Long { var movieId = 0L viewModelScope.launch { movieId = repository.insertMovie(movie) Log.i(LOG_TAG, &quot;add movie with id $movieId within launch&qu...
<p>A launch statement just launches a coroutine. What happens inside the coroutine does not matter to the rest of the function, thats why the code after the launch statement gets executet immediately after the launch and will probably be done before your <code>repository.insertMovie()</code>.</p> <p>As broot already me...
Wait for insert function to complete (Coroutine)
android|kotlin-coroutines|dao
0
57
1
72,858,362
72,858,362
0
true
2022-07-04T13:10:46.927Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Wait for insert function to complete (Coroutine)<p>I have the following function in my ViewModel:</p> <pre><code>fun insertMovie(movie: Movie): Long { va...
72,845,616
type hint npt.NDArray number of axis<p>Given I have the number of axes, can I specify the number of axes to the type hint npt.NDArray (from <code>import numpy.typing as npt</code>)</p> <p>i.e. if I know it is a 3D array, how can I do <code>npt.NDArray[3, np.float64]</code></p>
<p>On Python 3.9 and 3.10 the following does the job for me:</p> <pre class="lang-py prettyprint-override"><code>data = [[1, 2, 3], [4, 5, 6]] arr: np.ndarray[Tuple[Literal[2], Literal[3]], np.dtype[np.int_]] = np.array(data) </code></pre> <p>It is a bit cumbersome, but you might follow <a href="https://github.com/nump...
type hint npt.NDArray number of axis
numpy|numpy-ndarray
0
57
1
72,858,364
72,858,364
0
true
2022-07-03T10:11:09.107Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: type hint npt.NDArray number of axis<p>Given I have the number of axes, can I specify the number of axes to the type hint npt.NDArray (from <code>import nump...
72,861,095
Integrating Nuxt Js in Django "GET /_nuxt/bed9682.js HTTP/1.1" 404 2918<p>I am trying to integrate my Nuxt application inside Django. I have my Nuxt application and django application inside the same folder. I have set up the settings.py</p> <pre><code> TEMPLATES = [ { 'BACKEND': 'django.template.backend...
<p>any xxxx.js is static file, not the view-route. Django serve static files through settings: &quot;static&quot; or &quot;media&quot;. you can setup in settings:</p> <pre><code># override Media MEDIA_URL = '/_nuxt/' MEDIA_ROOT = BASE_DIR / '_nuxt' </code></pre> <p>or you can set up static folder with properly configur...
Integrating Nuxt Js in Django "GET /_nuxt/bed9682.js HTTP/1.1" 404 2918
django|deployment|nuxt.js|integrate
1
57
1
72,861,727
72,861,727
0
true
2022-07-04T19:09:10.223Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Integrating Nuxt Js in Django "GET /_nuxt/bed9682.js HTTP/1.1" 404 2918<p>I am trying to integrate my Nuxt application inside Django. I have my Nuxt applicat...
72,864,140
Unable to fetch date data in HTml <input type= 'date'> from database<p>I have a input box in HTML</p> <pre><code>&lt;label&gt;Holiday&lt;/label&gt; &lt;input type=&quot;date&quot; class=&quot;form-control&quot; asp-for=&quot;HolidayDate&quot; &gt; </code></pre> <p>In this field I want data from my Database in sqlserve...
<p>.NET Datetime is different from JavaScript Date, be sure convert like below:</p> <pre><code>$(&quot;.btnGet&quot;).click(function () { var origin = window.location.origin; $.post(origin + &quot;/HolidayMaster/Edit&quot;, { Id: $(this).attr(&quot;data-id&quot;) }, //id for fetching data ...
Unable to fetch date data in HTml <input type= 'date'> from database
javascript|html|asp.net-core
1
57
1
72,864,843
72,864,843
0
true
2022-07-05T04:51:07.087Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to fetch date data in HTml <input type= 'date'> from database<p>I have a input box in HTML</p> <pre><code>&lt;label&gt;Holiday&lt;/label&gt; &lt;input...