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,872,764
How to delete the symmetric rows of a matrix stored in long format and in one query?<p>I store matrix data in sqlite with a schema of the form:</p> <pre><code>create table mat_long(a varchar, b varchar, float val) </code></pre> <p>I then can store the following matrix:</p> <pre><code> x y z x 4 1 2 y 1 4 3 z ...
<p>Since you know that your table is symmetric, you can filter out values whose &quot;<em>a</em>&quot; is less or equal than the &quot;<em>b</em>&quot; value:</p> <pre><code>SELECT * FROM tab WHERE a &lt;= b; </code></pre> <p>Check the demo <a href="https://www.db-fiddle.com/f/gM4JYGFBkcf4BhGuPMcGG/0" rel="nofollow no...
How to delete the symmetric rows of a matrix stored in long format and in one query?
sql|algorithm|sqlite
0
51
1
72,873,196
72,873,196
1
true
2022-07-05T16:29:52.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to delete the symmetric rows of a matrix stored in long format and in one query?<p>I store matrix data in sqlite with a schema of the form:</p> <pre><cod...
72,871,335
Jquery code is not working in next js . Showing unexpected results but working on react<p>i am trying to implement an ui requirement. I want to add a active class name to the children div one at a time. 1st it will add the class in first child, and then the class will be removed and to be added in the 2nd child div. An...
<p>You can write an effect that sets the classname for elements in an array in a round-robin manner.</p> <pre><code>// Keep the interval id around so that // it can be cleared when unsubscribing the effect. let activeFxId; /* Applies active class to an array of HTMLElement in a round-robin manner. */ function active...
Jquery code is not working in next js . Showing unexpected results but working on react
javascript|jquery|reactjs|next.js
0
51
1
72,874,349
72,874,349
1
true
2022-07-05T14:43:17.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Jquery code is not working in next js . Showing unexpected results but working on react<p>i am trying to implement an ui requirement. I want to add a active ...
72,881,720
Oracle APEX before insert trigger issue<p>I am trying to create a before insert trigger in Oracle Application Express to fill out the timetaken field by calculating enddate - startdate that the user will enter in the web application. The table looks like this:</p> <p>Column Name Data Type<br /> ID NUMBER<br />...
<p>Hm, not exactly like that. When you subtract two timestamps, you don't get yet another timestamp as result (which is what <code>timetaken</code>'s datatype suggests), but <code>interval day to second</code>.</p> <p>Apart from that, trigger should contain only the calculation - all the other columns are inserted (or ...
Oracle APEX before insert trigger issue
oracle|plsql|oracle-apex
0
51
1
72,881,887
72,881,887
1
true
2022-07-06T10:15:08.560Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Oracle APEX before insert trigger issue<p>I am trying to create a before insert trigger in Oracle Application Express to fill out the timetaken field by calc...
72,882,366
Mapping incorrect values<p>I'm trying to map multiple observables into one single observable use RXJS <code>CombineLatest</code>. This was previously working when I was trying to map 6 observables but when adding an additional 5, the compiler seems to get confused about the mapping. This is the logic in question:</p> <...
<p>RxJS combineLatest also has another overload where you can pass in an object, which would let you skip the <code>map</code> too:</p> <pre><code> this.referenceData$ = combineLatest({ ArrOne: this.observableOne$, ArrTwo: this.observableTwo$, ArrThree: this.observableThree$...
Mapping incorrect values
angular|rxjs
0
51
3
72,883,715
72,883,715
1
true
2022-07-06T10:57:39.013Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mapping incorrect values<p>I'm trying to map multiple observables into one single observable use RXJS <code>CombineLatest</code>. This was previously working...
72,884,861
Adding lines to parenthesis in Xcode as others code editors<p>how can I add lines to my code on Xcode as other code editors like the image below?</p> <p><a href="https://i.stack.imgur.com/Upd66.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Upd66.png" alt="enter image description here" /></a></p>
<blockquote> <p>how can I add lines to my code on Xcode as other code editors like the image below?</p> </blockquote> <p>You can't, because Xcode doesn't render code that way. However, those vertical lines are often used to indicate which lines will be collapsed or folded, and Xcode <em>does</em> support code folding:<...
Adding lines to parenthesis in Xcode as others code editors
swift|xcode|formatting|xcode13
0
51
1
72,885,334
72,885,334
1
true
2022-07-06T13:56:09.557Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding lines to parenthesis in Xcode as others code editors<p>how can I add lines to my code on Xcode as other code editors like the image below?</p> <p><a h...
72,885,564
find out values / elements of a certain range of an array<p>I would like to find out if there is a java function that can check the values from index 0-5? For example. Without using a loop Is there a function that identifies the elements in sub Array1 [0-5] as { 1,2,3,4,5} ...
<p>You can use <code>Arrays.copyOfRange(arr, start, end)</code> this will return you an array containing the specified range from the original <code>arr</code> array.</p> <p><code>start</code> is inclusive, <code>end</code> is exclusive</p> <p>e.g. for your case</p> <pre><code>int[] arr = new int[]{1,2,3,4,5,6,7,8,9,10...
find out values / elements of a certain range of an array
java
-1
51
3
72,885,660
72,885,660
1
true
2022-07-06T14:44:18.130Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: find out values / elements of a certain range of an array<p>I would like to find out if there is a java function that can check the values from index 0-5? Fo...
72,835,724
ExtJs 6.7.0- treePanel with rowWidget misaligned when using locked column<p>I have an <strong>Ext.tree.Panel</strong> with a <em>rowWidget</em> using <strong>Ext.grid.Panel</strong>, when I lock the first column of <strong>Ext.tree.Panel</strong> the <em>rowWidget</em> expansion doesn't expand the locked column all the...
<p>You could force a refresh on the locked grid when the row widget is expanded;</p> <p><a href="https://fiddle.sencha.com/#view/editor&amp;fiddle/3kh1" rel="nofollow noreferrer">Fiddle</a></p>
ExtJs 6.7.0- treePanel with rowWidget misaligned when using locked column
extjs|treegrid|locked|treepanel
0
51
1
72,886,553
72,886,553
1
true
2022-07-02T00:46:33.350Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ExtJs 6.7.0- treePanel with rowWidget misaligned when using locked column<p>I have an <strong>Ext.tree.Panel</strong> with a <em>rowWidget</em> using <strong...
72,887,169
How to remove numpy columns based on condition?<p>I have a numpy array which contains the correlation between a label column</p> <pre><code>[0.5 -0.02 0.2] </code></pre> <p>And also a numpy array containing</p> <pre><code>[[0.42 0.35 0.6] [0.3 0.34 0.2]] </code></pre> <p>Can I use a function to determine which column...
<p>You can do boolean indexing along values with something like this:</p> <pre class="lang-py prettyprint-override"><code>a = np.array([ [1, 2, 3], [4, 5, 6] ]) b = np.array([ [True, False, True], [False, True, False] ]) new_a = a[b] </code></pre> <p>Or, to do boolean indexing along rows/columns, use th...
How to remove numpy columns based on condition?
python|numpy
0
51
2
72,887,352
72,887,352
1
true
2022-07-06T16:45:00.187Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to remove numpy columns based on condition?<p>I have a numpy array which contains the correlation between a label column</p> <pre><code>[0.5 -0.02 0.2] <...
72,885,201
JQuery Form Submit Not Calling Controller Method<p>I am trying to submit a form in a JSP using JQuery/AJAX. It should call a method in a Spring Controller. My JSP looks like this:</p> <pre><code>&lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=UTF-8&quot; pageEncoding=&quot;UTF-8&quot;%&gt; &l...
<p>A page can't be manipulated safely until the document is &quot;ready.&quot; jQuery detects this state of readiness for you. Code included inside $( document ).ready() will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute.</p> <p>Move the click event listener inside the <code...
JQuery Form Submit Not Calling Controller Method
javascript|jquery|ajax|spring-mvc|ajaxform
2
51
1
72,887,558
72,887,558
1
true
2022-07-06T14:20:01.147Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JQuery Form Submit Not Calling Controller Method<p>I am trying to submit a form in a JSP using JQuery/AJAX. It should call a method in a Spring Controller. M...
72,890,156
Django alert is not appearing<p>I need help with my Django app :</p> <p>I'm trying to use Django messages framework to display a message. And I don't know why my message is not showing up?</p> <p>views.py :</p> <pre><code> from django.contrib import messages def login(request): return render(request, 'authorisati...
<p>In Yor Template Double s</p> <pre><code>{{ message }} </code></pre> <p>Not Triple s</p> <pre><code>{{ messsage }} </code></pre>
Django alert is not appearing
python|django
0
51
1
72,890,338
72,890,338
1
true
2022-07-06T21:40:46.523Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django alert is not appearing<p>I need help with my Django app :</p> <p>I'm trying to use Django messages framework to display a message. And I don't know wh...
72,891,666
Contact Postgres database directly from plain JS (browser)<p>Let's say I have a remote Postgres database:</p> <pre><code>postgres://&lt;user&gt;:&lt;passwd&gt;@foo.us-west-1.compute.amazonaws.com:5432/&lt;dbname&gt; </code></pre> <p>The usual way to connect to this database would be to spin up a backend server and send...
<p><code>fetch</code> works on HTTP layer and Postgres natively do not support communication on HTTP. So it is not possible to query your DB directly from the browser.</p> <p>However, there are tools that you can configure like <a href="https://postgrest.org/en/stable/" rel="nofollow noreferrer">Postgrest</a> which cre...
Contact Postgres database directly from plain JS (browser)
javascript|postgresql|http|browser|fetch-api
0
51
1
72,891,766
72,891,766
1
true
2022-07-07T02:28:56.270Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Contact Postgres database directly from plain JS (browser)<p>Let's say I have a remote Postgres database:</p> <pre><code>postgres://&lt;user&gt;:&lt;passwd&g...
72,886,708
how to stop a function in if statement in react native?<p>I want to use if statement in a function such that **&quot;if there is x ,don't continue function&quot; ** &quot;else ,continue the function&quot;.... my code is like below,i dont know why it continue doing the function!(it create calendar) plz help me</p> <pre>...
<p>First of all <code>a ==! b</code> isn't doing what you probably think it does. Because semantically it's equivalent to <code>a == (!b)</code>. Use <code>!==</code> instead.</p> <p>Second <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter" rel="nofollow noreferrer">...
how to stop a function in if statement in react native?
react-native|function|if-statement|expo-calendar
-1
51
1
72,894,412
72,894,412
1
true
2022-07-06T16:04:06.797Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to stop a function in if statement in react native?<p>I want to use if statement in a function such that **&quot;if there is x ,don't continue function&q...
72,891,807
Kusto control commands transaction<p>Is it possible to run Kusto control commands to create/alter multiple Kusto functions in a transaction? I want to make sure that a set of functions that I create/update all succeed or none at all.</p>
<p>No, there's no way to execute several such control commands in a transactional way. You can check out <a href="https://docs.microsoft.com/en-us/azure/data-explorer/kusto/management/execute-database-script" rel="nofollow noreferrer"><code>.execute database script</code></a> which allows you to run several control com...
Kusto control commands transaction
transactions|azure-data-explorer|kql
0
51
1
72,894,536
72,894,536
1
true
2022-07-07T02:54:54.133Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kusto control commands transaction<p>Is it possible to run Kusto control commands to create/alter multiple Kusto functions in a transaction? I want to make ...
72,885,737
how to set apex heatmap border?<p>I am referring to the <em><a href="https://apexcharts.com/docs/options/" rel="nofollow noreferrer">apexcharts documentation</a></em> to find if there is anyway to show the border of each cell in the heatmap.</p> <p>So far, I have tried to add</p> <pre><code>grid: { show: true, bord...
<p>You can change <code>stroke</code> color (white space between cells) like this</p> <pre><code>stroke: { colors: [&quot;#90A4AE&quot;], }, </code></pre> <p><a href="https://apexcharts.com/docs/options/stroke/" rel="nofollow noreferrer">https://apexcharts.com/docs/options/stroke/</a></p>
how to set apex heatmap border?
javascript|reactjs|apexcharts
0
51
1
72,895,299
72,895,299
1
true
2022-07-06T14:55:01.697Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to set apex heatmap border?<p>I am referring to the <em><a href="https://apexcharts.com/docs/options/" rel="nofollow noreferrer">apexcharts documentation...
72,894,962
"URI has an authority component" when resolving URI<p>I am getting the &quot;<code>URI has an authority component</code>&quot; error when trying to create a document during an XSLT transformation on a network location.</p> <p>The transformation works fine locally on my pc.</p> <p>My original template was:</p> <pre><cod...
<p>When you talk of a &quot;network location&quot;, does that mean you are using a UNC filename such as <code>//server/path</code>? There's a long-standing problem that there's no consensus on how such filenames should be represented as URIs, and in particular, Java and .NET do it differently. Because Saxon 9.x on .NET...
"URI has an authority component" when resolving URI
.net|xslt|uri|saxon
0
51
2
72,896,221
72,896,221
1
true
2022-07-07T08:56:56.060Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "URI has an authority component" when resolving URI<p>I am getting the &quot;<code>URI has an authority component</code>&quot; error when trying to create a ...
72,895,258
get fields from all levels from 3x nested level array documents<p>I have the following document type:</p> <pre><code>{ _id: 1, &quot;_a&quot;: [ { &quot;_aId&quot;: { &quot;CC&quot;: &quot;CA&quot; }, &quot;_p&quot;: [ { &quot;_pId&quot;: { &quot;CC&quot;: &quot;CA&quot;, &quot;SN&quot;:1 }, ...
<p>I am not sure about performance, but you can try an option,</p> <ul> <li><code>$match</code> your condition,</li> <li><code>$project</code>, <ul> <li><code>$reduce</code> to iterate loop of <code>_a</code> <ul> <li><code>$filter</code> to iterate loop of <code>_p</code> and filter it by <code>&quot;_pId.CC&quot;: &q...
get fields from all levels from 3x nested level array documents
mongodb|mongodb-query|aggregation-framework
1
51
1
72,896,357
72,896,357
1
true
2022-07-07T09:17:57.783Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: get fields from all levels from 3x nested level array documents<p>I have the following document type:</p> <pre><code>{ _id: 1, &quot;_a&quot;: [ { &quot;_aId...
72,898,285
Use find_nearest function on PySpark<p>I have a dataframe in PySpark that has the following schema:</p> <pre><code>root |-- value: array (nullable = true) | |-- element: double (containsNull = true) |-- id: long (nullable = true) |-- timestamp: long (nullable = true) |-- variable_name: string (nullable = true) ...
<p>The error you get means you need to define an <a href="https://spark.apache.org/docs/3.1.3/api/python/reference/api/pyspark.sql.functions.udf.html" rel="nofollow noreferrer">UDF</a>.</p> <p>However, here you can simply use Spark builtin functions. Here's one way using <code>transform</code> and <code>array_min</code...
Use find_nearest function on PySpark
python|dataframe|apache-spark|pyspark|apache-spark-sql
0
51
2
72,900,964
72,900,964
1
true
2022-07-07T13:00:11.300Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Use find_nearest function on PySpark<p>I have a dataframe in PySpark that has the following schema:</p> <pre><code>root |-- value: array (nullable = true) ...
72,900,372
std::thread and ros::ok() do not work in ROS<p>I have a function that is executing by std::thread. I want it works until the user closes the terminal that running roscore by pressing Ctrl+C. Because of that I use this inside the thread:</p> <pre><code>void publish_camera_on_topic(std::vector&lt;Camera&gt; cameras, cons...
<p>The problem is solved. The issue is <code>ros::ok()</code> does not check for ROS master. Instead of this line:</p> <p><code>while (ros::ok()) { //do sth}</code></p> <p>This line should be used:</p> <p><code>while (ros::ok() &amp;&amp; ros::master::check()) { // do sth}</code></p>
std::thread and ros::ok() do not work in ROS
c++|multithreading|ros
1
51
1
72,901,206
72,901,206
1
true
2022-07-07T15:17:31.140Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: std::thread and ros::ok() do not work in ROS<p>I have a function that is executing by std::thread. I want it works until the user closes the terminal that ru...
72,901,926
SQL query to populate missing values using lead and lag<p>I'm trying to create a new column that fills in the nulls below. I tried using leads and lags but isn't turning out right. Basically trying to figure out who is in &quot;possession&quot; of the record, given the TransferFrom and TransferTo columns and sequence...
<p>Kind of a funky situation but this works for your sample data. Ideally it would be better to fix the process that is not inserting values consistently so you don't have to jump through these hoops.</p> <pre><code>select r.* , NewColumn = coalesce(x.TransferFrom, y.TransferTo) from results r outer apply ( sel...
SQL query to populate missing values using lead and lag
apache-spark-sql
-1
51
2
72,902,578
72,902,578
1
true
2022-07-07T17:17:28.213Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL query to populate missing values using lead and lag<p>I'm trying to create a new column that fills in the nulls below. I tried using leads and lags but ...
72,893,650
NullPointerException when bucket.defaultCollection() is called Couchbase SDK3<p>Getting NullPointerException when trying the below code</p> <pre><code>public class SalesCouchbaseDao { @Resource private Cluster cluster; @Autowired @Qualifier(&quot;salesBucket&quot;) private Bucket bucket; priv...
<p>Field initializers are invoked before Spring auto-wiring happens. The NullPointerException happens because <code>bucket</code> is still null when the <code>collection</code> field is initialized.</p> <p>One option is to use a <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#bean...
NullPointerException when bucket.defaultCollection() is called Couchbase SDK3
couchbase|couchbase-java-api|couchbase-java-client
1
51
1
72,903,328
72,903,328
1
true
2022-07-07T07:13:15.420Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NullPointerException when bucket.defaultCollection() is called Couchbase SDK3<p>Getting NullPointerException when trying the below code</p> <pre><code>public...
72,895,027
Workflow when working on GitHub fork for PR requests<p>Know there is a lot of Q/A on this, but I'm still very uncertain on how to proceed.</p> <hr /> <p><em>(Based on a real story!)</em></p> <p>Say there is a public project named <code>unicorns</code> by <code>danny</code>. To make pull requests one are to work from ow...
<blockquote> <ol> <li>Did I do something wrong above?</li> </ol> </blockquote> <p>No.</p> <blockquote> <ol start="2"> <li>Is it my two local branches <code>my_work_1</code> and <code>my_work_2</code> that is the reason for the message?</li> </ol> </blockquote> <p>Which message? Do you mean <em>Do these explain the <co...
Workflow when working on GitHub fork for PR requests
git|github
1
51
1
72,905,319
72,905,319
1
true
2022-07-07T09:01:02.547Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Workflow when working on GitHub fork for PR requests<p>Know there is a lot of Q/A on this, but I'm still very uncertain on how to proceed.</p> <hr /> <p><em>...
72,915,272
Unordered Map Performing Much Slower than Map<p>Say I am attempting to solve the <a href="https://leetcode.com/problems/two-sum/" rel="nofollow noreferrer">two-sum problem</a>. Below are two samples of the same algorithm, one using an ordered map, and one using an un-ordered map.</p> <p>Using unordered_map:</p> <pre><c...
<p>The unordered_map has to allocate and copy to grow over and over while the map just allocates nodes.</p>
Unordered Map Performing Much Slower than Map
c++|algorithm|hashmap
-1
51
1
72,915,337
72,915,337
1
true
2022-07-08T17:57:54.463Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unordered Map Performing Much Slower than Map<p>Say I am attempting to solve the <a href="https://leetcode.com/problems/two-sum/" rel="nofollow noreferrer">t...
72,919,815
How can I use two if statments and one else statment?<p>I'm trying to have the code reject someone If they're under 13 and over 20 then, accept when they're over 13. It was working before I added the over 20 part but now I enter a age under 13 it plays both under 13 and else. Should I have worded it better?</p> <pre><c...
<p>You can use interval comparison and have:</p> <pre><code>if 13 &lt; age &lt; 20: print(&quot;No no no&quot;) else: print(&quot;Welcome to the clan!&quot;) </code></pre> <p>or if you need explicit print statements for these cases, just handle the rest in <code>elif</code>:</p> <pre><code>if age&lt;13: print(&qu...
How can I use two if statments and one else statment?
python
1
51
2
72,919,859
72,919,859
1
true
2022-07-09T07:49:54.217Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I use two if statments and one else statment?<p>I'm trying to have the code reject someone If they're under 13 and over 20 then, accept when they're ...
72,883,463
Add data above index pandas and write to excel sheet<p>So the dataframe I have is like this,</p> <pre><code> Status Count Success 2 Error 2 </code></pre> <p>I set the index to status column, but thats not all what i need. I need to displ...
<p>With the following dataframe:</p> <pre class="lang-py prettyprint-override"><code>import pandas as pd df = pd.DataFrame({&quot;Status&quot;: [&quot;Success&quot;, &quot;Error&quot;], &quot;Count&quot;: [2, 2]}) print(df) # Output Status Count 0 Success 2 1 Error 2 </code></pre> <p>Here is one wa...
Add data above index pandas and write to excel sheet
python|pandas|dataframe
1
51
1
72,919,985
72,919,985
1
true
2022-07-06T12:20:27.240Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add data above index pandas and write to excel sheet<p>So the dataframe I have is like this,</p> <pre><code> Status Cou...
72,870,741
Looping a slice or using a mapping is better to retrieve an object<p>I have a slice which contains around 3000 bson objects. Every object has some nested mappings and one object has an average size of <code>4 kb</code>. In my code I have to be able to retrieve these objects based on their <code>uid</code> field fast as...
<p>Beyond performance and memory usage there is one main difference between both solution, the way your map is defined can only contain one entry with the same id. Nothing prevents to have multiple times the same id in your array.</p> <p>In general, if your array is sorted, you can use a dichotomic search which should ...
Looping a slice or using a mapping is better to retrieve an object
go
-2
51
1
72,921,879
72,921,879
1
true
2022-07-05T14:00:26.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Looping a slice or using a mapping is better to retrieve an object<p>I have a slice which contains around 3000 bson objects. Every object has some nested map...
72,921,450
How to lazy-load a React "widget"?<p>My terminology is probably wrong here, but I don't know what to call it other than a &quot;widget&quot; when you don't have a whole React app, but are attaching little React pieces to different <code>root</code>s on an otherwise static HTML page. But, that's what I'm doing:</p> <pre...
<p>You're already using <code>lazy</code>, so React will only import the component if it's not being rendered. The problem is that you're still rendering the component by default, so the component is still being loaded once it's available.</p> <p>React is declarative, so the way to solve this is to conditionally render...
How to lazy-load a React "widget"?
reactjs|lazy-loading
0
51
1
72,922,380
72,922,380
1
true
2022-07-09T12:42:16.887Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to lazy-load a React "widget"?<p>My terminology is probably wrong here, but I don't know what to call it other than a &quot;widget&quot; when you don't h...
72,926,142
How to make a button in Dialog close that Dialog (Kotlin)<p>I have a custom dialog that's initialized in <code>onCreate()</code> of some Activity. It displays some text and a button. I want the button to close the dialog when clicked. How can I achieve this?</p> <p>Here's my attempt that fails.</p> <p>MyActivity.kt</p>...
<p>Just replace</p> <pre class="lang-kotlin prettyprint-override"><code>button.setOnClickListener { fun onClick(v: View) { myDialog.dismiss() } } </code></pre> <p>with</p> <pre><code>button.setOnClickListener { fun onClick(v: View) { myDialog.dismiss() } onClick(it) } </code></pre> <...
How to make a button in Dialog close that Dialog (Kotlin)
android|kotlin
1
51
2
72,926,332
72,926,332
1
true
2022-07-10T04:28:16.760Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make a button in Dialog close that Dialog (Kotlin)<p>I have a custom dialog that's initialized in <code>onCreate()</code> of some Activity. It display...
72,921,370
Mongodb Aggregation pipeline: different $match to show different results on the same value in the same pipeline<p>Lets take as an example the following book collection :</p> <pre><code>{BookDate: &quot;BOOKA-2010&quot;, Price: &quot;1&quot;, BookName: &quot;BOOKA&quot;}, {BookDate: &quot;BOOKA-2011&quot;, Price: &quot;...
<p>I recommend just doing the <code>$sum</code> with a <a href="https://www.mongodb.com/docs/manual/reference/operator/aggregation/cond/" rel="nofollow noreferrer">$cond</a> expression, this means we sum <code>price</code> when the condition is matched, otherwise we sum 0, like so:</p> <pre><code>db.collection.aggregat...
Mongodb Aggregation pipeline: different $match to show different results on the same value in the same pipeline
mongodb|mongodb-query|aggregation-framework
1
51
1
72,926,777
72,926,777
1
true
2022-07-09T12:30:38.370Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mongodb Aggregation pipeline: different $match to show different results on the same value in the same pipeline<p>Lets take as an example the following book ...
72,916,141
bs4 select_one on loop sometimes has lack of a value text and fails how should i fix it?<pre><code> url=http://www.mercadopublico.cl/Procurement/Modules/RFB/DetailsAcquisition.aspx?idlicitacion=3951-24-L122 print(i) soup = BeautifulSoup(requests.get(i).content, &quot;html.parser&quot;) soup.select(&quot;...
<p>You should check if your element is available in your <code>soup</code>:</p> <pre><code>estado_licitacion = e.text if (e:=soup.select_one(&quot;#lblFicha1Estado&quot;)) else 'no estato licitation available' </code></pre> <p><strong>Note</strong> <em><code>walrus operator</code> requires <code>Python 3.8</code> or la...
bs4 select_one on loop sometimes has lack of a value text and fails how should i fix it?
python|web-scraping|exception|beautifulsoup
0
51
2
72,927,598
72,927,598
1
true
2022-07-08T19:25:25.497Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: bs4 select_one on loop sometimes has lack of a value text and fails how should i fix it?<pre><code> url=http://www.mercadopublico.cl/Procurement/Modules/R...
72,927,326
worst case time complexity of finding the floor of a number in a BST<p>I know that the worst case time complexity of searching a node in a BST is O(logn) if the tree is balanced. But what about searching for a floor of a number t in a BST?</p> <p>because in the above scenario, we are not just searching for an exact nod...
<p>The time complexity is still O(log), because there is only <em>one</em> path that is followed from the root to a leaf. The only change is that the value that comes out of the recursive call is potentially not retained, but instead the current node's value is used as return value (cf. the last statement in your code)...
worst case time complexity of finding the floor of a number in a BST
c|recursion|time-complexity|big-o|binary-search-tree
0
51
1
72,928,492
72,928,492
1
true
2022-07-10T09:02:28.287Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: worst case time complexity of finding the floor of a number in a BST<p>I know that the worst case time complexity of searching a node in a BST is O(logn) if ...
72,931,975
Object Color not Updating when Changing Custom Slider Value in SwiftUI<p>I have an app built in SwiftUI that uses a custom slider to change a value. This value controls the color of a rectangle. When using the slider, it properly changes the value but the color of the rectangle does not update. It does work normally wi...
<p>Your problem is that the <code>redValue</code> being set by your slider is a value in the range <code>0.0...100.0</code>, but you need a value in the range <code>0.0...1.0</code> when setting the color of the <code>Rectangle</code>:</p> <pre><code>Rectangle() .foregroundColor(Color(red: redValue/100, green: gree...
Object Color not Updating when Changing Custom Slider Value in SwiftUI
swift|xcode|swiftui
0
51
1
72,932,099
72,932,099
1
true
2022-07-10T21:20:27.097Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Object Color not Updating when Changing Custom Slider Value in SwiftUI<p>I have an app built in SwiftUI that uses a custom slider to change a value. This val...
72,931,936
Toast displaying twice on React page render - why does it happen multiple times?<p>I'm dipping my toes in the React pool and can't seem to get my head round one aspect mainly around the amount of times the function renders the page.</p> <p>Using the below example when the form validation fails I see the toast display T...
<p>I am not familiar with the <code>&lt;InputField&gt;</code> but I reckon error gets displayed right? It probably toasts and then rerenders the error and then toasts again after because you still have the error there.</p> <p>What you probably want is <code>useEffect(() =&gt; { //Code you want excecuted like toasting /...
Toast displaying twice on React page render - why does it happen multiple times?
javascript|reactjs
0
51
1
72,932,186
72,932,186
1
true
2022-07-10T21:13:19.713Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Toast displaying twice on React page render - why does it happen multiple times?<p>I'm dipping my toes in the React pool and can't seem to get my head round ...
72,933,532
Return axios get error ([[PromiseState]]: "rejected")<p>I want to pass two parameters with symbols into API (using Axios get), but the errors come out <strong>[[PromiseState]]: &quot;rejected&quot;</strong>. If pass two parameters without symbols into API, it can be worked and the messages come out <strong>[[PromiseSta...
<p>Your query parameters are not <a href="https://en.wikipedia.org/wiki/Percent-encoding" rel="nofollow noreferrer">encoded</a> correctly. Axios offers a convenience config property for this very thing.</p> <p>First, remove the <code>companyName</code> parameter from your URL</p> <pre class="lang-js prettyprint-overrid...
Return axios get error ([[PromiseState]]: "rejected")
node.js|reactjs|api|axios
0
51
1
72,933,823
72,933,823
1
true
2022-07-11T03:52:06.150Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Return axios get error ([[PromiseState]]: "rejected")<p>I want to pass two parameters with symbols into API (using Axios get), but the errors come out <stron...
72,933,927
How to add tab before table?<p>I want to have this output <a href="https://i.stack.imgur.com/C0GIz.png" rel="nofollow noreferrer">tab space before TabularDisplay</a></p> <p>I am trying to print tab space in front of the whole table. I tried adding tab space before : print $table-&gt;render; but it's adding tab space be...
<p>So you want to modify the string returned by <code>$table-&gt;render</code>...</p> <pre class="lang-c prettyprint-override"><code>print $table-&gt;render =~ s/^/\t/mgr; </code></pre>
How to add tab before table?
perl|whitespace
-2
51
1
72,934,047
72,934,047
1
true
2022-07-11T05:05:43.343Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add tab before table?<p>I want to have this output <a href="https://i.stack.imgur.com/C0GIz.png" rel="nofollow noreferrer">tab space before TabularDis...
72,937,524
Display Form data on popup\modal when submitted in Angular<p>I have a form with submit button. On clicking the submit button, popup\modal should appear displaying the data of the form submitted. I am using Bootstrap and Angular. So how do I store the data and display on the modal? Here is the code in html</p> <p>HTML</...
<p>You have many solutions to your &quot;question&quot; since it is not a specific problem.</p> <p>You can save the form data in localStorage. Create a service to store the form data in an appropiate way into the localStorage and then retrieve it from another page ( the success page maybe? ) showing the information the...
Display Form data on popup\modal when submitted in Angular
angular|typescript|forms|modal-dialog
-2
51
1
72,937,596
72,937,596
1
true
2022-07-11T11:04:37.873Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Display Form data on popup\modal when submitted in Angular<p>I have a form with submit button. On clicking the submit button, popup\modal should appear displ...
72,894,166
Don't find any classes in own maven Library<p>I created a new Maven project, that I want to use as a library in another project. The library compiles and loaded into our own Maven repository. In my other project, I insert the dependency. The dependency is found, but in the project I can't use any class of the library.<...
<p>Here is the official answer. After a long way of search:</p> <p><a href="https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto.build.use-a-spring-boot-application-as-dependency" rel="nofollow noreferrer">https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto.build.use-a-spr...
Don't find any classes in own maven Library
java|spring-boot|maven
0
51
1
72,938,044
72,938,044
1
true
2022-07-07T07:54:10.753Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Don't find any classes in own maven Library<p>I created a new Maven project, that I want to use as a library in another project. The library compiles and loa...
72,938,098
list of entries (files and folders) in a directory tree by os.scandir() in Python<p>I have used &quot;os.walk()&quot; to list all subfolders and files in a directory tree , but heard that &quot;os.scandir()&quot; does the job up to 2X - 20X faster. So I tried this code:</p> <pre><code>def tree2list (directory:str) -&gt...
<p>Your code almost works, just a minor modification is required:</p> <pre class="lang-py prettyprint-override"><code>def tree2list(directory: str) -&gt; list: import os tree = [] counter = 0 for i in os.scandir(directory): if i.is_dir(): counter += 1 tree.append([counter...
list of entries (files and folders) in a directory tree by os.scandir() in Python
python|python-3.x|scandir
1
51
2
72,939,698
72,939,698
1
true
2022-07-11T11:47:32.857Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: list of entries (files and folders) in a directory tree by os.scandir() in Python<p>I have used &quot;os.walk()&quot; to list all subfolders and files in a d...
72,939,520
Flutter Phone Number TextField With Country Code<p>I'm trying to make the phone number field in the design. I'm using the intl_phone_number_input package for this but I couldn't do it like in my design. I would be glad if you can help with this.</p> <p>My design:</p> <p><a href="https://i.stack.imgur.com/xGesm.png" rel...
<p>I think we can use a combination of two types widget, I try use <code>Stack</code></p> <p>And this is my UI:</p> <p><a href="https://i.stack.imgur.com/Y2fW1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y2fW1.png" alt="enter image description here" /></a></p> <p><strong>My code:</strong></p> <pr...
Flutter Phone Number TextField With Country Code
flutter
0
51
1
72,939,994
72,939,994
1
true
2022-07-11T13:40:53.317Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter Phone Number TextField With Country Code<p>I'm trying to make the phone number field in the design. I'm using the intl_phone_number_input package for...
72,876,661
SQL Query Order by intercalated<p>First of all, thanks for your time!</p> <p>I have a recurrence pattern mapped in my database (e.g. google calendar events), I'm trying to perform a query that sorts results by distance and startDate, but I can't make it work. Here is my query:</p> <pre><code>select cast(e.id as var...
<p>If you want to &quot;group&quot; results by day while seeing all rows, add the date as part of the <code>order by</code>.</p> <pre><code>order by startsAt::date, distance, startsAt; </code></pre>
SQL Query Order by intercalated
sql|postgresql|sql-order-by
2
51
1
72,940,284
72,940,284
1
true
2022-07-06T00:04:18.493Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL Query Order by intercalated<p>First of all, thanks for your time!</p> <p>I have a recurrence pattern mapped in my database (e.g. google calendar events),...
72,943,164
Python Logging Duplicate Output<p>I am getting duplicate output for Python logging with custom logger. Below is the section of logging code and output. For some reason if I remove the <code>logger.setLevel(logging.DEBUG)</code> line, the logger doesn't seem to respect the <code>console_handler.setLevel(logging.DEBUG)</...
<p>As far as I remember the setting propagates to higher level (ancestor) loggers. You can read about it <a href="https://docs.python.org/3/library/logging.html#logging.Logger.propagate" rel="nofollow noreferrer">here</a>.</p> <p>I would suggest adding <code>logger.propagate = False</code> after initializing logger <co...
Python Logging Duplicate Output
python|logging
1
51
1
72,943,384
72,943,384
1
true
2022-07-11T18:37:17.967Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python Logging Duplicate Output<p>I am getting duplicate output for Python logging with custom logger. Below is the section of logging code and output. For s...
72,943,028
Mocking function within a function pytest?<pre><code>def func1(): return 5 def func2(param1, param2): var1 = func1() return param1 + param2 + var1 </code></pre> <p>I want to use pytest to test the second function by mocking the first, but I am not sure how to do this.</p> <pre><code>@pytest.fixtur...
<p>You don't need to change anything.</p> <p>You can use <code>mocker</code> fixture with <code>pytest</code> (requires installation of <a href="https://pypi.org/project/pytest-mock/" rel="nofollow noreferrer">pytest-mock</a>). don't worry about the <code>mocker</code> argument, it will magically work.</p> <pre><code>d...
Mocking function within a function pytest?
python|python-3.x|function|pytest
1
51
1
72,943,495
72,943,495
1
true
2022-07-11T18:23:55.950Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mocking function within a function pytest?<pre><code>def func1(): return 5 def func2(param1, param2): var1 = func1() return param1 + pa...
72,896,969
Feature elimination to screen for multiple models using tidymodels<p>I am currently performing regression modeling, with a dataset that has number of features (<em>p</em>) higher than observations (<em>n</em>). Typically <code>p = 10000</code> and <code>n = 30</code>. Furthermore, I'd like to <a href="https://www.tmwr....
<p>It is reasonable as long as you are using resampling or a validation set to make sure that there is no information leakage.</p> <p>We hope to have more recipe functions for supervised filters later this year but Steven's are great.</p>
Feature elimination to screen for multiple models using tidymodels
r|machine-learning|tidymodels|r-recipes|r-parsnip
0
51
1
72,944,939
72,944,939
1
true
2022-07-07T11:23:56.163Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Feature elimination to screen for multiple models using tidymodels<p>I am currently performing regression modeling, with a dataset that has number of feature...
72,944,738
Extracting text from text file with recurring nested pattern<p>I am struggling to extract text from a file. The text is in the following format with [] signifying a delimiter.</p> <p>File Text:</p> <p><em>[Dataset 1] &quot;text&quot; [Filename 1] &quot;text&quot; [Filename 2] &quot;text&quot; [Key Data Delimiter] !key ...
<p>Here's an option without regex, just some string and list manipulations. Somewhat convoluted, but it works:</p> <pre><code>kds = &quot;&quot;&quot;[Dataset 1] &quot;text1&quot; [Filename 1] &quot;text2&quot; [Filename 2] &quot;text3&quot; [Key Data Delimiter] !key data1![Key Data Delimiter] &quot;text4&quot; [Filena...
Extracting text from text file with recurring nested pattern
python|regex|text-extraction
2
51
2
72,945,782
72,945,782
1
true
2022-07-11T21:13:50.800Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extracting text from text file with recurring nested pattern<p>I am struggling to extract text from a file. The text is in the following format with [] signi...
72,947,460
To count total entry to a "string" in R<p>I have created a df of 50 rows. I have labelled value &gt;0.5 as fraud and rest as not fraud. For the rows labelled as not fraud, i actually place them under another group called iffraud.</p> <pre><code>num = runif(50) class_df = data.frame(num) print(class_df) class_df$type =...
<p>Using boolean operations only:</p> <pre><code>sum(class_df[&quot;type&quot;] == &quot;not fraud&quot;) 23 </code></pre>
To count total entry to a "string" in R
r
0
51
2
72,948,424
72,948,424
1
true
2022-07-12T05:35:44.933Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: To count total entry to a "string" in R<p>I have created a df of 50 rows. I have labelled value &gt;0.5 as fraud and rest as not fraud. For the rows labelled...
72,948,573
Python regex for getting string with special characters<p>So i want to get specific data</p> <p>So string is an input by the user</p> <pre><code>&quot;price_to_earning + current_price * 0.8&quot; </code></pre> <p>It could even be</p> <pre><code>&quot;price_to_earning*current_price+0.8&quot; </code></pre> <p>or</p> <pre...
<p>Why not use a regex to match words without digits, e.g. <code>[^\d\W]+</code> ?</p> <p>have a look at the demo here <a href="https://regex101.com/r/EbNQvm/1" rel="nofollow noreferrer">https://regex101.com/r/EbNQvm/1</a></p>
Python regex for getting string with special characters
python|regex
0
51
3
72,948,750
72,948,750
1
true
2022-07-12T07:31:36.783Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python regex for getting string with special characters<p>So i want to get specific data</p> <p>So string is an input by the user</p> <pre><code>&quot;price_...
72,943,174
Binding property from Object in v-model<p>I have the following code, but when I render the page, I get the correct number of checkboxes with nulls beside them. I'm guessing this has to do with how I set up my v-model. My Business Lines array is returning as <strong>{id: 1, name: Cars}, {id: 2, name: Trucks}, {id: 3, ...
<p><em><strong>Two ways to get rid from the problem you are facing :</strong></em></p> <ol> <li><p>Use <code>value-field</code> and <code>text-field</code> attributes in your <code>&lt;b-form-checkbox-group&gt;</code> element.</p> <p>Live Demo <strong>:</strong></p> <p><div class="snippet" data-lang="js" data-hide="fal...
Binding property from Object in v-model
vue.js|vue-component
-1
51
2
72,950,295
72,950,295
1
true
2022-07-11T18:38:03.723Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Binding property from Object in v-model<p>I have the following code, but when I render the page, I get the correct number of checkboxes with nulls beside the...
72,950,440
Vectorized evaluation of sklearn.gaussian_process.kernels.Matern<p>It is unclear for me from the <a href="https://scikit-learn.org/stable/modules/generated/sklearn.gaussian_process.kernels.Matern.html#sklearn.gaussian_process.kernels.Matern.__call__" rel="nofollow noreferrer">documentation</a> how the <code>__call__</c...
<p>Correct implementation:</p> <pre><code>x_eval = np.reshape(x, [n, 1]) k1 = kernel(x_eval) </code></pre>
Vectorized evaluation of sklearn.gaussian_process.kernels.Matern
python|scikit-learn|vectorization
2
51
1
72,951,964
72,951,964
1
true
2022-07-12T09:58:17.367Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Vectorized evaluation of sklearn.gaussian_process.kernels.Matern<p>It is unclear for me from the <a href="https://scikit-learn.org/stable/modules/generated/s...
72,852,422
How to draw horizontal line in chart js which when hovered shows the data<pre><code>ngOnInit(): void { var myChart = new Chart('myChart', { type: 'bar', data: { labels: ['Recordings'], datasets: [ { label: 'A', data: [this.data.a], borderColor: 'rgba(255,105,180,1)', b...
<p>I finally found the way out. The answer to this is a floating bar</p> <pre><code>{ label: 'Total Recordings', data: [[data.totalrecordings -0.5, data.totalrecordings + 0.5]] categoryPercentage: 1, barPercentage: 1, borderColor:'rgba(2,117,216,1)', backgroundColor:'rgba(2,117,216,0.2)', order:0 } </code...
How to draw horizontal line in chart js which when hovered shows the data
angular|chart.js|bar-chart|linechart|combo-chart
1
51
1
72,952,122
72,952,122
1
true
2022-07-04T06:15:15.247Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to draw horizontal line in chart js which when hovered shows the data<pre><code>ngOnInit(): void { var myChart = new Chart('myChart', { type: 'bar', ...
72,950,009
Dump a mongodb array of objects in a slice of struct<p>I have an array of objects along with other fields in a mongodb document:</p> <pre><code>db.config.find({},{list_attributes:1, _id:0}); [ { list_attributes: { '0': { field: 'LASTNAME', field_key: 'lastname', dataType: 'text' }, '1': { field: 'FIRSTNAME'...
<p>Your query JSON is not valid JSON:</p> <pre><code>// Create a string using ` string escape ticks query := `{list_attributes:1, _id:0}` // Declare an empty BSON Map object var bsonMap bson.M // Use the JSON package's Unmarshal() method err = json.Unmarshal([]byte(query), &amp;bsonMap) </code></pre> <p>A valid JSON ...
Dump a mongodb array of objects in a slice of struct
json|mongodb|go|mongo-go
3
51
1
72,953,315
72,953,315
1
true
2022-07-12T09:26:12.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dump a mongodb array of objects in a slice of struct<p>I have an array of objects along with other fields in a mongodb document:</p> <pre><code>db.config.fin...
72,955,781
Convert ISO 8061 datetime to timestamp in python<p>I have a string with a date in the format: <code>2021-03-12T14:45:34.000Z</code></p> <p>I would like to convert it to a standard format as this one: <code>12-Mar-2021 14:45:34</code></p> <p>I tried using:</p> <pre><code>print(datetime.datetime.strptime(&quot;2021-03-12...
<p>You are missing a <code>.</code> in your format string. The correct format string is</p> <pre><code>&quot;%Y-%m-%dT%H:%M:%S.%fZ&quot; </code></pre> <p>Notice the <code>.</code> after <code>%S</code> and before <code>%fZ</code>.</p>
Convert ISO 8061 datetime to timestamp in python
python|datetime|timestamp|iso8601
0
51
2
72,955,822
72,955,822
1
true
2022-07-12T16:48:11.993Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert ISO 8061 datetime to timestamp in python<p>I have a string with a date in the format: <code>2021-03-12T14:45:34.000Z</code></p> <p>I would like to co...
72,958,203
OutlinedTextField's Text Color Does Not Change When Disabled<p>I modified my textfield according to this article. <a href="https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldDefaults#OutlinedTextFieldDecorationBox(kotlin.String,kotlin.Function0,kotlin.Boolean,kotlin.Boolean,androidx.compo...
<p>Set the color of your <code>BasicTextField</code>'s <code>textStyle</code> to the color from <code>TextFieldDefaults.outlinedTextFieldColors()</code></p> <pre><code>val colors = TextFieldDefaults.outlinedTextFieldColors() val enabled = false OutlinedTextField( textStyle = TextStyle.Default.copy(color = colors.t...
OutlinedTextField's Text Color Does Not Change When Disabled
android|android-jetpack-compose
0
51
2
72,960,255
72,960,255
1
true
2022-07-12T20:47:24.700Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: OutlinedTextField's Text Color Does Not Change When Disabled<p>I modified my textfield according to this article. <a href="https://developer.android.com/refe...
72,946,261
How to implement `&&` (overlap) operator of postgres in DynamoDB?<p>How to implement <a href="https://www.postgresql.org/docs/8.3/functions-array.html#:%7E:text=%26t%26,t" rel="nofollow noreferrer"><code>&amp;&amp;</code> (overlap) operator of postgres</a> in DynamoDB?</p> <p>Like postgres behaves -</p> <pre class="lan...
<p>I found a solution to achieve the above scenario. It may not be a good solution so open to your opinions and answers.</p> <p>I used <code>contains</code> with <code>or</code> of DynamoDB to reach the desired results as follows.</p> <p>field -&gt; #arrayOfElements <br> values -&gt; :elementToMatch (String)</p> <pre c...
How to implement `&&` (overlap) operator of postgres in DynamoDB?
arrays|postgresql|amazon-dynamodb|dynamodb-queries
1
51
1
72,960,280
72,960,280
1
true
2022-07-12T01:51:47.380Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to implement `&&` (overlap) operator of postgres in DynamoDB?<p>How to implement <a href="https://www.postgresql.org/docs/8.3/functions-array.html#:%7E:t...
72,962,141
Reshaping each element of a multidimension 3D array to another Multidimension 3D array in Python<p>I'm working on a problem where I've to reshape a (63,16,3) array's each element to an array (4,4,3), and I'm stuck there.</p> <p>I generated an array of (63,16,3) using the random function of NumPy. Please help me how to ...
<p>You just need <code>reshape()</code>. The size of the array is 63 * 16 * 3 = 3,024 elements. If you want to divide that into 4x4x3 arrays, that's 3,024 / (4 * 4 * 3) = 63 elements.</p> <p>So:</p> <pre><code>b = np.reshape(a, (63, 4, 4, 3)) print(b[0].shape) </code></pre> <p>Result:</p> <pre><code>(4, 4, 3) </code></...
Reshaping each element of a multidimension 3D array to another Multidimension 3D array in Python
python|arrays|numpy|multidimensional-array|reshape
-1
51
1
72,962,244
72,962,244
1
true
2022-07-13T07:03:01.277Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reshaping each element of a multidimension 3D array to another Multidimension 3D array in Python<p>I'm working on a problem where I've to reshape a (63,16,3)...
72,966,354
useEffect to occur multiple times<p>I want the useEffect to occur multiple times. For example in the below example, everything works correctly the first time round.</p> <p>If the input field is empty, and you click on 'Next', the focus then shifts to another button. When you click this button, the focus then shifts to ...
<p><code>useEffect</code> will trigger any time the value of <code>hasErrors</code> <em>changes</em>. You never reset the <code>hasErrors</code> value after the input is focused.</p> <pre><code>useEffect(() =&gt; { if (hasErrors === true) { goToQuestionButton.current.focus(); setHasErrors(false); } ...
useEffect to occur multiple times
reactjs|use-effect
0
51
4
72,966,535
72,966,535
1
true
2022-07-13T12:32:22.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: useEffect to occur multiple times<p>I want the useEffect to occur multiple times. For example in the below example, everything works correctly the first time...
72,966,556
How can I separate a single column into 3 separate columns<p>Want to execute a query to view single date-month-year time column to separate date column, month column and year column.</p> <p>eg</p> <pre><code> joining_date 01-JAN-22 12.00.00AM </code></pre> <p>to</p> <pre><code>joining_date|joining_month|joining_year ...
<p>You have some ways of doing this:</p> <p>If your data is always in this <code>01-JAN-22 12.00.00AM</code> format , no matter what comes after 22, you can use substring.</p> <pre><code>select substring('01-JAN-22 12.00.00AM',1,2) as joining_date, substring('01-JAN-22 12.00.00AM',4,3) as joining_month, s...
How can I separate a single column into 3 separate columns
mysql|sql
0
51
2
72,967,149
72,967,149
1
true
2022-07-13T12:45:09.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I separate a single column into 3 separate columns<p>Want to execute a query to view single date-month-year time column to separate date column, mont...
72,969,654
Bootstrap accordion menus<p>I am implementing Bootstrap accordions to provide additional information. However, when I click on one of them, they all open. Is there something I can add whether it be in HTML, CSS, or JS to prevent them from all opening and closing at once? It may seem like there is alot of CSS jumbo, but...
<p>All your <code>accordion-item</code> divs have the same <code>aria-labelledby=&quot;headingOne&quot;</code> so its opening any accordion that has the label headingOne, go through each and give them unique label like <code>aria-labelledby=&quot;headingTwo&quot;</code> then <code>aria-labelledby=&quot;headingThree&quo...
Bootstrap accordion menus
javascript|html|css|bootstrap-4|accordion
0
51
1
72,969,883
72,969,883
1
true
2022-07-13T16:29:26.137Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bootstrap accordion menus<p>I am implementing Bootstrap accordions to provide additional information. However, when I click on one of them, they all open. Is...
72,971,682
I'm trying to delete the duplicated rows ; no way ; I keep getting errors (Oracle); In fact, when I was creating the table I excut<pre><code>create table salesmen ( salesman_id int, name varchar(30), city varchar(30), commission numeric(5) ) insert into salesmen (salesman_id, name, city, commission) ...
<p>This is table's contents:</p> <pre><code>SQL&gt; select * From salesmen order by 1; SALESMAN_ID NAME CITY COMMISSION ----------- ------------------------------ ------------------------------ ---------- 5001 james hoog new york ...
I'm trying to delete the duplicated rows ; no way ; I keep getting errors (Oracle); In fact, when I was creating the table I excut
sql|oracle
0
51
1
72,971,809
72,971,809
1
true
2022-07-13T19:33:26.887Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I'm trying to delete the duplicated rows ; no way ; I keep getting errors (Oracle); In fact, when I was creating the table I excut<pre><code>create table sal...
72,972,161
shiny: how to catch manual input of an interactive table and export it?<p>I created an interactive table that takes changes both from <code>selectizeInput</code> and manual input. I need to write the table to a database after updating. My problem is that I can catch the changes made by <code>selectizeInput</code>. I do...
<p>You must avoid using a reactive dataframe in <code>datatable</code>, because when it changes then the full table is regenerated, and this can be avoided with a <em>proxy</em>:</p> <pre class="lang-r prettyprint-override"><code>library(shiny) library(shinydashboard) library(DT) ui &lt;- dashboardPage( dashboardHea...
shiny: how to catch manual input of an interactive table and export it?
r|shiny|export|interactive|dt
0
51
1
72,972,766
72,972,766
1
true
2022-07-13T20:18:59.173Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: shiny: how to catch manual input of an interactive table and export it?<p>I created an interactive table that takes changes both from <code>selectizeInput</c...
72,979,752
Is there a way to use Primary Partition Key and GSI together in DynamoDB?<p>I am looking for way to improve the following query scans. I need to query based on 3 keys</p> <ol> <li>Primary Partition Key</li> <li>GSI Partition Key</li> <li>GSI Sort Key</li> </ol> <p>DynamoDB only allows 2 conditions in key-condition-expr...
<p>Yes, adding multiple keys into the partition key or sort key is a common pattern. To help with identifying keys, it is common to prefix each key with the key type, or an abbreviation, followed by a hash, and a hash between each key.</p> <p>For your case, a sort key would look similar to: <code>r#${RegulationSid}#b${...
Is there a way to use Primary Partition Key and GSI together in DynamoDB?
amazon-dynamodb
0
51
1
72,979,844
72,979,844
1
true
2022-07-14T11:25:21.073Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to use Primary Partition Key and GSI together in DynamoDB?<p>I am looking for way to improve the following query scans. I need to query based ...
72,980,516
How to make the bot not said the language code?<p>I'm trying to code discord tts bot but I run into a problem. When I used <code>$speak en Hi guys</code> the bot said <code>&quot;en hi guys&quot;</code>.</p> <p>I tried making the bot not say the language code but I can't so if you have any solution please share it with...
<p>You will need to remove the first item (<code>&quot;en&quot;</code>) from your <code>args</code> array and <code>join</code> the rest:</p> <pre class="lang-js prettyprint-override"><code>const text = args.slice(1).join(&quot; &quot;) if(!text) return message.reply(&quot;Please enter the text&quot;) </code></pre>
How to make the bot not said the language code?
javascript|node.js|discord.js|text-to-speech
1
51
1
72,980,769
72,980,769
1
true
2022-07-14T12:28:08.340Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make the bot not said the language code?<p>I'm trying to code discord tts bot but I run into a problem. When I used <code>$speak en Hi guys</code> the...
72,981,835
How to extract a digit from number in oracle<p>please help with query how to extract digit '1' from below table using SQL in oracle.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th style="text-align: left;">Table</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">1000</td> </tr>...
<p>I expect you are giving us a simplified version of your problem? One way to achieve this is is using <code>REGEXP_REPLACE</code> to replace all characters but the character <code>1</code> with an empty space:</p> <pre><code>SELECT REGEXP_REPLACE(YOUR_COLUMN,'[^1]','') AS DESIRED_RESULT FROM YOUR_TABLE </code></pr...
How to extract a digit from number in oracle
sql|oracle
0
51
3
72,982,091
72,982,091
1
true
2022-07-14T14:03:48.727Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to extract a digit from number in oracle<p>please help with query how to extract digit '1' from below table using SQL in oracle.</p> <div class="s-table-...
72,910,153
How to pass Angular directive by reference?<p>In an existing component template I have this (simplified) element:</p> <pre><code>&lt;input type=&quot;button&quot; #refreshPrice /&gt; </code></pre> <p>This is picked up (I don't know the correct term) by this property so we can subscribe to it's click event and call a fu...
<p>the <code>@Input()</code> attribute here allows you to bind a value to a variable on your component, if you want to have the parent do something based on your components data, you might want to use <code>@Output()</code> and emit a custom event. If the requirement is just listen to a click event then adding a <code>...
How to pass Angular directive by reference?
angularjs-directive|angular-components|angular-elements
2
51
1
72,984,168
72,984,168
1
true
2022-07-08T10:35:16.057Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to pass Angular directive by reference?<p>In an existing component template I have this (simplified) element:</p> <pre><code>&lt;input type=&quot;button&...
72,982,850
Fill cells with the last non empty column value dynamically<p>How to get the last value to be filled in the next empty cells untill the next value, like this <a href="https://docs.google.com/spreadsheets/d/1yRX0sfIK3geu0bY1L1vXBSDAV7xIfmQHtPA4-ZuH9GY/edit?usp=sharing" rel="nofollow noreferrer">Link to the sheet</a>.<br...
<p>Here is a formula that can achieve this:</p> <p><code>=ARRAYFORMULA(VLOOKUP(column(B1:J1),FILTER(transpose({column(B1:J1);B1:J1}),transpose(B1:J1)&lt;&gt;&quot;&quot;),2,TRUE))</code><br /> <a href="https://i.stack.imgur.com/ZujoU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZujoU.png" alt="ex"...
Fill cells with the last non empty column value dynamically
google-sheets|filter|dynamic|array-formulas
0
51
1
72,984,263
72,984,263
1
true
2022-07-14T15:14:03.823Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fill cells with the last non empty column value dynamically<p>How to get the last value to be filled in the next empty cells untill the next value, like this...
72,986,697
C++ fstream object passed as reference, but it won't make<p>I'm trying to do a bunch of stuff with the .txt file I'm trying to read, so I want to break it up into functions. But even when I pass the file stream in by reference, I can't get the program to compile.</p> <pre><code> #include &quot;Executive.h&quot; ...
<p>ITNOA</p> <p><strong>simple answer</strong></p> <p>for resolve your problem you can just remove <code>const</code> keyword in declaration of <code>findStart</code> funciton.</p> <p><strong>TL;DR;</strong></p> <p>in generally if you want to only read from file, please use <a href="https://cplusplus.com/reference/fstr...
C++ fstream object passed as reference, but it won't make
c++|fstream|filestream|txt
0
51
1
72,986,930
72,986,930
1
true
2022-07-14T21:10:05.133Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C++ fstream object passed as reference, but it won't make<p>I'm trying to do a bunch of stuff with the .txt file I'm trying to read, so I want to break it up...
72,989,732
How to structure base class where derived classes operate on different data types<p>I have a class that is supposed to fetch an object from the server.</p> <pre><code>// T types struct RequestLicense { // arbitrary data }; struct RequestTrial { // arbitrary data } // U types struct LicenseData { // arbitra...
<p>I think I would make the whole <code>Fetcher</code> structure a template, with the member functions being abstract virtual functions:</p> <pre><code>// R is the request type // D is the data type template &lt;typename R, typename D&gt; struct Fetcher { virtual std::wstring FetchBlob(R const&amp; requestParameter...
How to structure base class where derived classes operate on different data types
c++|templates|inheritance|c++17
0
51
1
72,989,817
72,989,817
1
true
2022-07-15T06:13:51.450Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to structure base class where derived classes operate on different data types<p>I have a class that is supposed to fetch an object from the server.</p> <...
72,982,568
Indexing first n characters of Charfield in Django<p>How to index a specific number of Characters on Django Charfield?</p> <p>For example, this is how we index fields in Django, but I guess it applies to entire field or all characters.</p> <pre><code>class Meta: indexes = [ models.Index(fields=['last_...
<p>You can create a functional index with the <a href="https://docs.djangoproject.com/en/dev/ref/models/database-functions/#substr" rel="nofollow noreferrer"><strong><code>Substr</code></strong> function <sup>[Django-doc]</sup></a>:</p> <pre><code>from django.db.models.functions import <b>Substr</b> # &hellip; class ...
Indexing first n characters of Charfield in Django
python|django|django-models
1
51
1
72,990,011
72,990,011
1
true
2022-07-14T14:54:00.570Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Indexing first n characters of Charfield in Django<p>How to index a specific number of Characters on Django Charfield?</p> <p>For example, this is how we ind...
72,992,828
query to select columns from a row in which another column has certain value only SQL<p>Consider the following table</p> <pre><code>id attribute 1 a 1 a 1 b 2 a 2 a 3 c 4 a </code></pre> <p>I want to select the ids that have attribute of 'a' only, ie 2 and 4. Cant select 1 because 1 has 'a...
<p>You can use</p> <pre><code>SELECT id FROM YourTable GROUP BY id HAVING MAX(attribute) = 'a' AND MIN(attribute) = 'a' AND COUNT(*) = COUNT(attribute) </code></pre> <p>the</p> <pre><code>COUNT(*) = COUNT(attribute) </code></pre> <p>is to discard any id that have <code>NULL</code> attribute as well as <code>...
query to select columns from a row in which another column has certain value only SQL
sql
1
51
2
72,992,875
72,992,875
1
true
2022-07-15T10:48:03.117Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: query to select columns from a row in which another column has certain value only SQL<p>Consider the following table</p> <pre><code>id attribute 1 a 1 ...
72,994,496
defining a fuction using the for loop / Python<p>I need to define a function using the <em>for loop</em>. it's purpose is to check whether a letter included in <em>secret_word</em> is already included in the <em>old_letters_guessed</em> list. if it is, the function returns True. else, False. This is what I wrote thus f...
<p>You can use this:</p> <pre class="lang-py prettyprint-override"><code>def check_win(word, guessed): for letter in word: if letter not in guessed: return False return True print(check_win('typewriter', ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'])) # True print(check_win('typewriter...
defining a fuction using the for loop / Python
python|function|loops|func
-2
51
2
72,994,652
72,994,652
1
true
2022-07-15T13:07:48.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: defining a fuction using the for loop / Python<p>I need to define a function using the <em>for loop</em>. it's purpose is to check whether a letter included ...
72,997,169
How to place a widget in a specific position relative to the button clicked. (Tkinter)<p>it's a code for a Calendar, recording the subjects for a specific day.</p> <p><a href="https://i.stack.imgur.com/tjeHb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tjeHb.png" alt="enter image description here"...
<p>Instead of using a function to make the option box, it would be better to use a class which subclasses <code>Frame</code>.</p> <pre><code>class OptionBox(Frame): def __init__(self, master, parent_x, parent_y): # Initialise frame and place it Frame.__init__(self, master, width = 200, height = 270,...
How to place a widget in a specific position relative to the button clicked. (Tkinter)
python|tkinter|canvas
2
51
1
72,998,331
72,998,331
1
true
2022-07-15T16:37:06.507Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to place a widget in a specific position relative to the button clicked. (Tkinter)<p>it's a code for a Calendar, recording the subjects for a specific da...
72,998,892
How to create an automatic index<p>How can I generate this pattern automatically?</p> <pre><code>indice = [&quot;A Minus 2&quot;, &quot;A Plus 2&quot;, &quot;A Minus 3&quot;, &quot;A Plus 3&quot;, &quot;A Minus 4&quot;, &quot;A Plus 4&quot;, &quot;A Minus 5&quot;, &quot;A Plus 5&quot;] </code></pre> <p>It's fast just t...
<p>You could try this:</p> <pre><code>indice = [] for i in range(num): indice.append(f'A Plus {i}') indice.append(f'A Minus {i}') </code></pre>
How to create an automatic index
python
0
51
2
72,998,946
72,998,946
1
true
2022-07-15T19:37:52.933Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create an automatic index<p>How can I generate this pattern automatically?</p> <pre><code>indice = [&quot;A Minus 2&quot;, &quot;A Plus 2&quot;, &quot...
72,999,182
How to customize 'Previous' and 'Next' buttons in 'Slick' slider<p>I created a carousel using 'Slick' but I want to change the 'Previous' and 'Next' buttons into arrows. How do I do that?</p> <p>This is my code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div cl...
<p>You can use <strong>prevArrow</strong> and <strong>nextArrow</strong> to customize the code from your arrows. Something like this:</p> <pre><code>$('.horizontal').slick({ slidesToShow: 2, slidesToScroll: 1, autoplay: true, autoplaySpeed: 100, prevArrow: '&lt;button type=&quot;button&quot; class=&quot;slick...
How to customize 'Previous' and 'Next' buttons in 'Slick' slider
javascript|html|jquery|css|slick.js
1
51
1
72,999,517
72,999,517
1
true
2022-07-15T20:14:48.353Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to customize 'Previous' and 'Next' buttons in 'Slick' slider<p>I created a carousel using 'Slick' but I want to change the 'Previous' and 'Next' buttons ...
72,998,977
BEFORE INSERT trigger with primary key using the sqlite3 shell .import command<p>I'm trying to create a <code>BEFORE INSERT</code> trigger in Sqlite that catches my unique primary key column (UID) during import and replaces the remaining columns. I'm using sqlite3 command line for CSV import and whenever it sees an exi...
<p>You're on the right path here, but the trigger can be simplified a lot. Using a trimmed down example...</p> <h3>SQL:</h3> <pre class="lang-sql prettyprint-override"><code>CREATE TABLE example(UID TEXT PRIMARY KEY, blah1 TEXT, blah2 INTEGER); CREATE TRIGGER bulk_update_example BEFORE INSERT ON example WHEN EXISTS (S...
BEFORE INSERT trigger with primary key using the sqlite3 shell .import command
sql|sqlite|triggers|sqlitestudio
0
51
1
73,000,496
73,000,496
1
true
2022-07-15T19:49:01.953Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: BEFORE INSERT trigger with primary key using the sqlite3 shell .import command<p>I'm trying to create a <code>BEFORE INSERT</code> trigger in Sqlite that cat...
72,999,248
Get uncompressed form of P-384 curve PK<p>I have a base-64 public key of a P-384 elliptic curve.</p> <p>Trying to write a C# (.NET 4.7.2) code to get the uncompressed form (manage to do with OpenSSL, but from operatives reasons, cannot use it in production).</p> <p>I can use Microsoft cryptography lib or Bouncy Castle....
<p>It is not quite clear what format your public EC key has, probably X.509/SPKI. In this case the raw key is right at the end. However, it can be uncompressed or compressed. If the P-384 key starts with 0x3046, e.g.:</p> <pre class="lang-none prettyprint-override"><code>3046301006072A8648CE3D020106052B8104002203320003...
Get uncompressed form of P-384 curve PK
c#|cryptography|bouncycastle|.net-4.7.2
2
51
1
73,003,427
73,003,427
1
true
2022-07-15T20:21:39.457Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get uncompressed form of P-384 curve PK<p>I have a base-64 public key of a P-384 elliptic curve.</p> <p>Trying to write a C# (.NET 4.7.2) code to get the unc...
72,925,192
Why is my foreach and map return undefined<p>I have a packet system where you can have products in a packet.</p> <p>So if anyone buy a packet I add this in shopping cart, if he buy it again then I check if the packet id is the same and if the products in packet have the same size and color if yes then I add amount + 1....
<p>ForEach method works in such way in which it doesn't return anything while it works. So even if you add return statement in your forEach, it wouldn't return anything. In your case you can change forEach to map method which returns new array</p>
Why is my foreach and map return undefined
javascript|reactjs|react-native|redux
0
51
1
73,003,600
73,003,600
1
true
2022-07-09T23:12:09.523Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is my foreach and map return undefined<p>I have a packet system where you can have products in a packet.</p> <p>So if anyone buy a packet I add this in s...
73,003,583
Inserting NaN in specific index(positions) in a numpy.array in Python<p>I have two arrays <code>P</code> and <code>J</code>. I want to insert <code>C1=nan</code> in <code>P</code> according to positions in <code>J</code>. But I am getting an error. I present the expected output.</p> <pre><code>import numpy as np from ...
<p>You can use for loop to reach each item in J.</p> <pre><code>import numpy as np from numpy import nan J = np.array([[1, 4, 5, 7]]) P = np.array([[ 1.35961580e+03, 1.35179719e+03, 1.30676673e+03, 1.17569069e+02, 5.19255443e+00, 5.19255443e+00, 5.19255443e+00, 1.00000000e-09 ]]) C1 = nan for i in J[0]: P...
Inserting NaN in specific index(positions) in a numpy.array in Python
python|numpy
1
51
3
73,003,689
73,003,689
1
true
2022-07-16T10:55:31.503Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Inserting NaN in specific index(positions) in a numpy.array in Python<p>I have two arrays <code>P</code> and <code>J</code>. I want to insert <code>C1=nan</c...
73,003,692
how to wrap a promise and keep the return type?<p>I have a function that uses an axios instance and has type <code>async function register(data: RegisterData): Promise&lt;AxiosResponse&lt;UserResponse, any&gt;&gt;</code></p> <pre><code>export const register = (data: RegisterData) =&gt; api.post&lt;UserResponse&gt;('reg...
<p>You can use a type assertion for the <code>makeRequest</code> function.</p> <pre><code>export function useForm&lt; T extends Record&lt;string, any&gt;, R extends (...args: any) =&gt; Promise&lt;AxiosResponse&gt; &gt;(init: T, request: R) { /* ... */ const makeRequest = (() =&gt; { /* ... */ }) as ...
how to wrap a promise and keep the return type?
typescript|vue.js
-1
51
1
73,004,050
73,004,050
1
true
2022-07-16T11:11:55.793Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to wrap a promise and keep the return type?<p>I have a function that uses an axios instance and has type <code>async function register(data: RegisterData...
73,007,180
Pull in ALL posts from the last two weeks using Rest API<p>So I am working with the WordPress REST API and I would like to pull in <code>all the posts from the last 2 weeks</code>, so approximately 14 days.</p> <p>In the WordPress REST API arguments, they have a <code>before</code> and <code>after</code> argument (<a h...
<p>The proper format for <code>before</code> or <code>after</code> is ISO8601 so <code>2022-07-16T20:33:00</code> In the below function, I set it to 2 weeks ago, 1 second after midnight. You can use <code>date_format($date, 'Y-m-d\TH:i:s');</code> <a href="https://www.php.net/manual/en/datetime.format.php" rel="nofoll...
Pull in ALL posts from the last two weeks using Rest API
php|wordpress
2
51
1
73,008,525
73,008,525
1
true
2022-07-16T19:42:56.453Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pull in ALL posts from the last two weeks using Rest API<p>So I am working with the WordPress REST API and I would like to pull in <code>all the posts from t...
73,010,761
Extract numbers that does not follow a pattern python<p>I have a CSV file which contains many columns for payments.</p> <p>There's one column column called <code>control_number</code>. This is unique identifier for every transaction and it follows a pattern, all control numbers must.</p> <p>Starts with <code>991</code>...
<p>Since all the values are already 12-digit numbers, you do not need a regex here, you can use <code>Series.str.startswith</code>:</p> <pre class="lang-py prettyprint-override"><code>df = df[~df[&quot;control_number&quot;].astype(str).str.startswith(&quot;991&quot;)] </code></pre> <p>Here is a minified test:</p> <pre ...
Extract numbers that does not follow a pattern python
python|pandas|regex
2
51
2
73,010,785
73,010,785
1
true
2022-07-17T09:45:25.027Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extract numbers that does not follow a pattern python<p>I have a CSV file which contains many columns for payments.</p> <p>There's one column column called <...
73,010,965
How to make an EXCLUDE constraint with date + time values? (PostgreSQL)<p>As the title suggests, what I'm trying is to create an <code>EXCLUDE</code> constraint by concatenating <code>date + time</code> values.</p> <p>Here is a DB table called <code>bookings</code>:</p> <pre><code>column name | data type --------------...
<p>sorry I was unable to recreate the problem. when I try SQL code above it works as expected. I'm using PostgreSQL 14.</p> <p><a href="https://i.stack.imgur.com/qGizB.png" rel="nofollow noreferrer">sample result with DBeaver</a></p>
How to make an EXCLUDE constraint with date + time values? (PostgreSQL)
sql|postgresql
0
51
1
73,011,107
73,011,107
1
true
2022-07-17T10:19:58.857Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make an EXCLUDE constraint with date + time values? (PostgreSQL)<p>As the title suggests, what I'm trying is to create an <code>EXCLUDE</code> constra...
73,013,752
Flutter How to stack image and total member text<p>I was able to show the pictures as in the video by taking advantage of Johannes Milke's video that I left the link of. But that's not all I want. I need a structure that looks like these images but shows the total number of users. I leave the image of exactly what I wa...
<p>Add a label also to this class</p> <pre class="lang-dart prettyprint-override"><code> import 'package:flutter/material.dart'; class StackedWidgets extends StatelessWidget { final List&lt;Widget&gt; items; final TextDirection direction; final double size; final double xShift; final String lable; const...
Flutter How to stack image and total member text
flutter|flutter-layout
0
51
2
73,013,922
73,013,922
1
true
2022-07-17T17:00:52.723Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter How to stack image and total member text<p>I was able to show the pictures as in the video by taking advantage of Johannes Milke's video that I left ...
73,014,986
replace/replaceAll is not a function<p>I'm trying to use replace in order to remove some characters in a 2d array of strings, but I keep incountering an issue:</p> <pre><code> dataArr[j,k] = dataArr[j,k].replaceAll(mCH, &quot;&quot;); ^ TypeError: dataArr[(j , k)].replaceAll is not a...
<p>You can use the <code>.replace</code> function instead of <code>replaceAll</code>, if the later is not available.</p> <p><code>&quot;any string&quot;.replace(new RegExp(&quot;to replace&quot;, &quot;g&quot;), &quot;new text&quot;)</code></p> <p>This is by using <code>new RegExp(&quot;text to replace&quot;, &quot;g&q...
replace/replaceAll is not a function
javascript|reactjs
0
51
2
73,015,158
73,015,158
1
true
2022-07-17T20:02:16.007Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: replace/replaceAll is not a function<p>I'm trying to use replace in order to remove some characters in a 2d array of strings, but I keep incountering an issu...
72,323,441
How should I share the states amongst all the executions of a Behaviour Tree triggered from all ticks?<p>I'm still learning about Behaviour Tress and my understanding of the &quot;blackboard&quot; is essentially a state object. When passing the state object through the ticks to the function calls (which are nodes and l...
<p>Blackboards need to be mutable and thread safe, if you support parallel nodes. You are correct that in your example, it could be a problem that one asynchronous node changes the value of <code>cash</code> while a second traversal believes it has enough cash to perform certain actions.</p> <p>You could either pass a ...
How should I share the states amongst all the executions of a Behaviour Tree triggered from all ticks?
javascript|typescript|data-structures|behavior|behavior-tree
0
51
1
73,018,430
73,018,430
1
true
2022-05-20T18:33:26.913Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How should I share the states amongst all the executions of a Behaviour Tree triggered from all ticks?<p>I'm still learning about Behaviour Tress and my unde...
72,987,505
How to test MaterialStateProperty values?<p>I have a button with a specific elevation, set as an argument:</p> <pre class="lang-dart prettyprint-override"><code> child: ElevatedButton( key: const Key('MyButton'), onPressed: () {}, child: Text('My Button'), style: ButtonSty...
<p>I've just got hit by this issue myself.</p> <p>For your specific test, this would be the code:</p> <pre><code>final button = tester.widget&lt;ElevatedButton(find.byKey(Key('MyButton'))); final elevation = button.style!.elevation; expect(elevation!.resolve(&lt;MaterialState&gt;{}), 2.0); expect(elevation.resolve(&lt...
How to test MaterialStateProperty values?
flutter|unit-testing|dart
1
51
1
73,020,546
73,020,546
1
true
2022-07-14T23:06:06.307Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to test MaterialStateProperty values?<p>I have a button with a specific elevation, set as an argument:</p> <pre class="lang-dart prettyprint-override"><c...
73,023,798
terraform for_each for security groups<pre><code>variable &quot;ingress_ports_cidr_blocks&quot; { type = any default = { 1111 = {description = &quot;test&quot; , protocol = &quot;TCP&quot; , cidr_blocks = [&quot;0.0.0.0/0&quot;]} 2222 = {description = &quot;test&quot; , protocol = &quot;TCP&quot; , cidr_...
<p>Your question is a bit confusing as you seem to be focusing on the <code>type</code> part of the variable declaration, which really has nothing to do with the issue you are encountering. Specifying <code>type = any</code> is the same as just leaving the <code>type</code> definition out all together, it isn't really ...
terraform for_each for security groups
amazon-web-services|terraform
0
51
1
73,023,975
73,023,975
1
true
2022-07-18T14:15:18.100Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: terraform for_each for security groups<pre><code>variable &quot;ingress_ports_cidr_blocks&quot; { type = any default = { 1111 = {description = &quo...
72,974,073
Why is Akka creating so many dispatchers?<p>I'm using Akka for several different Actors. The work done by these Actors is non-blocking. I noticed something odd - the number of dispatchers scales with the number of Actors I'm creating. If I create hundreds of actors, I find myself with hundreds of dispatchers, sometimes...
<p>It seems that this mostly answered in the comments above, but to collate them into an &quot;Answer&quot;: it appears that &quot;so many dispatchers&quot; are getting created because you are creating them explicitly in your config.</p> <p>Also, when you give an example of a &quot;dispatcher&quot; you are actually sho...
Why is Akka creating so many dispatchers?
scala|akka
0
51
1
73,025,127
73,025,127
1
true
2022-07-14T00:44:45.607Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is Akka creating so many dispatchers?<p>I'm using Akka for several different Actors. The work done by these Actors is non-blocking. I noticed something o...
72,902,585
Apache beam fileio write compressed files<p>I would like to know if it's possible to write compressed files using the fileio module from Apache Beam, Python SDK. At the moment I am using the module to write files to a GCP bucket:</p> <pre><code>_ = (logs | 'Window' &gt;&gt; beam.WindowInto(window.FixedWindows(60*60)) ...
<blockquote> <p>developers still need to implement handling of compression.</p> </blockquote> <p>This is correct.</p> <p>Though there are open FRs:</p> <ul> <li><a href="https://github.com/apache/beam/issues/19415" rel="nofollow noreferrer">https://github.com/apache/beam/issues/19415</a></li> <li><a href="https://githu...
Apache beam fileio write compressed files
google-cloud-platform|file-io|google-cloud-dataflow|apache-beam|apache-beam-io
0
51
1
73,027,512
73,027,512
1
true
2022-07-07T18:23:31.457Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Apache beam fileio write compressed files<p>I would like to know if it's possible to write compressed files using the fileio module from Apache Beam, Python ...
73,021,016
How to use a mail template ID when sending an email with admin api in shopware 6?<p>When sending an email via Shopware 6 admin api (<a href="https://shopware.stoplight.io/docs/admin-api/b3A6MTI2MjUzOTg-send-a-mail" rel="nofollow noreferrer">https://shopware.stoplight.io/docs/admin-api/b3A6MTI2MjUzOTg-send-a-mail</a>) i...
<p>This endpoint was not implemented to fetch an existing <code>mail_template</code> entity by an <code>id</code>. You'll have to provide the mails content yourself.</p> <p>Your best bet would be to send a request to the corresponding endpoint for mail templates, e.g. <code>GET /api/mail-template/086f8adc94f14a618e3729...
How to use a mail template ID when sending an email with admin api in shopware 6?
shopware6|shopware6-api|shopware6-app
1
51
1
73,029,161
73,029,161
1
true
2022-07-18T10:41:18.980Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use a mail template ID when sending an email with admin api in shopware 6?<p>When sending an email via Shopware 6 admin api (<a href="https://shopware...
73,025,794
Any way to get request headers in IDocumentFilter class? (Swashbuckle)<p>Here's my definition for the IDocumentFilter class -</p> <pre><code>public class ShowDocumentationFilter : IDocumentFilter { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] public class ShowDocumentationAttribute : Attri...
<p>You can access HttpContext inside Apply method. you can check for any required header.</p> <p><a href="https://i.stack.imgur.com/07X2C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/07X2C.png" alt="enter image description here" /></a></p>
Any way to get request headers in IDocumentFilter class? (Swashbuckle)
c#|.net|swagger|swashbuckle
0
51
1
73,032,509
73,032,509
1
true
2022-07-18T16:42:56.247Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Any way to get request headers in IDocumentFilter class? (Swashbuckle)<p>Here's my definition for the IDocumentFilter class -</p> <pre><code>public class Sho...
72,936,950
How can I limit pdfminer to read data in the cropbox or mediabox<p>If I have a simple code like this one:</p> <pre><code>from pdfminer.layout import LAParams, LTTextBox from pdfminer.pdfpage import PDFPage from pdfminer.pdfinterp import PDFResourceManager from pdfminer.pdfinterp import PDFPageInterpreter from pdfminer....
<p>Not sure if I understood correctly, but if you want to print text contained in a given area, you can use the coordinates returned by <code>bbox</code> to conditionnally print your ROI (region of interest).</p> <p>For a given crop area (x0, y0, x1, y1) :</p> <pre><code>for page in pages: interpreter.process_page(...
How can I limit pdfminer to read data in the cropbox or mediabox
python|python-3.x|parsing|pdf|pdfminer
0
51
1
73,082,854
73,082,854
1
true
2022-07-11T10:14:55.720Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I limit pdfminer to read data in the cropbox or mediabox<p>If I have a simple code like this one:</p> <pre><code>from pdfminer.layout import LAParams...
72,982,493
How to change multiple values in the df under multiple conditions<p>I know how to change values of the df under one condition <code>(df_csv.loc[df_csv['X'] == 'train', ['A', 'B']] = ['t1', 't2']</code>)`, but how do I change values in the df under multiple conditions?</p> <p>What I've tried:</p> <pre><code>df_csv.loc[d...
<p>try:</p> <pre class="lang-py prettyprint-override"><code>df_csv.loc[((df_csv['A'] == 'car') &amp; (df_csv['B'] == 'plane')), ['A', 'B']] = ['t1', 't2'] </code></pre> <p>to replicate everything:</p> <pre class="lang-py prettyprint-override"><code># create data import pandas as pd data = {'A': ['train', 'car', 'truck'...
How to change multiple values in the df under multiple conditions
python|pandas|dataframe|jupyter
1
51
2
72,982,620
72,982,620
1
true
2022-07-14T14:49:25.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change multiple values in the df under multiple conditions<p>I know how to change values of the df under one condition <code>(df_csv.loc[df_csv['X'] =...
72,878,430
Check whether filtered values per group in other column exist in equal number of times, then calculate time difference based on precedence<p>I am having the trouble on cleaning the data like below, I want for each distinct value in <strong>Name</strong> column filter only those record in <strong>Country</strong> which ...
<p>Use:</p> <pre><code>#filtered only Y an Z rows df1 = df[df['Country'].isin(['Y','Z'])].copy() #helper column with datetimes df1['datetime'] = pd.to_datetime(df1['Date'] + ' ' + df1['Time'], dayfirst=True) print (df1) #extract maximal datetimes per Y rows df2 = df1.loc[df1[df1['Country'].eq('Y')].groupby('Name')['d...
Check whether filtered values per group in other column exist in equal number of times, then calculate time difference based on precedence
python|pandas
1
51
1
72,878,467
72,878,467
1
true
2022-07-06T05:42:35.100Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Check whether filtered values per group in other column exist in equal number of times, then calculate time difference based on precedence<p>I am having the ...
72,880,280
How to change field from return response in api<p>This is the result of response from api</p> <p><a href="https://i.stack.imgur.com/oDcDq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oDcDq.png" alt="enter image description here" /></a></p> <p>what I want is to change the field return like</p> <p><...
<p>If you just want to change one specific item, you need to choose it by key - as they are numeric you'll have to use square bracket notation</p> <pre><code>WorkflowApi.getTransactionLog().then(logs =&gt; { const newLog = { ...logs[43], 'id': logs[43]._id } } </code></pre> <p>If you want to change al...
How to change field from return response in api
javascript|node.js|reactjs
0
51
1
72,880,491
72,880,491
1
true
2022-07-06T08:34:24.697Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change field from return response in api<p>This is the result of response from api</p> <p><a href="https://i.stack.imgur.com/oDcDq.png" rel="nofollow ...
72,788,407
Python: count the numbers between a range that are divisible by another integer<blockquote> <p>Detail: User enters 3 integers as numX &gt;= numY &gt;= numZ. Count how many integers between the range of numX and numZ that are divisible by numY (while loop required).</p> </blockquote> <p>This is a practice question from ...
<p>You were increasing <code>z</code> value and decreasing <code>x</code> value. You shouldn't do that. If you increase <code>z</code> value then it will not execute between the actual range. You don't even need the old variables.</p> <p>So, I think the following code snippet will work for you.</p> <p><strong>Code:</st...
Python: count the numbers between a range that are divisible by another integer
python|python-3.x|while-loop
1
51
1
72,788,625
72,788,625
1
true
2022-06-28T14:34:15.287Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python: count the numbers between a range that are divisible by another integer<blockquote> <p>Detail: User enters 3 integers as numX &gt;= numY &gt;= numZ. ...
72,902,133
PHP-MySQL - MATCH AGAINST don't work properly<p>I have a problem getting a query to work. I use PHP 8 and MySQL 5.7.36</p> <p>What i need is let the user type a place (city,country or region) and show all corresponding places while typing.</p> <p>The table name is : places and i have 4 fields : id, name, name_fr, alter...
<p>Firstly you are using a mixture of single and double quotes it makes code messy. If you are concatenating text with variable it's better approach to use single quotes. Double quotes tells php to search variable in the text.</p> <pre class="lang-php prettyprint-override"><code>$dbcon-&gt;query('SELECT name FROM place...
PHP-MySQL - MATCH AGAINST don't work properly
mysql
0
51
1
72,903,950
72,903,950
1
true
2022-07-07T17:38:12.340Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP-MySQL - MATCH AGAINST don't work properly<p>I have a problem getting a query to work. I use PHP 8 and MySQL 5.7.36</p> <p>What i need is let the user typ...
72,947,402
Logical formula in docplex<p>Given the following formula</p> <p><a href="https://i.stack.imgur.com/2zvDj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2zvDj.png" alt="enter image description here" /></a></p> <p>with the table below encode the relationship of <code>x_0</code>, <code>x_1</code> and <...
<p>Both in docplex and OPL you can use logical constraints.</p> <p>In OPL for instance:</p> <pre><code>int R[0..1][0..1]=[[0,0],[2,1]]; dvar boolean x; dvar boolean y; dvar int obj; maximize obj; subject to { forall(i in 0..1,j in 0..1) (x==i) &amp;&amp; (y==j) =&gt; (obj==R[i][j]); } </code></pre> <p>that is gene...
Logical formula in docplex
cplex|docplex
0
51
2
72,948,601
72,948,601
1
true
2022-07-12T05:27:46.577Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Logical formula in docplex<p>Given the following formula</p> <p><a href="https://i.stack.imgur.com/2zvDj.png" rel="nofollow noreferrer"><img src="https://i.s...
72,848,438
split a string in javascript based on start and end delimiters<p>I'm looking for a way in Javascript to split a string into an array based on &quot;starting&quot; and &quot;ending&quot; separators rather than one separator, as str.split currently does.</p> <p>For example, if I have this string:</p> <pre><code>const str...
<p>Regex to the rescue!</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const str = '{lang}_{cmp_abbrev}_{cmp_type}_{pl_abbrev}_{w}x{h}_d{dv}c{cv}' const values = [...str.match...
split a string in javascript based on start and end delimiters
javascript|sorting
0
51
3
72,848,488
72,848,488
1
true
2022-07-03T17:07:21.760Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: split a string in javascript based on start and end delimiters<p>I'm looking for a way in Javascript to split a string into an array based on &quot;starting&...
72,941,375
How to calculate the rolling mean of the nth previous values<p>So let's say I have a data frame of a series of values which are assigned to one of two groups ('Gp'):</p> <pre><code>set.seed(12) df &lt;- data.frame(id = sample(1:50,50), Gp = sample(2, 50, TRUE)) </code></pre> <p>Here are the top 20 values from this:</p...
<p>You could lag the id variable before taking using the rolling mean:</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) df |&gt; group_by(Gp) |&gt; mutate(rm = id - zoo::rollmeanr(lag(id, 10), k = 3, fill = NA)) |&gt; ungroup() </code></pre> <p>Update: Typo + added <code>group_by</code>.</p>
How to calculate the rolling mean of the nth previous values
r|time-series|lag|rolling-average
0
51
1
72,941,765
72,941,765
1
true
2022-07-11T15:58:03.697Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to calculate the rolling mean of the nth previous values<p>So let's say I have a data frame of a series of values which are assigned to one of two groups...
72,806,268
How do you load images into specific spots based on a list and a dictionary?<p>I'm making a simple 2d exploration game in replit (hoping to have a nice base for a future game I'm making) and I have all my map tiles as images</p> <pre class="lang-py prettyprint-override"><code>WATER = pygame.image.load(r'water.jpg') SAN...
<p><code>WATER</code>, <code>SAND</code>, etc are already <code>pygame.Surface</code> objects. You do not need to load them again. Just <a href="https://www.pygame.org/docs/ref/surface.html#pygame.Surface.blit" rel="nofollow noreferrer"><code>blit</code></a> the images:</p> <pre class="lang-py prettyprint-override"><co...
How do you load images into specific spots based on a list and a dictionary?
python|pygame
0
51
1
72,806,325
72,806,325
1
true
2022-06-29T18:33:39.453Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you load images into specific spots based on a list and a dictionary?<p>I'm making a simple 2d exploration game in replit (hoping to have a nice base ...
72,812,993
JSON.parse incorrect string format<p>i have this string:</p> <pre><code>&quot;{\\'Ovcount\\':\\'0\\',\\'S1\\':\\'LU\\',\\'S2\\':\\'NewClientOrMove\\',\\'memoToDisplay\\':\\'LU -- New Client or Move\\\&quot;}&quot;; </code></pre> <p>and i want it to become like this:</p> <pre><code>'{&quot;Ovcount&quot;:&quot;0&quot;,&...
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var result = "{\'Ovcount\':\'0\',\'S1\':\'LU\',\'S2\':\'NewClientOrMove\',\'memoToDisplay\':\'LU -- New Client or Move\"}" .replac...
JSON.parse incorrect string format
javascript|parsing|replace|format|stringify
-2
51
1
72,813,130
72,813,130
1
true
2022-06-30T08:57:44.287Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JSON.parse incorrect string format<p>i have this string:</p> <pre><code>&quot;{\\'Ovcount\\':\\'0\\',\\'S1\\':\\'LU\\',\\'S2\\':\\'NewClientOrMove\\',\\'memo...
72,860,665
div with cdkDrag on top of mat-slider doesn't hide the slider button<p>I'm writing an angular14 application.</p> <p>I have a <code>div</code> element that has <code>cdkDrag</code> for it to be moveable, and behind it i have a few buttons and sliders and i noticed that the slider button is still visible when i drag that...
<p>You are on the right track with z-index. You just need to set on the right classes and in the right css.</p> <p>styles.css</p> <pre><code>.mat-slider-thumb { z-index: 0 ; } .myDiv{ z-index: 1; } </code></pre> <p>html</p> <pre><code>... &lt;div class=&quot;myDiv&quot; cdkDrag ... </code></pre> <p><a href="http...
div with cdkDrag on top of mat-slider doesn't hide the slider button
css|typescript|angular-cdk-drag-drop|angular14
1
51
2
72,860,813
72,860,813
1
true
2022-07-04T18:16:03.213Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: div with cdkDrag on top of mat-slider doesn't hide the slider button<p>I'm writing an angular14 application.</p> <p>I have a <code>div</code> element that ha...