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,185,027
How to iterate over an array of arrays to filter out or reject duplicate entries?<p>I want to iterate over this 2-dimensional array. Arrays with multiple objects have multiple entries in the same month (in the example below January). I want to filter out (reject) the duplicate entries and want to return the altered arr...
<p>What the OP actually means with ...</p> <blockquote> <p><em>&quot;I want to filter out the double entries and want to return the filtered array.&quot;</em></p> </blockquote> <p>... is that the OP wants to mutate either the provided data structure directly or maybe a <a href="https://developer.mozilla.org/en-US/docs/...
How to iterate over an array of arrays to filter out or reject duplicate entries?
javascript|arrays|recursion|filter|splice
0
170
2
72,187,285
72,187,285
1
true
2022-05-10T10:52:10.493Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to iterate over an array of arrays to filter out or reject duplicate entries?<p>I want to iterate over this 2-dimensional array. Arrays with multiple obj...
72,193,794
How to sort array of objects by date but with most current date first?<p>I've got the array of objects:</p> <pre><code>const data = [{ &quot;id&quot;: &quot;1&quot;, &quot;effectiveDate&quot;: &quot;2023-01-21&quot; }, { &quot;id&quot;: &quot;2&quot;, &quot;effectiveDate&quot;: &quot;2023-02-22&quot; }, { &qu...
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function getItemsInAscendingDateOrderAndClosestToNowFirst(arr) { const time = Date.now(); const [closest, ...rest] = Array ...
How to sort array of objects by date but with most current date first?
javascript|arrays|date|sorting|object
0
238
2
72,199,846
72,199,846
1
true
2022-05-10T23:05:39.783Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to sort array of objects by date but with most current date first?<p>I've got the array of objects:</p> <pre><code>const data = [{ &quot;id&quot;: &quo...
72,231,438
How do I wait until data from Preferences DataStore is loaded?<p>I'm trying to make a LibGDX Live Wallpaper. But I think that is unrelated to the problem I'm having at the moment. Basically, I'm storing the wallpaper's settings inside a Preferences DataStore. Now, if you need to retrieve data from the DataStore, you ne...
<p>It is acceptable in libGDX to block the rendering thread. This is a separate thread from the Android main thread, so it won't freeze the Android UI or put you at risk of an ANR (application not responding error). It will freeze any game/wallpaper rendering while blocking, but that's OK when you're still loading the ...
How do I wait until data from Preferences DataStore is loaded?
android|kotlin|libgdx|datastore|kotlin-flow
0
428
1
72,232,627
72,232,627
1
true
2022-05-13T14:44:52.023Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I wait until data from Preferences DataStore is loaded?<p>I'm trying to make a LibGDX Live Wallpaper. But I think that is unrelated to the problem I'm...
72,227,355
ASP.NET Core MVC - posting to a different action name does not bind the values<p>I'm using a regular html form instead of <code>@html.BeginForm</code> and I have these 2 form tags in my <code>Create.cshtml</code> view file.</p> <p>I was experimenting with routing, but my post doesn't seem to get the values even if I bi...
<blockquote> <p>can I use a different method name for get and post that is not the same as the view name?</p> </blockquote> <p>Yes, you can.</p> <blockquote> <p>How can I get initially load the page for GET using routing that would work in a different view name?</p> </blockquote> <p>return to this view.</p> <pre><code>...
ASP.NET Core MVC - posting to a different action name does not bind the values
c#|asp.net-core-mvc|razor-pages
0
49
1
72,227,599
72,227,599
1
true
2022-05-13T09:30:43.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ASP.NET Core MVC - posting to a different action name does not bind the values<p>I'm using a regular html form instead of <code>@html.BeginForm</code> and I ...
72,150,443
Which relation in MongoDB is better?<p>For my whole projects I have relationed my multiple collection as this.</p> <pre><code>User model Name:string, email:string, password:string, vehicles:[{ &quot;vehicleId&quot;, &quot;vehicleId&quot; }] </code></pre> <p>Vehicle model</p> <pre><code>vehicleId:string, vehicle...
<p>It depends on the amount of entries there will be in the <code>vehicles</code> array.</p> <p>If you plan to store less than a couple of hundreds vehicles, embedding dependancies in an array is the best solution because it allows to retrieve all your user data at once.</p> <p>That means you don't even have to store o...
Which relation in MongoDB is better?
node.js|database|mongodb|mongoose
0
21
1
72,150,473
72,150,473
1
true
2022-05-07T07:34:48.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Which relation in MongoDB is better?<p>For my whole projects I have relationed my multiple collection as this.</p> <pre><code>User model Name:string, email:...
72,205,297
How can i proof by absurd with coq?<p>I am reading Logical Foundations from Software Foundations series and i saw the <code>plus_id_example</code> that is:</p> <pre><code>Theorem plus_id_example : forall n m:nat, n = m -&gt; n + n = m + m. Proof. intros n m. intros H. rewrite H. reflexivity. Qed. </code><...
<p>You can use one of the many contraposition-based lemmas in Coq: you can see them by using, for instance, <code>Search &quot;contra&quot;.</code> in Coq.</p> <p>Using the ssreflect tactic language, a proof based on this idea can be obtained as follows (I'm sure there must be shorter proofs):</p> <pre><code>Theorem pl...
How can i proof by absurd with coq?
coq
0
76
1
72,206,126
72,206,126
1
true
2022-05-11T17:32:51.620Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can i proof by absurd with coq?<p>I am reading Logical Foundations from Software Foundations series and i saw the <code>plus_id_example</code> that is:</...
72,145,574
SQL- How to combine 3 tables to get this result?<p>The SNO seems to be misdirecting So, I simplified the question even further</p> <pre><code>--creation CREATE TABLE LAB (JOB_ID int, LAB_ID VARCHAR(50)); CREATE TABLE SPR (JOB_ID int, SPR_ID VARCHAR(50)); --Table 1 data insertion INSERT INTO LAB (JOB_ID, LAB_ID) VALUES...
<p>Check this:</p> <pre class="lang-sql prettyprint-override"><code>WITH cte1 AS ( SELECT *, ROW_NUMBER() OVER (PARTITION BY job_id ORDER BY lab_id) rn FROM lab ), cte2 AS ( SELECT *, ROW_NUMBER() OVER (PARTITION BY job_id ORDER BY spr_id) rn FROM spr ), cte3 AS ( SELECT rn, job_id FROM cte1 ...
SQL- How to combine 3 tables to get this result?
mysql
0
46
1
72,146,325
72,146,325
1
true
2022-05-06T17:51:29.497Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL- How to combine 3 tables to get this result?<p>The SNO seems to be misdirecting So, I simplified the question even further</p> <pre><code>--creation CREA...
72,200,149
Distribute array row data to make multiple new rows<p>I have below the data</p> <pre><code>[ { &quot;price_in_dollar&quot;: 1000, &quot;price_in_euro&quot;: 1000, &quot;price_in_pound&quot;: 1000, &quot;price_in_rupee&quot;: 1000, &quot;toy_id&quot;: 1, &quot;toy_name...
<p>your code was actually replacing a <code>key =&gt; value</code> pair data, not pushing a data into <code>$cars</code>, you can fix it like this:</p> <pre class="lang-php prettyprint-override"><code>$cars = []; foreach($data as $r) { $singleCar = [ &quot;toy_id&quot; =&gt; $r['toy_id'], &quot;toy&...
Distribute array row data to make multiple new rows
php|arrays
0
65
5
72,200,570
72,200,570
1
true
2022-05-11T11:21:28.747Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Distribute array row data to make multiple new rows<p>I have below the data</p> <pre><code>[ { &quot;price_in_dollar&quot;: 1000, &quot;p...
72,184,441
About the pimpl syntax<p>I have a question about the C++ usage used in the pimpl syntax.</p> <p>First, why is it not necessary to write <code>pimpl( new impl )</code> as <code>pimpl( new my_class::impl )</code></p> <p>Second, why is the lifetime of <code>new impl</code> extended even though it is a temporary object?</p...
<blockquote> <p>First, why is it not necessary to write pimpl( new impl ) as pimpl( new my_class::impl )</p> </blockquote> <p>Scope. When constructor is defined you are inside a cope of a class, so <a href="https://en.cppreference.com/w/cpp/language/lookup" rel="nofollow noreferrer">name lookup</a> is able to find it w...
About the pimpl syntax
c++|pimpl-idiom
0
74
3
72,184,926
72,184,926
1
true
2022-05-10T10:12:23.227Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: About the pimpl syntax<p>I have a question about the C++ usage used in the pimpl syntax.</p> <p>First, why is it not necessary to write <code>pimpl( new impl...
72,169,683
Can you insert ignore into table if certain fields are duplicate?<p>I am trying to insert into a MySQL table, but I came across a problem that I can't seem to solve. The problem is that I want to add a record into the table if certain fields are duplicate, but not all.</p> <p>To make my problem more clear this is the t...
<p>I am not sure what your create table statement is like but you can add UNIQUE key:</p> <pre><code>UNIQUE (userid ,url, status) </code></pre> <p><a href="https://dbfiddle.uk/?rdbms=mysql_8.0&amp;fiddle=ab00ff60e00957bf6fb9cdaeeb7f9ecd" rel="nofollow noreferrer">Here is a demo</a></p> <p>So first you create table like...
Can you insert ignore into table if certain fields are duplicate?
mysql|sql
0
45
2
72,169,815
72,169,815
1
true
2022-05-09T09:24:06.650Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can you insert ignore into table if certain fields are duplicate?<p>I am trying to insert into a MySQL table, but I came across a problem that I can't seem t...
72,174,883
Convert String containing commas to array<p>I am trying to convert a String</p> <pre><code>$string = &quot;'1', '2', '3'&quot;;` </code></pre> <p>to an array</p> <pre><code>$array = array($string); </code></pre> <p>By doing so it gives me an error when trying to fetch data on MySQL</p> <pre><code>SELECT * FROM name WH...
<p>if you remove the quotes around the id's, assuming the <code>id</code> column is a integer column</p> <pre><code>$string = &quot;'1', '2', '3'&quot;; $string = str_replace(&quot;'&quot;, '', $string); $sql = &quot;SELECT * FROM name WHERE id NOT IN ( &quot; . implode(&quot;,&quot;, explode(',',$string)) . &quot;) ...
Convert String containing commas to array
php|sql
0
46
1
72,175,016
72,175,016
1
true
2022-05-09T15:57:25.313Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert String containing commas to array<p>I am trying to convert a String</p> <pre><code>$string = &quot;'1', '2', '3'&quot;;` </code></pre> <p>to an arra...
72,161,602
Use a phing ForEach loop to execute tasks<p>I want to execute an arbitrary selection of tasks in a Phing build.</p> <p>I'm passing in a list of modules for building. Each module is of a particular type. The type is specified in the name, as {type}_{unitname}. I started with a build file that took a single module name ...
<blockquote> <p>At first I tried to use the loop variable as the target</p> <p>&lt;foreach list=&quot;${mylist}&quot; param=&quot;item&quot; target=&quot;${item&quot;} /&gt;</p> <p>but it doesn't seem to allow a variable as a target name</p> </blockquote> <p>The <code>target</code> attribute of the <code>foreach</code>...
Use a phing ForEach loop to execute tasks
phing
0
58
1
72,238,809
72,238,809
1
true
2022-05-08T13:43:42.460Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Use a phing ForEach loop to execute tasks<p>I want to execute an arbitrary selection of tasks in a Phing build.</p> <p>I'm passing in a list of modules for b...
72,173,944
How to make a black border overlap yellow<p>How to make a black border overlap yellow For example, as in the picture<a href="https://i.stack.imgur.com/vwCF6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vwCF6.png" alt="enter image description here" /></a></p> <p><div class="snippet" data-lang="js" ...
<p>Just &quot;drag&quot; the button over the outer element's boundaries with a negative margin-top and -left.</p> <p>And add 2px to the height to compensate.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-...
How to make a black border overlap yellow
css
0
43
1
72,173,991
72,173,991
1
true
2022-05-09T14:48:25.240Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make a black border overlap yellow<p>How to make a black border overlap yellow For example, as in the picture<a href="https://i.stack.imgur.com/vwCF6....
72,185,246
Azure speech to text REST API V3 binary data<p>I'm trying to use Azure Speech to text service. In the documentation I'm confronted with examples, that use <strong>V1</strong> API version: <code>https://$region.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1</code></p> <p>And basically ever...
<blockquote> <p>Is there a way to pass a binary file and also get word level timestamps with <code>wordLevelTimestampsEnabled=true</code> parameter?</p> </blockquote> <p>As suggested by <a href="https://stackoverflow.com/users/2538939/code-different">Code Different</a>, converting a comment as a community wiki answer t...
Azure speech to text REST API V3 binary data
azure|rest|text-to-speech|azure-speech
0
181
1
72,195,332
72,195,332
1
true
2022-05-10T11:06:46.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Azure speech to text REST API V3 binary data<p>I'm trying to use Azure Speech to text service. In the documentation I'm confronted with examples, that use <s...
72,141,009
How to use Google OAuth2.0 without out-of-band (OOB)<p>I have created new OAuth 2.0 Client IDs (application type = Desktop app). Then downloaded the OAuth client JSON file. Put the file into the folder where my code is looking. When I run the code locally on my PC it`s try to open following URL:</p> <pre><code>https://...
<p>Developers using installed applications need to stitch to using IP flow.</p> <p><a href="https://developers.google.com/identity/protocols/oauth2/native-app#redirect-uri_loopback" rel="nofollow noreferrer">Loopback IP address (macOS, Linux, Windows desktop)</a></p> <p>A key point on that page is</p> <blockquote> <p>T...
How to use Google OAuth2.0 without out-of-band (OOB)
oauth-2.0|google-oauth
0
965
1
72,142,864
72,142,864
1
true
2022-05-06T11:49:30.473Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use Google OAuth2.0 without out-of-band (OOB)<p>I have created new OAuth 2.0 Client IDs (application type = Desktop app). Then downloaded the OAuth cl...
72,236,594
CSS animation appear on top while running<p>I'm animating 2 blinking eyes. But they appear on top of my navigation bar when I scroll the page. It doesn't do that without the animation. How can I make the animation run under the navigation bar? Some posts mentioned z-index but I can't seem to make it work. I replicated ...
<p>I have edited your code as follows:</p> <pre><code>&lt;script setup&gt; &lt;/script&gt; &lt;template&gt; &lt;div class=&quot;nav&quot;&gt; navigation bar &lt;/div&gt; &lt;div class=&quot;face&quot;&gt; &lt;div class=&quot;eyes&quot;&gt; &lt;div&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&...
CSS animation appear on top while running
html|css|vue.js|position|css-animations
0
62
1
72,237,577
72,237,577
1
true
2022-05-14T00:58:39.430Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CSS animation appear on top while running<p>I'm animating 2 blinking eyes. But they appear on top of my navigation bar when I scroll the page. It doesn't do ...
72,201,597
Django - ModelForm has no model class specified<p>Django is giving me the following error:</p> <pre><code>ModelForm has no model class specified </code></pre> <p><strong>Traceback</strong></p> <pre><code>Traceback (most recent call last): File &quot;C:\Users\Laila\.virtualenvs\BlogProject-71CaIFug\lib\site-packages\d...
<p>Can you try this? For more about Meta class, check <a href="https://stackoverflow.com/a/10344231/8353711">here</a>.</p> <pre><code>class UserUpdateForm(forms.ModelForm): class Meta: model = User fields = ['username', 'email'] </code></pre>
Django - ModelForm has no model class specified
python|django|forms|django-models
0
269
1
72,201,684
72,201,684
1
true
2022-05-11T13:05:51.840Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django - ModelForm has no model class specified<p>Django is giving me the following error:</p> <pre><code>ModelForm has no model class specified </code></pre...
72,204,853
Create Pandas DataFrame from 2 tuple lists with common first elements<p>I currently have 2 lists of tuples, both of which have the same information on the first element of the tuple. I'm trying to see if there is a way to &quot;Join&quot; these two tuple lists in a dataframe based on their common elements. Something li...
<p>Try this,</p> <p><strong>Code:</strong></p> <pre><code>import pandas as pd l1 = [(0, 'A'), (1, 'B'), (2, 'C')] l2 = [(0, 'G'), (1, 'H'), (2, 'I')] ur_lists = [l1, l2] list_of_dfs = [pd.DataFrame(data, columns=['key', f'col{idx}']) for idx, data in enumerate(ur_lists)] dfs = [df.set_index('key') for...
Create Pandas DataFrame from 2 tuple lists with common first elements
python|pandas|dataframe|tuples
0
65
3
72,204,912
72,204,912
1
true
2022-05-11T16:53:12.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create Pandas DataFrame from 2 tuple lists with common first elements<p>I currently have 2 lists of tuples, both of which have the same information on the fi...
72,148,043
Alternative to index signature<p>I have an array of object like this:</p> <pre><code>[ { &quot;bio&quot;: &quot;Douglas Gerald Hurley is an American engineer, former Marine Corps pilot and former NASA astronaut. He launched into space for the third time as commander of Crew Dragon Demo-2.&quot;, &quot;images&...
<p>Objectively answering your question, this is my go:</p> <pre class="lang-js prettyprint-override"><code>//if these are optional mark them so with `?` also if there are more formats you support you could add them here as well type Image = { png: string, webp: string, } export type PlanetInfo = { [key: string]...
Alternative to index signature
javascript|typescript|types
0
38
1
72,148,104
72,148,104
1
true
2022-05-06T22:40:16.073Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Alternative to index signature<p>I have an array of object like this:</p> <pre><code>[ { &quot;bio&quot;: &quot;Douglas Gerald Hurley is an American en...
72,202,017
BigQuery SQL JSON Returning additional rows when current row contains multiple values<p>I have a table that looks like this</p> <pre><code>keyA | data:{&quot;value&quot;:false}} keyB | data:{&quot;value&quot;:3}} keyC | data:{&quot;value&quot;:{&quot;paid&quot;:10,&quot;unpaid&quot;:20}}} ...
<p>Try this one:</p> <pre class="lang-sql prettyprint-override"><code>WITH sample AS ( SELECT 'keyA' AS col, '{&quot;value&quot;:false}' AS data UNION ALL SELECT 'keyB' AS col, '{&quot;value&quot;:3}' AS data UNION ALL SELECT 'keyC' AS col, '{&quot;value&quot;:{&quot;paid&quot;:10,&quot;unpaid&quot;:20}}' A...
BigQuery SQL JSON Returning additional rows when current row contains multiple values
sql|google-bigquery|json-extract
0
112
2
72,202,871
72,202,871
1
true
2022-05-11T13:33:24.393Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: BigQuery SQL JSON Returning additional rows when current row contains multiple values<p>I have a table that looks like this</p> <pre><code>keyA | d...
72,217,689
How do I convert object type data to datetime data in this case?<p>So I have data given in the format of: <code>1/1/2022 0:32</code></p> <p>I looked up the type that was given with <code>dataframe.dytpe</code> and found out that this was an object type. Now for my further analysis I think it would be best to get this c...
<p>You can do like this:</p> <pre><code>df['time'] = pd.to_datetime(df['time']).dt.normalize() </code></pre> <p>or</p> <pre><code>df[&quot;time&quot;]=df[&quot;time&quot;].astype('datetime64') </code></pre> <p>it will convert <code>object</code> type to <code>datetime64[ns]</code></p> <p>I think <code>datetime64[ns]</c...
How do I convert object type data to datetime data in this case?
python|pandas|datetime
0
40
1
72,217,731
72,217,731
1
true
2022-05-12T14:44:34.447Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I convert object type data to datetime data in this case?<p>So I have data given in the format of: <code>1/1/2022 0:32</code></p> <p>I looked up the t...
72,222,104
Hosting a separate app service as a website directory<p>Is it possible to include a separate Azure App Service as part of another App Service?</p> <p>For example lets say that I have a website called <a href="http://www.mycompany.com" rel="nofollow noreferrer">www.mycompany.com</a> hosted in its own Azure App Service. ...
<p>For this purpose you could use Application Gateway.</p> <p>In a certain sense it resembles a load balancer (it is a L7 LB indeed) as you indicated, but the product provides many additional features.</p> <p>The following image, extracted from the product documentation, explains how it works:</p> <p><a href="https://i...
Hosting a separate app service as a website directory
azure|azure-web-app-service|azure-appservice
0
43
1
72,222,488
72,222,488
1
true
2022-05-12T21:12:03.187Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hosting a separate app service as a website directory<p>Is it possible to include a separate Azure App Service as part of another App Service?</p> <p>For exa...
72,220,834
How to insert image in table<p>I need create a table with rows</p> <blockquote> <p>ID | Image | Info about image</p> </blockquote> <p>and it's a part of code:</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-...
<p>It should work this way, not tested though (and I smashed some other bugs in your function):</p> <pre><code>function add(form) { table1 = document.getElementById('mytable'); row1 = table1.insertRow(table1.rows.length); cell1 = row1.insertCell(row1.cells.length); cell1 = row1.rowIndex; cell2 = row1.insertCe...
How to insert image in table
javascript|html|image
0
168
2
72,221,279
72,221,279
1
true
2022-05-12T18:59:04.433Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to insert image in table<p>I need create a table with rows</p> <blockquote> <p>ID | Image | Info about image</p> </blockquote> <p>and it's a part of code...
72,228,006
Restyle createRestyleFunction<p>Can anyone help with me understanding the purpose of this function?</p> <p>Does anyone have a real life example of a time they implemented it?</p> <p>I understand the example given but I cant see a real world need to rename opacity to transparency so I am sure there are some real problem...
<p>The example given in the docs does more than remap the name of opacity - it inverts the value. The example could be more interesting, as <code>transform</code> also takes a <code>theme</code> and <code>themeKey</code>. I made a more involved example that uses these. So, for a value of <code>progress</code> from 0...
Restyle createRestyleFunction
react-native|restyle
0
48
1
72,236,805
72,236,805
1
true
2022-05-13T10:21:24.527Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Restyle createRestyleFunction<p>Can anyone help with me understanding the purpose of this function?</p> <p>Does anyone have a real life example of a time the...
72,146,394
Adding new key values in a dictionary that was imported from an CSV file?<p>Sorry But I can't use pandas.</p> <p>I have a sample input csv file that looks like this:</p> <pre><code>Alfa,Beta,Charlie,Delta,Echo,Foxtrot,Golf,Hotel,India,Juliett,Kilo A1,B1,C1,D1,E1,F1,G1,H1,I1,J1,K1 A2,B2,C2,D2,E2,F2,G2,H2,I2,J2,K2 A3,B3,...
<p>I feel like you have misunderstood how <code>DictWriter</code> works.</p> <p>When you specify <code>fieldnames=...</code>, <code>DictWriter</code> doesn't care <em>where</em> those field names come from, as long as it's a list of strings.</p> <p>When you pass a dictionary to <code>writerow()</code>, the <code>DictWr...
Adding new key values in a dictionary that was imported from an CSV file?
python|csv|dictionary
0
51
1
72,146,610
72,146,610
1
true
2022-05-06T19:16:39.473Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding new key values in a dictionary that was imported from an CSV file?<p>Sorry But I can't use pandas.</p> <p>I have a sample input csv file that looks li...
72,160,739
Why doesn't help(module) work in python interpreter?<p>Why do I get an exception on the last one (python 3.9.2)?</p> <pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; import os &gt;&gt;&gt; help(type(os)) # =&gt; Help on class module in module builtins &gt;&gt;&gt; help(int) # =&gt; Help on class int ...
<p>There is no symbol named <code>module</code> by default, so you can't ask the help function to describe it. The description is that it is <em>from the module</em> <code>builtins</code>, not that there's a symbol named <code>module</code>.</p> <p>You can ask for help about <code>builtins</code>, as long as you make s...
Why doesn't help(module) work in python interpreter?
python
0
40
1
72,160,765
72,160,765
1
true
2022-05-08T11:54:41.127Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why doesn't help(module) work in python interpreter?<p>Why do I get an exception on the last one (python 3.9.2)?</p> <pre class="lang-py prettyprint-override...
72,225,227
Unique constraint violated message on inserting code below<p>I am writing this code which throws an error in primary key:</p> <pre><code>DECLARE CURSOR A1 AS SELECT TRANS_DET_ID, (SELECT MAX (NVL(TRANS_DET_DET_ID, 0) + 1) FROM PROD_OPERATIONS_RATE) DET_ID, OPER_CODE, ART_CODE, RATE...
<p>Unique (primary) key value which is calculated as <code>MAX + 1</code> is almost always wrong. Switch to a sequence.</p> <p>Find MAX <code>trans_det_det_id</code> value:</p> <pre><code>SELECT MAX (trans_det_det_id) max_id FROM PROD_OPERATIONS_RATE; </code></pre> <p>Create sequence as <code>max_id + 1</code> (I put a...
Unique constraint violated message on inserting code below
oracle|plsql|oracle11g
0
170
1
72,225,364
72,225,364
1
true
2022-05-13T06:22:03.353Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unique constraint violated message on inserting code below<p>I am writing this code which throws an error in primary key:</p> <pre><code>DECLARE CURSOR A1 AS...
72,078,631
how to show initial data if search field is cleared<p>Initially, useEffect is used to get data from the server and list it in a table. The records are paginated. When a user begins to type I make a debounced request to the server to search the database. When the data is returned I am setting the state and the table is ...
<p>You can move <code>getBookings</code> function out of <code>useEffect</code> for the re-usage. Whenever your search input field is empty, you just fetch data again from it.</p> <pre><code> const [searchTerm, setSearchTerm] = useState(); const [data, setData] = useState([]); const [isLoading, setIsLoading] = useS...
how to show initial data if search field is cleared
reactjs
0
24
1
72,078,715
72,078,715
1
true
2022-05-01T16:39:31.273Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to show initial data if search field is cleared<p>Initially, useEffect is used to get data from the server and list it in a table. The records are pagina...
72,100,950
How to add a new json object to array which elements will be rendered as components on a page?<p>I want to change a state of an array which will have values derived from data.js file as a starting point. Changing a state means running function setAllThingsArray and adding new element which will be set using a function ...
<p>state setters (<code>setAllThingsArray</code> and <code>setThingsArray</code>) are asynchronous, so you cannot use a state update within another state update. <code>setThingsArray</code> itself is also a function (not a state value), so you cannot set it directly into <code>setAllThingsArray</code> either.</p> <p>I'...
How to add a new json object to array which elements will be rendered as components on a page?
javascript|reactjs
0
29
1
72,101,226
72,101,226
1
true
2022-05-03T14:28:21.863Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add a new json object to array which elements will be rendered as components on a page?<p>I want to change a state of an array which will have values ...
72,143,709
Align items horizontally in sinblings, without changing html structure<p>Like you can see from the snippet, there are 2 dynamically created flex div's (it can be more)</p> <p>Is there a way to align items horizontally, on bigger screens, without changing html structure?</p> <p>I'm loking for:</p> <p><a href="https://i....
<p>You can use <code>table-row</code> and <code>table-cell</code> to align rows like table's elements</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.detail-card { margin-...
Align items horizontally in sinblings, without changing html structure
html|css
0
63
1
72,143,912
72,143,912
1
true
2022-05-06T15:10:18.037Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Align items horizontally in sinblings, without changing html structure<p>Like you can see from the snippet, there are 2 dynamically created flex div's (it ca...
72,195,943
mock value inside the component file<p>I would like to ask if I have the variable <code>useState</code> in the component which is used as a condition that determines the element inside it will appear or not. How to mock the variable? So that I can test the element inside the condition if the value is 'login'.</p> <pre>...
<p>Firstly, you need to add <code>data-testid</code> for your button</p> <pre><code>{data === &quot;firstTimeLogin&quot; &amp;&amp; ( &lt;div&gt;&lt;button onClick=&quot;funct2&quot; data-testid=&quot;next-button&quot;&gt;next&lt;/button&gt;&lt;/div&gt; )} </code></pre> <p><em>You called <code>onClick=&quot;funct2()...
mock value inside the component file
javascript|reactjs|jestjs|react-testing
0
120
2
72,197,751
72,197,751
1
true
2022-05-11T05:42:48.120Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: mock value inside the component file<p>I would like to ask if I have the variable <code>useState</code> in the component which is used as a condition that de...
72,191,177
Inertia - Reloading page url created with POST shows GET 405 (Method Not Allowed)<p>I want to load a new <code>vue component</code> and show its <code>id</code> in the <code>URL</code>. This can be done like so:</p> <pre><code>&lt;template&gt; &lt;button @click=&quot;submit&quot;&gt;Load new page with id in url&lt;/b...
<p>Probably you needed to use GET Request instead of POST Request. If yes, then just add to url your id and then pass the <code>GET method</code> to param:</p> <pre><code>const id = 1 Inertia.visit('/admin/kreationen/bearbeiten/' + id, {method: 'get'}) </code></pre> <p>And for Backend side in Laravel url stays as...
Inertia - Reloading page url created with POST shows GET 405 (Method Not Allowed)
laravel|vue.js|vuejs3|inertiajs|inertial-navigation
0
163
1
72,192,090
72,192,090
1
true
2022-05-10T18:11:33.730Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Inertia - Reloading page url created with POST shows GET 405 (Method Not Allowed)<p>I want to load a new <code>vue component</code> and show its <code>id</co...
72,134,686
Need help making a function to take in an int N and make an array with N elements. Each element should be half of the previous element starting from 1<p>Problem: Write a function that takes in an int n and returns a double[] of length n where the starting element (value) is 1.0 and the other elements are the previous d...
<p>If you are writing in JavaScript, define an array with only first element [1.0]. Then, define for-loop and loop over the array n times. Starting index should be 1 (because we already have one element in the array) and on each iteration push <code>(arr[i - 1]) / 2</code> to the array.</p>
Need help making a function to take in an int N and make an array with N elements. Each element should be half of the previous element starting from 1
javascript|function
0
30
1
72,134,837
72,134,837
1
true
2022-05-05T23:42:16.163Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Need help making a function to take in an int N and make an array with N elements. Each element should be half of the previous element starting from 1<p>Prob...
72,175,978
How to set env variable in Heroku with Node.js?<p>How to set env variable Heroku with Node.js? I opened Heroku account but unable to find out the possible solution to set my env variables up.</p>
<p>Go to your deployed app settings. Then, in &quot;config vars&quot; section click on &quot;Reveal Config Vars&quot; button and you can enter env variables there, which will be also available in your application</p> <p>Like this: <a href="https://i.stack.imgur.com/LvVZD.png" rel="nofollow noreferrer"><img src="https:/...
How to set env variable in Heroku with Node.js?
javascript|node.js|heroku
0
41
2
72,176,054
72,176,054
1
true
2022-05-09T17:25:31.680Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to set env variable in Heroku with Node.js?<p>How to set env variable Heroku with Node.js? I opened Heroku account but unable to find out the possible so...
72,166,091
Reading a file -- pairing a String and int value -- with multiple split lines<p>I am working on an exercise with the following criteria:</p> <p><strong>&quot;The input consists of pairs of tokens where each pair begins with the type of ticket that the person bought (&quot;coach&quot;, &quot;firstclass&quot;, or &quot;d...
<p>If you can afford to read the text file in all at once as a very long <code>String</code>, simply use the built-in <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String)" rel="nofollow noreferrer"><code>String.split()</code></a> with the regex <code>\\s+</code>, like so</p> ...
Reading a file -- pairing a String and int value -- with multiple split lines
java|string|file|stringtokenizer
0
88
3
72,166,338
72,166,338
1
true
2022-05-09T01:07:38.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reading a file -- pairing a String and int value -- with multiple split lines<p>I am working on an exercise with the following criteria:</p> <p><strong>&quot...
72,184,176
How do I render numbers like 4999 to $4,999.00 in datatables?<p>If the data source is from an existed DOM, rather than some JSON variable. How do I convert the numbers like <code>4999</code> to <code>$4,999.00</code> in datatables?</p> <p>I don't know what kind of options should be passed to the main function.</p> <pre...
<p>You can use the <a href="https://datatables.net/reference/option/columns.createdCell" rel="nofollow noreferrer"><code>createdCell()</code></a> callback, inside DataTables' <a href="https://datatables.net/reference/option/columnDefs" rel="nofollow noreferrer"><code>columnDefs</code></a> initializazion option.</p> <p>...
How do I render numbers like 4999 to $4,999.00 in datatables?
datatables
0
26
1
72,184,962
72,184,962
1
true
2022-05-10T09:52:26.907Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I render numbers like 4999 to $4,999.00 in datatables?<p>If the data source is from an existed DOM, rather than some JSON variable. How do I convert t...
72,201,568
how to make colspan of table footer flexible with javascript/jQuery?<p>I've a dynamic html table where I want to place sums in the footer at certein calculated positions. Those fields have a fixed colspan of <code>1</code>. Other fields should be displayed as single column with variable colspan.</p> <p>In my example be...
<p>I managed it by creating a new <code>spans[]</code> array (initially containing an object <code>{text:'', colspan:0}</code>) and a <em>cursor</em>, updated on certain conditions while looping inside the <code>header[]</code> array.</p> <p>Then I loop the <code>header[]</code>.</p> <p>Each time a <code>header[]</code...
how to make colspan of table footer flexible with javascript/jQuery?
javascript|jquery
0
131
2
72,204,264
72,204,264
1
true
2022-05-11T13:03:54.060Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to make colspan of table footer flexible with javascript/jQuery?<p>I've a dynamic html table where I want to place sums in the footer at certein calculat...
72,165,929
Why there are stray pixels in computing the average of grayscale images?<p>I am computing the average of three grayscale images attached herewith. image1Each image is of size 256 x 256. Upon averaging, I am getting several stray pixels in the averaged output. Given below is the code I am using to generate the averaged ...
<p>Jifi has the answer. If you had printed the arrays you're reading, you would have realized that those arrays ALREADY run from 0 to 255. You assumed they run from 0 to 1. If you remove the <code>255*</code>, you'll get the results you expect.</p> <p>That does say that at least some of your images do have stray pix...
Why there are stray pixels in computing the average of grayscale images?
python|image|opencv|grayscale
0
54
1
72,166,064
72,166,064
1
true
2022-05-09T00:23:18.060Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why there are stray pixels in computing the average of grayscale images?<p>I am computing the average of three grayscale images attached herewith. image1Each...
72,160,195
How do I get my highest match from my findings<p>Hi im new to coding and i know this may be a a stupid question but i want to get my highest match from my output but dont know how i would do this. I shall put my example below:</p> <pre><code> I want to be able to get the highest match and help would be appreciated </co...
<p>a short version:</p> <pre><code>def frac(part, primer=primer): return sum(pa == pr for pa, pr in zip(part, primer)) / len(primer) mx_i = max(range(len(Seq1) - len(primer)), key=lambda i: frac(Seq1[i:i + len(primer)])) mx_seq = Seq1[mx_i:mx_i+len(primer)] mx_ratio = frac(mx_seq) print(f&quot;sequen...
How do I get my highest match from my findings
python
0
33
2
72,160,344
72,160,344
1
true
2022-05-08T10:41:18.353Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get my highest match from my findings<p>Hi im new to coding and i know this may be a a stupid question but i want to get my highest match from my ou...
72,224,054
How to make path using pandas dataframe as reference<p>I plan to make hundreds of dataframe with using Excel in hundreds of folders.</p> <p>Reference table:</p> <pre><code> Folder Category Sub Category 205 News and Media News and Media News and Media 206 ...
<p>First create a column named &quot;Path&quot; in your dataframe.</p> <pre><code>df['Path'] = df['Folder'] + '/TopSites-' + df['Category'] + '_' + df['Sub Category'] + '-(999)-(2022_03).xlsx' # Create the whole path </code></pre> <p>After that, you can loop through your dataframe and read each path.</p> <pre><code>for...
How to make path using pandas dataframe as reference
python|pandas|directory
0
57
1
72,224,220
72,224,220
1
true
2022-05-13T03:11:33.840Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make path using pandas dataframe as reference<p>I plan to make hundreds of dataframe with using Excel in hundreds of folders.</p> <p>Reference table:<...
72,233,169
how to make grpc proto "timestamp" change to Date input format?<p>I want to make timestamp to convert to <code>Date</code> but I was expecting to input <code>Date</code> format ,&quot;NOT&quot; seconds and nano. How do change it to date format input?</p> <p><img src="https://i.stack.imgur.com/2ufXQ.png" alt="This is ...
<p>In order to get more efficient serialization and more descriptive code than just having a string you could do copy the implementation of <a href="https://github.com/googleapis/googleapis/blob/master/google/type/date.proto" rel="nofollow noreferrer">Date</a> from the Google API repo. If you are working only with Java...
how to make grpc proto "timestamp" change to Date input format?
java|spring-boot|grpc|grpc-java|proto
0
293
2
72,237,651
72,237,651
1
true
2022-05-13T17:07:29.577Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to make grpc proto "timestamp" change to Date input format?<p>I want to make timestamp to convert to <code>Date</code> but I was expecting to input <cod...
72,041,586
Is the description of the "Contiguity within looping patterns " in the document correct?<p>as the description in <a href="https://nightlies.apache.org/flink/flink-docs-release-1.14/docs/libs/cep/" rel="nofollow noreferrer">flink CEP document</a>:</p> <ol> <li><code>Strict Contiguity:</code> Expects all matching events ...
<p>I believe you are right. With strict contiguity, it does not match at all. I wrote the following example to make sure:</p> <pre class="lang-java prettyprint-override"><code>public class StreamingJob { public static void main(String[] args) throws Exception { StreamExecutionEnvironment env = StreamExecu...
Is the description of the "Contiguity within looping patterns " in the document correct?
apache-flink|flink-streaming|flink-cep
0
31
1
72,056,845
72,056,845
1
true
2022-04-28T09:51:50.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is the description of the "Contiguity within looping patterns " in the document correct?<p>as the description in <a href="https://nightlies.apache.org/flink/...
72,174,708
read-while loop with variables in bash -- equivalent in Python?<p>Currently refactoring some old code and looking to convert some bash scripts to python.</p> <p>We have a small piece of functionality written in bash that's similar to:</p> <pre><code>var1=$1 var2=$2 var3=$3 while read var1 var2 var3; do logi...
<p>The <code>bash</code> script reads each line from standard input, splits it into words, and assigns the words to <code>var1</code>, <code>var2, and </code>var3<code>in order. It loops until</code>read` returns an error, which normally happens at EOF.</p> <p>The roughly equivalent python code would be:</p> <pre><code...
read-while loop with variables in bash -- equivalent in Python?
python|bash|while-loop|do-while
0
54
1
72,174,851
72,174,851
1
true
2022-05-09T15:44:01.433Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: read-while loop with variables in bash -- equivalent in Python?<p>Currently refactoring some old code and looking to convert some bash scripts to python.</p>...
72,231,628
Extract tar achives into separate folders<p>I have a folder containing many tar archives</p> <ul> <li>archive1.tar</li> <li>archive2.tar</li> <li>...</li> </ul> <p>I'd like to write a bash script which extracts their innard files to separate folders:</p> <ul> <li>archive1</li> <li> <ul> <li>file1-1</li> </ul> </li> <li...
<p>Create a subdirectory named after the tarfile and use that instead of <code>.</code></p> <pre><code>for file in *.tar; do dir=$(basename &quot;$file&quot; .tar) mkdir &quot;$dir&quot; tar -xf &quot;$file&quot; -C &quot;$dir&quot; done </code></pre>
Extract tar achives into separate folders
bash|tar
0
30
1
72,231,669
72,231,669
1
true
2022-05-13T14:59:00.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extract tar achives into separate folders<p>I have a folder containing many tar archives</p> <ul> <li>archive1.tar</li> <li>archive2.tar</li> <li>...</li> </...
72,147,549
How do you use std::distance in a range-based loop?<p>This is my code that won't compile:</p> <pre><code>for( auto occurances : occ ){ if( occurances == 1 ) cout &lt;&lt; distance( occ.begin(), occurances ) } </code></pre> <p>It gave me the following error:</p> <pre><code>candidate template ignored: deduced confl...
<p>You could count the iterations round the loop yourself:</p> <pre><code>size_t loop_count = 0; for( auto occurances : occ ){ if( occurances == 1 ) cout &lt;&lt; loop_count; ++loop_count; } </code></pre> <p>But that's really no easier than just coding the <code>for</code> loop explicitly, and you might forget ...
How do you use std::distance in a range-based loop?
c++|std
0
120
1
72,148,008
72,148,008
1
true
2022-05-06T21:28:54.657Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you use std::distance in a range-based loop?<p>This is my code that won't compile:</p> <pre><code>for( auto occurances : occ ){ if( occurances == 1 ...
72,226,671
How to initiate multiple structs<p>I'm fairly new to C++.</p> <p>Have a struct <code>Bbox</code> with a constructor with two arguments <code>x</code> and <code>y</code> which I have just added. Before when the constructor had no arguments I could initiate multiple instances of <code>Bbox</code> by doing this and <code>...
<p>And, to build on @anoop's (excellent) answer, if you use <a href="https://en.cppreference.com/w/cpp/container/vector" rel="nofollow noreferrer"><code>std::vector</code></a> instead of a C-style array (and you should!), then you can do this:</p> <pre><code>std::vector &lt;Box&gt; make_boxes (int num_boxes) { retu...
How to initiate multiple structs
c++
0
51
3
72,226,870
72,226,870
1
true
2022-05-13T08:36:14.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to initiate multiple structs<p>I'm fairly new to C++.</p> <p>Have a struct <code>Bbox</code> with a constructor with two arguments <code>x</code> and <co...
72,182,319
Update relationship in SQLAlchemy<p>I have this kind of model:</p> <pre><code>class A(Base): id = Column(UUID(as_uuid=True), primary_key=True, server_default=text(&quot;uuid_generate_v4()&quot;)) name = Column(String, nullable=False, unique=True) property = Column(String) parent_id = Column(UUID(as_uu...
<p>I'd do a single query and compare the result against the message you receive. That way it's easier to handle both additions, removals and updates.</p> <pre class="lang-py prettyprint-override"><code>msg_parent_id = 5 msg_children = [('name', 'property'), ('name2', 'property2')] stmt = select(A).where(A.parent_id ==...
Update relationship in SQLAlchemy
sqlalchemy|relationship
0
163
1
72,183,089
72,183,089
1
true
2022-05-10T07:35:01.600Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Update relationship in SQLAlchemy<p>I have this kind of model:</p> <pre><code>class A(Base): id = Column(UUID(as_uuid=True), primary_key=True, server_def...
72,228,866
Move files to a network folder<p>Could you tell me please, how to correctly specify the path to the <code>network folder</code> from the <code>Linux</code> operating system in the code?</p> <p>The network folder is accessible via <code>SMB</code></p> <p>I use the following code to move a certain type of files:</p> <pre...
<p>Since you're uploading to an SMB share, you need to use <a href="https://pysmb.readthedocs.io/en/latest/api/smb_SMBConnection.html" rel="nofollow noreferrer">pysmb</a> for instance.</p> <p>NB. I don't have a SMB share available right now, so this is untested, but should point you in the right direction.</p> <pre><co...
Move files to a network folder
python|python-3.x|shutil
0
186
1
72,229,343
72,229,343
1
true
2022-05-13T11:30:37.897Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Move files to a network folder<p>Could you tell me please, how to correctly specify the path to the <code>network folder</code> from the <code>Linux</code> o...
72,231,376
Hashing gives different result<p>I am using Python and MySql to handle user authentication. I have added the users thru python with the exact same method, but when I try to do the &quot;login&quot;/authentication it does not match.</p> <p>This is my code for authentication:</p> <pre><code># Collecting data from users. ...
<p>Looking at the insertion code, you seem to treat <code>salt</code> like the <code>get_salt</code> tuple, get first item, not knowing what it is originally, that might be the source of your issues as I would not expect the first salt you get to be in a tuple.</p> <p>Here is a version that works, it's using SQLite rat...
Hashing gives different result
python|mysql|hash|salt|hashlib
0
45
1
72,234,737
72,234,737
1
true
2022-05-13T14:40:41.960Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hashing gives different result<p>I am using Python and MySql to handle user authentication. I have added the users thru python with the exact same method, bu...
72,201,765
Download dynamic XML/JSON file in Spring Boot<p>I need to implement a feature where users can <strong>download</strong> their personal data in <strong>XML or JSON format file</strong>.</p> <p>The file will be generated at run time and I have no idea how to implement this in Spring Boot in the corresponding <code>@RestC...
<p>Since your file is created dynamically from a string, you will need to create an output stream and write the string content to it. I haven't tested any of this but I've used similar code in the past.</p> <pre><code>import org.apache.commons.io.IOUtils; import javax.servlet.http.HttpServletRequest; import javax.servl...
Download dynamic XML/JSON file in Spring Boot
spring|spring-boot
0
83
1
72,206,825
72,206,825
1
true
2022-05-11T13:16:43.027Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Download dynamic XML/JSON file in Spring Boot<p>I need to implement a feature where users can <strong>download</strong> their personal data in <strong>XML or...
72,212,207
Dynamic API requests from user input<p>i'm new to API's and am building a webpage that calls an API and gets some data to build a table and display it. Currently the page runs the buildTable() function on page load and takes a URL value. Here is the entire page code:</p> <pre><code>function buildTable(url) { fetch(url)...
<blockquote> <p>My question is how do I take user input to change the URL and load the new data?</p> </blockquote> <p>If you use an <code>URL</code> object, you can conveniently set the individual query parameters.</p> <p>Here is an example assuming an input box <code>#filterInput</code>:</p> <pre class="lang-js pretty...
Dynamic API requests from user input
javascript
0
62
1
72,212,295
72,212,295
1
true
2022-05-12T08:18:26.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dynamic API requests from user input<p>i'm new to API's and am building a webpage that calls an API and gets some data to build a table and display it. Curre...
72,186,910
Python imports in deployed/local packages<p>How can I write <code>import foo.bar</code> in <code>__init__.py</code> so it will load the system-wide version of <code>foo/bar.py</code> when run from most places, but will load the local version of <code>bar.py</code> when run from within <code>foo</code>'s source director...
<blockquote> <p>but I'm not sure how they manage to develop these libraries (perhaps they always use virtual environments)</p> </blockquote> <p>Yes, I think 99% or so of python dev work uses virtualenvs. They're really not too hard---you might want to have a look at something like <a href="https://python-poetry.org/" ...
Python imports in deployed/local packages
python|python-import
0
34
1
72,187,127
72,187,127
1
true
2022-05-10T13:06:22.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python imports in deployed/local packages<p>How can I write <code>import foo.bar</code> in <code>__init__.py</code> so it will load the system-wide version o...
72,166,637
How do I compare a string variable to a list of string variables in a Sympy matrix?<p>I'm trying to access a list of string variables in a matrix to compare to a user inputted string in an if/elif statement. I can't seem to get the access right as my code prints the 'else' statement and doesn't do what I want...</p> <p...
<p>You should iterate through the odd and even matrices and check if the number string is there in the matrices. Also, compare the strings in matrices using str() method/constructor because the members of the matrix in &quot;sympy&quot; are converted into symbols even if you provide them as strings. I guess the display...
How do I compare a string variable to a list of string variables in a Sympy matrix?
python|string|matrix|sympy
0
54
2
72,166,834
72,166,834
1
true
2022-05-09T03:13:34.583Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I compare a string variable to a list of string variables in a Sympy matrix?<p>I'm trying to access a list of string variables in a matrix to compare ...
72,215,332
Change eventbridge cron rule name in terraform<p>I have a lambda that I trigger with an <code>EventBridge</code>.</p> <p>I have <code>allowed_triggers</code> in my <code>lambda_function</code>:</p> <pre><code> allowed_triggers = { &quot;RunDaily&quot; = { principal = &quot;events.amazonaws.com&quot; s...
<p>As per the module definition [1], the <code>aws_cloudwatch_event_rule</code> name is derived from value of the <strong>key</strong> of the <code>rules</code> block, i.e.:</p> <pre><code> rules = { crons = { description = &quot;My custom cron rule&quot; schedule_expression = &quot;rate(1 day)...
Change eventbridge cron rule name in terraform
amazon-web-services|terraform|amazon-cloudwatch|aws-event-bridge
0
442
1
72,216,445
72,216,445
1
true
2022-05-12T12:10:44.603Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change eventbridge cron rule name in terraform<p>I have a lambda that I trigger with an <code>EventBridge</code>.</p> <p>I have <code>allowed_triggers</code>...
72,228,411
Django filtering on a queryset not working<p>I am trying to add a filter on an existing queryset based on a condition but it doesn't work.</p> <p>This works</p> <pre><code> queryset = None if self.is_instructor == True: queryset = Issue.objects.filter(type=self.type, type_id=self.type_id).fil...
<p>You need to update <code>query_set</code> not just call the function.</p> <pre><code>... if len(self.status) &gt; 0: queryset = queryset.filter(status__in=self.status) queryset = queryset.order_by('-created_on') </code></pre>
Django filtering on a queryset not working
python|django|django-rest-framework|django-queryset
0
150
1
72,250,775
72,250,775
1
true
2022-05-13T10:51:42.283Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django filtering on a queryset not working<p>I am trying to add a filter on an existing queryset based on a condition but it doesn't work.</p> <p>This works<...
72,237,113
Mock addListener from navigation in unit test<p>Used addListener from navigation like this,</p> <pre><code>useEffect(() =&gt; { const navigationSubscription = props.navigation.addListener( &quot;willFocus&quot;, () =&gt; setFocused(true) ); return navigationSubscription.remove; //navigationSubscription is unde...
<p>You have a small problem with mocked <code>addListener</code>. It's expecting a returned value when you call <code>addListener</code>, but you've not returned anything from that mocked function.</p> <p>A potential fix could be the following:</p> <pre><code>const componentStub = (props) =&gt; { return ( &lt;Pro...
Mock addListener from navigation in unit test
react-native|jestjs
0
338
2
72,254,573
72,254,573
1
true
2022-05-14T03:26:22.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mock addListener from navigation in unit test<p>Used addListener from navigation like this,</p> <pre><code>useEffect(() =&gt; { const navigationSubscription...
72,201,438
Detect when the user lifts their finger (off the screen)<p>We have <code>pointerInput</code> for detecting tap, drag and pan events, and it also provides a handy <code>awaitPointerEventScope</code>, the <code>pointer</code> being the finger, for mobile devices here. Now, we do have a <code>awaitFirstDown()</code> for d...
<p>Better way, and what is suggested by Android code if you are not using interoperability with existing View code is <code>Modifier.pointerInput()</code></p> <blockquote> <p>A special PointerInputModifier that provides access to the underlying MotionEvents originally dispatched to Compose. Prefer pointerInput and use ...
Detect when the user lifts their finger (off the screen)
android|android-jetpack-compose
0
153
2
72,210,341
72,210,341
1
true
2022-05-11T12:54:38.407Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Detect when the user lifts their finger (off the screen)<p>We have <code>pointerInput</code> for detecting tap, drag and pan events, and it also provides a h...
72,188,903
Pyside6, How do I resize a QLabel without loosing the size aspect ratio?<p><strong>My issue goes excactly as in those related posts:</strong></p> <ul> <li><a href="https://stackoverflow.com/questions/21041941/">How to Autoresize QLabel pixmap keeping ratio without using classes?</a></li> <li><a href="https://stackoverf...
<h1><a href="https://stackoverflow.com/a/21053898/11465149">Thanks to this PyQt answer !!!</a></h1> <p>I was able to find out how to do the same thing in PySide6 pretty flawlessly by following those simple example steps:</p> <ul> <li><em><strong>Open pyside6-designer\Qt-designer:</strong></em></li> </ul> <div class="s-...
Pyside6, How do I resize a QLabel without loosing the size aspect ratio?
python|resize|qt-designer|qlabel|pyside6
0
250
1
72,188,904
72,188,904
1
true
2022-05-10T15:14:31.930Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pyside6, How do I resize a QLabel without loosing the size aspect ratio?<p><strong>My issue goes excactly as in those related posts:</strong></p> <ul> <li><a...
72,177,060
Custom React Component Library - jest 'cannot find module react'- testing-library, rollup<p>I'm building a custom react component library to share with other applications. I'm using rollup and following this blog and a few others: <a href="https://dev.to/alexeagleson/how-to-create-and-publish-a-react-component-library...
<p><code>react</code> and <code>react-dom</code> should be included in both <code>devDependencies</code> <em>and</em> <code>peerDependencies</code> of your library.</p> <p>Including them in <code>devDependencies</code> makes them available when developing (and when running tests), but they won't be included in the libr...
Custom React Component Library - jest 'cannot find module react'- testing-library, rollup
javascript|reactjs|jestjs|react-testing-library|rollup
0
445
1
72,179,343
72,179,343
1
true
2022-05-09T19:05:10.820Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Custom React Component Library - jest 'cannot find module react'- testing-library, rollup<p>I'm building a custom react component library to share with other...
72,154,993
Swift UI - Dynamic List, TextField focus and deletion<p>I have a really strange behaviour with Swift UI on Mac OS. The idea is that I have a dynamic list of editable elements (I can add, edit &amp; remove). If I don't focus the TextField, I can add / remove element without problem. But If I start to give focus to TextF...
<p>I can replicate with your steps, I believe it is a bug.</p> <p>You can circumvent the issue by using the &quot;new&quot; <code>format</code> and <code>.number</code> instead of <code>formatter</code></p> <pre><code>TextField(&quot;field3&quot;, value: $line.field3, format: .number).textFieldStyle(.roundedBorder) Tex...
Swift UI - Dynamic List, TextField focus and deletion
swift|list|swiftui|textfield
0
203
1
72,155,147
72,155,147
1
true
2022-05-07T17:39:57.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Swift UI - Dynamic List, TextField focus and deletion<p>I have a really strange behaviour with Swift UI on Mac OS. The idea is that I have a dynamic list of ...
72,118,047
Show OneToMany connection<p>I am trying in vain to display a list of objects of type calendar entries. I use a @OneToMany and @ManyToOne assertion. If I call up my controller with Postman, I &quot;only&quot; see my user, which also contains my entries. How can I display everything here without an extra query in a repos...
<p>Both directions were annotated with <code>@JsonIgnore</code>, so it won't display relational data, but will query it anyways, try activate &quot;show sql&quot; in console with these settings:</p> <pre><code>// add these in property file and you can see generated sql spring.jpa.show-sql: true spring.jpa.properties.hi...
Show OneToMany connection
spring|spring-boot|spring-data-jpa
0
35
1
72,118,236
72,118,236
1
true
2022-05-04T18:49:04.413Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Show OneToMany connection<p>I am trying in vain to display a list of objects of type calendar entries. I use a @OneToMany and @ManyToOne assertion. If I call...
72,210,505
Should we make a request to /sanctum/csrf-cookie first, before registration that logs in a user after a successful registration?<p>My SPA is in the same repository as my laravel application and the documentation states that when using sanctum, your SPA's &quot;login&quot; page should first make a request to the <code>/...
<p>I investigated this issue further and found that the <code>/sanctum/csrf-cookie</code> endpoint actually only returns a 204 empty content. You can check here:</p> <p><a href="https://github.com/laravel/sanctum/blob/5a602d520474e103174900301d7b791e6d7cd953/src/Http/Controllers/CsrfCookieController.php#L12" rel="nofol...
Should we make a request to /sanctum/csrf-cookie first, before registration that logs in a user after a successful registration?
laravel|vue.js|laravel-sanctum
0
173
1
72,224,845
72,224,845
1
true
2022-05-12T05:29:13.350Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Should we make a request to /sanctum/csrf-cookie first, before registration that logs in a user after a successful registration?<p>My SPA is in the same repo...
72,231,068
Elasticsearch - Match all arraylist field<p>I have few documents with array &quot;items&quot; , i want to only pick those documents where &quot;items.name&quot; is equal to &quot;red&quot;. If there is any document with one red and another color, then it should not come in result.</p> <p>1.</p> <pre><code>{ &quot;ite...
<p>Here is my first solution with the script :</p> <pre><code>GET test/_search { &quot;runtime_mappings&quot;: { &quot;all_red_items&quot;: { &quot;type&quot;: &quot;boolean&quot;, &quot;script&quot;: { &quot;source&quot;: &quot;int count = 0; for (int i = 0; i &lt; doc['items.name'].size(); i...
Elasticsearch - Match all arraylist field
elasticsearch|lucene|kibana|elastic-stack
0
94
1
72,231,558
72,231,558
1
true
2022-05-13T14:18:29.343Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Elasticsearch - Match all arraylist field<p>I have few documents with array &quot;items&quot; , i want to only pick those documents where &quot;items.name&qu...
72,235,683
How can I rotate this array?<p>I have this code that works perfectly but in the opposite direction ( left ) I would like to rotate this array to the right, how can I do this?</p> <pre><code> public int[] RotateArray(int[] A) { for(int i = 0 ;i &lt; A.Length - 1;i++) { int aux = A[i+1]; A[i+1] = A[...
<p>Try iterating over the array from the back:</p> <p><em><strong>Note</strong>: I changed the method to be <code>void</code> since from the looks of it you were attempting an in-place solution anyway.</em></p> <pre><code>using System; public class Program { public static void RotateArray(int[] A) { if (A...
How can I rotate this array?
c#|arrays|algorithm
0
90
3
72,235,818
72,235,818
1
true
2022-05-13T21:42:00.343Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I rotate this array?<p>I have this code that works perfectly but in the opposite direction ( left ) I would like to rotate this array to the right, h...
72,217,318
How to combine duplicated rows into a single row?<p>I have a table with each row representing a person. In this table there are a lot of duplicates that I want to get rid of. I want to deduplicate based on <code>name</code> and <code>age</code> only. However, the information in columns can be spread between different ...
<p>Simple group by combined with max as an aggregation function should do the trick</p> <pre><code>SELECT name, age, max(height), max(eye_color), max(weight) FROM employees GROUP BY name, age WHERE name is not null and age is not null; </code></pre> <p>Here we always get biggest value so any other than null sho...
How to combine duplicated rows into a single row?
postgresql
0
57
1
72,217,370
72,217,370
1
true
2022-05-12T14:19:06.983Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to combine duplicated rows into a single row?<p>I have a table with each row representing a person. In this table there are a lot of duplicates that I wa...
72,147,821
How to make a random sample of panel data (keeping all years for each randomly selected id)<p>I am using an unbalanced panel dataset, with multiple ids, each with 1 or more years of data. I would like to work with a smaller dataset as I build my code. I would therefore like to randomnly choose IDs, but for each ID that...
<p>Randomly select two 'id'. Get their indexes and, if necessary, values.</p> <pre><code>import pandas as pd import random df = pd.DataFrame({'id': ['1', '1', '2', '2', '3', '4', '4', '5', '6', '7', '7'], 'value': [40000, 50000, 42000, 20000, 20000, 25000, 27000, 20000, 23000, 50000, 22000]}) rrr =...
How to make a random sample of panel data (keeping all years for each randomly selected id)
python
0
93
1
72,152,789
72,152,789
1
true
2022-05-06T22:05:54.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make a random sample of panel data (keeping all years for each randomly selected id)<p>I am using an unbalanced panel dataset, with multiple ids, each...
72,214,109
How to store High or Low values (trading)<p>I would like to develop a code which add a Series to my DataFrame; the Series should store the lowest value of the Close until a new low is reached. When a new low is reached a new value should appear in the Series. The starting code is:</p> <pre><code>import yfinance as yf i...
<pre><code>import yfinance as yf import numpy as np ticker = 'EURUSD=X' df = yf.download(ticker, start='2021-2-1', end= '2021-3-1') minimum = np.min(df['Close'])#you saved the minimum print('minimum', minimum) df1 = yf.download(ticker, start='2021-3-2', end= '2022-5-1') for i in df1['Close'].values: if i &lt; mi...
How to store High or Low values (trading)
python|series|algorithmic-trading|trading
0
73
1
72,215,034
72,215,034
1
true
2022-05-12T10:39:01.350Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to store High or Low values (trading)<p>I would like to develop a code which add a Series to my DataFrame; the Series should store the lowest value of th...
72,140,559
How to take changes from one remote branch to other remote branch<p>I'm working on a project and I cut a branch from a <em>release_branch</em> let's call my branch <em>branch_A</em>. My colleague also had cut another branch from same release branch and lets call that <em>branch_B</em>. We are working on the same file a...
<p>First, make sure that you commit all changes to your <code>branch_A</code> and if you are concerned about losing your work as part of the process, create a new branch at <code>branch_A</code> (e.g. <code>branch_A_old</code>).</p> <p>Since you will eventually be merging back to <code>release_branch</code>, you can us...
How to take changes from one remote branch to other remote branch
git|version-control|bitbucket|jira
0
41
1
72,142,115
72,142,115
1
true
2022-05-06T11:11:34.983Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to take changes from one remote branch to other remote branch<p>I'm working on a project and I cut a branch from a <em>release_branch</em> let's call my ...
72,177,247
Initialize Class with Parameter from Session<p>I am trying to figure out how (if it is even possible), to initialize a class once in a controller with parameter so that I don't have to create an instance in each method. I am getting back a bearer token that I need to submit with each call. This works:</p> <pre><code>...
<p>Your <code>HttpContext.Session</code> isn't initialized by the time the constructor runs. It seems like you're actually looking for a get-only property though.</p> <pre class="lang-cs prettyprint-override"><code>public Client _client =&gt; new Client(token); </code></pre> <p>This is shorthand for the following</p> <...
Initialize Class with Parameter from Session
c#
0
47
1
72,177,473
72,177,473
1
true
2022-05-09T19:23:08.227Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Initialize Class with Parameter from Session<p>I am trying to figure out how (if it is even possible), to initialize a class once in a controller with parame...
72,148,364
Storing numbers larger than Big integer C#<p>I am having a really hard time finding a way to store massive prime numbers in c#. I tried everything but nothing worked out for me. For example. How can I store this number.</p> <p>0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3...
<p>The size of an integer representable by <code>BigInteger</code> is effectively only constrained by the maximum addressable memory of the program if not the computer itself. You can parse one by using <code>BigInteger.Parse</code> or <code>BigInteger.TryParse</code> and passing <code>NumberStyles.HexNumber</code> (mi...
Storing numbers larger than Big integer C#
c#|memory-management|primes|biginteger
0
126
3
72,148,448
72,148,448
1
true
2022-05-06T23:41:01.497Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Storing numbers larger than Big integer C#<p>I am having a really hard time finding a way to store massive prime numbers in c#. I tried everything but nothin...
72,153,849
unsupported operand type(s) for -: 'datetime.date' and 'Timestamp'<p>I have a csv file which is a list of dates as strings e.g. 2018-05-04</p> <p>I'm trying to make a new column in a dataframe that is the difference in days. I'm having a problem with different formats of date as apparently you can't subtract a pandas ...
<p>You are subtracting a <code>pd.Timestamp</code> object from a <code>datetime.date</code> instance. The latter has no notion of time. You should convert <code>today</code> to a <code>datetime.datetime</code> object instead:</p> <pre><code># Initialises a datetime.datetime instance at midnight of the given date (today...
unsupported operand type(s) for -: 'datetime.date' and 'Timestamp'
python|pandas|dataframe
0
880
1
72,153,936
72,153,936
1
true
2022-05-07T15:20:02.897Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: unsupported operand type(s) for -: 'datetime.date' and 'Timestamp'<p>I have a csv file which is a list of dates as strings e.g. 2018-05-04</p> <p>I'm trying...
72,158,197
Plot the 2 graphs with same y scale<p>I need to draw 2 bar graphs with the same x axis. It was done as shown below. Buy their heights are not comparable, since the y axis have been drawn with le8 in the left hand side and le9 with the right hand side. Cannot I bring them to the same scale? for an example loth are into ...
<ul> <li><code>ax.set_ylim()</code> sets the y limits of <code>ax</code></li> <li><code>ax2.get_ylim()</code> gets the current y limits of <code>ax2</code></li> </ul> <p>With this in mind, you can just write:</p> <pre><code>ax.set_ylim(ax2.get_ylim()) </code></pre> <p>Thins will make the data in <code>ax</code> look wa...
Plot the 2 graphs with same y scale
python|seaborn
0
64
2
72,158,233
72,158,233
1
true
2022-05-08T05:00:57.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Plot the 2 graphs with same y scale<p>I need to draw 2 bar graphs with the same x axis. It was done as shown below. Buy their heights are not comparable, sin...
72,181,559
Matplotlib scatter plot dual y-axis<p>I try to figure out how to create scatter plot in matplotlib with two different y-axis values. Now i have one and need to add second with index column values on y.</p> <pre><code>points1 = plt.scatter(r3_load[&quot;TimeUTC&quot;], r3_load[&quot;r3_load_MW&quot;], ...
<p>Continuing after the suggestions in the comments.</p> <p>There are <a href="https://matplotlib.org/3.5.0/api/index.html#usage-patterns" rel="nofollow noreferrer">two ways of using <code>matplotlib</code></a>.</p> <ul> <li>Via the <code>matplotlib.pyplot</code> interface, like you were doing in your original code sni...
Matplotlib scatter plot dual y-axis
python|matplotlib|scatter
0
190
1
72,183,327
72,183,327
1
true
2022-05-10T06:22:57.740Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Matplotlib scatter plot dual y-axis<p>I try to figure out how to create scatter plot in matplotlib with two different y-axis values. Now i have one and need ...
72,194,605
Subtracting a rolling window mean based on value from one column based on another without loops in Pandas<p>I'm not sure what the word is for what I'm doing, but I can't just use the pandas rolling (<a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.rolling.html" rel="nofollow noreferrer">https://pa...
<p>If I understood correctly, you could create a fake <code>DatetimeIndex</code> to use for rolling.</p> <h2>Example data:</h2> <pre><code>import pandas as pd df = pd.DataFrame({'UT':[0.5, 1, 2, 8, 9, 12, 13, 14, 15, 24, 60, 61, 63, 100], 'WINDS':[1, 1, 10, 1, 1, 1, 5, 5, 5, 5, 5, 1, 1, 10]}) print...
Subtracting a rolling window mean based on value from one column based on another without loops in Pandas
python|pandas|dataframe|rolling-computation
0
60
1
72,195,831
72,195,831
1
true
2022-05-11T01:57:45.207Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Subtracting a rolling window mean based on value from one column based on another without loops in Pandas<p>I'm not sure what the word is for what I'm doing,...
72,185,852
using ColumnTransformer for predicting values<p>I am currently running a logistic regression model using keras.</p> <p>I have 1 numeric variable and around 6 categorical variables.</p> <p>I am currently using a column transformer for training and testing the model and it works perfect (code shown below):</p> <pre><code...
<p>After the discussion in the comments:</p> <p>It appears that you are using <a href="https://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html#sklearn.pipeline.Pipeline.fit_transform" rel="nofollow noreferrer"><code>pipeline.fit_transform(X_test)</code></a>. This means you are fitting your pipe...
using ColumnTransformer for predicting values
python|tensorflow|scikit-learn|regression
0
64
1
72,196,823
72,196,823
1
true
2022-05-10T11:54:18.197Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: using ColumnTransformer for predicting values<p>I am currently running a logistic regression model using keras.</p> <p>I have 1 numeric variable and around 6...
72,199,286
Pandas: group records by a column value and timestamp and apply a function on each record<p>I have a JSON file of Ethereum transactions with the following structure:</p> <pre><code> ..., { &quot;blockNumber&quot;: &quot;14492022&quot;, &quot;timeStamp&quot;: &quot;1648703953&quot;, &quot;hash&quot;: &quo...
<p>Here is a possible answer:</p> <h2>Data:</h2> <p>Here is some example data. I stripped the unnecessary columns for the sake of this answer.</p> <pre><code> timeStamp from 0 1648703953 0xaaaaa 1 1648779553 0xaaaaa 2 1648855153 0xaaaaa 3 1648930753 0xaaaaa 4 1649006353 0xaaaaa 5 1649081953 0x...
Pandas: group records by a column value and timestamp and apply a function on each record
python|json|pandas
0
42
1
72,201,304
72,201,304
1
true
2022-05-11T10:16:23.153Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas: group records by a column value and timestamp and apply a function on each record<p>I have a JSON file of Ethereum transactions with the following st...
72,211,476
What is the difference between `pandas.Series.ravel()`, `pandas.Series.to_numpy()`, `pandas.Series.values` and `pandas.Series.array`?<p>Basically the title sums it up. I have created a dummy <code>pandas.Series</code> object and looked up all these properties and methods. Documentation states that all of them except ma...
<p>By default, all of these return a view:</p> <pre><code>import pandas as pd s = pd.Series(range(10)) rav = s.ravel() # array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) to_num = s.to_numpy() # array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) values = s.values # array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) array = s.array # &lt;PandasArray&gt...
What is the difference between `pandas.Series.ravel()`, `pandas.Series.to_numpy()`, `pandas.Series.values` and `pandas.Series.array`?
python|pandas|series
0
305
1
72,212,052
72,212,052
1
true
2022-05-12T07:15:57.303Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the difference between `pandas.Series.ravel()`, `pandas.Series.to_numpy()`, `pandas.Series.values` and `pandas.Series.array`?<p>Basically the title s...
72,213,061
Create pairwise difference of rolling window of two dataframes<p>I have a time-series dataframe <code>df</code> with zeros and ones and I aim to compare the three most recent days <code>df_recent</code> with the historic time-series of <code>df</code>. In order to do that, I try to build pairwise differences of <code>d...
<p>If you can install <a href="https://numba.pydata.org" rel="nofollow noreferrer"><code>numba</code></a>, here is one solution with <code>.rolling</code> using the <code>'table'</code> method that allows you to roll over all columns at once:</p> <pre><code>import numpy as np recent_array = df_recent.to_numpy() def pa...
Create pairwise difference of rolling window of two dataframes
python|pandas|dataframe
0
37
1
72,214,480
72,214,480
1
true
2022-05-12T09:22:58.573Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create pairwise difference of rolling window of two dataframes<p>I have a time-series dataframe <code>df</code> with zeros and ones and I aim to compare the ...
72,222,416
How to reuse click listeners for different layouts<p>My app contains 2 different layouts for different device types. I want different actions to be performed e.g. 1st, 2nd and 3rd items to navigate to different screens, 4th item to show a <code>Toast</code>, the 5th item to launch an email composer intent, etc. Is ther...
<p>Since we're using Compose, we can take advantage of Kotlin. Instead of creating a <code>string-array</code> resource, we can create an enum class with all the choices like this:</p> <pre class="lang-kotlin prettyprint-override"><code>enum class Choices(@StringRes val textResId: Int) { Breads(R.string.breads), ...
How to reuse click listeners for different layouts
android|kotlin|android-layout|android-intent|android-jetpack-compose
0
85
2
72,224,968
72,224,968
1
true
2022-05-12T21:48:41.810Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to reuse click listeners for different layouts<p>My app contains 2 different layouts for different device types. I want different actions to be performed...
72,212,708
Android Telephony CellSignalStrength<p>sorry for my bad english.</p> <p>I want to ask about android telephony : CellSignalStrength</p> <p>I have code like below to display signal strength information on android..</p> <pre><code>public class MainActivity extends AppCompatActivity { private TextView textView2; public ...
<p>Instead of using <code>getDbm()</code> which return the &quot;signal strength as dBm&quot; you should use <code>getLevel()</code></p> <blockquote> <p>Retrieve an abstract level value for the overall signal quality. Returns int value between SIGNAL_STRENGTH_NONE_OR_UNKNOWN and SIGNAL_STRENGTH_GREAT inclusive</p> </bl...
Android Telephony CellSignalStrength
java|android|android-studio|telephonymanager
0
144
1
72,212,956
72,212,956
1
true
2022-05-12T08:57:22.247Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android Telephony CellSignalStrength<p>sorry for my bad english.</p> <p>I want to ask about android telephony : CellSignalStrength</p> <p>I have code like be...
72,165,821
Parent - Two Child correct way to communicate with each other<p>I have a small program in which there're a <strong>parent process</strong> and <strong>two child processes</strong>. First, the parent process sends data through pipe to its children (childA, childB). To make it clearer, I have a pointers array which has e...
<p>At a quick glance, it looks like you're on the right track, but you're missing some code in the child processes to write the processed data back to the pipe so it can be picked up by the parent process. Furthermore, your <code>wait()</code> call should probably be the very first call in the parent process after your...
Parent - Two Child correct way to communicate with each other
c|process|pipe|fork|parent-child
0
35
1
72,165,941
72,165,941
1
true
2022-05-08T23:47:35.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parent - Two Child correct way to communicate with each other<p>I have a small program in which there're a <strong>parent process</strong> and <strong>two ch...
72,182,285
generics in typescript with typeof for type guard<p>hi now iam learing typescript and i want to make a function to merge object or string and i use generic to add additional info to the function to can understand <strong>mergedObj.name</strong> after merge the two objects that's work fine if i deleted the condition for...
<p>You have to disambiguate the type somewhere, for example:</p> <pre><code>if (typeof mergedObj !== 'string') console.log(mergedObj.name); </code></pre> <p>removes the error</p>
generics in typescript with typeof for type guard
typescript|typescript-generics
0
63
3
72,182,424
72,182,424
1
true
2022-05-10T07:31:57.383Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: generics in typescript with typeof for type guard<p>hi now iam learing typescript and i want to make a function to merge object or string and i use generic t...
72,190,148
environmental variable not being read (NPM)<p>So I have a project running with nodejs, and an env file using multiple variables. For some reason one of these does not seem to be working though.</p> <p>Here the code should be printing out the port and namespace/ip of that the env file should have specified</p> <pre><cod...
<p>Fast solution at the moment in your <code>package.json</code></p> <p>Put your envs in your scripts</p> <pre class="lang-json prettyprint-override"><code>&quot;scripts&quot;: { &quot;dev&quot;: &quot;API_PORT=8080 API_HOST=127.0.0.1 node index.js&quot;, &quot;test&quot;: &quot;your script here&quot; }, </cod...
environmental variable not being read (NPM)
npm|environment-variables|chai|dotenv
0
316
1
72,305,974
72,305,974
1
true
2022-05-10T16:45:46.240Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: environmental variable not being read (NPM)<p>So I have a project running with nodejs, and an env file using multiple variables. For some reason one of these...
72,220,259
How do I reset the binding from my source (ViewModel) to the target (.xaml)<p>I have a ProfilePage.xaml containing some ImageButtons like these (six of them):</p> <pre><code>&lt;ImageButton x:Name=&quot;resultImage&quot; Source=&quot;{Binding Profile.Images[0].Source}&quot; Command=&quot;{Binding HandleImage}&quo...
<p>Based on your Updated code, you can avoid the need to directly access individual elements (<code>{Binding Profile.ImageSources[0]}</code>), by using a <a href="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/collectionview/layout#vertical-grid" rel="nofollow noreferrer">CollectionView with Grid...
How do I reset the binding from my source (ViewModel) to the target (.xaml)
c#|xaml|xamarin|xamarin.forms|maui
0
149
1
72,266,707
72,266,707
1
true
2022-05-12T18:03:59.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I reset the binding from my source (ViewModel) to the target (.xaml)<p>I have a ProfilePage.xaml containing some ImageButtons like these (six of them)...
72,190,372
PostgreSQL- If data in table, delete for stored procedure<p>I have this procedure, which I call with <code>CALL pr_calc_quarter(2,2022)</code>, that insert data into a table <code>erp.tb_quarter</code> from a query. I need to add code to check that if there is already data in the table, to delete it before inserting ne...
<p>If you always want to delete all data from table then just do always</p> <pre class="lang-sql prettyprint-override"><code>truncate erp.tb_quarter; </code></pre> <p>place it in next line after <code>BEGIN</code></p> <p>If you want to delete only data from calculated range do <code>delete</code> with proper <code>wher...
PostgreSQL- If data in table, delete for stored procedure
sql|postgresql|stored-procedures
0
97
1
72,190,462
72,190,462
1
true
2022-05-10T17:02:20.473Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PostgreSQL- If data in table, delete for stored procedure<p>I have this procedure, which I call with <code>CALL pr_calc_quarter(2,2022)</code>, that insert d...
72,210,906
Jest, command not found on GitLab<p>I'd like to execute my unit tests using JEST on GITLAB, but it seeem's not working.</p> <p>It works on my local machine but not on GitLab.</p> <p><strong>The entire code of <code>.gitlab-ci.yml</code> :</strong></p> <pre><code>image: node:16 cache: paths: - node_modules insta...
<p>You need to have a step to install, better to check with GitLab CI document</p> <pre class="lang-yaml prettyprint-override"><code>image: node:16 cache: paths: - node_modules install: stage: build script: npm ci jest: stage: test script: npm run test:ci artifacts: when: always reports: ...
Jest, command not found on GitLab
jestjs|gitlab|gitlab-ci|gitlab-ci.yml|jest-junit
0
660
1
72,211,810
72,211,810
1
true
2022-05-12T06:21:07.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Jest, command not found on GitLab<p>I'd like to execute my unit tests using JEST on GITLAB, but it seeem's not working.</p> <p>It works on my local machine b...
72,194,281
How to read unicode codepoints greater than 0xFFFF from file in Java<p>I'm writing a lexical analyzer for a compiler and I was wondering how I can read a UTF-8 file that contains unicode codepoints greater than 0xFFFF. The <code>char</code> data type only supports two bytes, so how can I read an <code>int</code> codepo...
<p>I had to do this recently; here's the code I used. It's a <code>Spliterator.OfInt</code> implementation that can be used to create an <code>IntStream</code> of codepoints from input from a <code>Reader</code>, or used directly if that's easier. Or just extract the logic from the <code>nextCP</code> method.</p> <pre ...
How to read unicode codepoints greater than 0xFFFF from file in Java
java|unicode|utf-8
0
57
1
72,197,175
72,197,175
1
true
2022-05-11T00:47:40.733Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to read unicode codepoints greater than 0xFFFF from file in Java<p>I'm writing a lexical analyzer for a compiler and I was wondering how I can read a UTF...
72,229,792
Git bash on Windows different result than terminal on CentOS for regex<p>See the following <code>cleanCustomer.sh</code> file</p> <pre><code>#!/bin/bash customer=Reportçós cleanedCustomer=${customer//[^a-zA-Z0-9 \-_.]/} echo $cleanedCustomer </code></pre> <p>When I run it on Windows 11 in Git Bash it prints <code>Repor...
<p>From the <a href="https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html#Pattern-Matching" rel="nofollow noreferrer">bash manual</a>:</p> <blockquote> <p>A pair of characters separated by a hyphen denotes a range expression; any character that falls between those two characters, inclusive, using th...
Git bash on Windows different result than terminal on CentOS for regex
bash|git-bash|glob
0
39
1
72,229,898
72,229,898
1
true
2022-05-13T12:41:48.087Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Git bash on Windows different result than terminal on CentOS for regex<p>See the following <code>cleanCustomer.sh</code> file</p> <pre><code>#!/bin/bash cust...
72,229,556
Trouble implementing custom IntoIterator trait<p>I'm new to rust, so forgive me if the question is naive.</p> <p>I'm trying to build an OS in rust and I'm following <a href="https://tc.gts3.org/cs3210/2020/spring/lab/lab2.html" rel="nofollow noreferrer">this</a> tutorial. The OS doesn't have memory management yet, so t...
<p>Different problems here:</p> <ul> <li>You cannot use <code>array::IntoIterator</code> because you do not have an array, you have a slice, which is quite different. It can be solved, for example, by using the proper <code>core::slice::Iter</code> as in the example.</li> <li>You are trying to return <code>T</code> but...
Trouble implementing custom IntoIterator trait
rust|iterator|traits|bare-metal
0
68
1
72,229,746
72,229,746
1
true
2022-05-13T12:23:00.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trouble implementing custom IntoIterator trait<p>I'm new to rust, so forgive me if the question is naive.</p> <p>I'm trying to build an OS in rust and I'm fo...
72,170,881
Computing sd() with irregular rolling windows in r<pre><code>df &lt;- structure(list(investor = c(&quot;INV_1&quot;, &quot;INV_1&quot;, &quot;INV_1&quot;, &quot;INV_1&quot;, &quot;INV_1&quot;), asset = c(&quot;x&quot;, &quot;x&quot;, &quot;x&quot;, &quot;x&quot;, &quot;x&quot;), ...
<p>There is an error in the code to produce df in the question so we will use the input in the Note at the end. Also we create a second investor giving df2 so that we can test this. Grouping by investor and asset, create a grouping variable which creates a new group each time the portfolio is 0 and for each such group...
Computing sd() with irregular rolling windows in r
r|rolling-computation|standard-deviation
0
38
1
72,171,112
72,171,112
1
true
2022-05-09T10:59:39.080Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Computing sd() with irregular rolling windows in r<pre><code>df &lt;- structure(list(investor = c(&quot;INV_1&quot;, &quot;INV_1&quot;, &quot;INV_1&quot;, &q...
72,202,743
Plot time series without straight lines<p>I am trying to plot some time series but since I have data only for the summer I get these straight lines. Any idea how to fix that? The code I used: Any idea would be helpful!</p> <pre><code> ggplot(ba, aes(x=date1, y=pc1)) + geom_line(color=&quot;turquoise4&quot;) + th...
<p><strong>1)</strong> Using the input in the Note at the end expand the dates to include the missing ones using NA's for them. Then plot.</p> <pre><code>library(ggplot2) library(zoo) z &lt;- read.zoo(ba) zz &lt;- merge(z, zoo(, seq(start(z), end(z), 1))) autoplot(zz) + xlab(&quot;&quot;) </code></pre> <p><a href="ht...
Plot time series without straight lines
r|ggplot2|plot|time-series
0
68
1
72,203,209
72,203,209
1
true
2022-05-11T14:21:31.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Plot time series without straight lines<p>I am trying to plot some time series but since I have data only for the summer I get these straight lines. Any idea...
72,213,317
unable to convert coma seperated string to array of ints in swift<p>I am getting string of ints, i need to convert that in array if ints</p> <p><strong>i need like this [8,9,10]</strong></p> <pre><code> let stringOfints = &quot;8,9,10&quot; let arrOfIds = stringOfints?.components(separatedBy: &quot;,&quot;) </code>...
<p><em><strong>Previous Answer</strong></em></p> <p>You have to convert the <code>String</code> to <code>Int</code></p> <pre><code>let stringOfints = &quot;8,9,10&quot; let arrOfIds = stringOfints.components(separatedBy: &quot;,&quot;).compactMap { Int($0) } </code></pre> <p><em><strong>Updated Answer</strong></em></p>...
unable to convert coma seperated string to array of ints in swift
arrays|swift|string
0
35
1
72,213,363
72,213,363
1
true
2022-05-12T09:41:18.243Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: unable to convert coma seperated string to array of ints in swift<p>I am getting string of ints, i need to convert that in array if ints</p> <p><strong>i nee...
72,213,537
Swift, Get action Bar Button Action from Container<p>I have ParentViewController.swift and ChildContainer.swift. In ParentViewController, I have bar button item action like below :</p> <pre><code>@IBAction func onClickBarItemRefresh(_ sender: UIBarButtonItem) { print(&quot;Refresh&quot;) } </code></pre> <p>I want t...
<p>First declare a callback function in the <code>ContainerViewController</code>.</p> <pre><code>var refreshButtonTapped: (() -&gt; Void)? </code></pre> <p>In <code>ParentViewController</code> where you initialise <code>ContainerViewController</code> give action of the callback function.</p> <p>In your case create a se...
Swift, Get action Bar Button Action from Container
swift
0
44
1
72,214,616
72,214,616
1
true
2022-05-12T09:56:31.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Swift, Get action Bar Button Action from Container<p>I have ParentViewController.swift and ChildContainer.swift. In ParentViewController, I have bar button i...
72,206,471
Error on validating JWT token IDX12741. JWT: must have three segments (JWS) or five segments (JWE)<p>I'm trying to implement token refresh feature in angular 12 and .net core 5.</p> <p>this is my JWT service registration:</p> <p>startup.cs:</p> <pre><code>services.AddAuthentication(options =&gt; { o...
<p>what does your jwt look like? JWT is consist of three parts:header,playload and signature, and they are splited by&quot;.&quot; in your jwt string.Your error was caused by the wrong structure of jwt,I suppose. and you could see the test result as below: <a href="https://i.stack.imgur.com/vBeIG.gif" rel="nofollow nor...
Error on validating JWT token IDX12741. JWT: must have three segments (JWS) or five segments (JWE)
angular|jwt|asp.net-core-webapi|refresh-token|angular12
0
1,449
1
72,209,654
72,209,654
1
true
2022-05-11T19:15:53.917Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error on validating JWT token IDX12741. JWT: must have three segments (JWS) or five segments (JWE)<p>I'm trying to implement token refresh feature in angular...
72,215,887
Could vue3 <script setup> use component is, how to make it work?<p>I am new beginner of vue3 and found that vue have three way to write component:</p> <ul> <li>&lt;script setup&gt;</li> <li>normal-setup/composition api</li> <li>options api.</li> </ul> <p>I know how to use in normal composition api like this:</p> <pre>...
<p>You need to use imported name:</p> <pre><code>&lt;script setup&gt; import CommonLayout from &quot;@/components/Layout/CommonLayout.vue&quot;; &lt;/script&gt; &lt;template&gt; &lt;CommonLayout /&gt; &lt;/template&gt; </code></pre> <p>or dynamically:</p> <pre><code>&lt;script setup&gt; import CommonLayout from &...
Could vue3 <script setup> use component is, how to make it work?
javascript|vue.js|vuejs3
0
66
1
72,216,119
72,216,119
1
true
2022-05-12T12:49:04.157Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Could vue3 <script setup> use component is, how to make it work?<p>I am new beginner of vue3 and found that vue have three way to write component:</p> <ul> <...
72,224,290
How to move an Item inside a list of lists?<p>I have the following list of lists representing a matrix stored in <code>space</code>:</p> <pre><code>[' ', '1', '1', ' '] [' ', '1', ' ', ' '] [' ', '1', ' ', ' '] [' ', ' ', ' ', ' '] </code></pre> <p>The number 1s represent an upside down L (like a gamma, &quot;Γ&quot;)....
<p>A list of lists is clunky for representing a matrix. Instead you can use an actual matrix-like type, the <a href="https://numpy.org/doc/stable/reference/arrays.ndarray.html" rel="nofollow noreferrer">NumPy ndarray</a>. NumPy includes a <a href="https://numpy.org/doc/stable/reference/generated/numpy.roll.html" rel="n...
How to move an Item inside a list of lists?
python|list
0
95
2
72,224,727
72,224,727
1
true
2022-05-13T04:01:16.753Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to move an Item inside a list of lists?<p>I have the following list of lists representing a matrix stored in <code>space</code>:</p> <pre><code>[' ', '1'...
72,222,778
EXC_BAD_ACCESS when initializing Dictionary of CurrentValueSubject in Swift<p>I am trying to create a class that executes data loading once and returns the data to all callers of the method while the data was loading to not perform the data loading for the same item (identifier) more than once. The issue I am having is...
<p>Swift Dictionary is not thread-safe. You need to make sure it is being accessed from only one thread (i.e queue) or using locks.</p> <p>EDIT - another solution suggested by @Bogdan the question writer is to make the class an <a href="https://www.hackingwithswift.com/quick-start/concurrency/what-is-an-actor-and-why-d...
EXC_BAD_ACCESS when initializing Dictionary of CurrentValueSubject in Swift
ios|swift|combine
0
147
1
72,224,949
72,224,949
1
true
2022-05-12T22:42:42.053Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: EXC_BAD_ACCESS when initializing Dictionary of CurrentValueSubject in Swift<p>I am trying to create a class that executes data loading once and returns the d...
72,205,780
Removing null values from array object mongodb<p>How can I remove null elements from this array with updateMany? I have many documents following this pattern with null values and I want to update them all without null values.</p> <pre><code>{ &quot;car&quot;: &quot;Honda&quot;, &quot;color&quot;: [ null, n...
<p><strong>Option 1. Using aggregation pipeline inside update() query with $filter:</strong></p> <pre><code>db.collection.update({ color: { $exists: true, $eq: null } }, [ { $addFields: { color: { $filter: { input: &quot;$color&quot;, as: &quot;c&quot;, cond: { $ne: [ ...
Removing null values from array object mongodb
mongodb
0
128
1
72,206,936
72,206,936
1
true
2022-05-11T18:14:20.130Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Removing null values from array object mongodb<p>How can I remove null elements from this array with updateMany? I have many documents following this pattern...
72,039,609
Use numpy array to do conditional operations on another array<p>Let's say I have 2 arrays:</p> <pre><code>a = np.array([2, 2, 0, 0, 2, 1, 0, 0, 0, 0, 3, 0, 1, 0, 0, 2]) b = np.array([0, 0.5, 0.25, 0.9]) </code></pre> <p>What I would like to do, is take the value in array <code>b</code> and multiple it to the values in...
<p>Integer arrays can be used as indices in numpy. As a consequence, you can simply do something like this</p> <pre><code>b[a] * a </code></pre> <p>EDIT:</p> <p>Just for completeness, your iterative solution triggers a new memory allocation every time <code>append</code> is called (see the 'returns' section of <a href=...
Use numpy array to do conditional operations on another array
python|numpy
0
33
2
72,039,707
72,039,707
1
true
2022-04-28T07:25:15.393Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Use numpy array to do conditional operations on another array<p>Let's say I have 2 arrays:</p> <pre><code>a = np.array([2, 2, 0, 0, 2, 1, 0, 0, 0, 0, 3, 0, 1...
72,177,330
Type inference failed: Not enough information to infer parameter T<p>I have a function that compares responses from two different endpoints. It looks like this:</p> <pre><code>suspend fun &lt;I, T&gt; multiplexOrShadow( request: I, v1ResponseStringGenerator: KFunction1&lt;T, String&gt; = ::getV1ResponseString, ...
<p>Looks like this is a known issue, which is fixed since Kotlin 1.6.20: <a href="https://youtrack.jetbrains.com/issue/KT-12963" rel="nofollow noreferrer">https://youtrack.jetbrains.com/issue/KT-12963</a>.</p> <p>For Kotlin 1.6.10, the workaround is to avoid using the <code>KFunctionN</code> types if you don't need the...
Type inference failed: Not enough information to infer parameter T
kotlin|generics
0
47
1
72,179,045
72,179,045
1
true
2022-05-09T19:32:29.993Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Type inference failed: Not enough information to infer parameter T<p>I have a function that compares responses from two different endpoints. It looks like th...