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,378,148
how to add a custom claim to a web token? b2c custom policys<p>I have a custom policy on Azure B2C. When the user signs up, I need to remove the display for &quot;DisplayName&quot; (text box) from the signup screen. Instead, I need to copy the email into DisplayName and add the DisplayName to the web token.</p> <p>I ha...
<p>Try to use in your login-Noninteractive your displayName claim like this:</p> <p>ClaimTypeReferenceId=&quot;email&quot; PartnerClaimType=&quot;displayName&quot;</p> <p>You really don't need the claims transformation &quot;CopyEmailAddress&quot;</p>
how to add a custom claim to a web token? b2c custom policys
azure-ad-b2c-custom-policy|claims
-1
68
1
72,421,438
72,421,438
1
true
2022-05-25T13:00:21.053Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to add a custom claim to a web token? b2c custom policys<p>I have a custom policy on Azure B2C. When the user signs up, I need to remove the display for ...
72,358,205
Ruby: how to concat two return values to two strings in one line<p>I am trying to <code>concat</code> two strings that are returned by a function to two existing strings in one line.</p> <p>this is my code with extra steps</p> <pre><code>def my_function() return &quot;foo&quot;, &quot;bar&quot; end foo = String.ne...
<p>It depends on how <code>concat</code> is defined. If it accepts multiple arguments, you should be able to do:</p> <pre><code>config_file_a.concat(*L4_LB.build_pool(some_vars)) </code></pre> <p>Note the <code>*</code> which ensures that each element in the array returned by <code>build_pool</code> is passed as an ind...
Ruby: how to concat two return values to two strings in one line
ruby
2
68
1
72,362,020
72,362,020
1
true
2022-05-24T06:36:16.947Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ruby: how to concat two return values to two strings in one line<p>I am trying to <code>concat</code> two strings that are returned by a function to two exis...
72,253,231
Insert operation fails with NULL identity key Error in SQLAlchemy + SQLite<p><strong>tldr;</strong> After trying to insert a record into a table called <code>json_schema</code> using an ORM mapper class, I received the error: <code>sqlalchemy.orm.exc.FlushError: Instance &lt;JsonSchema at 0x10657f730&gt; has a NULL ide...
<p><a href="https://github.com/sqlalchemy/sqlalchemy/issues/6195" rel="nofollow noreferrer">SQLAlchemy does not yet support RETURNING for SQLite</a>, and the primary key in this case isn't handled by <code>AUTOINCREMENT</code>. In such a case, SQLAlchemy must execute the default-generating function itself and explicit...
Insert operation fails with NULL identity key Error in SQLAlchemy + SQLite
sqlite|sqlalchemy
1
68
1
72,255,076
72,255,076
1
true
2022-05-16T00:56:32.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Insert operation fails with NULL identity key Error in SQLAlchemy + SQLite<p><strong>tldr;</strong> After trying to insert a record into a table called <code...
72,251,583
Combine geoQuery with rating aggregation<p>I want to get all objects in a radius and also for each single of those objects their average rating and total ratings. I've got both queries working but I'm looking to combine these 2 into one.</p> <p><strong>LocationSchema</strong></p> <pre><code>const LocationObject = new S...
<p>As per your latest playground, you could achieve using <a href="https://mongoplayground.net/p/-rQfBmdMQS2" rel="nofollow noreferrer">this</a></p> <pre><code>db.locationObject.aggregate([ { &quot;$match&quot;: { &quot;location&quot;: { &quot;$geoWithin&quot;: { &quot;$centerSphere&quot;:...
Combine geoQuery with rating aggregation
node.js|mongodb|mongoose
1
68
1
72,287,027
72,287,027
1
true
2022-05-15T19:31:55.053Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Combine geoQuery with rating aggregation<p>I want to get all objects in a radius and also for each single of those objects their average rating and total rat...
72,325,434
How to use if commands with sentances<p>I am currently learning c++ and creating an assistant for myself. I need to make sure the if command checks for a sentence, not a word in a string how do I do that.</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;windows.h&gt; using namespace std; c...
<p>In this:</p> <blockquote> <p><code>if (Question == whats the weather?)</code></p> </blockquote> <p>Add quotes around the sentence. You want to write</p> <p><code>if (Question == &quot;whats the weather?&quot;)</code></p> <p>Also, since you're <code>using namespace std</code>, you don't need <code>std::</code> before...
How to use if commands with sentances
c++
-4
68
2
72,325,460
72,325,460
1
true
2022-05-20T22:55:28.270Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use if commands with sentances<p>I am currently learning c++ and creating an assistant for myself. I need to make sure the if command checks for a sen...
72,327,368
Why number or digits showing dots on smartphone?<p>I am facing one issue. My whole website digits change to &quot;…&quot; dots. Example if there is &quot;123&quot;, it changes to &quot;…&quot;.</p> <p>Here is my deployed application: <a href="https://ezylegal.in/legal-consultation" rel="nofollow noreferrer">https://ezy...
<p>It’s because Microsoft Clarity hides all sensitive data by default (or the data <em>it thinks</em> is sensitive). It’s called masking content.</p> <blockquote> <p>Clarity masks all sensitive content on your website by default. The sensitive content includes all input box content, numbers, and email addresses. Clarit...
Why number or digits showing dots on smartphone?
javascript|android|reactjs|ms-clarity
1
68
1
72,327,408
72,327,408
1
true
2022-05-21T06:59:56.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why number or digits showing dots on smartphone?<p>I am facing one issue. My whole website digits change to &quot;…&quot; dots. Example if there is &quot;123...
72,280,186
Uncaught ReferenceError: firstFunc is not defined at HTMLButtonElement.onclick Wordpress Divi<p>Very new to the web development industry, and having some trouble figuring out what's wrong with my code. Trying to implement javascript onto a code snippet with Wordpress using Divi, but can't seem to understand what exactl...
<p>The issue is caused by a few typos. unfortunately to many and to long to list them in the comments. So if this solve the issue for you, remove your question voluntarily:</p> <ol> <li><code>if (x.style.backgroundColor == &quot;transparent&quot;;) {</code> -&gt; remove the semicolon: <code>if (x.style.backgroundColor ...
Uncaught ReferenceError: firstFunc is not defined at HTMLButtonElement.onclick Wordpress Divi
javascript|html|css|wordpress|divi
1
68
1
72,280,372
72,280,372
1
true
2022-05-17T20:18:48.383Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Uncaught ReferenceError: firstFunc is not defined at HTMLButtonElement.onclick Wordpress Divi<p>Very new to the web development industry, and having some tro...
72,262,318
Subdivide lagrange interpolated curve<p>I'm looking for a way to subdivide a curve, generated by Lagrange interpolation.</p> <p>Let's say I have a curve defined by c1,c2,c3 control points, and I want to divide it somewhere between c1 and c2 with d1 (d1 is a point that's on the curve between c1 and c2).</p> <p>As a resu...
<p>Lagrange polynomial for three points is the only quadratic polynomial through these points.</p> <p>So you can get any point inside left part and any point inside right part and recalculate two Lagrange polynomials - but they <strong>will be similar</strong> to each other and to initial polynomial.</p> <p>I mean ther...
Subdivide lagrange interpolated curve
graphics|geometry|2d|interpolation|curve
0
68
1
72,263,273
72,263,273
1
true
2022-05-16T16:12:03.537Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Subdivide lagrange interpolated curve<p>I'm looking for a way to subdivide a curve, generated by Lagrange interpolation.</p> <p>Let's say I have a curve defi...
72,317,254
How do I limit the scope of `resolveJsonModule`?<p>I'm working on project that uses Typescript and webpack. I have to import json files, and I have to do it in two ways:</p> <ul> <li>I have to import project's <code>package.json</code> as a module. This has already been implemented previously.</li> <li>Have to import s...
<p>As I know, there's no way to override json types once <code>--resolveJsonModule</code> was set. May you consider to disable that flag and write types for package.json manually? It's not time-consuming since you use only one <code>package.json</code> field.</p> <pre><code>declare module '*.schema.json' { const ur...
How do I limit the scope of `resolveJsonModule`?
json|typescript|webpack
2
68
1
72,326,697
72,326,697
1
true
2022-05-20T10:18:43.807Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I limit the scope of `resolveJsonModule`?<p>I'm working on project that uses Typescript and webpack. I have to import json files, and I have to do it ...
72,245,160
How to fill in the blanks for one (or more) columns by calculating based on multiple conditions?<p>I collect and process hundreds of jumbled tables every day, and some of the data requires attention.</p> <p><a href="https://i.stack.imgur.com/1oj0u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1oj0u...
<p>IUUC,</p> <pre class="lang-py prettyprint-override"><code>m = df['LEVEL'].eq('S') &amp; df['CHECK'].eq('Go') df['FillNA'] = df['FillNA'].mask(m &amp; df['FillNA'].isna(), 'DANGER') df['Detail'] = df['Detail'].mask(m &amp; df['Detail'].isna(), df.index.astype(str) + ' ' + df['CHECK']) # or cols = ['FillNA', 'Detail...
How to fill in the blanks for one (or more) columns by calculating based on multiple conditions?
python|pandas|dataframe
0
68
1
72,245,245
72,245,245
1
true
2022-05-15T02:28:56.980Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to fill in the blanks for one (or more) columns by calculating based on multiple conditions?<p>I collect and process hundreds of jumbled tables every day...
72,304,699
How to combine two arrow function?<p>how to combine below two functions , which I need to use in single element. Please help</p> <pre><code>onClick={() =&gt; setSelectedItem(&quot;List A&quot;)} onClick={(e) =&gt; e.stopPropagation()} e.g &lt;a onClick={function1, funtion2} </code></pre>
<pre class="lang-js prettyprint-override"><code>onClick = {(e) =&gt; { setSelectedItem(&quot;List A&quot;); e.stopPropagation() }} </code></pre>
How to combine two arrow function?
reactjs|arrow-functions
0
68
3
72,304,747
72,304,747
1
true
2022-05-19T12:37:48.577Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to combine two arrow function?<p>how to combine below two functions , which I need to use in single element. Please help</p> <pre><code>onClick={() =&gt...
72,259,748
Scripts arguments starting with -- are removed<p>In node 14 I had the following script</p> <pre class="lang-json prettyprint-override"><code>scripts: { &quot;test&quot;: &quot;node test.js&quot;, } </code></pre> <p>Then I ran it with the following command <code>npm run test -- --value '10'</code> this gave the output...
<p>I'm not sure 100% about the root cause, but I can now explain the semi-root causes and ways to work around it.</p> <p>It appears that while on my machine there is only an <code>npm.cmd</code> file in <code>C:\Program Files\nodejs</code>, on yours there is also an <code>npm.ps1</code> file. It appears this file is cr...
Scripts arguments starting with -- are removed
node.js|windows|powershell-core
1
68
1
72,260,631
72,260,631
1
true
2022-05-16T13:08:08.713Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scripts arguments starting with -- are removed<p>In node 14 I had the following script</p> <pre class="lang-json prettyprint-override"><code>scripts: { &qu...
72,269,676
Getting yellow background-color in chrome around anchor, tried all the solution available, but still no fix<p>I tried all the solutions from forums, still not fixed. I am creating a combo box using styled-component in React.</p> <p><a href="https://i.stack.imgur.com/q0bbO.png" rel="nofollow noreferrer"><img src="https:...
<p>One sidenote: I find it very difficult to read StyledComponents and I try to avoid them as much as possible.</p> <p>There are 2 things. <code>VisibleLabel</code> should not be an <code>&lt;a&gt;</code>-tag, but a <code>label</code>. You want it to select the Selectbox, not link to something else.</p> <p>Have you see...
Getting yellow background-color in chrome around anchor, tried all the solution available, but still no fix
html|css|reactjs|google-chrome|styled-components
0
68
2
72,271,012
72,271,012
1
true
2022-05-17T07:17:16.787Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting yellow background-color in chrome around anchor, tried all the solution available, but still no fix<p>I tried all the solutions from forums, still no...
72,257,607
SQL (Snowflake) - Column that recursively refers to itself<p>I have seen a number of posts on this topic but I couldn't find any that are exactly the same.</p> <p>I would like to make a view with a column that refers to itself. In the example below:</p> <ul> <li>Value 1 + 2 are static values that continue throughout th...
<p>With slightly extended example data to show a new value3 taking precedent:</p> <pre><code>WITH data(Index, Value1, Value2, Value3) AS ( SELECT * FROM VALUES (1, 0.5, 0.25, 1), (2, 0.5, 0.25, null), (3, 0.5, 0.25, null), (4, 0.5, 0.25, 10), (5, 0.5, 0.25, null), (6, 0.5, 0.25, nul...
SQL (Snowflake) - Column that recursively refers to itself
sql|snowflake-cloud-data-platform
2
68
1
72,258,107
72,258,107
1
true
2022-05-16T10:16:55.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL (Snowflake) - Column that recursively refers to itself<p>I have seen a number of posts on this topic but I couldn't find any that are exactly the same.</...
72,275,836
Why can't I manually define a template parameter?<p>I have a simple sample which provides:</p> <ol> <li><p>a struct template:</p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; template &lt;typename T&gt; struct range_t { T b, e; range_t(T x, T y) : b(x), e(y) {} T begin() { return b; } T...
<p>Based on the comments and <a href="https://wiki.sei.cmu.edu/confluence/display/cplusplus/CTR55-CPP.+Do+not+use+an+additive+operator+on+an+iterator+if+the+result+would+overflow" rel="nofollow noreferrer">this</a> article about iterator overflow, here a complete <a href="https://replit.com/@Orace/SO72275836" rel="nofo...
Why can't I manually define a template parameter?
c++|templates|vector
0
68
1
72,276,155
72,276,155
1
true
2022-05-17T14:29:17.870Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why can't I manually define a template parameter?<p>I have a simple sample which provides:</p> <ol> <li><p>a struct template:</p> <pre><code>#include &lt;ios...
72,249,536
Is there a name to this common state manegement pattern with rxjs? Does it have limitations?<p>In Angular applications, we typically do something like this to manage shared states:</p> <pre><code>import { BehaviorSubject } from 'rxjs'; interface User { id: number; } class UserService { private _users$ = new Behav...
<p>That's a valid pattern, and that's why we also have introduced ngrx/component-store (<a href="https://ngrx.io/guide/component-store" rel="nofollow noreferrer">https://ngrx.io/guide/component-store</a>).</p> <p>The docs also provide pro/cons of both &quot;ways&quot;: <a href="https://ngrx.io/guide/component-store/com...
Is there a name to this common state manegement pattern with rxjs? Does it have limitations?
angular|redux|rxjs|ngrx|flux
2
68
1
72,260,927
72,260,927
2
true
2022-05-15T15:10:29.190Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a name to this common state manegement pattern with rxjs? Does it have limitations?<p>In Angular applications, we typically do something like this t...
72,262,778
What's wrong in my useEventListener.js that generates me useEventListener error all the time<p>what's wrong with my useEventListener ? Because each time I click on checkboxes I get this error :</p> <pre><code>useEventListener.js:14 Uncaught TypeError: callbackRef.current is not a function at HTMLDocument.internalCa...
<p>It seems the issue is in what you are passing to the custom hook:</p> <pre><code>useEventListener('change', ((e) =&gt; setIsMatch(e.matches), queryList)) </code></pre> <p>The code here is passing a Comma Operator expression.</p> <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/...
What's wrong in my useEventListener.js that generates me useEventListener error all the time
reactjs|react-hooks
5
68
2
72,263,710
72,263,710
2
true
2022-05-16T16:47:34.973Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What's wrong in my useEventListener.js that generates me useEventListener error all the time<p>what's wrong with my useEventListener ? Because each time I cl...
72,266,089
How to add bar outline to an R plotly bar chart?<p>I am creating a plotly chart with individual bars coded based on a variable category. I am having trouble adding a black outline to the bars while keeping the bars' color categorization.</p> <p>Below is my current code. What do I need to add to include a black outline ...
<p>The <code>marker</code> parameter is what you are after.</p> <pre><code>library(plotly) library(tidyverse) my_tibble &lt;- tibble(mins = runif(10,10,30), week = 1:10, exercise = c(&quot;a&quot;, &quot;b&quot;, &quot;b&quot;, &quot;b&quot;, &quot;a&quot;, &quot;a&quot;, &quot...
How to add bar outline to an R plotly bar chart?
r|plotly|r-plotly
1
68
1
72,266,131
72,266,131
2
true
2022-05-16T22:01:06.100Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add bar outline to an R plotly bar chart?<p>I am creating a plotly chart with individual bars coded based on a variable category. I am having trouble ...
72,274,789
Firestore update document without skipping values in Flutter<p>Currently I have a collection with a list of Users in it</p> <p>In my admin app I have a button that lets me update users documents based on the current value I set which is done via this function:</p> <pre><code>onPressed: () async { var querySnapshots =...
<p>It sounds like you'll want to use a <a href="https://firebase.google.com/docs/firestore/manage-data/transactions#batched-writes" rel="nofollow noreferrer">batched write</a>, which allows you to write to multiple document atomically.</p> <p>For your code that'd look something like this:</p> <pre><code>// Get a new wr...
Firestore update document without skipping values in Flutter
firebase|flutter|google-cloud-firestore
0
68
1
72,275,102
72,275,102
2
true
2022-05-17T13:18:38.437Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firestore update document without skipping values in Flutter<p>Currently I have a collection with a list of Users in it</p> <p>In my admin app I have a butto...
72,302,133
C# JSON deserialize: failing stating I need an array when everything is already an array<p>I must be blind. This is what I am receiving from API:</p> <pre><code>{ &quot;temperatures&quot;: [ { &quot;field&quot;: &quot;temp1&quot;, &quot;values&quot;: [ { ...
<p>JSON does not contain array, it contains single object with array <code>temperatures</code>, that's why serialzer cannot deserialize it as a collection. Do it that way:</p> <pre><code>var temperatures = JsonConvert.DeserializeObject&lt;Temperatures&gt;(content); ObservableCollection&lt;Temperatures&gt; res = new Obs...
C# JSON deserialize: failing stating I need an array when everything is already an array
c#|json
0
68
2
72,302,253
72,302,253
2
true
2022-05-19T09:35:53.617Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# JSON deserialize: failing stating I need an array when everything is already an array<p>I must be blind. This is what I am receiving from API:</p> <pre><c...
72,310,591
How to compare two objects and change the key name?<p>compare headerObj(field_key) and dataObj(key) and form the result with label from headerObj</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 prettyprin...
<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 headerArray = [ { label: 'Code', field_key: 'code', }, { label: 'Worked Accounts', ...
How to compare two objects and change the key name?
javascript|angular|typescript|ecmascript-6|ecmascript-2016
0
68
2
72,310,863
72,310,863
2
true
2022-05-19T20:14:17.107Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to compare two objects and change the key name?<p>compare headerObj(field_key) and dataObj(key) and form the result with label from headerObj</p> <p><div...
72,324,034
R chunk inside LaTeX in an rmarkdown document<p>I am trying to get an R chunk run inside LaTeX code in the following rmarkdown document:</p> <pre><code>--- title: &quot;Untitled&quot; output: pdf_document date: '2022-05-20' --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, results = &quot;hide&quot;) ...
<p>Meanwhile, I found this: <a href="https://tex.stackexchange.com/questions/210003/how-can-i-nest-a-code-chunk-within-an-enumerate-environment-when-using-r-markdow">How can I nest a code chunk within an enumerate environment when using R Markdown?</a>, which inspires the following solution:</p> <pre><code>--- title: &...
R chunk inside LaTeX in an rmarkdown document
r|r-markdown
1
68
3
72,324,409
72,324,409
2
true
2022-05-20T19:36:47.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R chunk inside LaTeX in an rmarkdown document<p>I am trying to get an R chunk run inside LaTeX code in the following rmarkdown document:</p> <pre><code>--- t...
72,333,443
Bitwise XOR on unsigned char is terminating program without error<p>I'm trying to create a 64 bit integer as class in C++, I know this already exists in the C header stdint.h but I thought it could be a fun challenge.</p> <p>Anyway, I am trying to perform a bitwise XOR operation on three unsigned chars, and the program...
<p>You're trying to dereference invalid pointers. You want to get rid of a lot of those <code>*</code>s.</p> <pre><code>unsigned char a = 1; unsigned char b = 2; unsigned char c = 3; unsigned char* result = (unsigned char*) malloc(sizeof(unsigned char)); std::cout &lt;&lt; &quot;Trying&quot; &lt;&lt; std::endl; *resu...
Bitwise XOR on unsigned char is terminating program without error
c++|bitwise-operators
0
68
2
72,333,469
72,333,469
2
true
2022-05-21T21:49:24.090Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bitwise XOR on unsigned char is terminating program without error<p>I'm trying to create a 64 bit integer as class in C++, I know this already exists in the ...
72,333,706
How to pull a key from a dict (pandas series) to its own row?<p>Here is my example data with two fields where the last one [outbreak] is a pandas series.</p> <p>Start: <a href="https://i.stack.imgur.com/nfUOg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nfUOg.png" alt="Start" /></a></p> <p>Goal (E...
<p>Try this</p> <pre><code>import json d = {'report_id': [100, 101], 'outbreak': [ '{&quot;outbreak_100&quot;:{&quot;name&quot;:&quot;Chris&quot;,&quot;disease&quot;:&quot;A-Pox&quot;},&quot;outbreak_101&quot;:{&quot;name&quot;:&quot;Stacy&quot;,&quot;disease&quot;: &quot;H-Pox&quot;}}', '{&quot;outbreak_200&q...
How to pull a key from a dict (pandas series) to its own row?
python|pandas|dataframe|dictionary|series
1
68
3
72,333,813
72,333,813
2
true
2022-05-21T22:45:58.447Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to pull a key from a dict (pandas series) to its own row?<p>Here is my example data with two fields where the last one [outbreak] is a pandas series.</p>...
72,348,966
How can I globally set a custom HtmlEncoder to use in all Razor pages?<p><strong>I want to set a custom <code>HtmlEncoder</code> as the default <code>HtmlEncoder</code> to be used in Asp.net Core Razor pages.</strong></p> <p>The <code>RazorPageBase</code> class does have a <code>HtmlEncoder</code> property which I can ...
<p>In your app configuration, do the following:</p> <pre><code>[.NET 6 Program.cs] builder.Services.Configure&lt;WebEncoderOptions&gt;(options =&gt; { options.TextEncoderSettings = new TextEncoderSettings(UnicodeRanges.All); }); </code></pre> <p>Or</p> <pre><code>[Pre-.NET 6 Startup.cs] services.Configure&lt;WebEnc...
How can I globally set a custom HtmlEncoder to use in all Razor pages?
c#|asp.net-core|razor-pages
1
68
1
72,349,089
72,349,089
2
true
2022-05-23T13:02:25.837Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I globally set a custom HtmlEncoder to use in all Razor pages?<p><strong>I want to set a custom <code>HtmlEncoder</code> as the default <code>HtmlEnc...
72,358,046
MYSQL create relationships in existing table<p>I have already a big table with many columns. Now I try to split the table in separate smaller tables and create some relationships. As an example: In my case the department name is directly written in the employee table. Now I want to split them and create the relationshi...
<p>An example:</p> <blockquote> <pre><code>CREATE TABLE sub (id INT AUTO_INCREMENT PRIMARY KEY) SELECT DISTINCT val2 FROM src; </code></pre> </blockquote> <blockquote> <pre><code>ALTER TABLE src ADD COLUMN sub_id INT, ADD FOREIGN KEY (sub_id) REFERENCES sub (id); </code></pre> </blockquote> <blockquote> <pr...
MYSQL create relationships in existing table
mysql|foreign-keys|mysql-workbench
0
68
1
72,359,071
72,359,071
2
true
2022-05-24T06:20:51.973Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MYSQL create relationships in existing table<p>I have already a big table with many columns. Now I try to split the table in separate smaller tables and crea...
72,374,655
Spring Boot 2.x.x - Combine 2 conditions in @ConditionalOnProperty<p>I have the following interface :</p> <pre><code>@Primary @ConditionalOnProperty(value = &quot;ms.couchbase.enabled&quot;, havingValue = &quot;true&quot;, matchIfMissing = true) @ConditionalOnProperty(value = &quot;iiams.switch.iiamsSingleProcessIdPer1...
<p>You can use <code>AllNestedConditions</code> to combine two or more conditions:</p> <pre class="lang-java prettyprint-override"><code>class AsyncCommonRepositoryCondition extends AllNestedConditions { AsyncCommonRepositoryCondition() { super(ConfigurationPhase.PARSE_CONFIGURATION); } @Condition...
Spring Boot 2.x.x - Combine 2 conditions in @ConditionalOnProperty
spring|spring-boot|spring-annotations|spring-bean
0
68
1
72,375,104
72,375,104
2
true
2022-05-25T08:57:58.783Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring Boot 2.x.x - Combine 2 conditions in @ConditionalOnProperty<p>I have the following interface :</p> <pre><code>@Primary @ConditionalOnProperty(value = ...
72,380,439
Variable 'email' should not be initialized on declaration<p>I'm trying to create a random generator for emails in my cypress code</p> <p>this is my exemple :</p> <pre><code>export function userEmail(): string { let email = &quot;&quot;, domainName = &quot;&quot;, possible = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabc...
<p>Just split the declarations on 3 different lines</p> <pre><code>let email = &quot;&quot;; let domainName = &quot;&quot;; let possible = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&quot;; </code></pre>
Variable 'email' should not be initialized on declaration
javascript|typescript|cypress
0
68
3
72,380,552
72,380,552
2
true
2022-05-25T15:28:21.227Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Variable 'email' should not be initialized on declaration<p>I'm trying to create a random generator for emails in my cypress code</p> <p>this is my exemple :...
72,384,672
How can I avoid circular dependency in my Makefile compiling obj file with g++ and gcc?<p>I tried to create a makefile for a project that use c++ and c. I need to compile those file in order to make de .o file, but when I compile using make I have circular dependency that is dropped.</p> <p>I don't know why this error ...
<p>The rules you wrote are <code>%.cpp : %.o</code> and <code>%.c : %.o</code>. You wrote those rules the wrong way around. The target being built must be to the left of the colon, and the things it depends on must be to the right.</p> <p>The error message tells you about a circular dependency because GNU Make defin...
How can I avoid circular dependency in my Makefile compiling obj file with g++ and gcc?
c++|c|gcc|makefile|g++
0
68
1
72,384,696
72,384,696
2
true
2022-05-25T22:12:18.950Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I avoid circular dependency in my Makefile compiling obj file with g++ and gcc?<p>I tried to create a makefile for a project that use c++ and c. I ne...
72,244,498
Javascript for deleting DIV that blurs website<p>There is a website with the following div:</p> <pre><code>&lt;div class=&quot;x&quot; style=&quot;user-select: none; filter: blur(4px);&quot;&gt; </code></pre> <p>under this div there are a lot of other divs. I would like to know if there is any possibility to delete onl...
<p><code>getElementsByClassName()</code> returns a collection. Only single objects have <code>remove()</code> method. You have to apply one of the following:</p> <ol> <li>Use brackets to specify an index of the object you want to get:</li> </ol> <p><code>div[0].remove()</code></p> <ol start="2"> <li>Use <code>item()</c...
Javascript for deleting DIV that blurs website
javascript|html|css|web|webbrowser-control
0
68
1
72,244,736
72,244,736
2
true
2022-05-14T23:21:17.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript for deleting DIV that blurs website<p>There is a website with the following div:</p> <pre><code>&lt;div class=&quot;x&quot; style=&quot;user-selec...
72,348,454
Why does my array keep outputting [object]?<p>I am trying to use a forEach loop to return a component for each item in an array. However, when my react app loads it just returns [Object] over and over again. Why is this and how do I fix it?</p> <p>Here is the code:</p> <pre><code>const ProductList = () =&gt; { let pr...
<p>What you are doing here</p> <pre><code>product_listbox_options += ( &lt;Listbox.Option&gt; &lt;Heading&gt;{product_heading}&lt;/Heading&gt; {product_image} &lt;/Listbox.Option&gt; ); </code></pre> <p>is you are adding an empty string value to a react component which results in [Object...
Why does my array keep outputting [object]?
javascript|reactjs|shopify|polaris
-1
68
3
72,349,049
72,349,049
2
true
2022-05-23T12:22:52.563Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does my array keep outputting [object]?<p>I am trying to use a forEach loop to return a component for each item in an array. However, when my react app l...
72,340,656
Calling multiple methods of an object in sequence<p>I need to do something like this:</p> <pre><code>abc = xyz() abc.method1() abc.method2() abc.method3() ... </code></pre> <p>Is there a way to shorten this? Like:</p> <pre><code>abc= xyz() abc.{method1(),method2(),method3(),...} </code></pre> <p>or something?</p>
<p>You can do this by ensuring that the instance functions (methods) each return a reference to the instance in which they are running (<em>self</em>)</p> <pre><code>class xyz: def method1(self): print('m1') return self def method2(self): print('m2') return self def method3(s...
Calling multiple methods of an object in sequence
python
0
68
3
72,340,759
72,340,759
2
true
2022-05-22T19:21:55.157Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calling multiple methods of an object in sequence<p>I need to do something like this:</p> <pre><code>abc = xyz() abc.method1() abc.method2() abc.method3() .....
72,389,966
Replace a string in a specific index in a line using python<p>I'm working on a python project and I want to replace a specific word in a line in a file (text.txt) with another string. Like I have this line <code>&lt;string name=&quot;AppName&quot;&gt;old string&lt;/string&gt;</code> And I want to replace the old string...
<p>This is will replace whatever is between the first '&gt;' and the second '&lt;' with the given string:</p> <pre><code>s = '&lt;string name=&quot;AppName&quot;&gt;old string&lt;/string&gt;' def replace(s, new): if (i := s.find('&gt;')) &gt;= 0: if (j := s[i:].find('&lt;')) &gt;= 0: s = s[:i+1...
Replace a string in a specific index in a line using python
python|replace
0
68
2
72,390,110
72,390,110
2
true
2022-05-26T09:55:21.173Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Replace a string in a specific index in a line using python<p>I'm working on a python project and I want to replace a specific word in a line in a file (text...
72,247,591
Java Error when receiving multiple inputs in IntelliJ<p>I'm having trouble receiving 2 user inputs back to back. When I run the code below, it doesn't register the 2nd line. If I receive it as <code>int a = Integer.valueof(reader.nextLine());</code> it gives an error.</p> <p>Basically it skips over second input. If I p...
<p>As the documentation of the <code>nextLine()</code> method states</p> <blockquote> <p>Advances this scanner past the current line and returns the input that was skipped. <b>This method returns the rest of the current line, excluding any line separator at the end</b>. [...]</p> </blockquote> <p><a href="https://docs....
Java Error when receiving multiple inputs in IntelliJ
java|input|jetbrains-ide
-1
68
1
72,247,926
72,247,926
2
true
2022-05-15T10:55:11.743Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java Error when receiving multiple inputs in IntelliJ<p>I'm having trouble receiving 2 user inputs back to back. When I run the code below, it doesn't regist...
72,400,515
How to order alphabetically in SQL with two columns, but where either column may be empty<p>I'm using SQL Server, and I have a table with two columns, both <code>varchar</code>, column A and column B. I need to produce a list in alphabetical order, however only one of these columns will ever have a value in it (ie, if ...
<p>Use <a href="https://docs.microsoft.com/en-us/sql/t-sql/language-elements/coalesce-transact-sql?view=sql-server-ver16" rel="nofollow noreferrer">COALESCE</a> which takes the first non-null argument</p> <pre><code>order by coalesce(columnA, columnB) asc </code></pre>
How to order alphabetically in SQL with two columns, but where either column may be empty
sql|sql-server
0
68
2
72,400,530
72,400,530
2
true
2022-05-27T04:37:20.767Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to order alphabetically in SQL with two columns, but where either column may be empty<p>I'm using SQL Server, and I have a table with two columns, both <...
72,271,505
Replace column with some rows of another column<p>I have following dataframe:</p> <pre><code>midPrice Change % Spike New Oilprice 92.20000 0.00 0 92.043405 92.26454 0.07 0 92.049689 91.96950 -0.32 0 91.979751 91.73958 -0.25 0 91.844369 91.78985 0.05 0 ...
<p>Assuming the df is sorted by time in ascending order (as I've seen in the edit history of your question that you had a time column), you could use a mask like so:</p> <pre><code>mask = df['Spike'].eq(1).where(df['Spike'].eq(1)).fillna(method='ffill', limit=4).fillna(False) df.loc[mask, 'midPrice'] = df['New Oilprice...
Replace column with some rows of another column
python|pandas|numpy|for-loop
1
68
1
72,271,841
72,271,841
2
true
2022-05-17T09:31:36.423Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Replace column with some rows of another column<p>I have following dataframe:</p> <pre><code>midPrice Change % Spike New Oilprice 92.20000 0.00 ...
72,313,996
Adding a timer to the code and then looping it<p>Trying to find a way to add a timer to my code and then continuously loop it with the timer. e.g Trying to craft items with a button click and then waiting 5 seconds for it to craft before it automatically begins to craft again and so on as long as I have the materials. ...
<p>This will completely solve your problem. You must place only one condition in while.</p> <pre class="lang-cs prettyprint-override"><code>private void Start() =&gt; StartCoroutine(Run()); public bool youHaveMaterials; public IEnumerator Run() { while (youHaveMaterials) // repeat time until your materials end ...
Adding a timer to the code and then looping it
c#|unity3d
3
68
3
72,314,875
72,314,875
2
true
2022-05-20T05:34:50.643Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding a timer to the code and then looping it<p>Trying to find a way to add a timer to my code and then continuously loop it with the timer. e.g Trying to c...
72,369,634
graph-tool: edge property cannot be set to type 'object'<p>I have worked with <code>networkx</code> and am trying <code>graph-tool</code> for potentially better performance. Working through the documentation I wish to create edges with properties. In <code>networkx</code> I can do something like this for some graph <...
<p>Let's look at what the documentation tells us:</p> <pre><code>help(elayer) </code></pre> <p>This gives us:</p> <pre class="lang-none prettyprint-override"><code>a Shortcut to the :meth:`~PropertyMap.get_array` method as an attribute. This makes assignments more convenient, e.g.: &gt;&gt;&gt; g =...
graph-tool: edge property cannot be set to type 'object'
python-3.x|graph-tool
1
68
1
72,497,724
72,497,724
2
true
2022-05-24T21:24:30.203Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: graph-tool: edge property cannot be set to type 'object'<p>I have worked with <code>networkx</code> and am trying <code>graph-tool</code> for potentially bet...
72,323,786
CSS Weird behavour with nth-of-type(even or odd)<p>I have some css selectors to style every even and every odd occurance but for whatever reason the odd even selection is switch for a particular set of elements which are inside a div</p> <p><a href="https://i.stack.imgur.com/MYwKJ.png" rel="nofollow noreferrer"><img sr...
<p>From the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type" rel="nofollow noreferrer">MDN :nth-of-type() reference:</a> &quot;The <code>:nth-of-type()</code> CSS pseudo-class matches elements based on their position among siblings of the same type <em><strong>(tag name)</strong></em>.&quot; You ...
CSS Weird behavour with nth-of-type(even or odd)
html|css
2
68
1
72,323,926
72,323,926
2
true
2022-05-20T19:09:14.333Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CSS Weird behavour with nth-of-type(even or odd)<p>I have some css selectors to style every even and every odd occurance but for whatever reason the odd even...
72,375,398
How to show content from different ArrayLists in Recyclerview based on specific percentage?<p>I have this simple recyclerview which shows content from an ArrayList. I want to show content from multiple ArrayLists based on the percentage. To put it simply: I want to put 2 ArrayLists in my code with different content. I ...
<p>Note how the number of elements is calculated when entering a percentage:</p> <pre><code>public static &lt;T&gt; List&lt;T&gt; getRandomValue (List&lt;T&gt; list, int percent){ List&lt;T&gt; res = new ArrayList&lt;&gt;(); Collections.shuffle(list); for (int i = 0; i &lt; getIteration(percent,...
How to show content from different ArrayLists in Recyclerview based on specific percentage?
java|android|arraylist|android-recyclerview
0
68
1
72,380,089
72,380,089
2
true
2022-05-25T09:50:04.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to show content from different ArrayLists in Recyclerview based on specific percentage?<p>I have this simple recyclerview which shows content from an Arr...
72,298,228
Coq make failing on Omega<p>I'm trying to follow <a href="http://adam.chlipala.net/cpdt/" rel="nofollow noreferrer">this</a> but the provided source files are failing <code>make</code> with this error</p> <pre><code>make[1]: Entering directory '/home/myhome/Dropbox/org/coq/cpdt' COQC src/CpdtTactics.v File &quot;./src/...
<p>The <code>Omega</code> module and the <code>omega</code> tactic have been removed in Coq version 8.14 (after being deprecated in version 8.12).</p> <p>It seems that the latest CPDT tarball was not updated yet to be compatible with Coq 8.14, so this means that you should compile it with a lower version of Coq, such a...
Coq make failing on Omega
coq
1
68
1
72,299,989
72,299,989
3
true
2022-05-19T03:17:02.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Coq make failing on Omega<p>I'm trying to follow <a href="http://adam.chlipala.net/cpdt/" rel="nofollow noreferrer">this</a> but the provided source files ar...
72,313,737
EventSource for fixed seconds in Javascript<p>I'm newbie to the feature of EventSource in javascript. As per my understanding the eventsource calls the api with stream content and gets the updates of data automatically without making any further calls. But I'm planning to make if possible to stop listening the response...
<p>You could use <a href="https://developer.mozilla.org/en-US/docs/Web/API/EventSource/close" rel="nofollow noreferrer"><code>EventSource.close()</code></a> method and call it in a <code>setTimeout()</code> such as follows (adapted from the linked W3Schools code):</p> <pre class="lang-js prettyprint-override"><code>if(...
EventSource for fixed seconds in Javascript
javascript|server-sent-events
1
68
1
72,313,817
72,313,817
3
true
2022-05-20T04:53:55.910Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: EventSource for fixed seconds in Javascript<p>I'm newbie to the feature of EventSource in javascript. As per my understanding the eventsource calls the api w...
72,341,581
How do I know, the thread is finished in Kotlin?<p>Im trying to set text after all threads are finished. Do you have any ideas for me?</p> <pre><code>fun threadStart(){ var ende = 150_000 val s = Semaphore(1) var thread1 :Thread = Thread(Runnable{ while(counter &lt; ende){ counter++ println(&quot;1...
<p>Are you asking how to make the main thread <em>wait</em> for the other threads to finish? If so, you can do that with:</p> <pre class="lang-kotlin prettyprint-override"><code>thread1.join() thread2.join() thread3.join() thread4.join() </code></pre>
How do I know, the thread is finished in Kotlin?
multithreading|android-studio|kotlin
-1
68
1
72,341,707
72,341,707
3
true
2022-05-22T22:04:28.247Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I know, the thread is finished in Kotlin?<p>Im trying to set text after all threads are finished. Do you have any ideas for me?</p> <pre><code>fun thr...
72,347,311
Why is this method in a class is not getting extended to the next class, instead I see - [Function (anonymous)] in TypeScript<p>register() works fine with the Person class and I do see the return statement when I console.log it after the Person class</p> <p>Later on I am extending it to my Employee class but when I con...
<p>Now you are console logging</p> <pre><code>console.log(emp.register); </code></pre> <p>which returns:</p> <pre><code>register() { return `${this.name} is now registered`; } </code></pre> <p>aka a function, if you add parenthesis</p> <pre><code>console.log(emp.register()); </code></pre> <p>it will return</p> <pr...
Why is this method in a class is not getting extended to the next class, instead I see - [Function (anonymous)] in TypeScript
javascript|typescript|typescript-class
0
68
1
72,347,683
72,347,683
3
true
2022-05-23T10:50:45.453Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is this method in a class is not getting extended to the next class, instead I see - [Function (anonymous)] in TypeScript<p>register() works fine with th...
72,363,670
Is converting between String & Vec<u8> a zero-op in --release binary<p><code>String</code> &amp; <code>Vec&lt;u8&gt;</code> are almost the same to me, though <code>String</code> guarantees to have valid UTF-8 content, which is often useful.</p> <p>However, being in unsafe context, does it really take any machine operat...
<p>With the unsafe version of the function it is a no-op. As you can see <a href="https://rust.godbolt.org/z/K31hxoKPx" rel="nofollow noreferrer">here</a>, the assembly for converting a string into/from a vec without checks is the same as the identity function on a vec. This does not mean you should just use the unsafe...
Is converting between String & Vec<u8> a zero-op in --release binary
string|performance|rust|type-conversion|vec
1
68
2
72,363,964
72,363,964
3
true
2022-05-24T13:21:58.257Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is converting between String & Vec<u8> a zero-op in --release binary<p><code>String</code> &amp; <code>Vec&lt;u8&gt;</code> are almost the same to me, though...
72,374,472
How to exit QApplication from another thread?<p>So the problem is that in any application sometimes the GUI might freeze. Regardless of why it has happened, I want to be able to terminate/exit/quit my application.<br /> Is there any way to do it from another thread (in the same application instance)? Assume that the GU...
<p>Do you want a hard or a graceful exit? For a super hard exit, that can't be blocked by shutdown handlers (destructors, functions registered with <code>atexit</code>) use the C standard function <code>abort</code>: <a href="https://en.cppreference.com/w/cpp/utility/program/abort" rel="nofollow noreferrer">https://en....
How to exit QApplication from another thread?
c++|multithreading|qt|qml
0
68
2
72,374,545
72,374,545
3
true
2022-05-25T08:43:39.140Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to exit QApplication from another thread?<p>So the problem is that in any application sometimes the GUI might freeze. Regardless of why it has happened, ...
72,377,313
Is it possible to add description to an array type in Typescript?<p>I have the following type(s):</p> <pre><code>const type Person = [string, number, number] </code></pre> <pre><code> const type Person = [ string, // name number, // age number // height ] </code></pre> <p>Is it possible to add comments to what th...
<p>I think the closest solution is <a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#labeled-tuple-elements" rel="nofollow noreferrer">Labeled tuple elements</a></p> <pre class="lang-js prettyprint-override"><code>const type Person = [name: string, age: number, height: number] </co...
Is it possible to add description to an array type in Typescript?
typescript
2
68
1
72,377,410
72,377,410
3
true
2022-05-25T12:04:22.057Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to add description to an array type in Typescript?<p>I have the following type(s):</p> <pre><code>const type Person = [string, number, number]...
72,342,442
Why it is necessary to initialize a varriable before performing any assignment to it in C?<pre><code>#include &lt;stdio.h&gt; int main(){ int sale; float comm = 0; printf(&quot;enter the sale amount: &quot;); scanf(&quot;%d&quot;,&amp;sale); if (sale &lt; 10000) { comm = 0; } ...
<p>It is only &quot;necessary&quot; to initialize <code>comm</code> here for it to have a value if the user enters <code>25000</code> -- that's the only value that won't match any of the if statements, so won't assign a value to <code>comm</code>.</p> <p>There'a also a potential issue if the user enters <code>X</code> ...
Why it is necessary to initialize a varriable before performing any assignment to it in C?
c|windows
-2
68
4
72,342,477
72,342,477
3
true
2022-05-23T01:32:33.920Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why it is necessary to initialize a varriable before performing any assignment to it in C?<pre><code>#include &lt;stdio.h&gt; int main(){ int sale; f...
72,306,708
Find total IDs between two dates that satisfies a condition<p>I have a dataset PosNeg like this. I need to find count of ID's who have a pattern like this- P N P P or N P N N P N - that is having at least one N (negative) between two P's(positive). If this pattern occurs at least once, then count that ID. Date is alway...
<p>Here is one option with <code>str_c/str_detect</code> - grouped by 'ID', <code>paste</code> the 'Test' elements and then check whether the pattern <code>P</code> followed by one or more <code>N</code> (<code>N+</code>) and then a <code>P</code> occurs</p> <pre class="lang-r prettyprint-override"><code>library(string...
Find total IDs between two dates that satisfies a condition
python|sql|r|dataframe|data-manipulation
1
68
2
72,306,860
72,306,860
3
true
2022-05-19T14:49:13.640Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find total IDs between two dates that satisfies a condition<p>I have a dataset PosNeg like this. I need to find count of ID's who have a pattern like this- P...
72,316,503
Two python lists to nested dictionaries repeating pattern<p>I am trying to transform two lists of equal length which contain key:value pairs into nested dictionaries.</p> <p>List look like</p> <pre><code>list1 = ['first_name', 'surname', 'BoB', 'Question_no', 'comment1', 'comment2', 'Question_no', 'comment1', 'comment...
<p>Some things that should change in the given approach</p> <ol> <li>You don't need to use nested for loops for building the dictionary. Instead, you need to iterate over the lists at the same time because the elements at position <code>i</code> correspond to each other.</li> <li>Building the dictionary only through <c...
Two python lists to nested dictionaries repeating pattern
python
0
68
2
72,316,639
72,316,639
3
true
2022-05-20T09:20:52.263Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Two python lists to nested dictionaries repeating pattern<p>I am trying to transform two lists of equal length which contain key:value pairs into nested dict...
72,320,334
How to use a command all the 4th item nested lists in netlogo<p>I have built a long nested list having the following profile: <code>set my-list [A 1 2 3 4] [B 5 6 7 8] [C 9 10 11 12]</code></p> <p>I'd like to apply the <code>mean</code>command to the fourth item of each nested lists, so in the example to <strong>4 8 12...
<p>The <a href="https://ccl.northwestern.edu/netlogo/docs/dictionary.html#map" rel="nofollow noreferrer"><code>map</code></a> primitive is very well suited for these sorts of calculations with lists. It allows you to perform a reporter separately for each part of a list and then returns the results as a new list.</p> <...
How to use a command all the 4th item nested lists in netlogo
list|netlogo|mean|nested-lists
2
68
3
72,321,073
72,321,073
3
true
2022-05-20T14:10:44.707Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use a command all the 4th item nested lists in netlogo<p>I have built a long nested list having the following profile: <code>set my-list [A 1 2 3 4] [...
72,399,210
Write a for loop to create 5 randomly generated dataframes of length 100,200,500,800, and 1000, and print each of the dataframes<p>I've been trying to work through this small R prompt, but can't figure out what I'm doing wrong. I haven't used R in a few years, so I'm trying to get back into the flow of things. Here's m...
<p>You can just refer to the index of <code>loopValues</code> with <code>i</code> and use a single loop:</p> <pre class="lang-r prettyprint-override"><code>y &lt;- 5 loopValues &lt;- c(100,200,500,800,1000) dataframesq3 &lt;- vector(&quot;list&quot;, y) for (i in 1:y) { dataframesq3[[i]] &lt;- data.frame(replicate...
Write a for loop to create 5 randomly generated dataframes of length 100,200,500,800, and 1000, and print each of the dataframes
r|dataframe|for-loop|random
1
68
4
72,399,248
72,399,248
3
true
2022-05-27T00:05:22.773Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Write a for loop to create 5 randomly generated dataframes of length 100,200,500,800, and 1000, and print each of the dataframes<p>I've been trying to work t...
72,314,747
What can be done to prevent misleading assigment to returned value?<p>After many years of using C++ I realized a quirk in the syntax when using custom classes. Despite being the <a href="https://stackoverflow.com/questions/72308501/why-can-i-assign-to-temporary-class-instance">correct language behavior</a> it allows to...
<p>Ordinarily we can call a member function on an object regardless of whether that object's value category is an lvalue or rvalue.</p> <blockquote> <p>What can be done to the class definition to prevent this behavior?</p> </blockquote> <p>Prior to modern C++ there was no way prevent this usage. But since C++11 we can ...
What can be done to prevent misleading assigment to returned value?
c++|assignment-operator|user-defined-types|rvalue
4
68
1
72,315,075
72,315,075
5
true
2022-05-20T06:54:07.803Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What can be done to prevent misleading assigment to returned value?<p>After many years of using C++ I realized a quirk in the syntax when using custom classe...
72,341,853
Issue reproducing MATLAB's imfilter function<p>I am trying to understand how MATLAB's <code>imfilter</code> function works.</p> <pre><code>im = imread(&quot;cameraman.tif&quot;); % Kernel for sharpening the image kernel = [ 0 -1 0; -1 5 -1; 0 -1 0]; im2 = zeros(size(im)); for y = 1 : size(im,1) - 3 ...
<p>Your bug is in this line:</p> <pre class="lang-matlab prettyprint-override"><code>sum = sum + im(yy,xx)*kernel(ky,kx); </code></pre> <p>This is not obvious, but MATLAB makes a strange choice when doing arithmetic with different data types. In MATLAB, by default all numeric arrays (all values) are doubles. <code>sum<...
Issue reproducing MATLAB's imfilter function
matlab|image-processing|filter|convolution
1
68
1
72,343,987
72,343,987
5
true
2022-05-22T23:04:28.050Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Issue reproducing MATLAB's imfilter function<p>I am trying to understand how MATLAB's <code>imfilter</code> function works.</p> <pre><code>im = imread(&quot;...
72,327,925
How do I tell Typescript that I expect exactly 2 elements from split()?<p>I want to type an array of arrays, where each element has either two or four numbers.</p> <pre class="lang-js prettyprint-override"><code>[ [ 1, 2 ], [ 1, 2 ], [ 1, 2, 3, 4] ] </code></pre> <p>I've declared these types.</p> <pre class="lang...
<p><em>Preface: You can't reliably use <code>parseInt</code> directly as a <code>map</code> callback, because <code>parseInt</code> accepts multiple parameters and <code>map</code> passes it multiple arguments. You have to wrap it in an arrow function or similar, or use <code>Number</code> instead. I've done the latter...
How do I tell Typescript that I expect exactly 2 elements from split()?
typescript
0
68
2
72,328,031
72,328,031
5
true
2022-05-21T08:34:53.400Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I tell Typescript that I expect exactly 2 elements from split()?<p>I want to type an array of arrays, where each element has either two or four number...
72,391,481
Replace a \n in objects, which are in array<p>I want to replace \n which is in array of objects. For now I came across this, but it replaces only string, not an actual '\n' which makes the line break.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippe...
<p>You should use <code>\\n</code> in regax.</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>var obj = { 'a' : '\nThe fooman poured the drinks.', 'b' : { 'c' : 'Dog...
Replace a \n in objects, which are in array
javascript
1
68
3
72,391,520
72,391,520
5
true
2022-05-26T12:00:28.057Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Replace a \n in objects, which are in array<p>I want to replace \n which is in array of objects. For now I came across this, but it replaces only string, not...
72,980,775
how to show default value in angular forms with validation?<p>I am having some difficulty with this form.</p> <p>I am trying to make a form which can validate and also display a default value at the start. The problems I am facing:</p> <ol> <li>Once I add in the line &quot;formControlName&quot;=price, &quot;formControl...
<h2>Answer</h2> <blockquote> <ol> <li>Once I add in the line &quot;formControlName&quot;=price, &quot;formControlName&quot;=description, &quot;formControlName&quot;=name, the value is no longer displayed on the screen.</li> </ol> </blockquote> <p>Instead of this</p> <pre><code>&lt;input type=&quot;text&quot; id=&quot;p...
how to show default value in angular forms with validation?
angular
1
68
1
72,982,669
72,982,669
1
true
2022-07-14T12:47:24.540Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to show default value in angular forms with validation?<p>I am having some difficulty with this form.</p> <p>I am trying to make a form which can validat...
72,831,370
How can I build slider-functionality within an SVG file?<p>I have an SVG image of a slider with a colored bar and a handle (see code snippet below). I want to make this SVG image interactive, so the viewer can move the handle to the eleven different positions along the slider. Everything needs to be within the <code>&l...
<p>It is something like this. The code should look a bit different when it is an independent document, but you get the idea.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>co...
How can I build slider-functionality within an SVG file?
javascript|svg|slider|interactive
1
68
1
72,834,383
72,834,383
1
true
2022-07-01T15:17:32.960Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I build slider-functionality within an SVG file?<p>I have an SVG image of a slider with a colored bar and a handle (see code snippet below). I want t...
72,846,943
How to find specific data in nested object structure in Javascript?<p>I shared a piece of code which demonstrate I have two types of <code>response</code>. If you take a look at the code below you will find out the <code>response</code> of a service result would be slightly different. In the first type, you have a sing...
<p>You could use recursion to make a solution that works for any depth, e.g. data being on the 4th layer</p> <pre><code> .then((result: any) =&gt; { const findData = (response: any) =&gt; { return response.data ? findData(response.data):response; } return [...findData(result.data)...
How to find specific data in nested object structure in Javascript?
javascript|angular|typescript
1
68
1
72,847,486
72,847,486
1
true
2022-07-03T13:36:04.803Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to find specific data in nested object structure in Javascript?<p>I shared a piece of code which demonstrate I have two types of <code>response</code>. I...
73,010,931
How to learn material 3 component attribute use case<p>Can someone help me on Material 3. I found this two method <code>darkColorScheme</code> and <code>lightColorScheme</code> . When I checked the definition of this function I found so many colors used in the function. I am confused which one using where so, Is there...
<p>Jetpack Compose functions <code>darkColorScheme</code> and <code>lightColorScheme</code> help you set up a whole MD3 theme with all the color roles. You would want to set/define all colors if you want that background and foreground colors will work nicely together.</p> <p>The mapping for colors can be found at <a hr...
How to learn material 3 component attribute use case
android|kotlin|material-design|android-jetpack-compose|material-components-android
1
68
1
73,015,513
73,015,513
1
true
2022-07-17T10:14:53.087Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to learn material 3 component attribute use case<p>Can someone help me on Material 3. I found this two method <code>darkColorScheme</code> and <code>lig...
72,860,537
Intellij changing line spacing automatically<p>I have recently migrated to Intellij 2022.1.2 and sometimes the IDE will just change the line spacing randomly between different code sections: annotation / function definition, imports / class definition etc.</p> <p>This behavior seems to be very erratic, sometimes I just...
<p>These empty lines you see are placeholders for additional information about the code in the editor. They are called 'Inlay Hints' and you can configure them in the Settings dialog.</p> <p>If they are non-empty, these lines may look like this:</p> <p><a href="https://i.stack.imgur.com/CZ7kC.png" rel="nofollow norefer...
Intellij changing line spacing automatically
java|intellij-idea
4
68
2
72,860,749
72,860,749
1
true
2022-07-04T18:01:38.680Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Intellij changing line spacing automatically<p>I have recently migrated to Intellij 2022.1.2 and sometimes the IDE will just change the line spacing randomly...
73,014,693
Can we use HTML features in TinyTex (R Markdown)<p>everyone! I'm VERY new to Rmarkdown, so this may be a silly question. I was able to use HTML tags when kniting html file. However, I'm wondering If I could also use them when kniting a pdf file? I'm a bit used to HTML, so it would really help me if I could keep on with...
<p>You can not use HTML in the Markdown document and then render it directly to PDF. However you could render the document to html and later covert it to pdf manually from browser print method or automatically e.g. with ‘pagedown::chrome_print’ package.</p> <p>When the rmarkdown output is a pdf_output then a markdown i...
Can we use HTML features in TinyTex (R Markdown)
html|r|r-markdown|tinytext
2
68
1
73,014,770
73,014,770
1
true
2022-07-17T19:20:10.067Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can we use HTML features in TinyTex (R Markdown)<p>everyone! I'm VERY new to Rmarkdown, so this may be a silly question. I was able to use HTML tags when kni...
73,011,436
Retrieve png file and render it for preview<p>So I have an img tag in my template that is bound to a state &quot;imageBuffer&quot;</p> <pre><code> &lt;img v-bind:src=&quot;imageBuffer&quot; alt=&quot;&quot; /&gt; </code></pre> <p>and I have the following logic, the page has two file inputs and I used this one function ...
<p>Your file reader's load event will never be triggered because you didn't tell it to read anything.</p> <p>See the method <a href="https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL" rel="nofollow noreferrer"><code>readAsDataURL</code></a>. They even have a decent example of usage on that page<...
Retrieve png file and render it for preview
javascript|forms|image|vue.js|filereader
1
68
1
73,056,652
73,056,652
1
true
2022-07-17T11:38:13.347Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Retrieve png file and render it for preview<p>So I have an img tag in my template that is bound to a state &quot;imageBuffer&quot;</p> <pre><code> &lt;img v-...
72,991,630
javascript object get a list<p>I have an object like this and I want to get for exemple a simple list of all companies. After, what would be the code to filter the companies in a specific city or the companies starting with &quot;N&quot;?</p> <pre><code>[ { &quot;fieldData&quot;: { &quot;City&quot;: &qu...
<p>To get a list of all companies' names you should use the <a href="https://developer.mozilla.org/pl/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer"><strong>.map()</strong> method</a>. If you want to get specific companies' names you should first filter your data with the <a href="htt...
javascript object get a list
javascript|arrays|filter
-3
68
1
72,991,780
72,991,780
1
true
2022-07-15T09:07:09.800Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: javascript object get a list<p>I have an object like this and I want to get for exemple a simple list of all companies. After, what would be the code to filt...
72,786,603
Compare strings, find part that is present in each string<p>How do I compare several rows and find words/combination of words that are present in each row? Using pure python, nltk or anything else.</p> <pre class="lang-py prettyprint-override"><code>few_strings = ('this is foo bar', 'this is not a foo bar', 'some other...
<p>You might want to use the standard library <code>difflib</code> for sequence comparisons including finding common substrings:</p> <pre class="lang-py prettyprint-override"><code>from difflib import SequenceMatcher list_of_str = ['this is foo bar', 'this is not a foo bar', 'some other foo bar here'] result = list_o...
Compare strings, find part that is present in each string
python|nltk
-2
68
4
72,786,792
72,786,792
1
true
2022-06-28T12:39:29.817Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compare strings, find part that is present in each string<p>How do I compare several rows and find words/combination of words that are present in each row? U...
72,769,563
Shifting an image with bilinear interpolation in pytorch<p>Suppose that I have an input x of size [H,W] and also a mu_x and mu_y (which may be fractional)representing the pixels in x and y direction to shift. Is there any efficient way in pytorch without using c++ to shift the tensor x for mu_x and mu_y units with bili...
<p>I believe you can achieve this by applying grid sampling on your original input and using a grid to guide the sampling process. If you take a coordinate grid of your image and sample using that the resulting image will be equal to the original image. However you can apply a shift on this grid and therefore sample wi...
Shifting an image with bilinear interpolation in pytorch
python|pytorch|computer-vision|tensor
2
68
1
72,770,560
72,770,560
2
true
2022-06-27T09:08:41.710Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Shifting an image with bilinear interpolation in pytorch<p>Suppose that I have an input x of size [H,W] and also a mu_x and mu_y (which may be fractional)rep...
72,773,969
How to generate random matrix of arbitrary rank in Julia?<p>Is there any way in Julia to generate a random matrix that has some arbitrary/specified rank? For example, is there any function that would allow generating a random 3x3 matrix of rank 2?</p>
<p>This depends a little on what you mean by &quot;random matrix&quot; (i.e. what distribution?), but <code>rand(3,2)*rand(2,3)</code> will produce a random matrix 3x3 matrix of rank 2 with some distribution.</p>
How to generate random matrix of arbitrary rank in Julia?
matrix|julia|linear-algebra|numerical-methods
0
68
3
72,774,450
72,774,450
2
true
2022-06-27T14:41:26.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to generate random matrix of arbitrary rank in Julia?<p>Is there any way in Julia to generate a random matrix that has some arbitrary/specified rank? For...
72,806,112
How can i get controlEvent type in RxSwift?<p>I added textfield two controlEven with RxSwift I want to different things in a method.</p> <pre><code>textField.rx.controlEvent([.editingDidBegin, .editingDidEnd]) .asObservable() .subscribe(onNext: { event in // setFocusing(withType: ControlEven...
<p>Try this:</p> <pre><code>Observable.merge( [.editingDidBegin, .editingDidEnd] .map { event in textField.rx.controlEvent(event).map { event } } ) .subscribe(onNext: setFocusing) func setFocusing(type: UIControl.Event) { if type == .editingDidBegin { //.... } else if type == .editingDidEnd { ...
How can i get controlEvent type in RxSwift?
swift|textfield|rx-swift|uicontrolevents
3
68
1
72,813,383
72,813,383
2
true
2022-06-29T18:18:17.577Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can i get controlEvent type in RxSwift?<p>I added textfield two controlEven with RxSwift I want to different things in a method.</p> <pre><code>textField...
72,827,620
Swapping elements in a list in Python<p>I am trying to swap the elements of list <code>A</code> i.e. <code>(i,j)</code> turns to <code>(j,-i)</code>. But there is an error.</p> <pre><code>A=[(0,0),(0,1),(1,0),(1,1)] for i in range(0,len(A)-1): for j in range(0,len(A)-1): A[i][j]=A[j][-i] </code></pre> <p>T...
<p>What you have is a list of tuples, and tuples are immutable. What you're doing would not be described so much as &quot;swapping elements in a list&quot; as swapping the elements of a tuple (and negating the second one).</p> <p>If you have</p> <pre><code>a = (1, 1) </code></pre> <p>then you could perform this operat...
Swapping elements in a list in Python
python
-1
68
1
72,827,666
72,827,666
2
true
2022-07-01T10:03:42.187Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Swapping elements in a list in Python<p>I am trying to swap the elements of list <code>A</code> i.e. <code>(i,j)</code> turns to <code>(j,-i)</code>. But the...
72,830,522
.htaccess redirect for url with parameters<p>I have searched around for this but not finding what I need. Basically any url which has <code>?</code> at the end followed by further characters should be redirected to another url, the same path excluding the language though. An example will make it clearer.</p> <p>If a us...
<blockquote> <p>Basically any url which has ? at the end followed by further characters should be redirected to another url, the same path excluding the language though.</p> </blockquote> <p>You may use this redirect rule:</p> <pre class="lang-bash prettyprint-override"><code>RewriteCond %{QUERY_STRING} . RewriteRule ^...
.htaccess redirect for url with parameters
regex|.htaccess|url-rewriting
1
68
1
72,830,561
72,830,561
2
true
2022-07-01T14:07:54.627Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: .htaccess redirect for url with parameters<p>I have searched around for this but not finding what I need. Basically any url which has <code>?</code> at the e...
72,881,888
prefix column name to unnested struct in bigquery<p>I have a large number of attributes under multiple structures in a dataset. As a short example of the table:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th style="text-align: center;">id</th> <th style="text-align: center;">settings</th> ...
<p>Below is the most generic approach I can think of!<br /> Works for any number of structs, any level of nesting, etc.</p> <pre><code>create temp function get_keys(input string) returns array&lt;string&gt; language js as &quot;&quot;&quot; return Object.keys(JSON.parse(input)); &quot;&quot;&quot;; create temp func...
prefix column name to unnested struct in bigquery
google-bigquery
0
68
2
72,887,423
72,887,423
2
true
2022-07-06T10:27:07.807Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: prefix column name to unnested struct in bigquery<p>I have a large number of attributes under multiple structures in a dataset. As a short example of the tab...
72,897,729
Advice refactoring polars expr<p>I have a polars expr, and I cannot use a context 'cause my function has to return a polars expr.</p> <p>I've implemented a RSI indicator in polars:</p> <pre><code>rsi_indicator = (100*pl.when(pl.col(&quot;close&quot;).pct_change() &gt;= 0) \ .then(pl.col(&quot;close&quot;).p...
<p>First, let's use some real financial data, so that our results look reasonable. I'll also change the variable names so that your code will work, as-is.</p> <pre class="lang-py prettyprint-override"><code>import polars as pl from yfinance import Ticker ticker_data = Ticker(&quot;AAPL&quot;).history(period=&quot;3mo...
Advice refactoring polars expr
python-polars
1
68
1
72,898,977
72,898,977
2
true
2022-07-07T12:21:35.110Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Advice refactoring polars expr<p>I have a polars expr, and I cannot use a context 'cause my function has to return a polars expr.</p> <p>I've implemented a R...
72,935,473
Apply Levenshtein distance from rapidfuzz.distance to dataframe with two columns<p>I have a csv file that looks as follows:</p> <pre><code>ID; name1; name2 1; John Doe; John Does 2; Mike Johnson; Mike Jonson 3; Leon Mill; Leon Miller 4; Jack Jo; Jack Joe </code></pre> <p>Now I want to calculate the Levenshtein distance...
<p>In lambda function try to call an x variable that defines it.</p> <pre><code>df['ld']=df.apply(lambda x: Levenshtein.distance(x['name1'], x['name2']), axis=1) </code></pre>
Apply Levenshtein distance from rapidfuzz.distance to dataframe with two columns
python|pandas|levenshtein-distance|rapidfuzz
0
68
1
72,935,541
72,935,541
2
true
2022-07-11T08:08:16.963Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Apply Levenshtein distance from rapidfuzz.distance to dataframe with two columns<p>I have a csv file that looks as follows:</p> <pre><code>ID; name1; name2 1...
72,933,954
Pytest fixtures in requests post function<p>I'm trying to understand the example provided <a href="https://docs.pytest.org/en/7.1.x/how-to/monkeypatch.html#monkeypatching-returned-objects-building-mock-classes" rel="nofollow noreferrer">here</a> and emulate it to work for the <code>post</code> method instead of <code>g...
<p>Without changing your code too much and with the assumption of testing <code>status_code</code> in mind, you can have your fixture return a function that you can provide <code>status_code</code> and <code>raise_for_status</code> into, in order to initialize your <code>MockResponse</code> class. However, looking at y...
Pytest fixtures in requests post function
python|python-requests|pytest|monkeypatching
1
68
2
72,937,662
72,937,662
2
true
2022-07-11T05:10:51.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pytest fixtures in requests post function<p>I'm trying to understand the example provided <a href="https://docs.pytest.org/en/7.1.x/how-to/monkeypatch.html#m...
72,937,028
How to make a cli typescript library that can generate whole files like NestJs?<p>I have been using Nestjs a lot lately and have started to create my own libraries for things I work with a lot; however, I still can not figure out how to make a library that works on the CLI and create new files like using &quot;nest g r...
<p>Using the <code>generate</code> command of the CLI you can generate a new Nest element. Under the hood it uses <a href="https://angular.io/guide/schematics" rel="nofollow noreferrer">Angular Schematics</a> to do so. When you generate a command, controller, service...etc. you are scaffolding it using an Angular Schem...
How to make a cli typescript library that can generate whole files like NestJs?
javascript|typescript|command-line-interface|nestjs
-1
68
1
72,937,862
72,937,862
2
true
2022-07-11T10:21:02.937Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make a cli typescript library that can generate whole files like NestJs?<p>I have been using Nestjs a lot lately and have started to create my own lib...
72,935,354
What is humanize in Malli?<p>I do not understand this concept. <strong>malli.error/humanize</strong></p> <p>I tried following up with the github link of Malli. <a href="https://github.com/metosin/malli" rel="nofollow noreferrer">https://github.com/metosin/malli</a></p> <p>Does humanize refer to the error statements tha...
<p>&quot;Does humanize refer to the error statements that we can customize &amp; add like in Java? Or does it mean that errors are printed in a more readable way?&quot;</p> <p>So both actually. We can customize it too. And errors are printed in a more human-readable way.</p>
What is humanize in Malli?
functional-programming|clojure|schema|malli
2
68
1
72,939,350
72,939,350
2
true
2022-07-11T07:57:36.323Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is humanize in Malli?<p>I do not understand this concept. <strong>malli.error/humanize</strong></p> <p>I tried following up with the github link of Mall...
72,953,573
du behaves as if -h was always given<p>I noticed a strange behaviour of <code>du</code> on my system. It always assumes the -h option is set. Even if I call <code>/usr/bin/du</code> directly. No alias is set. This very much get's in the way if I want to do something like</p> <pre><code>du -s * | sort -g </code></pre> <...
<p>Sorry, I was stupid. I somehow got a file named '-h' in the directory I wanted to search.</p>
du behaves as if -h was always given
linux|bash|gnu-coreutils
2
68
1
72,953,628
72,953,628
2
true
2022-07-12T13:58:02.537Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: du behaves as if -h was always given<p>I noticed a strange behaviour of <code>du</code> on my system. It always assumes the -h option is set. Even if I call ...
72,970,702
Want to highlight selected widget in flutter<p>I have made an demo app where I have created a custom widget and using this custom widget many times. now I want to highlight widget with different colour than others on tap..like BottomNavigationBarItem showing selected barite with differ colour than other</p> <p>what sho...
<p>You can use nullable int to hold selected index, and index can be considered as widget ID. Also pass the bool to show selected condition.</p> <pre class="lang-dart prettyprint-override"><code>class MyContainer extends StatelessWidget { final VoidCallback ontap; bool isSelected; MyContainer({ required this....
Want to highlight selected widget in flutter
flutter|dart|flutter-layout
0
68
1
72,970,841
72,970,841
2
true
2022-07-13T18:00:15.930Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Want to highlight selected widget in flutter<p>I have made an demo app where I have created a custom widget and using this custom widget many times. now I wa...
72,971,337
GORM omit fields in a JSON Response<p>I would like to omit some fields in my JSON Response. Currently I have a type receiver that returns a new struct <code>userToJson</code>. I then pass this to the <code>json.NewEncoder()</code>. However I am wondering if this is the best way to omit fields using GORM.</p> <p>Thank y...
<p>Another approach is to implement the interface <code>Marshaler</code> for your type to modify how marshaling to JSON works. The <code>json</code> package checks for that interface before marshaling, and if it exists, calls that function. Here is the interface from the standard library.</p> <pre class="lang-golang pr...
GORM omit fields in a JSON Response
json|rest|http|go|go-gorm
1
68
2
72,972,255
72,972,255
2
true
2022-07-13T18:59:33.603Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GORM omit fields in a JSON Response<p>I would like to omit some fields in my JSON Response. Currently I have a type receiver that returns a new struct <code>...
72,999,781
Firebase emulators:exec with 'npm test' script returns immediately<p>I'm running some React integration tests with npm, and need the Firebase emulator for them. I've set up my npm scripts as follows:</p> <pre><code>&quot;scripts&quot;: { &quot;test:integration:runner&quot;: &quot;cross-env RTL_SKIP_AUTO_CLEANUP=tru...
<p>Well, I figured this out soon after asking the question. It turns out you need to double quote the script.</p> <p>So I changed</p> <pre><code>&quot;test:integration&quot;: &quot;firebase emulators:exec 'npm run test:integration:runner'&quot;, </code></pre> <p>to</p> <pre><code>&quot;test:integration&quot;: &quot;fir...
Firebase emulators:exec with 'npm test' script returns immediately
firebase|npm|npm-scripts|firebase-tools
1
68
1
72,999,805
72,999,805
2
true
2022-07-15T21:30:54.663Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firebase emulators:exec with 'npm test' script returns immediately<p>I'm running some React integration tests with npm, and need the Firebase emulator for th...
73,021,455
Calculate sum of distances between nodes of a graph passed as an array in a DataFrame<p>Graph definition (The graph is fixed for the problem concerned):</p> <p>N1 &lt;---10---&gt; N2 &lt;---30---&gt; N3 &lt;---20---&gt; N4</p> <p>We assume that the distance of a node from itself will always be 0. The distance between t...
<p>One approach using <a href="https://networkx.org/documentation/stable/index.html" rel="nofollow noreferrer">networkx</a>:</p> <pre><code>import networkx as nx # init distances distances = {(&quot;N1&quot;, &quot;N2&quot;): 10, (&quot;N2&quot;, &quot;N1&quot;): 10, (&quot;N2&quot;, &quot;N3&quot;): 30, (&quot;N3&quo...
Calculate sum of distances between nodes of a graph passed as an array in a DataFrame
python|pandas|dataframe|graph
0
68
1
73,021,751
73,021,751
2
true
2022-07-18T11:15:37.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calculate sum of distances between nodes of a graph passed as an array in a DataFrame<p>Graph definition (The graph is fixed for the problem concerned):</p> ...
73,022,319
If statement to check the length of dataframe column value<p>I'm trying create a user defined function to check the length of dataframe columns and return certain value.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Account Open Date</th> <th>Account Close Date</th> </tr> </thead> <tbody>...
<p>IIUC, you need:</p> <pre><code>s = pd.Series(np.where(df['Account Open Date'].notna(), 'OPEN', ''), index=df.index) df['Account Close Date'] = df['Account Close Date'].fillna(s) </code></pre> <p>output:</p> <pre><code> Account Open Date Account Close Date 0 27-04-2011 OPEN 1 ...
If statement to check the length of dataframe column value
python|pandas
1
68
1
73,022,387
73,022,387
2
true
2022-07-18T12:28:06.320Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: If statement to check the length of dataframe column value<p>I'm trying create a user defined function to check the length of dataframe columns and return ce...
73,026,333
How kubernetes port-forward choose pod when forward to a deployment?<p>Let say there's a deployment named my-deployment which is consisted of 3 pods, now we use port-forward forward a local port to this deployment :</p> <pre><code>kubectl port-forward deployment/my-deployment 8888 9999 </code></pre> <p>My question is :...
<p><code>when I visit localhost:8888 serveral times then which pod would be forwarded to ?</code></p> <p>Will forward to the first pod sorted by name.</p> <p><code>Always forward to a fixed pod(like first pod) ?</code></p> <p>Fixed.</p> <p><code>Or forward it by random ? Or use round-roubin strategy ?</code></p> <p>Fix...
How kubernetes port-forward choose pod when forward to a deployment?
kubernetes|kubernetes-pod
1
68
1
73,030,707
73,030,707
2
true
2022-07-18T17:32:05.017Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How kubernetes port-forward choose pod when forward to a deployment?<p>Let say there's a deployment named my-deployment which is consisted of 3 pods, now we ...
72,990,347
Unsupported nesting LOCAL error with Hilt<p>I'm getting a strange error while using hilt. It doesn't get compiled and stops with the error <code>Unsupported nesting LOCAL</code>. I don't see any dependency graph issue with hilt config. Has anyone come across this issue? These are the versions I'm using</p> <p>Java: <co...
<p>I found a solution <a href="https://issuetracker.google.com/issues/232742201" rel="nofollow noreferrer">here</a>. It seems to be a non-descriptive error message from hilt. I was using a private function as a provider where I missed <code>@Provides</code>. Removing <code>private</code> and adding <code>@Provides</cod...
Unsupported nesting LOCAL error with Hilt
android|dagger-2|dagger-hilt
0
68
1
73,090,126
73,090,126
2
true
2022-07-15T07:18:59.863Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unsupported nesting LOCAL error with Hilt<p>I'm getting a strange error while using hilt. It doesn't get compiled and stops with the error <code>Unsupported ...
72,878,363
Can we skip placing image in 1x, 2x but only placing in 3x Assets.xcassets, for app size optimization purpose?<p>Can we skip placing image in 1x, 2x but only placing in 3x Assets.xcassets, for app size optimization purpose?</p> <p>In order to increase sales, we plan to place a high number of high resolution screenshot ...
<p><a href="https://i.stack.imgur.com/rN4gu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rN4gu.png" alt="enter image description here" /></a>for this specific purpose ( when you have only one image , not for icons ) , you can use single scale like this</p>
Can we skip placing image in 1x, 2x but only placing in 3x Assets.xcassets, for app size optimization purpose?
ios|swift|xcode|kingfisher
-2
68
2
72,878,499
72,878,499
2
true
2022-07-06T05:33:50.770Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can we skip placing image in 1x, 2x but only placing in 3x Assets.xcassets, for app size optimization purpose?<p>Can we skip placing image in 1x, 2x but only...
72,850,709
Should NPM packages be required at top of main.js or inside functions? - node.js<p>I can't find a specific answer to this question anywhere.</p> <p>Using ParseServer with Back4App.<br /> I want to know the best place to require NPM packages, and what the difference between these two methods are.</p> <p>main.js - Global...
<p>In the Node/CommonJS context <code>require()</code> indicates that you are loading the module at runtime.</p> <p>Assuming we have a module A which contains a <code>require(moduleB)</code> (Which could either be in node_modules or a local file). Then when the require statement is reached then essentially the followin...
Should NPM packages be required at top of main.js or inside functions? - node.js
node.js|npm|parse-platform|requirejs|back4app
1
68
3
72,851,014
72,851,014
2
true
2022-07-04T00:10:09.347Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Should NPM packages be required at top of main.js or inside functions? - node.js<p>I can't find a specific answer to this question anywhere.</p> <p>Using Par...
72,996,586
Filter data from Google Sheet on a leaflet map by group<p>I'm trying to create a map with markers using data from Google Sheet using leaflet. I managed that but there are some bugs that I can't fix:</p> <ol> <li>Filter by group - I can filter by group, but only one marker is displayed for each selected group, even tho ...
<p>This is my first attempt at maps but I tried it and it works.</p> <p>Change your files accordingly.</p> <p>HTML_TestMap</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;UTF-8&quot;&gt; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-wid...
Filter data from Google Sheet on a leaflet map by group
javascript|google-apps-script|google-sheets|leaflet
0
68
1
72,997,946
72,997,946
2
true
2022-07-15T15:46:56.437Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Filter data from Google Sheet on a leaflet map by group<p>I'm trying to create a map with markers using data from Google Sheet using leaflet. I managed that ...
72,918,071
How could I provide more accurate search results?<p>I am trying to implement a search bar for a web application. What I currently have is an input that receives a <code>String</code>, which I then attempt to <em>tokenize</em> into an <code>Array</code> of <code>String</code> objects, like so:</p> <pre><code>function to...
<p>Basically, what you're looking for is relevance scoring (or a &quot;ranking function&quot;). The idea is, we assign each &quot;document&quot; (track name in your case) some numeric &quot;score&quot; based on keywords and display documents with sorted by their score.</p> <p>To compute the simplest possible ranking fu...
How could I provide more accurate search results?
javascript
1
68
1
72,918,182
72,918,182
2
true
2022-07-09T00:17:09.190Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How could I provide more accurate search results?<p>I am trying to implement a search bar for a web application. What I currently have is an input that recei...
72,999,634
Remap `gc` for vim-commentary not working<p>I am trying to write a mapping to use vim Commentary. Right now my <code>.vimrc</code> has the following line:</p> <pre><code>vnoremap gg &lt;PLUG&gt;Commentary </code></pre> <p>However, when I open a document to edit pressing <code>gg</code> only makes the terminal flash. Us...
<ul> <li><p>The terminal flashes because <code>gg</code> puts the cursor on the first line of the buffer and you are already there.</p> </li> <li><p><code>&lt;Plug&gt;Commentary</code> is a &quot;plug mapping&quot;, a special kind of mapping used by plugin developers as an alternative to exposing the guts of the plugin...
Remap `gc` for vim-commentary not working
vim
0
68
1
73,002,326
73,002,326
2
true
2022-07-15T21:10:39.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Remap `gc` for vim-commentary not working<p>I am trying to write a mapping to use vim Commentary. Right now my <code>.vimrc</code> has the following line:</p...
72,856,728
What do I have to change in my syntax for it to work in MS SQL Server from Informix<p>I'm currently updating a lot of our queries to work again in our new ERP-Release, where we will be working with MS SQL Server, swapping away from our current Informix database. Many are just simple Date-Format changes but this one I a...
<p>In Informix, subtracting two DATETIME values results in an INTERVAL. The <code>&lt;value&gt;::&lt;type&gt;</code> notation is a shorthand for <code>CAST(&lt;value&gt; AS &lt;type&gt;)</code>. Therefore, there are three consecutive casts:</p> <ol> <li><code>::interval second(9) to second</code></li> <li><code>::cha...
What do I have to change in my syntax for it to work in MS SQL Server from Informix
sql|sql-server|informix
1
68
1
72,860,504
72,860,504
2
true
2022-07-04T12:24:31.647Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What do I have to change in my syntax for it to work in MS SQL Server from Informix<p>I'm currently updating a lot of our queries to work again in our new ER...
72,939,739
Pyspark - Check if a column exists for a specific record<p>I'm using pyspark 3.1.1 and python 3.8</p> <p>I have a json file in input like this:</p> <pre><code>{&quot;id&quot; :1, &quot;field_a&quot;: &quot;test&quot;} {&quot;id&quot; :2, &quot;field_a&quot;: &quot;test&quot;, &quot;field_b&quot;: &quot;z&quot;} {&quot;...
<p>As per the <a href="https://spark.apache.org/docs/3.3.0/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrameReader.json.html#pyspark-sql-dataframereader-json" rel="nofollow noreferrer">spark documentation</a>, when we are reading the json file and not providing the schema it will first look into the data and i...
Pyspark - Check if a column exists for a specific record
python|pyspark|apache-spark-sql
1
68
2
72,942,993
72,942,993
2
true
2022-07-11T13:55:32.767Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pyspark - Check if a column exists for a specific record<p>I'm using pyspark 3.1.1 and python 3.8</p> <p>I have a json file in input like this:</p> <pre><cod...
73,014,350
ggplot2 - Second y-axis with different labels<p>I created a graph showing the effect size and confidence intervals. I would like to put on the right side of this graph (second y-axis) exact text information about &quot;ES&quot; and &quot;CI&quot; in the form: -0.07 [-1.16, 0.99], which means: ES [+95 CI, -95CI]. I can'...
<p>You can use a <code>geom_text</code> layer and some segment annotations:</p> <pre class="lang-r prettyprint-override"><code>ggplot(my_data, aes(y = varname, x = es, color = period, fill = period)) + geom_point(shape = 21, size = 2, position=position_dodge(width = 0.5)) + geom_errorbar(aes(xmin = lower_CI, xmax...
ggplot2 - Second y-axis with different labels
r|ggplot2
1
68
1
73,014,718
73,014,718
2
true
2022-07-17T18:29:58.380Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ggplot2 - Second y-axis with different labels<p>I created a graph showing the effect size and confidence intervals. I would like to put on the right side of ...
73,018,735
Dynamically fix function parameters in python?<p>Consider some generic function of many parameters:</p> <pre><code>def my_fun(x, a, b, c, d, e, f, g): return x, a, b, c, d, e, f, g </code></pre> <p>I want to create a kind of higher order function, which fixes an arbitrary collection of parameters of my_fun. For exa...
<p>I don't know if the following is &quot;more pythonic&quot; or more efficient, but at least it does the job in this particular case:</p> <pre><code>from inspect import signature def my_fun(x, a, b, c, d, e, f, g): return x, a, b, c, d, e, f, g def fixing_function(orig_function, fixing_dict): orig_params = s...
Dynamically fix function parameters in python?
python|scipy|curve-fitting|higher-order-functions
0
68
2
73,019,116
73,019,116
2
true
2022-07-18T07:34:55.013Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dynamically fix function parameters in python?<p>Consider some generic function of many parameters:</p> <pre><code>def my_fun(x, a, b, c, d, e, f, g): re...
72,961,204
SQLachemy flask - How to update values in database. getting: AttributeError: 'scoped_session' object has no attribute 'update'<p>So I have a pandas dataframe (dfm) from which I have calculated new values from based on user input. I want to place these update/changed values into the database. I feel like I should just b...
<p>The <code>update()</code> method is an <code>attribute</code> of the Query Object not the Session Object. If you want to update multiple rows you can pass a dictionary representation of all columns that need to be updated:</p> <pre><code>db.session.query(Foo).filter(Foo.foo == foo).update(values={'bar': bar}) </code...
SQLachemy flask - How to update values in database. getting: AttributeError: 'scoped_session' object has no attribute 'update'
python|flask|sqlalchemy
0
68
1
72,964,045
72,964,045
2
true
2022-07-13T05:08:40.020Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQLachemy flask - How to update values in database. getting: AttributeError: 'scoped_session' object has no attribute 'update'<p>So I have a pandas dataframe...
72,932,472
Tkinter image slideshow, defining the image folder path inside new window<p>I created a slideshow with Python3 &amp; Tkinter. It works fine, but only if I define the path to the image folder inside the code. But the people I am going to share this program with don't know how to edit the code. So, I want another Tkinter...
<p>You can make use of <code>askdirectory</code> with <code>tkinter</code>:</p> <pre><code>from tkinter import filedialog class GUI: def __init__(self, mainwin): ... directory = filedialog.askdirectory(parent=mainwin, title='Title of the box', initialdir='pat...
Tkinter image slideshow, defining the image folder path inside new window
python|tkinter
0
68
1
72,932,682
72,932,682
2
true
2022-07-10T23:19:43.050Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Tkinter image slideshow, defining the image folder path inside new window<p>I created a slideshow with Python3 &amp; Tkinter. It works fine, but only if I de...
72,906,797
How to sort a statically initiallized 2-D array with std::sort?<p>I initialized a 2-D array (<code>n rows * 2 cols</code>), and I want to sort it by <code>std::sort</code> like this:</p> <pre><code>// before std::sort 4 6 3 3 2 3 // after std::sort 2 3 3 3 4 6 </code></pre> <p>The <code>cmp</code> function is like thi...
<blockquote> <p>I initialized a 2-D array (<code>n rows * 2 cols</code>), and I want to sort it by <code>std::sort</code> [...]</p> </blockquote> <p>If the col count is always 2, then you should have used a</p> <ul> <li><p><a href="https://en.cppreference.com/w/cpp/utility/pair" rel="nofollow noreferrer"><code>std::pai...
How to sort a statically initiallized 2-D array with std::sort?
c++|arrays|algorithm|sorting|c++-standard-library
1
68
1
72,906,904
72,906,904
2
true
2022-07-08T04:55:31.513Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to sort a statically initiallized 2-D array with std::sort?<p>I initialized a 2-D array (<code>n rows * 2 cols</code>), and I want to sort it by <code>st...
72,897,390
Javascript object generator<p>Is there a generator approach to constructing a mapping (object)? I just need key/value mapping.</p> <p>For generating array, I can write something like this</p> <pre class="lang-js prettyprint-override"><code>function* rangeA(start, stop) { while(start &lt; stop) yield start++ } le...
<p>Try using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries" rel="nofollow noreferrer"><code>Object.fromEntries</code></a>:</p> <pre class="lang-js prettyprint-override"><code>function* rangeC(start, stop) { while(start &lt; stop) { // Replace the curl...
Javascript object generator
javascript|javascript-objects|generator
1
68
1
72,897,499
72,897,499
2
true
2022-07-07T11:55:07.803Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript object generator<p>Is there a generator approach to constructing a mapping (object)? I just need key/value mapping.</p> <p>For generating array, I...
72,830,160
svelte with tailwind showing different output in Firefox and Chrome<p>I was designing a <strong>Tags</strong> input field much like <strong>StackOverflow</strong>. I designed it using <strong><a href="https://kit.svelte.dev/" rel="nofollow noreferrer">Sveltekit</a></strong> and <strong><a href="https://tailwindcss.com/...
<p>It seems to be the <code>focus:outline</code> behavior that's different in Firefox than chrome.</p> <p>See <a href="https://svelte.dev/repl/350cc768f4924a2d817e09581a8e789b?version=3.48.0" rel="nofollow noreferrer">this REPL</a></p> <p>Adding <code>focus:outline-none</code> to the input gets rid of it.</p> <pre clas...
svelte with tailwind showing different output in Firefox and Chrome
firefox|tailwind-css|sveltekit
1
68
1
72,863,154
72,863,154
2
true
2022-07-01T13:38:12.937Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: svelte with tailwind showing different output in Firefox and Chrome<p>I was designing a <strong>Tags</strong> input field much like <strong>StackOverflow</st...
72,841,438
How to store array data as map key or increment frequency if array already in map?<p>My code:</p> <pre><code>map&lt;array&lt;byte, aes&gt;, int&gt; possible; array&lt;byte,aes&gt; temp; if (!possible.count(temp)) // if not found possible.insert(pair&lt;array&lt;byte,aes&gt;,int&gt;(temp,1)); // insert else pos...
<p>In C++ this code will work fine</p> <pre><code>possible[temp]++; </code></pre> <p>If <code>temp</code> exists then it's frequency will be incremented. If it does not exist then it will be inserted with a frequency of 0, which will then be incremented. This gives you exactly the same result as your code.</p> <p>Looki...
How to store array data as map key or increment frequency if array already in map?
c++|qt|stdmap|stdarray
0
68
1
72,841,469
72,841,469
2
true
2022-07-02T18:16:31.447Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to store array data as map key or increment frequency if array already in map?<p>My code:</p> <pre><code>map&lt;array&lt;byte, aes&gt;, int&gt; possible;...
72,947,084
How to convert JSON string in data frame column into multiple columns<p>I have a data frame with a <code>JSON</code> string in a column:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>ID</th> <th>Data</th> </tr> </thead> <tbody> <tr> <td>11</td> <td>{'Name': 'Sam', 'Age': 21}</td> </tr> <t...
<p>You can use <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.html" rel="nofollow noreferrer"><code>pandas.Series</code></a> to read your column of dictionaries values into columns.</p> <h4>Creating the data</h4> <pre><code>data = { 'Id' : [11, 22, 33], 'Data': [&quot;{'Name': 'Sam', 'Age':...
How to convert JSON string in data frame column into multiple columns
python|json|dataframe
1
68
1
72,947,328
72,947,328
2
true
2022-07-12T04:34:31.587Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert JSON string in data frame column into multiple columns<p>I have a data frame with a <code>JSON</code> string in a column:</p> <div class="s-ta...