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,145,014 | Google sheet script to search and retrieve Gmail data<p>I've started a script that matches an email address in Col D with Gmail and writes the last message date in Col E. I'd like that script to repeat row by row - now it only writes to Row 2 (newbie question - sorry).</p>
<p>I'd also like to search for data in additio... | <blockquote>
<p>I'd like that script to repeat row by row - now it only writes to Row 2</p>
</blockquote>
<p>You will need to iterate ("loop") through your sheet's rows.</p>
<p><strong>Try this:</strong></p>
<pre><code>function myFunction() {
const sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1'... | Google sheet script to search and retrieve Gmail data | google-apps-script|google-sheets | -1 | 66 | 1 | 72,145,211 | 72,145,211 | 1 | true | 2022-05-06T16:55:44.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google sheet script to search and retrieve Gmail data<p>I've started a script that matches an email address in Col D with Gmail and writes the last message d... |
72,147,837 | Range Not Found, Google Apps Script for Google Sheets<p>I'm trying to build a custom range for this sort function in an Apps Script for Google Sheets but I keep getting the error: "Exception: Range not found; sortProductionLog @ macros.gs:15"</p>
<p>I'm sure this is something basic but I have searched far an... | <p>The problem is you are trying to use a string <code>"4, 1, ..."</code> as the <code>.getRange()</code> argument. The function takes up to four numbers, or a single string in "A1 notation".</p>
<p>Source:</p>
<ul>
<li><a href="https://developers.google.com/apps-script/reference/spreadsheet/sheet#g... | Range Not Found, Google Apps Script for Google Sheets | sorting|google-apps-script|range | -1 | 80 | 2 | 72,148,019 | 72,148,019 | 1 | true | 2022-05-06T22:08:30.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Range Not Found, Google Apps Script for Google Sheets<p>I'm trying to build a custom range for this sort function in an Apps Script for Google Sheets but I k... |
72,065,186 | Present modal view on navigation to another view in swiftui<p>Let me know if this is a duplicate question.</p>
<p>I am developing an app with a photo picker. I am on view A and there is a + button on it. When I tap on the +, I want to navigate to a view B. Upon navigation I want to present a Photo Picker view automatic... | <p>There is a view modifier in SwiftUI known as <code>.onAppear(perform:)</code>, which is the SwiftUI counterpart to UIKit's <code>viewDidAppear</code> and gives you an entry point upon the construction and display of a SwiftUI view. Simply add this modifier to View B (the view inside the sheet that you are presentin... | Present modal view on navigation to another view in swiftui | ios|swift|swiftui|swiftui-navigationlink | -1 | 512 | 2 | 72,065,532 | 72,065,532 | 1 | true | 2022-04-30T02:10:17.637Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Present modal view on navigation to another view in swiftui<p>Let me know if this is a duplicate question.</p>
<p>I am developing an app with a photo picker.... |
72,162,486 | How to convert string on variable in class?<p>how can i get access to variable in class using string?</p>
<pre><code>class GameShop:
ManaPotion = "ManaPotion"
priceManaPotion = 50
HealthPotion = "HealthPotion"
priceHealthPotion = 50
StaminaPotion = "StaminaPotion"
p... | <p>Use the <code>itemy</code> dictionary:</p>
<pre><code>product_name = input("Product Name")
print(f'{GameShop.itemy[product_name]}'
</code></pre>
<p>The dictionary is really the only part of the <code>GameShop</code> class that you need; I'd suggest not even making <code>GameShop</code> a class, and just ma... | How to convert string on variable in class? | python|string | -1 | 43 | 2 | 72,162,511 | 72,162,511 | 1 | true | 2022-05-08T15:26:50.317Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert string on variable in class?<p>how can i get access to variable in class using string?</p>
<pre><code>class GameShop:
ManaPotion = "M... |
72,213,394 | Vendor Machine API's Postman Collection Issue<h1>I am trying to create a postman collection for a Vendor machine API but when I try to send a login request <code>localhost:3000/auth/login</code> I get connect ECONNREFUSED 127.0.0.1:3000</h1>
<p>Could the below error be the one making postman not respond to endpoint req... | <p>Thanks to Torsten and Jay McDoniel. They helped me realize that I was doing it the wrong way! I had indicated <code>PORT=1003</code> in my .env file, so I ought to have used <code>localhost:1003/...</code> The default is <code>localhost:3000/...</code> that is to be used when no port is provided in the .env file. So... | Vendor Machine API's Postman Collection Issue | typescript|rest|postman|localhost|nestjs | -1 | 40 | 1 | 72,221,442 | 72,221,442 | 1 | true | 2022-05-12T09:46:40.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vendor Machine API's Postman Collection Issue<h1>I am trying to create a postman collection for a Vendor machine API but when I try to send a login request <... |
72,176,798 | Rolling COUNT DISTINCT of n-day active users using T-SQL<p>I am counting 7-day active users using <strong>T-SQL</strong>. I used the following code:</p>
<pre><code>SELECT
*,
COUNT(DISTINCT [UserID]) OVER (
PARTITION BY [HospitalID], [HospitalName], [Device]
ORDER BY [Date]
ROWS 7 PRECE... | <p>Sorry to see that <code>COUNT DISTINCT</code> was not supported in that type of SQL... I hadn't known that. Especially after you went to the trouble of fixing the gaps between dates!</p>
<p>I used <a href="https://www.rasgoml.com/data-analysis-tutorials" rel="nofollow noreferrer">Rasgo</a> to generate the SQL -- so ... | Rolling COUNT DISTINCT of n-day active users using T-SQL | sql|sql-server|tsql | -1 | 77 | 1 | 72,177,217 | 72,177,217 | 1 | true | 2022-05-09T18:40:34.733Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rolling COUNT DISTINCT of n-day active users using T-SQL<p>I am counting 7-day active users using <strong>T-SQL</strong>. I used the following code:</p>
<pre... |
72,159,557 | Matplotlib and Pandas Plotting Score average for every year<p>I have pandas Dataframe that looks like this:</p>
<p><a href="https://i.stack.imgur.com/k0uYv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k0uYv.png" alt="Dataframe" /></a></p>
<p>I want to scatter plot the average of each 'Score' for h... | <p>You could use seaborn to plot it, it's very intuitive.</p>
<pre><code>import pandas as pd
import seaborn as sns
import random
df = pd.DataFrame()
df["Publish_date"] = [random.randrange(0,11) for _ in range(20)]
df["Score"] = [random.randrange(0,60)/10 for _ in range(20)]
df_grouped_by_year = df... | Matplotlib and Pandas Plotting Score average for every year | python|pandas|matplotlib|plot | -1 | 47 | 1 | 72,159,714 | 72,159,714 | 1 | true | 2022-05-08T09:11:54.403Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Matplotlib and Pandas Plotting Score average for every year<p>I have pandas Dataframe that looks like this:</p>
<p><a href="https://i.stack.imgur.com/k0uYv.p... |
72,207,913 | rename files that match strings in a txt file<p>I am trying to rename multiple files according to the match to a .txt file
my files are</p>
<pre><code>GCF_000698265.1_ASM69826v1_genomic.gff.gz
GCF_000785125.1_ASM78512v1_genomic.gff.gz
GCF_000934565.1_ASM93456v1_genomic.gff.gz
GCF_000963495.1_ASM96349v1_genomic.gff.gz
<... | <p>Using <code>sed</code> and <code>bash</code>, assuming the txt file is named 'rename.txt'</p>
<pre><code>sed 's/^/mv /' rename.txt | bash
</code></pre>
<p>Using awk:</p>
<pre><code>awk '{system("mv " $1 " " $2)}' rename.txt
</code></pre>
<p>The key here is to insert "mv " to the beginni... | rename files that match strings in a txt file | awk|rename|mv | -1 | 145 | 3 | 72,208,154 | 72,208,154 | 1 | true | 2022-05-11T21:43:11.967Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
rename files that match strings in a txt file<p>I am trying to rename multiple files according to the match to a .txt file
my files are</p>
<pre><code>GCF_00... |
72,169,914 | How to get the the shape and the type of any object in Python<p>I would like to know if there is a way to get the shape and the type of any variable in Python. In the IDE Spyder, there is a variable explorer that lists this information for all types of objects (numpy arrays, pandas dataframes, lists etc.) as you can se... | <p>To get <code>type</code> of any object use <a href="https://docs.python.org/3/library/functions.html?highlight=type#type" rel="nofollow noreferrer"><code>type()</code></a>:</p>
<p>For eg:</p>
<pre><code>>>> type([1,2,3])
<class 'list'>
>>> type(np.array([1,3,4]))
<class 'numpy.ndarray'>... | How to get the the shape and the type of any object in Python | python | -1 | 121 | 1 | 72,170,236 | 72,170,236 | 1 | true | 2022-05-09T09:41:49.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get the the shape and the type of any object in Python<p>I would like to know if there is a way to get the shape and the type of any variable in Pytho... |
72,141,183 | does openxlsx offer bullet/key point functionality?<p>I need to output, using the openxlsx R package, some text rows in bullet point format. There doesn't appear to be a createStyle() option for doing this. Is anyone aware of a way to do this using openxlsx?</p> | <p>In the absence of reproducible data I've made up a small dataframe. You can do this with excel formulas, using the excel CHAR() function which accesses unicode characters. The example uses a solid dot, but you can use whatever bullet symbol appeals.</p>
<pre class="lang-r prettyprint-override"><code>library(openxlsx... | does openxlsx offer bullet/key point functionality? | r|openxlsx | -1 | 29 | 1 | 72,142,274 | 72,142,274 | 1 | true | 2022-05-06T12:03:56.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
does openxlsx offer bullet/key point functionality?<p>I need to output, using the openxlsx R package, some text rows in bullet point format. There doesn't ap... |
72,173,865 | How to declare and instantiate a matrix of arrays<p>I am trying to Instantiate a matrix that contains arrays of colors.
But I am doing something wrong.</p>
<pre><code>Color[][,] map_clrs = new Color[64][ 8, 8 ];
</code></pre>
<p>I would like to end up with the following data structure.
I put Color[] first because I ass... | <pre><code>Color[][,] map_clrs = new Color[64][,];
for(var i = 0;i<64;i++)
{
map_clrs[i] = new Color[8,8];
}
</code></pre>
<p>And for the inverse:</p>
<pre><code>Color[,][] map_clrs = new Color[8,8][];
for(var i = 0;i<8;i++)
{
for (var j=0;j<8;j++)
{
map_clrs[i,j] = new Color[64];
}
}... | How to declare and instantiate a matrix of arrays | c# | -1 | 72 | 1 | 72,173,893 | 72,173,893 | 1 | true | 2022-05-09T14:43:32.077Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to declare and instantiate a matrix of arrays<p>I am trying to Instantiate a matrix that contains arrays of colors.
But I am doing something wrong.</p>
<... |
72,213,464 | How to navigate with react native expo?<p>I know it is a basic question but when I search on the web the answer is always a single file mith multiple functions <a href="https://snack.expo.io/?platform=android&name=Hello%20React%20Navigation%20%7C%20React%20Navigation&dependencies=%40expo%2Fvector-icons%40*%2C%4... | <p>The link which you provide we only need to do the changes that we have to create new file and paste that function in new file like below</p>
<p><strong>HomeScreen.js file is looks like this</strong></p>
<pre><code>import * as React from 'react';
import { Button, View, Text } from 'react-native';
Const HomeScreen = (... | How to navigate with react native expo? | reactjs|react-native|navigation|react-navigation | -1 | 57 | 1 | 72,214,835 | 72,214,835 | 1 | true | 2022-05-12T09:51:15.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to navigate with react native expo?<p>I know it is a basic question but when I search on the web the answer is always a single file mith multiple functio... |
72,182,067 | Reversing vectors in a vector error troubleshoot<pre><code>vector<vector<string>> Reverse(vector<vector<string>> a){
vector<string> dd;
for(int i = 0; i < a.size()/2; i++){
dd = a[i];
a[i] = a[-1*(i) - 1];
a[-1*(i) - 1] = dd;
}
return a;
}
</code>... | <p>You are trying to access negative positions in a vector. Positions starts from 0 to vector.size(). It's very bad what you are doing.You are getting a matrix and try to transform it in a vector?
You should review your code. Maybe you meant something like this?</p>
<pre><code>vector<vector<string>> reverse... | Reversing vectors in a vector error troubleshoot | c++ | -1 | 58 | 2 | 72,182,135 | 72,182,135 | 1 | true | 2022-05-10T07:12:50.167Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reversing vectors in a vector error troubleshoot<pre><code>vector<vector<string>> Reverse(vector<vector<string>> a){
vector<st... |
72,166,950 | react pass object key as prop<p>I want to pass array of strings from parent function component to child function component. At the child component the array should reflect the object key.</p>
<p>For example, send the following array from a parent BY PROP:
let colors = ['red','green','white']</p>
<p>and at the child com... | <p>Pass the array of keys to your component...</p>
<pre class="lang-jsx prettyprint-override"><code><Child colors={colors} />
</code></pre>
<p>then reduce that array to the matching keys from <code>config</code></p>
<pre class="lang-js prettyprint-override"><code>const arr = props.colors.reduce(
(acc, key) =>... | react pass object key as prop | javascript|reactjs | -1 | 177 | 2 | 72,167,009 | 72,167,009 | 1 | true | 2022-05-09T04:16:24.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
react pass object key as prop<p>I want to pass array of strings from parent function component to child function component. At the child component the array ... |
72,163,464 | Align Subtitles and Footers with LazyVGrid?<p>I have a question about using <strong>LazyVGrid</strong> to align the subtitles and footers for each column. Say I have a view like this:</p>
<pre><code> Title
Subtitle A Subtitle B Subtitle C
row1A row1B row1C
row2A row2B ... | <p>I mocked this up off of the Apple example at <a href="https://developer.apple.com/documentation/swiftui/grouping-data-with-lazy-stack-views" rel="nofollow noreferrer">Grouping Data with Lazy Stack Views</a>. The trick is to put the <code>LazyVStack</code> inside of the <code>ForEach</code> that goes through each sec... | Align Subtitles and Footers with LazyVGrid? | swiftui|ios15 | -1 | 113 | 1 | 72,165,448 | 72,165,448 | 1 | true | 2022-05-08T17:20:44.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Align Subtitles and Footers with LazyVGrid?<p>I have a question about using <strong>LazyVGrid</strong> to align the subtitles and footers for each column. Sa... |
72,184,463 | sql server, replace chars in string with values in table<p>how can i replace values in string with values that are in a table?</p>
<p>for example</p>
<pre><code> select *
into #t
from
(
select 'bla'c1,'' c2 union all
select 'table'c1,'TABLE' c2 union all
select 'value'c1,'000' c2 union all
select '.... | <p>You can do this via recursion. Assuming you have a table of find-replace pairs, you can number the rows and then use recursive cte:</p>
<pre><code>create table #t(c1 nvarchar(100), c2 nvarchar(100));
insert into #t(c1, c2) values
('bla', ''),
('table', 'table'),
('value', '000'),
('...', '');
declare @s nvarchar(ma... | sql server, replace chars in string with values in table | sql|sql-server|sqlclr | -1 | 48 | 1 | 72,184,877 | 72,184,877 | 1 | true | 2022-05-10T10:13:59.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
sql server, replace chars in string with values in table<p>how can i replace values in string with values that are in a table?</p>
<p>for example</p>
<pre><c... |
72,209,023 | `npx mrm@2 lint-staged` throw err that `.git` can't be found husky custom directrory<pre><code>xxx-MacBook-Pro:client xxx$ npx mrm@2 lint-staged
npx: installed 239 in 8.29s
Running lint-staged...
/Users/xxx/.npm/_npx/34378/lib/node_modules/mrm/bin/mrm.js:56
throw err;
^
Error: .git can't be found (see... | <p>Fixed:</p>
<ul>
<li><p>npx mrm@2 lint-staged</p>
<p>Failed</p>
</li>
<li><p>Fix the npm prepare script<br />
<code>"prepare": "cd .. && husky install client/.husky"</code></p>
</li>
<li><p>run <code>npm i</code> then</p>
</li>
<li><p>Added <code>pre-commit</code> manually</p>
<pre><code> ... | `npx mrm@2 lint-staged` throw err that `.git` can't be found husky custom directrory | prettier|pre-commit|husky | -1 | 376 | 1 | 72,209,079 | 72,209,079 | 1 | true | 2022-05-12T01:00:34.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
`npx mrm@2 lint-staged` throw err that `.git` can't be found husky custom directrory<pre><code>xxx-MacBook-Pro:client xxx$ npx mrm@2 lint-staged
npx: instal... |
72,157,780 | WPF TabControl - Add New Tab With Content Template<p>I am trying to make a demo application to help me understand WPF/MVVM. I have been struggling for 3 days looking at various tutorials and threads. I want to make a tab control with a new tab button (like <a href="https://docs.microsoft.com/en-us/archive/msdn-magazine... | <p>If you're trying to use MVVM, where is your view model? The approach you have so far is not very MVVM because you're using code-behind to add tab items. The MVVM approach would be to bind the <code>ItemSource</code> property of the <code>TabControl</code> to a collection of items and let the view model add the items... | WPF TabControl - Add New Tab With Content Template | c#|wpf | -1 | 106 | 1 | 72,158,779 | 72,158,779 | 1 | true | 2022-05-08T03:11:06.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WPF TabControl - Add New Tab With Content Template<p>I am trying to make a demo application to help me understand WPF/MVVM. I have been struggling for 3 days... |
72,143,949 | TypeError: x.include is not a function<p>I'm new on JS. In this code <code>country</code> is variable. Results can contain multiple answers at the same time 53,110,122 etc. And for example if I results have 68 I should get it but I get this error: <code>Uncaught TypeError: country.include is not a function</code></p>
<... | <p><code>includes</code> is a function built-in for arrays. You can use this function with Arrays only or with "values of an Object" which are also an array. Before applying this function to your array which is "country", You have to confirm that whether it is array or not. for that we have a built-... | TypeError: x.include is not a function | javascript | -1 | 206 | 1 | 72,144,135 | 72,144,135 | 1 | true | 2022-05-06T15:26:59.327Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TypeError: x.include is not a function<p>I'm new on JS. In this code <code>country</code> is variable. Results can contain multiple answers at the same time ... |
72,190,446 | Apache ActiveMQ AMQP Spring Boot AWS<p>I have an ActiveMQ AWS service with protocol AMQP. AWS returns to me:</p>
<pre><code>failover:(amqp+ssl://b-ca138bd4-e6c4-4596-8329-f11bebf40111-1.mq.us-east-1.amazonaws.com:5671,amqp+ssl://b-ca138bd4-e6c4-4596-8329-f11bebf40111-2.mq.us-east-1.amazonaws.com:5671)
</code></pre>
<p>... | <p>There are many things wrong with your code and configuration.</p>
<p><strong>First</strong>, the URL you're using for your client is incorrect. The <code>amqp+ssl</code> scheme is not valid for any client. That's the scheme used to define the connector in the ActiveMQ broker configuration.</p>
<p><strong>Second</str... | Apache ActiveMQ AMQP Spring Boot AWS | activemq|amqp|spring-amqp | -1 | 170 | 1 | 72,191,073 | 72,191,073 | 1 | true | 2022-05-10T17:08:52.427Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Apache ActiveMQ AMQP Spring Boot AWS<p>I have an ActiveMQ AWS service with protocol AMQP. AWS returns to me:</p>
<pre><code>failover:(amqp+ssl://b-ca138bd4-e... |
72,062,395 | Find number of duplicate columns<p>I have two tables, both with a column called TestID.</p>
<p>Table 1 has 4000 rows
Table 2 has 1000 rows.</p>
<p>I would like to see how many rows in table 2 have the same value in the TestID column compared to table 1.</p> | <p>A guess at what you're expecting:</p>
<pre><code>select count(t2.testId) T2Matches
from t1 join t2 on t1.TestId = t2.TestId;
</code></pre> | Find number of duplicate columns | mysql | -1 | 21 | 1 | 72,062,688 | 72,062,688 | 2 | true | 2022-04-29T18:37:12.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find number of duplicate columns<p>I have two tables, both with a column called TestID.</p>
<p>Table 1 has 4000 rows
Table 2 has 1000 rows.</p>
<p>I would li... |
72,065,951 | pass id from select to funtion in react js<p>pass id from select to funtion in react js after evry time the opions are changed i want to recive the corresponding id in updateStatus</p>
<pre><code> <select>
{this.state.hospital.map((ele) => {
return <... | <p>You should simply do</p>
<pre><code>
<select onChange={e => this.updateStatus(e.target.value)}>
{this.state.hospital.map((ele) =>
<option key={ele.id} value={ele.id} >{ele.name}</option>
)}
</select>
</code></pre> | pass id from select to funtion in react js | reactjs | -1 | 23 | 1 | 72,065,990 | 72,065,990 | 2 | true | 2022-04-30T05:27:19.707Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pass id from select to funtion in react js<p>pass id from select to funtion in react js after evry time the opions are changed i want to recive the correspon... |
72,133,139 | How to aggregate row values with multiple row criteria<p>I'm trying to aggregate values present in rows in which repeated values present in other columns must be used as a criteria:</p>
<p>This is what I have:</p>
<pre><code>Candidate, City, Ballot Box Number, Number of Votes
A Halifax 1 100
A Halifax 2 100
... | <p>Next time, please make it easy to reproduce your example data. Use this code:</p>
<pre><code>library(tidyverse)
candidate <- c("A","A","A","A","B","B","B","B")
city <- c("Halifax", "Halifax", "Halifax"... | How to aggregate row values with multiple row criteria | r | -1 | 29 | 1 | 72,133,482 | 72,133,482 | 2 | true | 2022-05-05T20:15:30.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to aggregate row values with multiple row criteria<p>I'm trying to aggregate values present in rows in which repeated values present in other columns mus... |
72,134,248 | R Dataframe Weighted Averages by Group<p>I have a dataframe looks like below (the true data has many more people):</p>
<pre><code>Year Player Club
2005 Phelan Chicago Fire
2007 Phelan Boston Pant
2008 Phelan Boston Pant
2010 Phelan Chicago Fire
2002 John New York Jet
2006 John ... | <p>Here, I cut out repeat Player-Club yrs. This could give wrong results if a player's data ends with repeats of the same club, but I can't immediately think of a better approach.</p>
<pre><code>df %>%
group_by(Player) %>%
filter(Club != lag(Club, default = "")) %>%
mutate(yrs = coalesce(Year -... | R Dataframe Weighted Averages by Group | r|dataframe|dplyr | -1 | 29 | 2 | 72,134,373 | 72,134,373 | 2 | true | 2022-05-05T22:28:08.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R Dataframe Weighted Averages by Group<p>I have a dataframe looks like below (the true data has many more people):</p>
<pre><code>Year Player Club
2005 ... |
72,142,169 | C# array issue due to indexing of int<p>I am fairly new to this and trying to learn. I am struggling trying to make a loop to find the max value in an array. I am not sure what I am doing wrong. I have searched everywhere and seen several people do it the way i am but do not know what i am missing…</p>
<pre><code>stati... | <p>The most basic change would be:</p>
<pre><code>static int FindMax(int[] arrayNumbs)
{
...
for (int Count = 0; Count < arrayNumbs.Length; Count++)
...
}
</code></pre>
<p>The rest is just fine. There are some ways to make it <em>better</em>, but I'm guessing this is a school assignment and you'll get t... | C# array issue due to indexing of int | c#|arrays|methods | -1 | 51 | 3 | 72,142,296 | 72,142,296 | 2 | true | 2022-05-06T13:22:03.543Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# array issue due to indexing of int<p>I am fairly new to this and trying to learn. I am struggling trying to make a loop to find the max value in an array.... |
72,143,839 | Convert a short DateTime string with date and time to DateTime<p>Having trouble with my Android project here trying to convert a string of DateTime into an actual DateTime object.
here's the code I wrote:</p>
<pre><code>string strDateTime = reminder.Date + " " + ((ReminderByTime)reminder).ReminderTime;
userDa... | <p>When you see <strong>Exact</strong> in the name of the <code>ParseExact()</code> method, <em>it means it!</em> The method is notoriously unforgiving about small typos or format variations.</p>
<p>In this case, the time portion of the format string uses a different separator than the actual value. <code>HH/mm</code>,... | Convert a short DateTime string with date and time to DateTime | c#|string|datetime|xamarin.android | -1 | 62 | 1 | 72,143,933 | 72,143,933 | 2 | true | 2022-05-06T15:19:08.493Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert a short DateTime string with date and time to DateTime<p>Having trouble with my Android project here trying to convert a string of DateTime into an a... |
72,148,556 | Getting Missing Months<p>I am working on a project where I am trying to chart the number of monthly order that I have received. My current data for monthlyOrder is:</p>
<pre><code>[
{
_id: { month: 12, year: 2021 },
year: 2021,
month: 'December',
orders: 1
},
{
_id: { month: 4, year: 2022 },
... | <blockquote>
<p>However, this is probably not the best way to do this, and I am not sure how to deal with dates where startYear < endYear, but startMonth === endMonth.</p>
</blockquote>
<p>I think an easier approach would be for each iteration of the loop to add a <em>single object</em> to the output array, along wi... | Getting Missing Months | javascript|node.js | -1 | 38 | 2 | 72,148,622 | 72,148,622 | 2 | true | 2022-05-07T00:26:22.720Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting Missing Months<p>I am working on a project where I am trying to chart the number of monthly order that I have received. My current data for monthlyOr... |
72,148,719 | returning the highest value in the key : value pair in a dictionary<p>I'm in need of some assistance in this code problem from a MOOC on python programming that I'm taking. This is just for self-learning, and not for any graded coursework. Could you please provide some guidance. I am stuck. Thanks in advance for your h... | <p>here is one way:</p>
<pre><code>most_active = max(some_dictionary,key=some_dictionary.get))
print(most_active)
</code></pre>
<p>output</p>
<pre><code>>>> Chopra, Deepak
</code></pre> | returning the highest value in the key : value pair in a dictionary | python|python-3.x | -1 | 50 | 2 | 72,148,752 | 72,148,752 | 2 | true | 2022-05-07T01:10:06.997Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
returning the highest value in the key : value pair in a dictionary<p>I'm in need of some assistance in this code problem from a MOOC on python programming t... |
72,148,480 | Decoding Base64 String in Java<p>I'm using Java and I have a Base64 encoded string that I wish to decode and then do some operations to transform.</p>
<p>The correct decoded value is obtained in JavaScript through function <code>atob()</code>, but in java, using <code>Base64.decodeBase64()</code> I cannot get an equal ... | <p><code>btoa</code> is broken and shouldn't be used.</p>
<p>The problem is, bytes aren't characters. Base64 encoding does only one thing. It converts <strong>bytes</strong> to a stream of characters that survive just about any text-based transport mechanism. And Base64 decoding does that one thing in reverse, it conve... | Decoding Base64 String in Java | javascript|java|base64|decode|scriptengine | -1 | 284 | 3 | 72,149,185 | 72,149,185 | 2 | true | 2022-05-07T00:08:51.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Decoding Base64 String in Java<p>I'm using Java and I have a Base64 encoded string that I wish to decode and then do some operations to transform.</p>
<p>The... |
72,152,362 | Opening file with specific format on Linux systems without iteration<p>I have a directory with many thousands of files, all of which have the general format of <code>***-***.txt</code> with the exception of one file with the format <code>***.txt</code>, which I am guaranteed to have exactly one of & whose exact nam... | <p>As noted, there is no way to avoid iterating over filenames.
The good news is that it really doesn’t matter. Even with thousands of entries (wut?!) it should not take much time, so if you only need to do it <em>once</em>, you are pretty much good to go.</p>
<h3>C++</h3>
<pre><code>// Life is easy in C++
#include &l... | Opening file with specific format on Linux systems without iteration | c|linux|file | -1 | 80 | 2 | 72,154,396 | 72,154,396 | 2 | true | 2022-05-07T12:12:25.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Opening file with specific format on Linux systems without iteration<p>I have a directory with many thousands of files, all of which have the general format ... |
72,155,986 | How to remove fonts and styles of text in php<p>I wanted to know how to convert text with font and style to plain text without font with php and also remove emoji?<br>
Example : <br>
To : Simple</p> | <p>You use the <code>Normalizer</code>.</p>
<pre><code>Normalizer::normalize($yourString);
</code></pre>
<p><a href="https://www.php.net/manual/en/normalizer.normalize.php" rel="nofollow noreferrer">https://www.php.net/manual/en/normalizer.normalize.php</a></p> | How to remove fonts and styles of text in php | php | -1 | 49 | 1 | 72,156,023 | 72,156,023 | 2 | true | 2022-05-07T20:02:19.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove fonts and styles of text in php<p>I wanted to know how to convert text with font and style to plain text without font with php and also remove ... |
72,150,477 | Check if string not in array in javascript<p>Yesterday I asked a question and, "with a little help from my friends" got my little javascript working.</p>
<p>This one:</p>
<pre><code><script type="text/javascript" >
function paint_cells() {
var tds = document.querySelectorAll('tbody td'),... | <p>Quotes don't matter. You have to reset the array to the trimmed value... trim returns the modified value, it doesn't "change in place".</p>
<pre><code>var arr = answers.split('|');
for(var ii=0; ii<arr.length; ii++){
arr[ii] = arr[ii].trim().toLowerCase();
}
</code></pre>
<p>Here's a working example... | Check if string not in array in javascript | javascript | -1 | 95 | 1 | 72,157,465 | 72,157,465 | 2 | true | 2022-05-07T07:42:25.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check if string not in array in javascript<p>Yesterday I asked a question and, "with a little help from my friends" got my little javascript workin... |
72,157,490 | How to use the AWS blockchain service with go-ethereum?<p>The AWS Blockchain service provides endpoints for <strong>HTTP</strong> and <strong>WebSocket</strong> protocols, but requires IAM signature verification to use them.</p>
<p>To use the HTTP endpoint, I just need to sign it in the <a href="https://github.com/gola... | <p>By reading the <a href="https://github.com/gorilla/websocket" rel="nofollow noreferrer">github.com/gorilla/websocket</a> source code, I found out that there is a logic in the <code>(*Dialer) DialContext</code> function to pass the http.Request pointer into the customizable <code>Proxy</code> function, which means I ... | How to use the AWS blockchain service with go-ethereum? | amazon-web-services|go|websocket|go-ethereum | -1 | 119 | 1 | 72,157,502 | 72,157,502 | 2 | true | 2022-05-08T01:39:00.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use the AWS blockchain service with go-ethereum?<p>The AWS Blockchain service provides endpoints for <strong>HTTP</strong> and <strong>WebSocket</stro... |
72,154,035 | Git - New repo allows me to "pull origin main" but cannot commit with "push origin main" and gives an error<p>It's been a minute since I've used git/github, and things seem to have changed a bit.</p>
<p>I set up a new repo on GitHub (with <em>readme</em>), then created a matching directory on my computer that I'll be w... | <h1>TL;DR: <code>git branch -m main</code></h1>
<p>For <em>your specific case</em>, the fix is easy: just rename your local branch <code>master</code> to <code>main</code> and you're good to go from here on using the newfangled names. Reading the rest of this is optional but should help you avoid future snags.</p>
<h1... | Git - New repo allows me to "pull origin main" but cannot commit with "push origin main" and gives an error | git|github | -1 | 46 | 2 | 72,157,779 | 72,157,779 | 2 | true | 2022-05-07T15:41:04.473Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Git - New repo allows me to "pull origin main" but cannot commit with "push origin main" and gives an error<p>It's been a minute since I've used git/github, ... |
72,162,158 | Why does not std::priority_queue constructor work?<p>Why is it that when I call the same constructor, it works in one case, but not in the other?</p>
<pre><code>std::vector<ulli> v(n);
for(int i = 0; i < n; i++){
inf >> v[i];
}
std::priority_queue<ulli> q1(std::greater<ulli>(), v); // f... | <p>Because of the default template parameter, the <code>Compare</code> of <code>std::priority_queue<ulli></code> is of type <code>std::less</code>, and in your first example, you use <code>std::greater</code> to initialize <code>std::less</code>, which is not correct.</p>
<p>With help of CTAD, just</p>
<pre><code... | Why does not std::priority_queue constructor work? | c++|priority-queue | -1 | 46 | 2 | 72,162,205 | 72,162,205 | 2 | true | 2022-05-08T14:48:56.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does not std::priority_queue constructor work?<p>Why is it that when I call the same constructor, it works in one case, but not in the other?</p>
<pre><c... |
72,162,281 | C++ Vector subscript out of range when assigning values<p>I am making a simple algorithm that counts how many times each number is represented in a vector. However, on compile it gives me the following error in popup: <strong>Vector subscript out of range</strong> and it is referencing to:</p>
<blockquote>
<p>File: C:... | <p>On the input <code>[-3, -2, -1]</code>, your program will:</p>
<ol>
<li>Set <code>mx=-1</code>.</li>
<li>Set <code>mn=-3</code>.</li>
<li>Create a vector <code>vl</code> of size <code>3</code>, so with the positions <code>vl[0]</code>, <code>vl[1]</code> and <code>vl[2]</code>.</li>
<li>Try to set <code>vl[3] += 1</... | C++ Vector subscript out of range when assigning values | c++|exception|vector | -1 | 113 | 1 | 72,162,546 | 72,162,546 | 2 | true | 2022-05-08T15:02:26.570Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ Vector subscript out of range when assigning values<p>I am making a simple algorithm that counts how many times each number is represented in a vector. H... |
72,166,581 | Permission java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()'<p>I am runnning an error about setting permission. I declared location and internet permissions in my Manifest and called <code>checkPermission()</code> and <code>onReque... | <p>Activities aren't initialized until onCreate is called. This means you can't use functions like getApplicationContext until then. Basically, Activities should never have init blocks. They should run everything in onCreate if it relies on a Context.</p> | Permission java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' | android|android-studio|kotlin|permissions|nullpointerexception | -1 | 201 | 1 | 72,166,707 | 72,166,707 | 2 | true | 2022-05-09T03:01:31.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Permission java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()'<p>I am ... |
72,166,898 | If a child class and parent class both implement the same interface, why is it only the parent class that is forced to add unimplemented methods?<p>I have three classes below <code>AnimalActions</code> an interface, and two other classes <code>Animal</code> which is the parent of <code>Human</code></p>
<p>The <code>Ani... | <p>This is simply because the child gets access to all parent methods, as well as the overriden methods from the Interface.
You can again override these methods, but then you need to call <code>super.someMethod()</code> if you need to call the parents implementation.</p> | If a child class and parent class both implement the same interface, why is it only the parent class that is forced to add unimplemented methods? | java|inheritance | -1 | 439 | 1 | 72,166,965 | 72,166,965 | 2 | true | 2022-05-09T04:06:34.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
If a child class and parent class both implement the same interface, why is it only the parent class that is forced to add unimplemented methods?<p>I have th... |
72,168,774 | How to format a json response in php<p>I am new to php and am trying to return a json response in a particular structure. Here is what I have tried so far:</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 ... | <p>You ask for stuff that we are unsure if db result returns but as nice_dev pointed out, you need something like this:</p>
<pre><code>$response = [];
if ($con) {
$sql = "select * from admission_view";
$result = mysqli_query($con, $sql);
if ($result) {
$x = 0;
while ($row = mysqli_fetch_assoc($... | How to format a json response in php | php|mysql|json|rest | -1 | 36 | 1 | 72,169,217 | 72,169,217 | 2 | true | 2022-05-09T08:05:41.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to format a json response in php<p>I am new to php and am trying to return a json response in a particular structure. Here is what I have tried so far:</... |
72,171,025 | How to look up or edit existing IBAction?<p>When adding an IBAction by ctrl + drag it is possible to see this menu:</p>
<p><a href="https://i.stack.imgur.com/WIxiI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WIxiI.png" alt="enter image description here" /></a></p>
<p>But how can I access it when ... | <p>You can check <code>IBAction</code> already existed in <code>xib</code> or <code>storyboard</code> by click on view / view controller -> on the right menu, select <code>Show the connections inspector</code></p>
<p><a href="https://i.stack.imgur.com/P8FOg.png" rel="nofollow noreferrer"><img src="https://i.stack.im... | How to look up or edit existing IBAction? | ios|xcode | -1 | 23 | 1 | 72,171,166 | 72,171,166 | 2 | true | 2022-05-09T11:10:57.023Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to look up or edit existing IBAction?<p>When adding an IBAction by ctrl + drag it is possible to see this menu:</p>
<p><a href="https://i.stack.imgur.com... |
72,171,948 | Regex not strictly following negative lookahead?<p>I have a regex which is matching urls which don't have <strong>quotes (double or single) at the end</strong> and <strong>have & (ampersand) in the url</strong>.</p>
<p>The regex i made</p>
<pre><code>([^'` "\n]+)\.([^ \n]+)&([^ "`'\n]+)(?!["'])
<... | <p>You need to make the lookahead active on the whole part after the ampersand. We then have the option of</p>
<ul>
<li><code>$</code> end of the line<br />
<em>or</em></li>
<li><code>(?=\s)</code> positive lookahead for a space.</li>
</ul>
<pre><code>([^' "\n]+)\.([^ \n]+)&((?!["'])[^ "'\n])+($|(?... | Regex not strictly following negative lookahead? | regex|regex-lookarounds | -1 | 54 | 2 | 72,172,230 | 72,172,230 | 2 | true | 2022-05-09T12:23:31.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex not strictly following negative lookahead?<p>I have a regex which is matching urls which don't have <strong>quotes (double or single) at the end</stron... |
72,171,744 | join table on condition<p>I have 3 tables <code>user</code>, <code>student_data</code>, <code>teacher_data</code>. A user can be either student or a teacher. If it is the teacher I want to join <code>user</code> and <code>teacher_data</code>. And if it is a student then I want to join <code>user</code> with <code>stude... | <p>I'd combine the two data tables in a sub-query, and then join the users to that.</p>
<pre><code>SELECT
*
FROM
usr u
LEFT JOIN
(
SELECT user_id, datum, xxx, NULL AS yyy FROM student_data
UNION ALL
SELECT user_id, datum, NULL, yyy FROM teacher_data
)
d
ON d.user_id = u.id
</code></pre>
<p><a h... | join table on condition | sql|oracle | -1 | 54 | 3 | 72,172,360 | 72,172,360 | 2 | true | 2022-05-09T12:07:04.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
join table on condition<p>I have 3 tables <code>user</code>, <code>student_data</code>, <code>teacher_data</code>. A user can be either student or a teacher.... |
72,178,030 | Find repeating bit sequence in number<p>How can I find multiples of a given bit sequence?
So the code should work like this:</p>
<pre><code>int bit = 0b100
for (int i = 0; i<=50;i++){
if (bit in i){
print(i);
}
}
</code></pre>
<p>This should print 4 (100) and 36 (100100).
I was trying to iterate ... | <p>You can use the modulo operator and shift operator to check the lower bits of the number and "reduce" the incoming number to check the next lower bits of the remaining number. The algorithm works like this:</p>
<ol>
<li>Do a modulo of the sequence on the number to check. The modulo must be 0.</li>
</ol>
<p... | Find repeating bit sequence in number | java|bit | -1 | 96 | 2 | 72,178,379 | 72,178,379 | 2 | true | 2022-05-09T20:44:52.170Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find repeating bit sequence in number<p>How can I find multiples of a given bit sequence?
So the code should work like this:</p>
<pre><code>int bit = 0b100
... |
72,181,492 | How to parse XML header properties in Java?<p>I am trying to parse a XML document.</p>
<p>I have successfully parsed the attribute having id tags but i wanted to parse the header attributes also;</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<XMLExample
xmlns="http://www.ex... | <p>If you want to get all or some of the attributes from the <code>XMLExample</code> node (id is an element) within an XML String using the DOM parser then you could do it this way:</p>
<p><strong>Example Demo Only:</strong></p>
<pre><code>String xmlString = "<?xml version=\"1.0\" encoding=\"UTF-... | How to parse XML header properties in Java? | java|xml|parsing|xml-parsing|attributes | -1 | 255 | 1 | 72,183,075 | 72,183,075 | 2 | true | 2022-05-10T06:16:34.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to parse XML header properties in Java?<p>I am trying to parse a XML document.</p>
<p>I have successfully parsed the attribute having id tags but i wante... |
72,180,397 | Updating Heroku App from different device?<p>I'm building my Express.js server app from different devices. I use the same git branch from both my PC and Laptop. And I successfully deploy this from my laptop. But the problem arises when I try to update some code and try to push from my PC using the command: <code>$ git ... | <p>Did you forget to add heroku as a git remote with the heroku cli?<br/>
<code>heroku git:remote -a example-app</code></p>
<p><a href="https://devcenter.heroku.com/articles/git#for-an-existing-app" rel="nofollow noreferrer">https://devcenter.heroku.com/articles/git#for-an-existing-app</a></p> | Updating Heroku App from different device? | git|heroku | -1 | 26 | 1 | 72,183,570 | 72,183,570 | 2 | true | 2022-05-10T03:25:20.033Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Updating Heroku App from different device?<p>I'm building my Express.js server app from different devices. I use the same git branch from both my PC and Lapt... |
72,183,433 | Angular Typescript convert file to string($byte)<p>I need to upload a file and send it as type $byte to the endpoint with POST method</p>
<p>First i am converting it to base64 and then from there to byte (i didn't find anywhere that I can directly convert it to byte, so maybe my point here is wrong)</p>
<p><strong>Code... | <p>There's no need to convert.</p>
<p>The values returned by the file input element's <code>files</code> property are of type <a href="https://developer.mozilla.org/en-US/docs/Web/API/File" rel="nofollow noreferrer"><code>File</code></a>, which is actually a binary <a href="https://developer.mozilla.org/en-US/docs/Web/... | Angular Typescript convert file to string($byte) | angular|typescript|file-upload | -1 | 90 | 1 | 72,183,729 | 72,183,729 | 2 | true | 2022-05-10T09:01:43.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular Typescript convert file to string($byte)<p>I need to upload a file and send it as type $byte to the endpoint with POST method</p>
<p>First i am conve... |
72,185,770 | Get user input as a list of integers<p>User input should be a list of nine integers. The code snippet below achieves that but it requires nine inputs from the user.</p>
<p>Is there a way to allow the user to just enter nine integers in a row and press enter?</p>
<pre><code>row=[]
for i in range(0,9):
while True:
... | <p>Try something like:</p>
<pre class="lang-py prettyprint-override"><code>user_input: list = list(map(int, input().split()))
</code></pre>
<p>We firstly grab an <code>input()</code>, eg. "1 2 3 4 5", then we <code>split()</code> it and we have <code>["1", "2", "3", "4"... | Get user input as a list of integers | python | -1 | 31 | 1 | 72,185,794 | 72,185,794 | 2 | true | 2022-05-10T11:48:09.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get user input as a list of integers<p>User input should be a list of nine integers. The code snippet below achieves that but it requires nine inputs from th... |
72,189,953 | Unit testing on imported package<p>I am currently creating unit testing for a project, i need to test a function that have dependency injection without interface from an entity. Here is the code</p>
<pre><code>func (u UserUsecase) CreateUser(ctx context.Context, p request.StoreUser) (entity.User, error) {
user := &... | <p>Use interface and use mock struct implements it to test</p>
<pre class="lang-golang prettyprint-override"><code>type User interface {
CreateUser(ctx context.Context, p request.StoreUser) (entity.User, error)
}
type user struct {
//... user struct
}
func (u *user) CreateUser(ctx context.Context, p request.Store... | Unit testing on imported package | unit-testing|go|dependency-injection|mocking|stub | -1 | 81 | 1 | 72,190,643 | 72,190,643 | 2 | true | 2022-05-10T16:29:47.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unit testing on imported package<p>I am currently creating unit testing for a project, i need to test a function that have dependency injection without inter... |
72,200,556 | Intersection with N matrices in MATLAB<p>I have a matrix <code>IntialMat</code>, and I have a structure with N other matrices. I want to have the indices of the matrices that intersect with a least one element of the matrix <code>IntialMat</code>. How can I do that in MATLAB?</p>
<p>For example InitialMat=[2, 5, 88; 55... | <p>You can loop over the matrices like this:</p>
<pre><code>IntialMat = randi(100, 3);
for i = 1:10
MatriciesStor{i} = randi(100, 3);
end
% Now compare all Mats against IntialMat
for i = 1:10
inter = intersect(MatriciesStor{i},IntialMat);
if ~isempty(inter)
fprintf("\nMatrix %d has intersectio... | Intersection with N matrices in MATLAB | matlab|intersection | -1 | 50 | 1 | 72,201,541 | 72,201,541 | 2 | true | 2022-05-11T11:50:57.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Intersection with N matrices in MATLAB<p>I have a matrix <code>IntialMat</code>, and I have a structure with N other matrices. I want to have the indices of ... |
72,203,316 | lambda function to calculate weighted average in a group by<p>I have made the following line of code :</p>
<pre><code>DF.groupby(["Name"], as_index=False).agg({"A": lambda x:sum(abs(x)) ,'B': 'first'}).round(2)
</code></pre>
<p>with a DF output :</p>
<div class="s-table-container">
<table class="s-t... | <p>You can use modify the columns using <code>assign</code>, then use <code>groupby.sum</code> find the totals; then <code>assign</code> again to find the ratio:</p>
<pre class="lang-py prettyprint-override"><code>out = df.assign(A=df['A'].abs(), B=df['A']*df['B']).groupby('Name', as_index=False).sum().assign(B=lambda ... | lambda function to calculate weighted average in a group by | python|pandas|dataframe|pandas-groupby | -1 | 135 | 1 | 72,204,064 | 72,204,064 | 2 | true | 2022-05-11T15:00:42.837Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
lambda function to calculate weighted average in a group by<p>I have made the following line of code :</p>
<pre><code>DF.groupby(["Name"], as_index... |
72,204,208 | Combine rows into columns in SQL Server in a particular way<p>I don't know how to describe my problem, but I'll do my best. I'm working in SQL Server 2014. I've simplified the problem as much as I can since I'm working with sensitive info.</p>
<p>I currently have a query that returns the following from a table of test ... | <p>Please try the following solution.</p>
<p><strong>SQL</strong></p>
<pre><code>-- DDL and sample data population, start
DECLARE @tbl TABLE (test_ID INT, question_id INT, is_checked VARCHAR(5));
INSERT INTO @tbl (test_ID, question_id, is_checked) VALUES
(1, 1, 'TRUE'),
(1, 2, 'TRUE'),
(1, 3, 'FALSE'),
(1, 4, 'FALSE'),... | Combine rows into columns in SQL Server in a particular way | sql|sql-server | -1 | 34 | 1 | 72,204,399 | 72,204,399 | 2 | true | 2022-05-11T16:02:10.663Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combine rows into columns in SQL Server in a particular way<p>I don't know how to describe my problem, but I'll do my best. I'm working in SQL Server 2014. I... |
72,205,998 | Less than Greater than signs in pyscript<p>I am trying to test this code on the webpage</p>
<p><a href="https://medium.com/analytics-vidhya/pyscript-use-python-code-in-html-f7c8b49486a4" rel="nofollow noreferrer">https://medium.com/analytics-vidhya/pyscript-use-python-code-in-html-f7c8b49486a4</a></p>
<p>When I test th... | <p>You have a number of source code lines that are folded together. This causes Python syntax errors.</p>
<p>Replace starting at <code># Mask of unwanted triangles</code> with this:</p>
<pre><code># Mask off unwanted triangles.
triang.set_mask(np.hypot(x[triang.triangles].mean(axis=1),
y[triang.triangles].mean(axis=1))... | Less than Greater than signs in pyscript | python|html|pyscript | -1 | 134 | 1 | 72,206,374 | 72,206,374 | 2 | true | 2022-05-11T18:31:27.593Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Less than Greater than signs in pyscript<p>I am trying to test this code on the webpage</p>
<p><a href="https://medium.com/analytics-vidhya/pyscript-use-pyth... |
72,211,583 | PHP: mktime() parse error invalid numeric literal<p>I need to set variable, let's call it <code>$times</code> to specific amount of 8AM. I tried using <code>mktime(08,00)</code> but it returns</p>
<blockquote>
<p>Parse error: Invalid numeric literal</p>
</blockquote>
<p>Since I'm new to php, I still don't know which fu... | <p>Just remove the leading zeros.</p>
<pre><code>mktime(8, 0);
</code></pre>
<p>It's because PHP is interpreting <code>08</code> as an octal number, and 8 is out of range in octal (0-7).</p> | PHP: mktime() parse error invalid numeric literal | php | -1 | 42 | 2 | 72,211,605 | 72,211,605 | 2 | true | 2022-05-12T07:25:41.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PHP: mktime() parse error invalid numeric literal<p>I need to set variable, let's call it <code>$times</code> to specific amount of 8AM. I tried using <code>... |
72,212,962 | Copy-paste multiple values to their placeholders notepad++<p>Suppose markup (many lines with same structure)</p>
<pre><code><a href="">xxx</a>
<a href="">yyy</a>
<a href="">zzz</a>
</code></pre>
<p>What is the best way to achive this? (copy-paste into hr... | <p>You could do the following replacement in regex mode:</p>
<pre><code>Find: <a href="">(.*?)</a>
Replace: <a href="$1">$1</a>
</code></pre>
<p>Here is a working regex <a href="https://regex101.com/r/iKSiqy/1" rel="nofollow noreferrer">demo</a>.</p> | Copy-paste multiple values to their placeholders notepad++ | html|notepad++ | -1 | 46 | 1 | 72,212,983 | 72,212,983 | 2 | true | 2022-05-12T09:15:56.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Copy-paste multiple values to their placeholders notepad++<p>Suppose markup (many lines with same structure)</p>
<pre><code><a href="">xxx<... |
72,214,828 | How in PhpStorm in Project Files to show size/modification date of file?<p>If there is a way in PhpStorm 2021.1 in Project Files area to show size and modification date of any file?</p> | <p>Yes, just enable <code>View | Appearance | Details in Tree Views</code> from the main menu.</p>
<p><a href="https://www.jetbrains.com/help/phpstorm/project-tool-window.html#show-filesize-timestamp" rel="nofollow noreferrer">https://www.jetbrains.com/help/phpstorm/project-tool-window.html#show-filesize-timestamp</a><... | How in PhpStorm in Project Files to show size/modification date of file? | phpstorm | -1 | 19 | 1 | 72,215,086 | 72,215,086 | 2 | true | 2022-05-12T11:36:49.030Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How in PhpStorm in Project Files to show size/modification date of file?<p>If there is a way in PhpStorm 2021.1 in Project Files area to show size and modifi... |
72,214,162 | Merging multiple CSV files into a single file in S3<p>I am looking to take a few files in S3 and merging all of them to one big file (All files have the same columns).
Is it possible to achieve this <strong>without downloading the files</strong>? Directly on S3 using Pyhton? Without using ECS/Lambda.</p>
<p>I have seen... | <blockquote>
<p>I am looking to take a few files in S3 and merging all of them to one big file (All files have the same columns). Is it possible to achieve this without downloading the files? Directly on S3 using Pyhton? Without using ECS/Lambda.</p>
</blockquote>
<p>No, this isn't possible. S3 doesn't run code for you... | Merging multiple CSV files into a single file in S3 | python|amazon-web-services|amazon-s3 | -1 | 50 | 1 | 72,215,309 | 72,215,309 | 2 | true | 2022-05-12T10:43:29.300Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Merging multiple CSV files into a single file in S3<p>I am looking to take a few files in S3 and merging all of them to one big file (All files have the same... |
72,215,565 | How output defined in java map put?<p>Please let me know how output of below java code is defined</p>
<pre><code>Map m=new HashMap();
m.put("A", "B");
m.put("A", m.put("A", "C"));
</code></pre>
<p>output:
<strong>A,B</strong></p>
<p>till 2nd line it is A,B
after going i... | <p>If you read the <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Map.html#put(K,V)" rel="nofollow noreferrer">documentation for the put</a> method you'll notice that it returns</p>
<blockquote>
<p>the previous value associated with key</p>
</blockquote>
<p>So in this case <code>m.put(&... | How output defined in java map put? | java | -1 | 43 | 1 | 72,215,610 | 72,215,610 | 2 | true | 2022-05-12T12:25:08.813Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How output defined in java map put?<p>Please let me know how output of below java code is defined</p>
<pre><code>Map m=new HashMap();
m.put("A", &q... |
72,165,561 | Scrape Spotify using Python<p>Im getting the <code>AttributeError: 'NoneType' object has no attribute 'find'</code> error. Before posting here with some research, possible problem could be that Cloudflare is blocking my access to Spotify. What would be thje workaround to this problem?</p>
<p>part of code looks like t... | <p><a href="https://stackoverflow.com/questions/72165561/scrape-spotify-using-python?noredirect=1#comment127553503_72165561">As I mentioned in my comment</a>, you need the add certain code <a href="https://stackoverflow.com/a/43590290/12511801">as is shown in this answer</a> for solve the 403 forbidden error.</p>
<p>Af... | Scrape Spotify using Python | python|web-scraping|beautifulsoup|spotify | -1 | 289 | 2 | 72,217,491 | 72,217,491 | 2 | true | 2022-05-08T22:37:32.490Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scrape Spotify using Python<p>Im getting the <code>AttributeError: 'NoneType' object has no attribute 'find'</code> error. Before posting here with some rese... |
72,217,421 | Remove all chars up to last known char C#<p>I have some string:</p>
<pre><code>var s = "*%hello%my%name%is%Mike%HowAreYou";
</code></pre>
<p>The <code>Mike%HowAreYou</code> is changed from object to object.</p>
<p>I want to trim all the start up to the last <code>%</code> and get <code>HowAreYou</code></p>
<p... | <pre><code>s.Substring(s.LastIndexOf('%') + 1)
</code></pre> | Remove all chars up to last known char C# | c#|string|trim | -1 | 36 | 2 | 72,217,502 | 72,217,502 | 2 | true | 2022-05-12T14:27:06.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove all chars up to last known char C#<p>I have some string:</p>
<pre><code>var s = "*%hello%my%name%is%Mike%HowAreYou";
</code></pre>
<p>The <c... |
72,217,399 | How do I declare the root as global and set it to null to indicate an empty tree in a structure in c++?<p>As a beginner in c++, I have encountered a problem trying to implement a structure for binary search tree. Shown below is part of my code but c++ kept reminding me that the "data member initializer is not allo... | <p>You simply write</p>
<pre><code>BstNode *root = nullptr;
</code></pre>
<p>outside of the struct.</p> | How do I declare the root as global and set it to null to indicate an empty tree in a structure in c++? | c++ | -1 | 56 | 1 | 72,217,637 | 72,217,637 | 2 | true | 2022-05-12T14:25:35.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I declare the root as global and set it to null to indicate an empty tree in a structure in c++?<p>As a beginner in c++, I have encountered a problem ... |
72,221,308 | PostgreSQL Nested Loop Join Performance<p>I have two tables <code>exchange_rate</code> (100 Thousand Rows) and <code>paid_date_t</code> (9 million rows) with below structure.</p>
<pre><code> "exchange_rate"
Column | Type | Collation | Nullabl... | <p>You should create a smaller table with just a sample of the rows from paid_date_t in it. It is hard to optimize a query if it takes a very long time each time you try to test it.</p>
<p>Your btree index has the column tested for equality as the 2nd column, which is certainly less efficient. The better btree index ... | PostgreSQL Nested Loop Join Performance | postgresql|join|indexing|query-optimization | -1 | 70 | 1 | 72,223,806 | 72,223,806 | 2 | true | 2022-05-12T19:43:27.870Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PostgreSQL Nested Loop Join Performance<p>I have two tables <code>exchange_rate</code> (100 Thousand Rows) and <code>paid_date_t</code> (9 million rows) with... |
72,225,132 | Vuejs get index in multiple input forms<p>I have an array of strings like:</p>
<pre><code>questions: [
"Question 1?",
"Question 2?",
"Question 3?",
"Question 4?",
],
</code></pre>
<p>Then I have form fields in my <code>data()</code> like:</p>
<pre><code>legitForm: {
nam... | <p>If you think of your questions as questions and answers, you can do something like this:</p>
<pre><code>questions: [
{
question: 'Question 1',
answer: null,
description: null,
duration: null,
},
{
question: 'Question 2',
answer: null,
description: null,
duration: null,
},
]
</... | Vuejs get index in multiple input forms | javascript|vue.js | -1 | 84 | 3 | 72,225,220 | 72,225,220 | 2 | true | 2022-05-13T06:11:14.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vuejs get index in multiple input forms<p>I have an array of strings like:</p>
<pre><code>questions: [
"Question 1?",
"Question 2?",
... |
72,222,675 | Standard Common Practice Method in Solidity to perfrom any type of division?<p>I am trying to do the following calculation with solidity:
3,000 / 45,000,000 = 0.000067 with the following method:</p>
<pre><code>// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
function divide(uint _num1, uint _num2) public pure r... | <p>Floating-point arithmetics are not supported in Solidity however you can use fixed-point arithmetics considering that you have 18 points of decimals if you use <code>uint256</code>.</p> | Standard Common Practice Method in Solidity to perfrom any type of division? | ethereum|solidity|smartcontracts | -1 | 165 | 1 | 72,238,145 | 72,238,145 | 2 | true | 2022-05-12T22:26:00.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Standard Common Practice Method in Solidity to perfrom any type of division?<p>I am trying to do the following calculation with solidity:
3,000 / 45,000,000 ... |
72,221,010 | Adding List items together while using provisional result<p>I have the following list:</p>
<pre><code>((a b) (c d) (e f))
</code></pre>
<p>and want to loop through it and combine the list elements together. I also have the loop for that, which works exactly like I want to:</p>
<pre><code>(loop for (x . tail) on l1
... | <h2>The Problem Statement</h2>
<p>The OP requirements are murky. Given an input list it isn't entirely clear what the output should be; this is compounded by inconsistencies in the example outputs provided by OP in the question and comments.</p>
<p>OP starts from a loop that combines the elements of an input list:</p>
... | Adding List items together while using provisional result | lisp|common-lisp | -1 | 103 | 2 | 72,244,738 | 72,244,738 | 2 | true | 2022-05-12T19:16:21.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding List items together while using provisional result<p>I have the following list:</p>
<pre><code>((a b) (c d) (e f))
</code></pre>
<p>and want to loop t... |
72,237,565 | twilio - how to make an outbound voice call in php<p>I have the below method. Currently is just calls up an external phone number and says "Welcome". I cannot understand how to connect a twilio number with an external phone number by voice? Lots of example of how to do text-to-voice but not much on voice t... | <p>If you want to connect your call there to another number, then you need to look at the <a href="https://www.twilio.com/docs/voice/twiml/dial" rel="nofollow noreferrer"><code><Dial></code> TwiML verb</a>.</p>
<p>You could, for example, update your <code>gomi.xml</code> to:</p>
<pre><code><Response>
<... | twilio - how to make an outbound voice call in php | php|twilio|twilio-api|twilio-twiml | -1 | 77 | 1 | 72,266,487 | 72,266,487 | 2 | true | 2022-05-14T05:22:04.440Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
twilio - how to make an outbound voice call in php<p>I have the below method. Currently is just calls up an external phone number and says "Welcome&quo... |
72,168,291 | How do I limit the api calls with exhaust map?<p>I am trying to make exhaustMap to work, but am not able to. I want to be able to limit the number of api calls. Right now when I search and it's loading, and I type in another value in the input, the code makes a new api call. I want to limit this, so that this does not ... | <p>If I understand your requirement correctly, and you wish to ignore all <code>keyup</code> events until the HTTP API request for the current event is completed, you'd need only to switch the <code>switchMap</code> with <code>exhaustMap</code> and remove the current <code>exhaustMap</code>.</p>
<pre class="lang-js pre... | How do I limit the api calls with exhaust map? | angular|rxjs | -1 | 210 | 1 | 72,168,655 | 72,168,655 | 2 | true | 2022-05-09T07:22:10.623Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I limit the api calls with exhaust map?<p>I am trying to make exhaustMap to work, but am not able to. I want to be able to limit the number of api cal... |
72,189,183 | Try to use a command to Install login page?<p>I downloaded a project from Github and followed the instruction to open it for login in. I have to use <code>php artisan make:auth</code> but there is an error, how can you help me?</p> | <p>That command is no longer available(Depends on the version ), use this:</p>
<pre class="lang-sh prettyprint-override"><code>composer require laravel/ui
php artisan ui vue --auth
php artisan migrate
</code></pre>
<p>source :
<a href="https://laravel.com/docs/9.x/authentication" rel="nofollow noreferrer">Laravel </a><... | Try to use a command to Install login page? | php|laravel | -1 | 33 | 1 | 72,189,197 | 72,189,197 | 2 | true | 2022-05-10T15:32:10.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Try to use a command to Install login page?<p>I downloaded a project from Github and followed the instruction to open it for login in. I have to use <code>ph... |
72,218,342 | xpath to extract the text in selenium<p>Need help in extracting the case id, would be great help</p>
<blockquote>
</blockquote>
<pre><code> <div class="note note-info"><h4 id="note-label-CreateCaseUploadDoc:Display_Process_Combination1:RequestID" class="note-title">A new r... | <p>You can use <code>following-sibling</code> to get text node value from p tag as follow:</p>
<pre><code>//*[@class="note-title"]/following-sibling::p
</code></pre>
<p>OR</p>
<p>Using css selector</p>
<pre><code>.note.note-info h4 + p
</code></pre>
<p>Example with selenium</p>
<pre><code>txt = WebDriverWait... | xpath to extract the text in selenium | selenium|xpath|css-selectors|text-extraction|domxpath | -1 | 277 | 1 | 72,218,785 | 72,218,785 | 2 | true | 2022-05-12T15:28:40.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
xpath to extract the text in selenium<p>Need help in extracting the case id, would be great help</p>
<blockquote>
</blockquote>
<pre><code> <div clas... |
72,235,419 | Cannot align in a cell the text on the left and Icon on the right<p>I am trying to achieve a very simple thing, I tried different options but none seems to work.
I have a simple JTable, in a column I use JLabel in order to show the text and the icon.
I just want to have the text to be on the left of the cell and the Ic... | <p>Had this old code lying around demonstrating the concept of using a panel as a renderer. The first 3 characters will be displayed on the left and the remainder on the right:</p>
<pre><code>import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableRendererPanel
{... | Cannot align in a cell the text on the left and Icon on the right | java|swing|jtable|renderer|tablecellrenderer | -1 | 57 | 1 | 72,237,036 | 72,237,036 | 2 | true | 2022-05-13T21:05:26.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cannot align in a cell the text on the left and Icon on the right<p>I am trying to achieve a very simple thing, I tried different options but none seems to w... |
72,144,475 | view of a NumPy array with non uniform stride<p>I have 1D array of N elements.
I need to create a PxR view (where PxR<N) on this array according to strides that re not uniform but rather specified in a aux list. Observe that aux list has exactly P elements. R is a constant.</p>
<p>Example</p>
<pre><code>INPUTS:
L=[1... | <p>With lists, that kind of list comprehension is the only option.</p>
<p>But if we start with arrays:</p>
<pre><code>In [298]: L=np.array([10,14,4,12,3,85,43,22,11,7,10])
...: R=3
...: aux=np.array([2,5,7])
</code></pre>
<p>We can make an indexing array with:</p>
<pre><code>In [299]: idx = aux[:,None]+np.ara... | view of a NumPy array with non uniform stride | numpy|performance|memory-efficient | -1 | 35 | 1 | 72,144,728 | 72,144,728 | 2 | true | 2022-05-06T16:07:10.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
view of a NumPy array with non uniform stride<p>I have 1D array of N elements.
I need to create a PxR view (where PxR<N) on this array according to stride... |
72,221,721 | Handling custom vector classes<p>I have come across many occasions where I want to have an item which is selected inside a vector, for this I have written the template class:</p>
<pre><code>// a vector wrapper which allows a specific item to be currently selected
template<typename T>
class VectorSelectable
{
pub... | <p>You mainly need to put the <code>std::vector<std::unique_ptr<T>></code> in <code>VectorSelectable</code> and hide all the pointer stuff from the interface. With a few small changes to your class, it could look like this:</p>
<pre class="lang-cpp prettyprint-override"><code>#include <algorithm>
#inc... | Handling custom vector classes | c++|templates|vector | -1 | 110 | 1 | 72,222,177 | 72,222,177 | 2 | true | 2022-05-12T20:27:27.053Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Handling custom vector classes<p>I have come across many occasions where I want to have an item which is selected inside a vector, for this I have written th... |
72,225,650 | Can't stringify an array-of-objects variable in react project<p>As you can see in the picture, <code>steppedJobDataState</code> is not empty. But x = stringified <code>steppedJobDataState</code>, and yet logging that shows an empty set of arrays.</p>
<p>I'm doing this because I need to use localStorage, but I'm just se... | <p>According to the result of cc(steppedJobDataState), each item in steppedJobDataState is an empty array with properties. It's like</p>
<pre><code>const steppedJobDataState = []
const item = [];
item.jobTitle = 'Random';
steppedJobDataState.push(item);
const x = JSON.stringify(steppedJobDataState);
cc(x);
</code></pre... | Can't stringify an array-of-objects variable in react project | javascript|reactjs|json|stringify | -1 | 175 | 2 | 72,226,073 | 72,226,073 | 2 | true | 2022-05-13T07:06:31.273Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't stringify an array-of-objects variable in react project<p>As you can see in the picture, <code>steppedJobDataState</code> is not empty. But x = stringi... |
72,192,123 | Which is the best/fastest practice? Create the same loop in each case of a switch statement, or to switch the same case of a for loop?<p>So I was about to write something like following code</p>
<pre class="lang-php prettyprint-override"><code>switch ($mode) {
case 'all':
foreach ($sortInfo as $info) $filte... | <p>Since you will only be running this once, any performance difference is entirely negligible. You could benchmark with a fixed dataset if you had to run it thousands of times, though still I doubt that you'd see more than a +/- 10% difference. Choose whichever version you find more readable. If you want to <em>save b... | Which is the best/fastest practice? Create the same loop in each case of a switch statement, or to switch the same case of a for loop? | php|arrays|for-loop|switch-statement | -1 | 81 | 3 | 72,192,247 | 72,192,247 | 2 | true | 2022-05-10T19:42:13.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Which is the best/fastest practice? Create the same loop in each case of a switch statement, or to switch the same case of a for loop?<p>So I was about to wr... |
72,226,585 | How to convert SqlDataReader result to generic list List<T><p>I'm trying to fetch records form Azure database using Ado.net I used <strong>SqlDataReader</strong> class for that. Even though the data fetch is successful, I don't know how to convert it into a generic list.</p>
<pre><code>protected List<T> GetList&l... | <p>SqlDataReader isn't a container, it's a cursor used to load data. It can't be converted to any container type. The application code must use it to load the results and then construct the objects and place them in a list. This is described in the ADO.NET docs, eg in <a href="https://docs.microsoft.com/en-us/dotnet/fr... | How to convert SqlDataReader result to generic list List<T> | c#|asp.net-mvc|azure|ado.net | -1 | 139 | 2 | 72,226,860 | 72,226,860 | 2 | true | 2022-05-13T08:29:30.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert SqlDataReader result to generic list List<T><p>I'm trying to fetch records form Azure database using Ado.net I used <strong>SqlDataReader</str... |
72,196,864 | Unexpected use of comma operator<p>I have following error message:</p>
<blockquote>
<p>Unexpected use of comma operator no-sequences</p>
</blockquote>
<p>This is the code:</p>
<pre><code><Icon.Clipboard onClick={() => (
this.handleModal("open","modify"), this.prettyPrint(JSON.stringif... | <p>It's the <code>,</code> after <code>this.handleModal("open","modify")</code>. That arrow function should use a full function body (<code>{</code> after the <code>=></code> and its accompanying <code>}</code> at the end) and a statement separator (<code>;</code> or newline) between the two func... | Unexpected use of comma operator | javascript|reactjs|function | -1 | 177 | 1 | 72,196,932 | 72,196,932 | 2 | true | 2022-05-11T07:14:28.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unexpected use of comma operator<p>I have following error message:</p>
<blockquote>
<p>Unexpected use of comma operator no-sequences</p>
</blockquote>
<p... |
72,230,748 | how to build a nested, dynamic JSON in Go<p>I'm writing a simple API in Go that reads from a database and outputs GeoJSON.</p>
<p>I have this working for simple points. But some of my data is lines (linestring). I would like to have a generic GeoJSON struct definition. However, as specified in GeoJSON, the "Featur... | <p>You can create a <code>map[string]any</code>, set its value for <code>Coordinates</code> and then marshal that.
Like this for example:</p>
<pre><code>package main
import (
"encoding/json"
"fmt"
)
type Point struct {
X, Y int
}
func main() {
m := map[string]any{}
var singleC... | how to build a nested, dynamic JSON in Go | json|go | -1 | 46 | 1 | 72,230,865 | 72,230,865 | 2 | true | 2022-05-13T13:55:16.260Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to build a nested, dynamic JSON in Go<p>I'm writing a simple API in Go that reads from a database and outputs GeoJSON.</p>
<p>I have this working for sim... |
72,167,389 | How to cause rerender of 2 components linked with database?<p>Suppose I have 2 components which are not linked (by props) A and B. They are linked but by the database, A has a button which allows it to change the database. And I want B to rerender (not all the page) when the database changes, is that possible?</p> | <p><code>&.</code> is called a safe navigation operator which was introduced in ruby 2.3, it works similar to the <code>try!</code> method and returns nil if the object is nil else returns the attribute value of the object.</p>
<pre><code>object = OpenStruct.new(a: 1)
object&.a
# => 1
object = nil
object&a... | How to cause rerender of 2 components linked with database? | javascript|node.js|reactjs | -1 | 61 | 1 | 72,167,510 | 72,167,510 | 2 | true | 2022-05-09T05:37:56.223Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to cause rerender of 2 components linked with database?<p>Suppose I have 2 components which are not linked (by props) A and B. They are linked but by the... |
72,149,573 | What does a generic type before the type name in a constructor call mean?<p>What does the code mean like this?</p>
<p><code>new <Number>ArrayList()</code></p>
<p>I know the correct way to write it like this</p>
<p><code>new ArrayList<Number>()</code></p>
<p>The first is not a generic, but what does it mean?... | <p>It's the type argument of function <code>new</code></p>
<pre class="lang-java prettyprint-override"><code> // Different type is semantic bad but good for testing the AST
final List<String> ls = new<Integer> ArrayList<Double>();
</code></pre>
<p>AST:</p>
<pre class="lang-java prettyprint-over... | What does a generic type before the type name in a constructor call mean? | java | -1 | 58 | 2 | 72,149,620 | 72,149,620 | 2 | true | 2022-05-07T04:47:43.947Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What does a generic type before the type name in a constructor call mean?<p>What does the code mean like this?</p>
<p><code>new <Number>ArrayList()</co... |
72,180,323 | left join if condition met , set to null<p>I am trying to write a sql join query for below tables.</p>
<p>I am trying get as in expected table.</p>
<p>The only join condition is that , if In table 1, the value of operation is 'D' i.e deleted, then the corresponding value of rows from table 2 should be null.</p>
<p>The ... | <p>You can get your desired result using <code>CASE WHEN</code>.
Basically, the query will look like this:</p>
<pre><code>SELECT t1.id, t1.operation, t1.keys,
CASE WHEN t1.operation = 'D' THEN NULL ELSE t2.col1 END col1,
CASE WHEN t1.operation = 'D' THEN NULL ELSE t2.col2 END col2
FROM table1 t1
LEFT JOIN table2 t2 ON... | left join if condition met , set to null | sql|postgresql|join | -1 | 68 | 2 | 72,180,596 | 72,180,596 | 2 | true | 2022-05-10T03:09:57.107Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
left join if condition met , set to null<p>I am trying to write a sql join query for below tables.</p>
<p>I am trying get as in expected table.</p>
<p>The on... |
72,232,012 | How can I calculate a really long number with modulo without using bcmod?<p>The bcmod function is deactivated and I won't be able to activate this because its not my own server.</p>
<p>For a reason I need to calculate an integer with a length of atleast 24 with modulo 97.
Integer cant be that long, thats why it can't w... | <p>If you've got a number that is too big you can divide the problem into several steps with smaller numbers. An example:</p>
<p>Suppose we do this in steps of 3 digits. So, <code>1550 % 16</code> is the same as first doing <code>155 % 16</code>, which is <code>11</code>. After this first step we combine the result wit... | How can I calculate a really long number with modulo without using bcmod? | php|modulo | -1 | 54 | 1 | 72,233,832 | 72,233,832 | 2 | true | 2022-05-13T15:27:22.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I calculate a really long number with modulo without using bcmod?<p>The bcmod function is deactivated and I won't be able to activate this because it... |
72,218,250 | If user adds "m" or "h" to input, print "mins" or "hours"<p>I'm wanting to print "mins" if the user inputs a number with "m" after; and "hours" if user inputs number with "h" after.</p>
<p>My code:</p>
<pre><code>import pyautogui
xtime = (input("Enter time (add: m for mins, ... | <p>The problem of your code is that what you're doing is adding a "m" if the string <code>xtime</code> is not null.</p>
<p>You should use <code>str.endswith</code> Python built-in function:</p>
<pre><code>xtime = (input("Enter time (add: m for mins, or h for hrs): "))
if xtime.endswith('m'):
pr... | If user adds "m" or "h" to input, print "mins" or "hours" | python|python-3.x|datetime|printing | -1 | 41 | 2 | 72,218,324 | 72,218,324 | 2 | true | 2022-05-12T15:21:38.723Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
If user adds "m" or "h" to input, print "mins" or "hours"<p>I'm wanting to print "mins" if the user inputs a number with "m" after; and &... |
72,206,373 | Implement Repository and Db Context .Net Core Console Entity Framework with DI<p>I am creating a .NET Core 6 console application.</p>
<p>I have a repository class <code>StorageCompetitorRepository</code> that implements an interface <code>IStorageCompetitorRepository</code>.</p>
<p>The following is breaking and showing... | <p>You are registering the interface but asking for the concrete implementation.</p>
<p>Here you are saying "When resolving a IStorageCompetitorRepository, give me the StorageCompetitorRepository"</p>
<pre><code>var services = new ServiceCollection()
.AddTransient<IStorageCompetitorReposito... | Implement Repository and Db Context .Net Core Console Entity Framework with DI | c#|.net-core|dependency-injection|entity-framework-core|console-application | -1 | 450 | 1 | 72,206,469 | 72,206,469 | 2 | true | 2022-05-11T19:06:59.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Implement Repository and Db Context .Net Core Console Entity Framework with DI<p>I am creating a .NET Core 6 console application.</p>
<p>I have a repository ... |
72,190,785 | Using numpy.where() to compare numbers in an array to an interval<p>I have an array of numbers:</p>
<p><code>my_arr = np.array([n, n+1, n+2 ... , m-1, m]</code></p>
<p>I want to create an array of Booleans which indicate which numbers are in some (closed) interval, <code>[A,B]</code>, to operate on some other related a... | <p>Operators "and" and "or" are not defined for numpy arrays.
In your case, you can use np.logical_and instead:</p>
<pre><code>my_boolean_arr = np.logical_and(my_arr>=A, my_arr<=B)
</code></pre>
<p><a href="https://numpy.org/doc/stable/reference/generated/numpy.logical_and.html" rel="nofollow ... | Using numpy.where() to compare numbers in an array to an interval | python|arrays|numpy|boolean-expression | -1 | 43 | 1 | 72,191,118 | 72,191,118 | 2 | true | 2022-05-10T17:37:26.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using numpy.where() to compare numbers in an array to an interval<p>I have an array of numbers:</p>
<p><code>my_arr = np.array([n, n+1, n+2 ... , m-1, m]</co... |
72,190,479 | SQL group by in Subquery<p>I'm trying to get monthly production using group by after converting the unix column into regular timestamp. Can you please tell how to use group by here in the code.</p>
<p>'''</p>
<pre><code>With production(SystemId, dayof, monthof, yearof, powerwatts, productionwattshours) as
(
Select S... | <p>I think you're looking for this (technically you don't need a subquery but it allows you to avoid repeating the <code>DATEADD()</code> expression):</p>
<pre><code>SELECT SystemId = 2368252,
[Month] = DATEFROMPARTS(YEAR(hrdtc), MONTH(hrdtc), 1),
powerwatts = SUM(powerwatts),
productionwatthours = SUM(production... | SQL group by in Subquery | sql|sql-server|group-by|subquery|data-analysis | -1 | 49 | 1 | 72,190,569 | 72,190,569 | 2 | true | 2022-05-10T17:11:40.917Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL group by in Subquery<p>I'm trying to get monthly production using group by after converting the unix column into regular timestamp. Can you please tell h... |
72,184,696 | erasing nlohmann::json object during iteration causes segmentation fault<p>I have a simple database consisting of objects with strings containing unix time as keys and strings containing instructions as values</p>
<p>I want to iterate though the database and erase any object who's key is smaller that current time ( so ... | <p>It's <em>extremely</em> normal for mutating container operations to invalidate iterators. It's one of the first things you should check for.</p>
<p>Documentation for <a href="https://json.nlohmann.me/api/basic_json/erase/#notes" rel="nofollow noreferrer"><code>nlohnmann::json::erase()</code></a>:</p>
<blockquote>
<p... | erasing nlohmann::json object during iteration causes segmentation fault | c++|json|segmentation-fault|nlohmann-json | -1 | 145 | 1 | 72,184,917 | 72,184,917 | 2 | true | 2022-05-10T10:29:08.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
erasing nlohmann::json object during iteration causes segmentation fault<p>I have a simple database consisting of objects with strings containing unix time a... |
72,196,676 | Efficient way to make REST handlers in Go (without repeating code)?<p>Currently I have too much repeated code for the handlers:</p>
<pre class="lang-golang prettyprint-override"><code>type GuestMux struct {
http.ServeMux
}
func main() {
guestMux := NewGuestMux()
http.ListenAndServe(":3001", guestMu... | <p>You can move the common logic to a separate function, and pass everything to it that is specific in each handler.</p>
<p>Let's assume you have these types and functions:</p>
<pre><code>type CreateGuestRequest struct{}
type UpdateGuestRequest struct{}
type CreateGuestResponse struct{}
type UpdateGuestResponse struct{... | Efficient way to make REST handlers in Go (without repeating code)? | api|rest|go|interface | -1 | 151 | 5 | 72,196,842 | 72,196,842 | 2 | true | 2022-05-11T06:59:02.560Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Efficient way to make REST handlers in Go (without repeating code)?<p>Currently I have too much repeated code for the handlers:</p>
<pre class="lang-golang p... |
72,205,596 | New list of not repeated elements<p>I want to create a function that take a lsit as argument, for example:</p>
<pre><code>list = ['a','b','a','d','e','f','a','b','g','b']
</code></pre>
<p>and returns a specific number of list elements ( i chose the number) such that no number occurs twice. For example if i chose 3:</p>... | <pre><code>def func(j, mylist):
# dedup, preserving order (dict is insertion-ordered as a language guarantee as of 3.7):
deduped = list(dict.fromkeys(mylist))
# Slice off all but the part you care about:
return deduped[:j]
</code></pre>
<p>If performance for large inputs is a concern, that's suboptimal ... | New list of not repeated elements | python|list | -1 | 73 | 5 | 72,205,883 | 72,205,883 | 2 | true | 2022-05-11T17:59:01.213Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
New list of not repeated elements<p>I want to create a function that take a lsit as argument, for example:</p>
<pre><code>list = ['a','b','a','d','e','f','a'... |
72,196,739 | Why does git log doesn't show HEAD and branches when passed to a pager<p>When passed to a pager (<code>git log | less</code>, <a href="https://stackoverflow.com/q/62803231/9157799"><code>watch git log</code></a>, etc), the <code>(HEAD -> master, origin/master, origin/HEAD)</code> doesn't show up.</p> | <p>It's called <em>ref names</em>. It doesn't show up because if we don't specify <code>--decorate</code>, <code>git log</code> will use <code>--decorate=auto</code> by default.</p>
<p>From <a href="https://git-scm.com/docs/git-log/en#Documentation/git-log.txt---decorateshortfullautono" rel="nofollow noreferrer">the do... | Why does git log doesn't show HEAD and branches when passed to a pager | git|git-log|pager | -1 | 80 | 1 | 72,196,740 | 72,196,740 | 2 | true | 2022-05-11T07:04:34.943Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does git log doesn't show HEAD and branches when passed to a pager<p>When passed to a pager (<code>git log | less</code>, <a href="https://stackoverflow.... |
72,215,952 | Traps as exceptions<p>The trap mechanism in Mumps has similarities to the exception mechanism in many other language.</p>
<p>Most examples I have seen of trap usage is for catching unintentional errors.</p>
<p>Is there also a way intentionally trigger an error, which can be caught by a trap, in a way that is similar to... | <p>You can do this by setting the <code>$ECODE</code> variable.</p>
<p>See also <a href="https://docs.yottadb.com/ProgrammersGuide/errproc.html#ecode" rel="nofollow noreferrer">https://docs.yottadb.com/ProgrammersGuide/errproc.html#ecode</a>.</p>
<p>This is YottaDB but I think it will work for GT.M too.</p>
<pre><code>... | Traps as exceptions | mumps|gtm-database|yottadb | -1 | 41 | 1 | 72,228,774 | 72,228,774 | 2 | true | 2022-05-12T12:53:38.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Traps as exceptions<p>The trap mechanism in Mumps has similarities to the exception mechanism in many other language.</p>
<p>Most examples I have seen of tra... |
72,175,730 | Sorting list of dictionaries based on nested value<p>I have the following data:</p>
<pre><code>[
{
"id": 2,
"members": [
{
"id": 1,
"username": "stefan",
"email": "stefan@test... | <p>You need to call <code>max()</code> to get the latest chat message in each list.</p>
<pre><code>new_list = sorted(data, key=lambda x: max(msg['created_on'] for msg in x['messages']))
</code></pre>
<p>But there's another problem. Your date strings are not in a format that can be ordered properly. You should change th... | Sorting list of dictionaries based on nested value | python|list|dictionary | -1 | 31 | 1 | 72,175,765 | 72,175,765 | 2 | true | 2022-05-09T17:03:05.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sorting list of dictionaries based on nested value<p>I have the following data:</p>
<pre><code>[
{
"id": 2,
"members"... |
72,147,098 | kafka - How to read and process messages in a fault tolerant way?<p>I am new to Kafka, and I am trying to understand how a Kafka Consumer can consume and process a message from a Kafka topic <strong>without losing messages if the consumer fails in between</strong>.</p>
<p>For Example:</p>
<p><em>There is a kafka topic ... | <p>As you mentioned a consumer offset can also be managed manually which you will need in this case to avoid duplications(by default the delivery guarantee is at least once) or missing an email as mentioned in your use case.</p>
<p>To manually control the offset auto-commit should be disabled (enable.auto.commit = fals... | kafka - How to read and process messages in a fault tolerant way? | apache-kafka|message-queue|event-sourcing | -1 | 100 | 1 | 72,149,321 | 72,149,321 | 2 | true | 2022-05-06T20:35:29.200Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
kafka - How to read and process messages in a fault tolerant way?<p>I am new to Kafka, and I am trying to understand how a Kafka Consumer can consume and pro... |
72,143,357 | How to solve a math sequence in R?<p>EDIT: I could not come up with a more precise question title but please let me know what better title I could use, thanks!</p>
<p>I have a "basic" math problem that I cannot turn into an R code. If I add 4 kg of rock <strong>every year</strong> to the soil and that 1% of <... | <p><strong>1)</strong> If u[i] and d[i] are the undissolved and dissolved rock at the end of year i and if we want to calculate that for n years then:</p>
<pre><code>n <- 3
u <- numeric(n)
u[1] <- 4
for(i in 2:n) u[i] <- (1-0.01) * u[i-1] + 4
u
## [1] 4.0000 7.9600 11.8804
d <- cumsum(0.01 * u)
d
## [... | How to solve a math sequence in R? | r|math|sequence | -1 | 63 | 2 | 72,144,129 | 72,144,129 | 2 | true | 2022-05-06T14:45:22.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to solve a math sequence in R?<p>EDIT: I could not come up with a more precise question title but please let me know what better title I could use, thank... |
72,143,901 | Delete Rows a day after the date has passed<p>I am still fairly new at script writing and am trying a write a script that deletes a row one day after the date which is in column L. The data is in range A133 to L117. I've gotten the code below from several different [sources][1] but it has several issues. The first bein... | <h2><strong>For your first issue:</strong></h2>
<blockquote>
<p>The first being that I get the error message "cannot read property 'getRange' of Null, on line 3 even though I've describe the array I want it to pull data from.</p>
</blockquote>
<p>This error means your <code>sheet</code> variable is incorrect.</p>
... | Delete Rows a day after the date has passed | date|google-apps-script|google-sheets|spreadsheet|delete-row | -1 | 125 | 1 | 72,144,869 | 72,144,869 | 2 | true | 2022-05-06T15:23:58.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Delete Rows a day after the date has passed<p>I am still fairly new at script writing and am trying a write a script that deletes a row one day after the dat... |
72,178,115 | Data types from csv columns using sed and regex<p>I have to resolve a problem for the university. I have to use a bash script to indicate the type of data of each column in a csv.</p>
<p>This is the header and the 1st line of the csv</p>
<pre><code>num_expediente;fecha;hora;localizacion;numero;cod_distrito;distrito;tip... | <p><code>Awk</code> will be a better choice as it can easily split the line into fields
to examine the fields one by one:</p>
<pre><code>awk -F';' -v OFS=';' '
NR>1 {
for (i = 1; i <= NF; i++) {
if (sub(/^[0-9]+:[0-9]+:[0-9]+$/, "(time)", $i));
else if (sub(/^[0-9]+\/... | Data types from csv columns using sed and regex | bash|sed | -1 | 100 | 1 | 72,178,995 | 72,178,995 | 2 | true | 2022-05-09T20:54:16.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Data types from csv columns using sed and regex<p>I have to resolve a problem for the university. I have to use a bash script to indicate the type of data of... |
72,212,348 | Wait x seconds for new emitted value before triggering a function<p>I have a child component that emits a value, and in the parent I perform an axios call with this value each time it is emitted. My problem is that I want to trigger the axios call only if in x ms (or seconds) the child has not emmited another value in ... | <p>What you need is <a href="https://medium.com/@jamischarles/what-is-debouncing-2505c0648ff1" rel="nofollow noreferrer">debouncing</a>. Here is an example:</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... | Wait x seconds for new emitted value before triggering a function | javascript|vue.js|vuejs3 | -1 | 50 | 3 | 72,212,512 | 72,212,512 | 2 | true | 2022-05-12T08:29:43.040Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wait x seconds for new emitted value before triggering a function<p>I have a child component that emits a value, and in the parent I perform an axios call wi... |
72,122,843 | Regex for ignoring matches<pre><code>*test*
**test**
***test***
</code></pre>
<p>In the above case, I want to match only <code>*test*</code> ignoring all other cases in a multiline text. Can anyone give me guidance on how to do this using regular expression?</p> | <p>This should work:</p>
<pre><code>(?<!\*)\*test\*(?!\*)
</code></pre>
<p>It uses negative look around to check whether there is an <code>*</code> before of after the match.</p>
<p>You can check that it does what you want: <a href="https://regex101.com/r/G23yZL/1" rel="nofollow noreferrer">https://regex101.com/r/G2... | Regex for ignoring matches | regex | -1 | 25 | 1 | 72,123,038 | 72,123,038 | 2 | true | 2022-05-05T06:32:48.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex for ignoring matches<pre><code>*test*
**test**
***test***
</code></pre>
<p>In the above case, I want to match only <code>*test*</code> ignoring all oth... |
72,237,645 | Access JSON like object properties<p>I have a return object like so:</p>
<p><a href="https://i.stack.imgur.com/jWUyY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jWUyY.png" alt="enter image description here" /></a></p>
<p>Can you tell me how to access its properties?</p>
<p>I have tried many ways ... | <p>Since the <code>config</code> property is a serialized JSON string. You can work with it simply by deserializing it as follows</p>
<pre><code>t.config = JSON.parse(T.config);
console.log(t.config.test);
</code></pre>
<p>However, if you have any control over how the object <code>t</code> is provided to you, please ... | Access JSON like object properties | angular|typescript|ionic-framework|lodash | -1 | 135 | 2 | 72,237,697 | 72,237,697 | 2 | true | 2022-05-14T05:41:33.257Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Access JSON like object properties<p>I have a return object like so:</p>
<p><a href="https://i.stack.imgur.com/jWUyY.png" rel="nofollow noreferrer"><img src=... |
72,139,238 | Create numpy array from function applied to (multiple) pandas columns<p>I have <code>pd.DataFrame</code> containing rows of values:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
df = pd.DataFrame({"col1": [1, 2, 3, 4, 5, 6], "col2": [6, 5, 4, 3, 2, 1]})
</code></pre>
<p>I ... | <p>You can try <code>np.vectorize</code></p>
<pre class="lang-py prettyprint-override"><code>def my_function(x, y):
x1, x2 = x
y1, y2 = y
return x1 > y1 and x2 < y2
arr = df.to_records(index=False)
f_vfunc = np.vectorize(my_function)
r = f_vfunc(arr[:, None], arr)
</code></pre>
<pre><code>print(r)
... | Create numpy array from function applied to (multiple) pandas columns | python|pandas|numpy | -1 | 59 | 2 | 72,140,893 | 72,140,893 | 3 | true | 2022-05-06T09:32:34.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create numpy array from function applied to (multiple) pandas columns<p>I have <code>pd.DataFrame</code> containing rows of values:</p>
<pre class="lang-py p... |
72,139,912 | Setting Azure AD Microsoft Graph Email API/Permission in Terraform<p>I am provisioning some Azure infrastructure using Terraform. Included in the setup requirement is some configuration of an Azure AD registered app and this requires the following Microsoft Graph permissions to be granted (see image below):</p>
<ul>
<l... | <p>For permission <code>type</code>, <code>Scope</code> corresponds to the <code>Delegated</code> permission type, where <code>Role</code> is the <code>Application</code> type.</p>
<p>The <code>email</code> OpenID scope is a <code>Delegated</code> permission type, so you need to change the permission <code>type</code> ... | Setting Azure AD Microsoft Graph Email API/Permission in Terraform | azure|permissions|azure-active-directory|terraform|microsoft-graph-api | -1 | 304 | 1 | 72,141,092 | 72,141,092 | 3 | true | 2022-05-06T10:19:38.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Setting Azure AD Microsoft Graph Email API/Permission in Terraform<p>I am provisioning some Azure infrastructure using Terraform. Included in the setup requi... |
72,145,654 | sort objects by key value 0 by number size<p>how i can sort this object by user_id ?</p>
<pre><code>{
key_1: { user_id: 3 },
key_2: { user_id: 1 },
key_3: { user_id: 2 }
}
</code></pre>
<p>I need this:</p>
<pre><code>{
key_2: { user_id: 1 },
key_3: { user_id: 2 },
key_1: { user_id: 3 }
}
</code></pre>
<p>thanks f... | <p>ES6 states a traversal order for object keys (see this <a href="https://2ality.com/2015/10/property-traversal-order-es6.html#traversing-the-own-keys-of-an-object" rel="nofollow noreferrer">article</a>):</p>
<ul>
<li>Integer indices in ascending numeric order.</li>
<li>Then, all other string keys, in the order in whi... | sort objects by key value 0 by number size | javascript|sorting|object | -1 | 99 | 2 | 72,145,770 | 72,145,770 | 3 | true | 2022-05-06T17:58:24.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
sort objects by key value 0 by number size<p>how i can sort this object by user_id ?</p>
<pre><code>{
key_1: { user_id: 3 },
key_2: { user_id: 1 },
key_3:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.