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,955,474 | Firebase function - how to create multiple documents from different collections<p>I am fairly new to writing functions and cannot figure out how to solve my issue or even search for it properly.</p>
<p>I have three collections:</p>
<p>current_projects</p>
<p>vendors</p>
<p>vendor_projects</p>
<p>when a new project is c... | <p>If you are trying to created a document in <code>project_vendors</code> collection for every vendor in <code>vendors</code> after a project is created then you can map an array of promises and then use <code>Promise.all()</code> as shown below:</p>
<pre><code>exports.createProjVen = functions.firestore.document(&quo... | Firebase function - how to create multiple documents from different collections | node.js|firebase|google-cloud-firestore|triggers|google-cloud-functions | 0 | 50 | 1 | 72,955,828 | 72,955,828 | 2 | true | 2022-07-12T16:23:44.333Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firebase function - how to create multiple documents from different collections<p>I am fairly new to writing functions and cannot figure out how to solve my ... |
72,956,392 | Get port value as output of security group in Terraform<p>I have the code to create security group in terraform</p>
<pre><code>resource "aws_security_group" "eks_group1"{
description = "Valid security group"
name = "eks_group1"
ingress {
from_port = 443
to_port = 443
... | <p>The <code>allowed_blocks</code> output value includes <code>toset([...])</code> in its output, which suggests that the provider has declared <code>ingress</code> as being represented as a <em>set of objects</em> data type.</p>
<p>Sets do not have any particular order, so it's not meaningful to ask for "the firs... | Get port value as output of security group in Terraform | terraform|aws-security-group|terraform-aws-modules | 0 | 50 | 1 | 72,956,549 | 72,956,549 | 2 | true | 2022-07-12T17:42:44.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get port value as output of security group in Terraform<p>I have the code to create security group in terraform</p>
<pre><code>resource "aws_security_gr... |
72,961,258 | How to do yearly comparison in spark scala<p>I have dataframe which contains columns like <strong>Month</strong> and <strong>Qty</strong> as you can see in below table:</p>
<pre><code>
| Month | Fruit | Qty |
| -------- | ------ | ------ |
| 2021-01 | orange | 5223 |
| 2021-02 | orange | 23 |
| ........ | <pre><code>import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.functions.{col, sum}
import spark.implicits._
val df1 = Seq(
("2021-01", "orange", 5223),
("2021-02", "orange", 23),
("2022-01", "orange", 2342),
("2022-02", &qu... | How to do yearly comparison in spark scala | scala|apache-spark | 1 | 50 | 1 | 72,963,242 | 72,963,242 | 2 | true | 2022-07-13T05:17:41.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do yearly comparison in spark scala<p>I have dataframe which contains columns like <strong>Month</strong> and <strong>Qty</strong> as you can see in b... |
72,962,086 | How can I backup couchdb data<p>How can I backup CouchDB data, because once we down the hyper ledger fabric network, we lost our previously stored data on CouchDB.
Is there any CouchDB cloud available for storing data?</p> | <p>Yes, <a href="https://www.ibm.com/cloud/cloudant" rel="nofollow noreferrer">IBM Cloudant</a> is a cloud service based on and fully compatible with CouchDB.
IBM also has a <a href="https://www.ibm.com/cloud/blockchain-platform" rel="nofollow noreferrer">hyperledger-based blockchain offer</a> so you might be able to c... | How can I backup couchdb data | docker|couchdb|hyperledger-fabric|docker-swarm | 1 | 50 | 1 | 72,964,526 | 72,964,526 | 2 | true | 2022-07-13T06:58:04.210Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I backup couchdb data<p>How can I backup CouchDB data, because once we down the hyper ledger fabric network, we lost our previously stored data on Co... |
72,968,019 | Convert string datetime to timestamp (with literal months) SPARK<p>I'm trying to cast the following string to timestamp in pyspark:</p>
<pre><code>"30-Jun-2022 14:00:00"
</code></pre>
<p>I've tried the following approaches:</p>
<pre><code>f.col("date_string").cast("timestamp"),
f.to_times... | <p>I do not have a testing environment for pyspark, but in Spark, this:</p>
<pre><code>.withColumn("timestamped",to_timestamp(col("name"), "dd-MMM-yyyy HH:mm:ss"));
</code></pre>
<p>returns this (which I assume is what you want):</p>
<pre><code>name,timestamped
30-Jun-2022 14:00:00,2022-06... | Convert string datetime to timestamp (with literal months) SPARK | apache-spark|pyspark | 0 | 50 | 1 | 72,968,563 | 72,968,563 | 2 | true | 2022-07-13T14:29:38.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert string datetime to timestamp (with literal months) SPARK<p>I'm trying to cast the following string to timestamp in pyspark:</p>
<pre><code>"30-J... |
72,968,858 | Does np.argmax return the first maximal?<p>Does <code>np.argmax</code> return the index of the <strong>first</strong> maximal element always?</p>
<p>Let <code>a = np.array([1, 3, -7, ...])</code> be a 1D-array with several maximal elements, say at indices <code>10</code>, <code>20</code> and <code>30</code>. Numpy seem... | <p>Yes, this is actually explicited in the <a href="https://numpy.org/doc/stable/reference/generated/numpy.argmax.html" rel="nofollow noreferrer"><code>numpy.argmax</code></a> documentation:</p>
<blockquote>
<p><strong>Notes</strong></p>
<p>In case of multiple occurrences of the maximum values, the indices
correspondin... | Does np.argmax return the first maximal? | python|numpy|argmax | 0 | 50 | 2 | 72,968,895 | 72,968,895 | 2 | true | 2022-07-13T15:29:03.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does np.argmax return the first maximal?<p>Does <code>np.argmax</code> return the index of the <strong>first</strong> maximal element always?</p>
<p>Let <cod... |
72,971,668 | Python Replace string if outside double quotes else ignore<p>Let's say I have a <code>JSON</code> with the following data:</p>
<pre><code>{"name":"John", "isAdult":True, "Address":"42 True Street SomeLand"}
</code></pre>
<p>I only want to replace <code>True</code> with ... | <p>I will assume you mean this is a string:</p>
<pre><code>'{"name":"John", "isAdult":True, "Address":"42 True Street SomeLand"}'
</code></pre>
<p>This is not valid JSON. For boolean values, JSON requires <code>true</code> and <code>false</code> to be all lower case.</p... | Python Replace string if outside double quotes else ignore | python|regex | 0 | 50 | 2 | 72,971,782 | 72,971,782 | 2 | true | 2022-07-13T19:31:57.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Replace string if outside double quotes else ignore<p>Let's say I have a <code>JSON</code> with the following data:</p>
<pre><code>{"name":&... |
72,974,209 | How to safely subslice a rust slice?<p>On Rust you can subslice a slice/vector/etc</p>
<pre><code>fn main() {
let a = vec![0; 6];
let b = &a[0..2];
println!("{:?}", b);
}
</code></pre>
<p>however this panics if the range for which you're slicing is too big.</p>
<p><strong>Is there a safe way t... | <p>Use <a href="https://doc.rust-lang.org/stable/std/primitive.slice.html#method.get" rel="nofollow noreferrer"><code>get()</code></a>:</p>
<pre class="lang-rust prettyprint-override"><code>fn main() {
let a = vec![0; 6];
let b = a.get(0..2);
println!("{:?}", b);
}
</code></pre> | How to safely subslice a rust slice? | rust | 0 | 50 | 1 | 72,974,213 | 72,974,213 | 2 | true | 2022-07-14T01:18:05.010Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to safely subslice a rust slice?<p>On Rust you can subslice a slice/vector/etc</p>
<pre><code>fn main() {
let a = vec![0; 6];
let b = &a[0..2... |
72,977,523 | Check if the related values in two columns are equal<p>In the following Excel sheet I want to find a formula in the third column to do the following:<br/>
For example, in the first column for all "A" Values if the related values on the second column are not equal, convert all to True and if they are equal kee... | <p>If the Fasle are actually typos for FALSE, you could just check for existence of <em>any</em> true in column B with same letter in column A:</p>
<pre><code>=COUNTIFS(A2:A12,A2:A12,B2:B12,TRUE)>0
</code></pre>
<p><a href="https://i.stack.imgur.com/DgoR4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgu... | Check if the related values in two columns are equal | excel|excel-formula | 0 | 50 | 2 | 72,978,366 | 72,978,366 | 2 | true | 2022-07-14T08:29:55.003Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check if the related values in two columns are equal<p>In the following Excel sheet I want to find a formula in the third column to do the following:<br/>
Fo... |
72,980,625 | Hide some legend entries in ggplot<p>I have the follow lines of code:</p>
<pre><code>ggplot() +
geom_line(data=TS_SimHeads_HOBS_final, aes(x=as.Date(Date), y=BH2672), color='red') +
geom_point(data=Hydro_dates_wellData_2014_2018, aes(x=as.Date(Date), y=BH2672), color='red') +
geom_line(data=TS_SimHeads_HOBS_fin... | <p>As is quite often the case you first have to convert both of your datasets to long or tidy format using e.g. <code>tidyr::pivot_longer</code> which will result in a new column with the variable names as categories which could then be mapped on the <code>color</code> aes. Doing so will automatically create a legend a... | Hide some legend entries in ggplot | r|ggplot2|legend|multiple-entries | 0 | 50 | 1 | 72,981,640 | 72,981,640 | 2 | true | 2022-07-14T12:36:35.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hide some legend entries in ggplot<p>I have the follow lines of code:</p>
<pre><code>ggplot() +
geom_line(data=TS_SimHeads_HOBS_final, aes(x=as.Date(Date)... |
72,992,776 | Index Match Match - Google Sheets<p>I have two tables in Google Sheets.</p>
<p><strong>Table 1</strong> is a list of contacts arranged vertically with multiple records appearing for each city.</p>
<p>In <strong>Table 2</strong>, I'd like the city name to appear only once and the contacts to be displayed horizontally.</... | <p>Your issue is happening because you are using a <code>MATCH()</code> function in the column parameter of the <code>INDEX()</code> function. <code>MATCH()</code> returns a row index of where the value is found, not a column.<br />
While it is possible to solve with an INDEX/MATCH method, another way you could solve t... | Index Match Match - Google Sheets | google-sheets|google-sheets-formula | 0 | 50 | 1 | 72,994,299 | 72,994,299 | 2 | true | 2022-07-15T10:43:55.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Index Match Match - Google Sheets<p>I have two tables in Google Sheets.</p>
<p><strong>Table 1</strong> is a list of contacts arranged vertically with multip... |
72,994,302 | How do I disable only the Clicked button for a mapped over component<p>I am mapping over the <code>request</code> variable and rendering it on the page, it has an array of object with a <code>question</code>, <code>correct_answer</code> and <code>incorrect_answer</code> properties, and I also set a state named <code>di... | <p>Essentially the issue is because your disabled <code>useState</code> is in the wrong place. It needs to be inside the <code>Question</code> component so you have 1 disabled flag per question rather than 1 global one.</p>
<pre class="lang-js prettyprint-override"><code>export default function Question (props) {
... | How do I disable only the Clicked button for a mapped over component | javascript|reactjs | 0 | 50 | 1 | 72,994,762 | 72,994,762 | 2 | true | 2022-07-15T12:52:40.860Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I disable only the Clicked button for a mapped over component<p>I am mapping over the <code>request</code> variable and rendering it on the page, it h... |
72,996,494 | How do I use CSS to center text vertically in a circle<p>I have a grid of circles, and in each circle I am trying to display text that is vertically centered. No matter what I try, nothing has worked so far.</p>
<p>Code is on codepen: <a href="https://codepen.io/slurmclassic/pen/bGvBJPJ" rel="nofollow noreferrer">https... | <p>I believe the problem here is the <code>padding-bottom</code> on <code>.grid-item</code>. Try replacing it with <code>aspect-ratio: 1/1;</code></p>
<p>If you need to support something not compatible <code>aspect-ratio</code> you might try to use a pseudo-element like <code>::after</code> with <code>padding-bottom: 1... | How do I use CSS to center text vertically in a circle | html|css | 1 | 50 | 3 | 72,996,605 | 72,996,605 | 2 | true | 2022-07-15T15:41:33.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I use CSS to center text vertically in a circle<p>I have a grid of circles, and in each circle I am trying to display text that is vertically centered... |
72,999,473 | Run-time error '52': Bad file name or number (SharePoint link vs Windows path)<p>When I try to assign a SharePoint link to flnameI I get a "Run-time error '52': Bad file name or number" on the yellow highlighte line in the image I attached
e.g. when flnameI = <strong><a href="https://cogsandwheels.sharepoint... | <p>You are attempting to open a file from a SharePoint Online location as compared to a local file system. When you're opening the local path, Windows automatically authenticate you in the background and it "just works". When you're trying to go after cloud hosted content such as this document in SharePoint... | Run-time error '52': Bad file name or number (SharePoint link vs Windows path) | excel|vba | 0 | 50 | 1 | 73,005,779 | 73,005,779 | 2 | true | 2022-07-15T20:50:14.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Run-time error '52': Bad file name or number (SharePoint link vs Windows path)<p>When I try to assign a SharePoint link to flnameI I get a "Run-time err... |
73,007,392 | How to select Java Profile (e.g. Compact 1, Compact 2, Full JRE) in NetBeans IDE 14?<h2>Short Version</h2>
<p>In NetBeans under <strong>Project Properties</strong> → <strong>Sources</strong> → <strong>Source Binary Format</strong>, there is supposed to be an option to select a <strong>Java Profile</strong>:</p>
<p><a h... | <p>I am not sure if this is a full answer, but here is what I can share:</p>
<ol>
<li><p>I have tested what you see using NetBeans v8.2 and NetBeans v13.</p>
</li>
<li><p>For the NetBeans v8.2 platform (using Java v8), when you create a new project using <code>File > New Project... > Java > Java Application</c... | How to select Java Profile (e.g. Compact 1, Compact 2, Full JRE) in NetBeans IDE 14? | java|netbeans|netbeans-14 | 1 | 50 | 1 | 73,008,685 | 73,008,685 | 2 | true | 2022-07-16T20:17:36.213Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to select Java Profile (e.g. Compact 1, Compact 2, Full JRE) in NetBeans IDE 14?<h2>Short Version</h2>
<p>In NetBeans under <strong>Project Properties</s... |
73,017,704 | Laravel one to many relationship query doesn't get produced properly<p>I'm designing a feedback web app using Laravel 9 and it has two tables called <code>users</code> and <code>feedbacks</code>, which have a one to many relationship. I tried to implement this using Laravel but when I try to get the data using <code>Us... | <p>Remember, Eloquent will automatically determine the proper foreign key column for the Feedback model. By convention, Eloquent will take the <strong>"snake case" name of the parent model and suffix it with _id</strong>. So, in this example, Eloquent will assume the foreign key column on the Feedback model i... | Laravel one to many relationship query doesn't get produced properly | php|mysql|laravel|eloquent|laravel-9 | 1 | 50 | 2 | 73,017,840 | 73,017,840 | 2 | true | 2022-07-18T05:32:47.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Laravel one to many relationship query doesn't get produced properly<p>I'm designing a feedback web app using Laravel 9 and it has two tables called <code>us... |
73,025,468 | R compute average increase for a timeseries dataset<p>Let' say I have the following dataset.</p>
<p>How can I compute the average increase in times (I don't know a proper word for this)?</p>
<p>Meaning you know like I want to tell the audience, that the <code>average temperature</code> in <code>2021</code> increased th... | <p>You can use the slope of the regression line to get the increase per year based on fitting a linear model to the data.</p>
<pre><code>fm <- lm(AvgTMean ~ year, DF); fm
##
## Call:
## lm(formula = AvgTMean ~ year, data = DF)
##
## Coefficients:
## (Intercept) year
## -6.93064 0.01582 <-- 0.0... | R compute average increase for a timeseries dataset | r|dplyr|exploratory-data-analysis | 0 | 50 | 2 | 73,025,680 | 73,025,680 | 2 | true | 2022-07-18T16:14:01.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R compute average increase for a timeseries dataset<p>Let' say I have the following dataset.</p>
<p>How can I compute the average increase in times (I don't ... |
73,024,221 | how to translate the result not found message of a select2 with laravel<p>I have a problem with the translation of select2 which is filled via an ajax call. I would like to translate the text result not found. If someone can help me it will be really nice. <a href="https://i.stack.imgur.com/QMwy4.png" rel="nofollow nor... | <p>You can customize not found text using property <code>noResults</code></p>
<p>Example of code</p>
<pre><code> {
"language": {
"noResults": function(){
return "My custom No Results Found";
}
},
</code></pre> | how to translate the result not found message of a select2 with laravel | laravel|select | -1 | 50 | 1 | 73,026,013 | 73,026,013 | 2 | true | 2022-07-18T14:44:53.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to translate the result not found message of a select2 with laravel<p>I have a problem with the translation of select2 which is filled via an ajax call. ... |
73,030,519 | How to create Microsoft Dependency injection for onetime tenant scope creation<p>I have multi tenant architecture on database divide by database scheme. on Web API, I want to create an instance of a service that load data from database one time, and then get data from service like a cache instead of access database eve... | <blockquote>
<p>My question is how can I create the instance of service that like Singleton of each tenant with Microsoft Dependency injection?</p>
</blockquote>
<p>You are looking for a "per tenant lifestyle" in MS.DI, but there isn't. The three basic lifestyles is all you got with MS.DI and there's little w... | How to create Microsoft Dependency injection for onetime tenant scope creation | c#|asp.net-core|dependency-injection | 0 | 50 | 1 | 73,033,802 | 73,033,802 | 2 | true | 2022-07-19T02:37:40.963Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create Microsoft Dependency injection for onetime tenant scope creation<p>I have multi tenant architecture on database divide by database scheme. on W... |
72,864,901 | Is there a Task.Run equivalent in JavaScript?<p>In C# there is the Task.Run(() => {}) method which makes it easy to run code asynchronously. Is there an equivalent method in JavaScript?</p>
<p>So far, the closes I've gotten is <a href="https://javascript.info/settimeout-setinterval#nested-settimeout" rel="nofollow n... | <p>While I'm by no stretch of the imagination a JS expert (or even proficient in JS), you should he able to use immediately-invoked Function Expressions and the fact that promises are always immediately executed to do achieve this, something like</p>
<pre class="lang-js prettyprint-override"><code>// we want/ need a pr... | Is there a Task.Run equivalent in JavaScript? | javascript|c#|multithreading | 0 | 50 | 1 | 72,865,048 | 72,865,048 | 2 | true | 2022-07-05T06:34:05.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a Task.Run equivalent in JavaScript?<p>In C# there is the Task.Run(() => {}) method which makes it easy to run code asynchronously. Is there an e... |
72,830,278 | Getting error when changing Ansible password<p>I am building an ansible playbook to change multiple passwords on our network. And it works! It changes all of the passwords like it is supposed to. However, the last password it changes is the ansible password, which then throws an error because it tries to do the success... | <p>I'd try to do this with an <a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html" rel="nofollow noreferrer">async task</a> and check back on the result with the new password:</p>
<pre class="lang-yaml prettyprint-override"><code>- hosts: rhel
become: yes
tasks:
- name: Set ansible... | Getting error when changing Ansible password | ansible|change-password | 1 | 50 | 1 | 72,837,761 | 72,837,761 | 2 | true | 2022-07-01T13:47:17.457Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting error when changing Ansible password<p>I am building an ansible playbook to change multiple passwords on our network. And it works! It changes all of... |
72,980,766 | C++ Eigen initialise dynamic matrix with raw data<p>Suppose I have raw data, whose size I don't know at compile time, and that's why I need to store it in a dynamically sized matrix. I know I can initialise a static-sized matrix as follows:</p>
<pre class="lang-cpp prettyprint-override"><code> std::vector<double>... | <p>If you want to copy the raw data, assign the Map to a normal matrix.</p>
<pre><code>std::vector<double> v {1.1, 2.2, 3.3, 4.4};
Eigen::MatrixXd m = Eigen::MatrixXd::Map(v.data(), 2, 2);
</code></pre>
<p>BTW: You don't need to deal with the template parameters such as <code>Matrix<double, 2, 2></code> or ... | C++ Eigen initialise dynamic matrix with raw data | c++|eigen | 0 | 50 | 1 | 72,983,330 | 72,983,330 | 2 | true | 2022-07-14T12:46:58.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ Eigen initialise dynamic matrix with raw data<p>Suppose I have raw data, whose size I don't know at compile time, and that's why I need to store it in a ... |
72,792,741 | IOHIDManagerOpen returns error code -536870201<p>I am new to USB usage in my application on Mac. When I log the result of IOHIDManagerOpen(x,y) function call on my application I get error code -536870201. I have found in the following post (<a href="https://stackoverflow.com/questions/70673002/keystrokes-are-not-block... | <p>For IOKit return values (<code>IOReturn</code>) it's typically much more helpful to print them as hexadecimal, ("0x%x") as that's how the constants are defined in <a href="https://github.com/apple-oss-distributions/xnu/blob/xnu-8020.121.3/iokit/IOKit/IOReturn.h" rel="nofollow noreferrer"><code><IOKit/IO... | IOHIDManagerOpen returns error code -536870201 | macos|hid|iokit | 1 | 50 | 1 | 72,797,835 | 72,797,835 | 2 | true | 2022-06-28T20:24:13.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
IOHIDManagerOpen returns error code -536870201<p>I am new to USB usage in my application on Mac. When I log the result of IOHIDManagerOpen(x,y) function call... |
72,813,334 | How can I orginize code in the right way in my case? Golang<p>There are almost two identical functions that do approximately the same thing. What would be the right way to organize the code to avoid repetition in this case? The httpGetter() function accesses cloud platform API and gets JSON response, which I then parse... | <p>First thing first if you know the method is a getter then you don't need to pass the method param so the signature would become something like below. Also, you are already returning a <code>*http.Response</code> back to the caller now it will be the callers decision on what to do with the response + the caller shoul... | How can I orginize code in the right way in my case? Golang | go | 0 | 50 | 1 | 72,816,947 | 72,816,947 | 2 | true | 2022-06-30T09:22:32.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I orginize code in the right way in my case? Golang<p>There are almost two identical functions that do approximately the same thing. What would be th... |
72,995,031 | How to get maximum value of one entity in nested dictionary?<pre><code>people = {1: {'Name': 'John', 'Age': '22', 'Sex': 'Male'}, 2: {'Name': 'Marie', 'Age': '26', 'Sex': 'Female'}, 3: {'Name': 'Marie', 'Age': '25', 'Sex': 'Female'}, 4: {'Name': 'Marie', 'Age': '21', 'Sex': 'Female'}}
</code></pre>
<p>I want to get the... | <p>You can use <code>max</code> with a defined key and <code>lambda</code>.</p>
<pre><code>people = {1: {'Name': 'John', 'Age': '22', 'Sex': 'Male'}, 2: {'Name': 'Marie', 'Age': '26', 'Sex': 'Female'}, 3: {'Name': 'Marie', 'Age': '25', 'Sex': 'Female'}, 4: {'Name': 'Marie', 'Age': '21', 'Sex': 'Female'}}
max(people.val... | How to get maximum value of one entity in nested dictionary? | python|dictionary | 0 | 50 | 2 | 72,995,080 | 72,995,080 | 2 | true | 2022-07-15T13:47:40.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get maximum value of one entity in nested dictionary?<pre><code>people = {1: {'Name': 'John', 'Age': '22', 'Sex': 'Male'}, 2: {'Name': 'Marie', 'Age':... |
72,915,572 | parallel sorting on separate sections of a single slice<p>I'm trying to implement a sort of parallel bubble sort, e.g. have a number of threads work on distinct parts of the same slice and then have a final thread sort those two similar to a kind of merge sort</p>
<p>I have this code so far</p>
<pre class="lang-rust pr... | <p><em>Disclaimer:</em> I assume that you want to sort in place, as you call <code>.sort()</code>.</p>
<p>There's a couple of problems with your code:</p>
<ul>
<li>The <code>to_sort</code> isn't mutable, so you won't be able to modify it. Which is an essential part of sorting ;) So I think that <code>Arc<&[i32]&... | parallel sorting on separate sections of a single slice | multithreading|sorting|rust | -1 | 50 | 1 | 72,915,793 | 72,915,793 | 2 | true | 2022-07-08T18:28:05.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
parallel sorting on separate sections of a single slice<p>I'm trying to implement a sort of parallel bubble sort, e.g. have a number of threads work on disti... |
72,838,593 | Execute powershell in x64 from MSBuild<p>I would like to run an after build script with Powershell. This script needs to be run in 64bits. However, whenever I run msbuild with my .csproj file the script always runs in 32 bits. If I run the same script from the same powershell session where I started the msbuild, the sc... | <p><strong>64-bit vs. 32-bit processes</strong> see <strong>separate, bitness-specific directories as <code>C:\Windows\System32</code></strong>.</p>
<p>Therefore, when launched from a 32-bit process, <code>$(WINDIR)\System32\WindowsPowerShell\v1.0\powershell.exe</code> refers to the 32-bit version of PowerShell.</p>
<p... | Execute powershell in x64 from MSBuild | powershell|msbuild|csproj | 1 | 50 | 1 | 72,839,609 | 72,839,609 | 2 | true | 2022-07-02T11:14:26.530Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Execute powershell in x64 from MSBuild<p>I would like to run an after build script with Powershell. This script needs to be run in 64bits. However, whenever ... |
72,820,532 | Why doesn't the opacity of the image increase according to the following description?<p>The following code snippet is supposed to increase the opacity of a certain image(its id is 'img') by 0.01 per every 10 milliseconds until its opacity is set to 1.</p>
<pre><code> ```var t;
var frontimage=document.getEle... | <p>The <code>opacity</code> property will return a string so you need to convert that to a number before you add to it because the <code>+</code> operator in JavaScript can mean numeric addition (when both operands are numbers) or string concatenation (when one or both operands are strings).</p>
<p>The reason it works ... | Why doesn't the opacity of the image increase according to the following description? | javascript|html | 1 | 50 | 3 | 72,820,719 | 72,820,719 | 2 | true | 2022-06-30T18:33:28.177Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why doesn't the opacity of the image increase according to the following description?<p>The following code snippet is supposed to increase the opacity of a c... |
72,987,309 | Normalize input data frame into separate frames<p>I'm trying to create a python script to help me normalize my database. I've written up some example code.</p>
<p>I'm trying to check if dataArray exists in df1, under the names of the columns columArray</p>
<p>if it does exist, return the ID of the row (1 would return f... | <blockquote>
<p>I'm particularly asking about is the commended out if line</p>
</blockquote>
<pre><code>>>> df1
ID1 A B C
0 0 A0 B0 Data does
1 1 A1 B1 not matter
2 2 A2 B2
>>> columArray
['A', 'B']
>>> find = ['A1','B1']
</code></p... | Normalize input data frame into separate frames | python|pandas|normalization | 0 | 50 | 2 | 72,987,717 | 72,987,717 | 2 | true | 2022-07-14T22:35:16.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Normalize input data frame into separate frames<p>I'm trying to create a python script to help me normalize my database. I've written up some example code.</... |
72,846,609 | Where condition inside json_agg in postgres<p>I'm trying to return a JSON object from postgres that looks something like this:</p>
<pre><code>[
{id: 1, name: "some organisation name", alias: [{alias:"alt name"}, {alias:"another name"}]}
...]
</code></pre>
<p>My query below works fine, exce... | <p>Not sure if it's exactly what you're looking for, but it does give you the required result for your example:</p>
<pre><code>SELECT
json_build_object('id', orgs.id
, 'name', name
, 'alias', json_agg(
json_build_object('name', alias)
)
... | Where condition inside json_agg in postgres | postgresql | 1 | 50 | 1 | 72,846,807 | 72,846,807 | 2 | true | 2022-07-03T12:43:58.930Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Where condition inside json_agg in postgres<p>I'm trying to return a JSON object from postgres that looks something like this:</p>
<pre><code>[
{id: 1, name:... |
73,021,181 | Expressjs main loop blocked during intense operation<p>I'm having an expressjs server running in which an endpoint <code>init</code> performs some intense operation that has an average completion time of 10 seconds. During these 10 seconds, the main loop is "stuck", making it impossible to send requests to th... | <p>It is possible to implement algorithms with long running time in a synchronous manner, for example the <a href="https://en.wikipedia.org/wiki/Tower_of_Hanoi" rel="nofollow noreferrer">Tower of Hanoi</a>:</p>
<pre class="lang-js prettyprint-override"><code>function move(from, to, via, n) {
if (n > 1)
move(fr... | Expressjs main loop blocked during intense operation | node.js|express|concurrency | 1 | 50 | 2 | 73,022,654 | 73,022,654 | 2 | true | 2022-07-18T10:53:15.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Expressjs main loop blocked during intense operation<p>I'm having an expressjs server running in which an endpoint <code>init</code> performs some intense op... |
72,901,560 | defined JSON value always returns undefined<p>When i try to get a JSON value, also if it is defined it returns undefined. Im trying to do a store system. Here's my code:</p>
<pre><code>fetch(link).then(response => response.text()).then(data => {
try {
var json = JSON.parse(data);
} catch (e) { ... | <p>As the comments already suggest, the JSON is not valid. In a JSON, the object's keys are always in quotes:</p>
<pre><code>{
"title": "Store Name",
"icon": "/storeicon.png",
"desc": "Eventual Description",
"type": "1"
}
</... | defined JSON value always returns undefined | javascript|json | -1 | 50 | 1 | 72,916,362 | 72,916,362 | 2 | true | 2022-07-07T16:46:46.243Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
defined JSON value always returns undefined<p>When i try to get a JSON value, also if it is defined it returns undefined. Im trying to do a store system. Her... |
72,921,751 | Convert all rows into a Series object pandas<p>I have a dataframe like so:</p>
<pre><code>time 0 1 2 3 4 5
0 3.477110 3.475698 3.475874 3.478345 3.476757 3.478169
1 3.422223 3.419752 3.417987 3.421341 3.418693 3.418340 ... | <p>I think you want something like this.</p>
<pre><code>result = df.set_index('time').apply(np.array, axis=1)
print(result)
print(type(result))
print(result.shape)
time
0 [3.47711, 3.475698, 3.475874, 3.478345, 3.4767...
1 [3.422223, 3.419752, 3.417987, 3.421341, 3.418...
2 [3.47411, 3.474816, 3.477463, 3.479... | Convert all rows into a Series object pandas | python|pandas|dataframe|sktime | 1 | 50 | 2 | 72,922,054 | 72,922,054 | 2 | true | 2022-07-09T13:28:31.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert all rows into a Series object pandas<p>I have a dataframe like so:</p>
<pre><code>time 0 1 2 3 4 ... |
72,914,102 | how to get the name of subcollection in cloud firestore<p>I have database (Like the image below) and I Need to get the name of subcollection which contain Quiz Name</p>
<p><img src="https://i.stack.imgur.com/VuZmn.png" alt="enter image description here" /></p> | <p>There are no way to get collections names (well on client side for sure). Collections are like table name in regular databases. If you don't know what you can have in collections, and you let users create their own collections, you will end up having your database used by some hackers. This is how rules should look ... | how to get the name of subcollection in cloud firestore | android|firebase|kotlin|google-cloud-firestore | 0 | 50 | 1 | 72,928,864 | 72,928,864 | 2 | true | 2022-07-08T16:03:51.520Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to get the name of subcollection in cloud firestore<p>I have database (Like the image below) and I Need to get the name of subcollection which contain Qu... |
72,904,569 | How to sort multiple columns using QUERY function together with checkboxes<p>I need to sort multiple columns using the QUERY function together with checkboxes which indicate which columns to sort. This should work with multiple columns.</p>
<p><a href="https://i.stack.imgur.com/GY4iO.png" rel="nofollow noreferrer"><img... | <p>try:</p>
<pre><code>=ARRAYFORMULA(QUERY(
{AI4:AY101, TRIM(FLATTEN(QUERY(TRANSPOSE(AJ4:AY101),,9^9)))},
"select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15,Col16,Col17
where Col18 is not null "&IF(SUM(C2:O2*1)>0,
"order by "&TEXTJOIN(", &... | How to sort multiple columns using QUERY function together with checkboxes | sql|if-statement|google-sheets|google-sheets-formula|spreadsheet | 1 | 50 | 1 | 72,904,603 | 72,904,603 | 2 | true | 2022-07-07T21:44:57.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to sort multiple columns using QUERY function together with checkboxes<p>I need to sort multiple columns using the QUERY function together with checkboxe... |
72,878,852 | Print triangular number patterns with loops and modulus calculation<p>I need to print a number pattern like this:</p>
<pre><code>1
12
123
1234
2
23
234
2341
3
34
341
3412
4
41
412
4123
</code></pre>
<p>My code:</p>
<pre><code>for($i=1; $i<=4; ++$i) {
for($j=1; $j<=$i; ++$j) {
echo $j;
}
echo (... | <p>You loop from 1 to 4, and subtract 4 if the value is bigger than 4.</p>
<p>This is for <em>2, 23, 234, 2341</em>:</p>
<pre><code>for ($i = 1; $i <= 4; $i++) {
for ($j = 1; $j <= $i; $j++) {
$value = $j + 1; // or +2, or +3
echo $value > 4 ? $value - 4 : $value;
}
echo "\n";
}
</cod... | Print triangular number patterns with loops and modulus calculation | php|for-loop|logic|modulo|triangle | 1 | 50 | 2 | 72,878,945 | 72,878,945 | 2 | true | 2022-07-06T06:33:44.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Print triangular number patterns with loops and modulus calculation<p>I need to print a number pattern like this:</p>
<pre><code>1
12
123
1234
2
23
234
2341
... |
72,953,492 | Regexp - Get everything before two different strings. One can contain both<p>I have to use regexp.</p>
<p>Current state:
<code>.+?((/=\.czxy)|(?=\.zzzz))</code></p>
<p>It's working for the first two cases (that's obvious)</p>
<p>So I have decided to do something like this:
<code>.+?((/=\.czxy)|(?=\.zzzz)|(?=\-\-[0-9]))... | <p>Your attempt has these issues:</p>
<ul>
<li>A typo: <code>(/=</code> should be <code>(?=</code></li>
<li>The regex does not require that the <code>--[0-9]</code> part is still followed by the extension. That part should actually be an optional part that precedes the pattern for the extension.</li>
</ul>
<p>So change... | Regexp - Get everything before two different strings. One can contain both | regex | 0 | 50 | 3 | 72,953,761 | 72,953,761 | 2 | true | 2022-07-12T13:52:27.917Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regexp - Get everything before two different strings. One can contain both<p>I have to use regexp.</p>
<p>Current state:
<code>.+?((/=\.czxy)|(?=\.zzzz))</co... |
72,984,333 | Javascript: Regex to convert a numbered list string to an array of items<p>I am trying to convert a numbered list into an array of items. This is what I have 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-j... | <p>Your regex does not foresee a dot after a number when there is no second number following it. It also requires a space after the number, but you have a case where there is no such space. So make it optional.</p>
<p>Also, use the <code>s</code> modified so <code>.</code> also matches newline cha</p>
<p>If a new item ... | Javascript: Regex to convert a numbered list string to an array of items | javascript|regex | 1 | 50 | 2 | 72,984,399 | 72,984,399 | 2 | true | 2022-07-14T17:15:13.127Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript: Regex to convert a numbered list string to an array of items<p>I am trying to convert a numbered list into an array of items. This is what I have... |
72,822,547 | Is there a way to have SQLAlchemy NOT change 1 to True and 0 to False for BIT columns?<p>I am using SQLAlchemy to read data from a SQL Server database and then turning the table data to a csv file to later hand off.</p>
<p>However, I noticed when there is a 1 or 0 in a SQL Server table field, the csv output has True or... | <p>As explained in</p>
<p><a href="https://github.com/mkleehammer/pyodbc/issues/383" rel="nofollow noreferrer">https://github.com/mkleehammer/pyodbc/issues/383</a></p>
<p>pyodbc returns <code>bit</code> columns as boolean values because that is what most people use <code>bit</code> columns for.</p>
<pre class="lang-py ... | Is there a way to have SQLAlchemy NOT change 1 to True and 0 to False for BIT columns? | python|dataframe|csv|sqlalchemy|dtype | 1 | 50 | 1 | 72,822,836 | 72,822,836 | 2 | true | 2022-06-30T22:11:31.243Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to have SQLAlchemy NOT change 1 to True and 0 to False for BIT columns?<p>I am using SQLAlchemy to read data from a SQL Server database and th... |
72,833,354 | What is the best approach to implement Local Variable Frame for IJVM?<p>I'm trying to implement in C an integer java virtual machine taking as example the IJVM described by Andrew Tanenbaum in "Structured Computer Organization" ->
<a href="https://users.cs.fiu.edu/%7Eprabakar/cda4101/Common/notes/lecture18... | <blockquote>
<p>the local variable should be located also in the array used for stack
(operands)?</p>
</blockquote>
<p>From your link:</p>
<ul>
<li><em>Local Variable Frame: The beginning of the frame will have the parameters (a.k.a. arguments) of the method/procedure, with the local variables following.</em></li>
<li>... | What is the best approach to implement Local Variable Frame for IJVM? | c|virtual-machine|ijvm | 1 | 50 | 1 | 72,835,040 | 72,835,040 | 2 | true | 2022-07-01T18:30:44.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the best approach to implement Local Variable Frame for IJVM?<p>I'm trying to implement in C an integer java virtual machine taking as example the IJ... |
73,016,265 | flag = 1 if there is a change from 1 to 0 in R<p>Is there a quick way to assign <code>flag</code> to 1 if for a particular <code>variable</code> there is a change from 1 to 0, so that I get the below. This <code>variable</code> is only allowed to go from from 0 to 1, it is not possible to see 1 to 0 and I would like to... | <p>Thank you for clarifying your problem in your comment and edited question. Here is a solution that I think will work with your actual data:</p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
df <- data.frame(
stringsAsFactors = FALSE,
organisation = c("A","A",... | flag = 1 if there is a change from 1 to 0 in R | r|conditional-statements|logic | -1 | 50 | 1 | 73,016,396 | 73,016,396 | 2 | true | 2022-07-18T00:26:12.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
flag = 1 if there is a change from 1 to 0 in R<p>Is there a quick way to assign <code>flag</code> to 1 if for a particular <code>variable</code> there is a c... |
72,901,535 | How do I await code inside a method that returns an EitherAsync<T1, T2> in LanguageExt?<p>When using <code>TryAsync</code> in LanguageExt, you can do something like this...</p>
<pre class="lang-cs prettyprint-override"><code>static TryAsync<int> Divide(int n1, int n2) =>
TryAsync(async () => {
// ... | <p>Any function function returning task should work due to implicit casts from <code>T</code> and <code>Task<T></code> to <code>Either</code>, for example:</p>
<pre class="lang-cs prettyprint-override"><code>static EitherAsync<string, int> Square(int n)
{
async Task<int> inner()
{
awai... | How do I await code inside a method that returns an EitherAsync<T1, T2> in LanguageExt? | c#|functional-programming|language-ext | 1 | 50 | 2 | 72,901,808 | 72,901,808 | 2 | true | 2022-07-07T16:44:49.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I await code inside a method that returns an EitherAsync<T1, T2> in LanguageExt?<p>When using <code>TryAsync</code> in LanguageExt, you can do somethi... |
72,931,632 | Channel is not recieving data or giving dead block<p>I've the below code:</p>
<pre class="lang-golang prettyprint-override"><code>//main.go
package main
import (
"edriven/events"
"fmt"
"math"
"time"
)
func main() {
fmt.Println("Starting")
event... | <p>This block of code is problematic</p>
<pre><code>for {
select {
case x := <- events.Publish:
fmt.Println(x)
default:
fmt.Println("waiting for data ...")
time.Sleep((time.Duration(math.MaxInt64)))
}
}
</code></pre>
<p>When <code>select</code> is invoked and assumin... | Channel is not recieving data or giving dead block | go | 0 | 50 | 1 | 72,931,737 | 72,931,737 | 2 | true | 2022-07-10T20:22:31.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Channel is not recieving data or giving dead block<p>I've the below code:</p>
<pre class="lang-golang prettyprint-override"><code>//main.go
package main
imp... |
72,919,747 | efficient way of getting unique values by comparing columns in two dataframes pandas<p>I have two dataframes, something like below:</p>
<pre><code> df1:
date col1 col2 col3
15-5-2022 ABC 1 PQR
16-5-2022 BCD 2 ABC
17-5-202... | <p>Use:</p>
<pre><code>df2.loc[~df2['col1'].isin(df1['col1']), 'col1'].unique()
</code></pre>
<p>output: <code>array(['XYZ', 'PQR'], dtype=object)</code></p>
<p>Or, with sets:</p>
<pre><code>set(df2['col1']) - set(df1['col1'])
</code></pre>
<p>output: <code>{'PQR', 'XYZ'}</code></p> | efficient way of getting unique values by comparing columns in two dataframes pandas | pandas|comparison|unique | 2 | 50 | 2 | 72,919,777 | 72,919,777 | 2 | true | 2022-07-09T07:37:49.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
efficient way of getting unique values by comparing columns in two dataframes pandas<p>I have two dataframes, something like below:</p>
<pre><code> df1:
... |
72,955,480 | Can't replace "\" with "/"<p>I am trying to replace a string here in Python.</p>
<p>This is my Input -</p>
<pre><code>link = (r"C:\dell\Documents\Ms\Realm")
</code></pre>
<p>I want my output to be like this:</p>
<pre><code>C:/dell/Documents/Ms/Realm
</code></pre>
<p>I tried the replace method it didn't work.<... | <p>In Python strings, the backslash "\" is a special character, also called the "escape" character. You need to add second backslash to "escape" it and use in string search.</p>
<pre><code>link.replace("\\", "/")
</code></pre> | Can't replace "\" with "/" | python|replace|str-replace | 0 | 50 | 2 | 72,955,505 | 72,955,505 | 2 | true | 2022-07-12T16:24:17.473Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't replace "\" with "/"<p>I am trying to replace a string here in Python.</p>
<p>This is my Input -</p>
<pre><code>link = (r"C:\dell\Documents\Ms\Rea... |
72,784,536 | Iterating over two list of lists, getting the same element of each inner list<p>I am working with ETABS API using python. So there is a command like:</p>
<pre><code>SapModel.FrameObj.AddByCoord(x1,y1,z1,x2,y2,z2,"name","section")
</code></pre>
<p>where x1 , x2 ,etc are coordinates in Cartesian coord... | <p>You can iterate as follows</p>
<pre><code>for _x, _y, _xs, _ys in zip(X,Y,X[1:],Y[1:]):
for x, y, xs, ys in zip(_x, _y, _xs, _ys):
print(x, y, xs, ys)
</code></pre>
<p>or</p>
<pre><code>for _x, _y, _xs, _ys in zip(zip(*X), zip(*Y) , zip(*X[1:]), zip(*Y[1:])):
for x, y, xs, ys in zip(_x, _y, _xs, _ys)... | Iterating over two list of lists, getting the same element of each inner list | python|loops|iteration | -1 | 50 | 2 | 72,784,871 | 72,784,871 | 2 | true | 2022-06-28T10:08:49.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Iterating over two list of lists, getting the same element of each inner list<p>I am working with ETABS API using python. So there is a command like:</p>
<pr... |
72,808,974 | Rename field values in list that occur twice<p>I'm trying to understand how I can rename values using python if they occur twice in a list, here <code>job['audio']</code>.</p>
<p>Following example given:</p>
<pre><code>job['audio'] = list(map(lambda x: build_audio(x), fileInfo['stream']['audio']))
</code></pre>
<p>Wher... | <p>Use sets to hold the names and languages that have already been seen. If you encounter a duplicate, update it.</p>
<pre><code>nameset = set()
langset = set()
for row in job['audio']:
if row['hls']['name'] in nameset:
row['hls']['name'] += '2'
else:
nameset.add(row['hls']['name'])
if row[... | Rename field values in list that occur twice | python | -3 | 50 | 1 | 72,809,094 | 72,809,094 | 2 | true | 2022-06-29T23:52:09.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rename field values in list that occur twice<p>I'm trying to understand how I can rename values using python if they occur twice in a list, here <code>job['a... |
72,999,214 | R dplyr change numeric values in sequence of rows to other numeric values<p>Let's say I have the following dataset. And, I want to change the range of values starting from <code>20010001-20010010</code> to <code>2001-2010</code>.</p>
<p>How can I do this?</p>
<p>Sample data (<code>df</code>):</p>
<pre><code>structure(l... | <p>Another possible solution.</p>
<p><strong>EXPLANATION</strong></p>
<p><a href="https://regex101.com/r/imRhHu/1" rel="nofollow noreferrer">Regex demo</a></p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
df %>%
mutate(z = str_replace(x, "2001[0]+(?=\\d{2}$)", "20")) %>... | R dplyr change numeric values in sequence of rows to other numeric values | r|dplyr | 1 | 50 | 3 | 72,999,347 | 72,999,347 | 2 | true | 2022-07-15T20:18:17.230Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R dplyr change numeric values in sequence of rows to other numeric values<p>Let's say I have the following dataset. And, I want to change the range of values... |
73,011,622 | Pytest - reuse fixture that outputs differently for different users<p>I have three test user fixtures defined as below in <code>conftest.py</code></p>
<pre class="lang-py prettyprint-override"><code>@pytest.fixture(scope="session")
def user1(db: Session):
user_create = UserCreate(name="u1", emai... | <p>I can think of two ways but I'm not sure which option would better suit your needs:</p>
<h2>1) Test function parametrization</h2>
<p>This way you would have the user token/header ready from the beginning but my example doesn't support multiple users at once even though it does support multiple invocations of the tes... | Pytest - reuse fixture that outputs differently for different users | python|testing|pytest|fastapi | 2 | 50 | 1 | 73,012,232 | 73,012,232 | 2 | true | 2022-07-17T12:06:18.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pytest - reuse fixture that outputs differently for different users<p>I have three test user fixtures defined as below in <code>conftest.py</code></p>
<pre c... |
72,847,536 | While loop multiple statements in js. "The Dice Game"<p>I have to create a dice roller game, if it lands on 2,3,6,12 the game is supposed to stop and tell me which of the numbers the sum of both my dices landed on and how many "rolls" or tries it took me to get there. I haven't been able to figure out why my ... | <p>Change your <code>||</code> to <code>&&</code> in your <code>while</code></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function play() {
var dice = -1;
var ro... | While loop multiple statements in js. "The Dice Game" | javascript|html | 0 | 50 | 2 | 72,847,588 | 72,847,588 | 2 | true | 2022-07-03T15:02:16.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
While loop multiple statements in js. "The Dice Game"<p>I have to create a dice roller game, if it lands on 2,3,6,12 the game is supposed to stop and tell me... |
72,899,841 | react get id from url with component<p>I want to get id in url i tried both ways but i get an error can anyone help about the solution?</p>
<p>Error :</p>
<p>Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:</p>
<p>You migh... | <p><code>useParams</code> is a hook & hence can be used either inside a function component or another hook only.</p>
<ol>
<li><p>You can split <code>window.location.href</code> using '/' to access the id, in <code>componentDidMount</code>. (recommended)</p>
</li>
<li><p>If you are using React Router version <= 5... | react get id from url with component | reactjs | 0 | 50 | 1 | 72,901,547 | 72,901,547 | 2 | true | 2022-07-07T14:43:09.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
react get id from url with component<p>I want to get id in url i tried both ways but i get an error can anyone help about the solution?</p>
<p>Error :</p>
<p... |
72,851,356 | Python Pandas Calculate Two Columns Containing String<p><a href="https://i.stack.imgur.com/1SKVy.png" rel="nofollow noreferrer">Excel Table</a>--<a href="https://i.stack.imgur.com/1dG9H.png" rel="nofollow noreferrer">pandas read_excel</a></p>
<p>Hi,</p>
<p>I am trying to calculate the difference of column C (unnamed: 2... | <p>First I would use the parameter <code>skiprows</code> in the <code>read_excel</code> method <a href="https://pandas.pydata.org/docs/reference/api/pandas.read_excel.html" rel="nofollow noreferrer">Documentation</a>:</p>
<pre><code>df1 = pandas.read_excel("Trial.xlsx", skiprows=4)
</code></pre>
<p>You can al... | Python Pandas Calculate Two Columns Containing String | python|pandas | 0 | 50 | 2 | 72,851,408 | 72,851,408 | 2 | true | 2022-07-04T02:55:50.553Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Pandas Calculate Two Columns Containing String<p><a href="https://i.stack.imgur.com/1SKVy.png" rel="nofollow noreferrer">Excel Table</a>--<a href="htt... |
72,812,779 | VBA loop until next bold and uppercase value<p>I have a file called tg. I'd like to loop through the column A and everytime I come across an uppercase bold value, I'd like to store it as a key of my dictionary pp. The item associated is a collection of all the values up until the next uppercase and bold value. And repe... | <p>Please, use the next faster way. It find the first Bolded cell, checks if <code>isUpper</code> and place in a dictionary (as key) the matched such cells value and the range in between as item:</p>
<pre><code>Function Pairs() As Scripting.Dictionary
Dim tg As Worksheet, rng As Range, cB As Range, firstAddress As S... | VBA loop until next bold and uppercase value | excel|vba | 0 | 50 | 2 | 72,813,559 | 72,813,559 | 2 | true | 2022-06-30T08:43:17.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
VBA loop until next bold and uppercase value<p>I have a file called tg. I'd like to loop through the column A and everytime I come across an uppercase bold v... |
72,865,703 | Difference between modifier and helper in Ember JS<p>What is the difference between the modifier and the helper in ember js?</p>
<p>Example:</p>
<ul>
<li>helper <code>{{fn this.increment amount}}</code></li>
<li>modifier <code>{{on "click" this.increment}}</code></li>
</ul> | <p>A helper is "just a function" that can be invoked from templates. More information here: <a href="https://guides.emberjs.com/release/components/helper-functions/" rel="nofollow noreferrer">https://guides.emberjs.com/release/components/helper-functions/</a></p>
<p>Since ember-source@4.5, helpers can be <em>... | Difference between modifier and helper in Ember JS | javascript|ember.js|frontend | 1 | 50 | 1 | 72,876,445 | 72,876,445 | 2 | true | 2022-07-05T07:42:47.820Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Difference between modifier and helper in Ember JS<p>What is the difference between the modifier and the helper in ember js?</p>
<p>Example:</p>
<ul>
<li>hel... |
72,999,201 | How can I write hexadecimal data in the file so that additional data is not written (like hexeditors)?<p>I want to make something like a small hex editor for my project.</p>
<p>so i wrote a function like this(to replace the original code with the new code):</p>
<pre><code>int replace(FILE *binaryFile, long offset, unsi... | <p><code>sizeof(replaced)</code> is wrong. <code>replaced</code> is a <code>unsigned char *</code>, so that's not the size you want.</p>
<p>You probably want <code>sizeof(unsigned char)</code> or <code>sizeof(*replaced)</code>.</p>
<p>Currently, you end up writing eight times too much.</p>
<p>Note that you could also w... | How can I write hexadecimal data in the file so that additional data is not written (like hexeditors)? | c|binary|hex|hex-editors | -1 | 50 | 1 | 72,999,289 | 72,999,289 | 2 | true | 2022-07-15T20:17:31.383Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I write hexadecimal data in the file so that additional data is not written (like hexeditors)?<p>I want to make something like a small hex editor for... |
72,931,798 | What is wrong with `conic-gradient`<p>I'm running into a weird glitch when using <code>conic-gradient</code> for a background in CSS.
The snippet below should have 36 hard-edged spokes (72 counting the transparent ones), yet some of them fail to render.</p>
<p>I've coloured some of them and formatted the CSS to make it... | <p>There seems to be a problem with rendering right down to one degree. Some of the rays don't render (at least, not so you can see them).</p>
<p>Moving from intervals of 1degree to 1.5degree I see all the rays, at least on Edge on Windows 10 on my laptop and on Safari IOS15 on an iPad.</p>
<p>This is the image I get:<... | What is wrong with `conic-gradient` | css | 1 | 50 | 1 | 72,932,061 | 72,932,061 | 2 | true | 2022-07-10T20:49:29.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is wrong with `conic-gradient`<p>I'm running into a weird glitch when using <code>conic-gradient</code> for a background in CSS.
The snippet below shoul... |
72,780,088 | Specialized overload/implementation of a generic function with a default parameter value<p>I have a generic function with a required <code>transformer</code> generic function parameter and a generic return type <code>T</code>.</p>
<p>I want to add a "default value" for that <code>transformer</code> parameter ... | <p>You need to change function type signature:</p>
<pre class="lang-js prettyprint-override"><code>declare const someImplementation: <T>(
url: string,
transformer: (buffer: ArrayBuffer) => T,
cacheName?: string,
updateIfInCache?: boolean
) => Promise<T>
export async function downloadW... | Specialized overload/implementation of a generic function with a default parameter value | typescript|typescript-generics | 1 | 50 | 1 | 72,796,530 | 72,796,530 | 3 | true | 2022-06-28T02:23:11.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Specialized overload/implementation of a generic function with a default parameter value<p>I have a generic function with a required <code>transformer</code>... |
72,837,276 | java generics wildcards casting issue<p>I have method as below</p>
<pre><code> void meth(List<?> list) {
List<Integer> integers = (List<Integer>)list; //how do I make sure am casting correctly to List < Integer >? what if list passed as List< String > , then this will throw some R... | <p>Basically ... you can't. Since you <em>could</em> call <code>meth</code> (as you have written it) with a <code>List<String></code> parameter, there can always be runtime exceptions.</p>
<p>Solutions:</p>
<ul>
<li><p>Declare <code>meth</code> as <code>public void meth(List<Integer> list)</code> so that ... | java generics wildcards casting issue | java|generics | 1 | 50 | 2 | 72,837,466 | 72,837,466 | 3 | true | 2022-07-02T07:28:14.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
java generics wildcards casting issue<p>I have method as below</p>
<pre><code> void meth(List<?> list) {
List<Integer> integers = (List&... |
72,838,445 | Offset time cells by a value in Excel or Google Sheets<p>I have a bunch of time cells in a spreadsheet. I'm trying to offset them all by a specific time interval, say 30 minutes or 1 hour. I don't want to offset these time values in cells elsewhere. I want the cells containing the old values to be replaced by the new v... | <p>In Excel, put <code>=30/60/24</code> or however many minutes it is you want to move them, in some other cell.
Then copy that cell, select the others, and do Paste Special | Values | Add.</p>
<p>GoogleSheets seems to not offer Values | Add within Paste Special.
So I guess you need to create temporary new cells being ... | Offset time cells by a value in Excel or Google Sheets | excel|google-sheets|excel-formula | 2 | 50 | 1 | 72,839,713 | 72,839,713 | 3 | true | 2022-07-02T10:47:43.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Offset time cells by a value in Excel or Google Sheets<p>I have a bunch of time cells in a spreadsheet. I'm trying to offset them all by a specific time inte... |
72,842,947 | can't access property "innerHTML", document.getElementById('id' +num) even though js is declared at the end of <body><p>I'm trying to pick a random value for each row of the array in js, however when i run the code i get Uncaught TypeError: can't access property "innerHTML", document.getElementById(...) is nu... | <p>It's failing because your <code>step</code> counter starts at 0 but you have no element with ID <code>crit0</code>.</p>
<p>If you add a <code>crit0</code> element or start your counter at 1, the error goes away.</p>
<p>It can also be helpful to also include a null check for <code>document.getElementByID()</code> to ... | can't access property "innerHTML", document.getElementById('id' +num) even though js is declared at the end of <body> | javascript|html | -1 | 50 | 2 | 72,842,982 | 72,842,982 | 3 | true | 2022-07-02T23:02:15.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
can't access property "innerHTML", document.getElementById('id' +num) even though js is declared at the end of <body><p>I'm trying to pick a random value for... |
72,846,724 | Extend plain background in a video<p>Is there any easier way to achieve this?, I'd like to make a .bat file that modify 148 videos that are 3840x2160</p>
<p>They belong to the <a href="https://forums.launchbox-app.com/files/file/1958-colorful-platform-video-set/" rel="nofollow noreferrer">COLORFUL platform video set 1.... | <p>You can do it in one command, like this</p>
<p><code>ffmpeg -i in.mp4 -vf "split=2[bg][img];[bg]trim=end_frame=1,crop=128:ih,scale=3840:2160:flags=neighbor,setsar=1[bg];[bg][img]overlay=w=0.15*W:h=0" -c:a copy out.mp4</code></p> | Extend plain background in a video | video|ffmpeg|command-line-arguments | 4 | 50 | 1 | 72,847,732 | 72,847,732 | 3 | true | 2022-07-03T13:02:50.803Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Extend plain background in a video<p>Is there any easier way to achieve this?, I'd like to make a .bat file that modify 148 videos that are 3840x2160</p>
<p>... |
72,870,040 | TYPOSCRIPT stdWrap.replacement I Want to replace space with underscore _<p>My typo3 version is 10.4.22</p>
<pre><code>lib.spaces = TEXT
lib.spaces {
current = 1
stdWrap.replacement {
10 {
search =
replace = _
wrap = |
}
}
}
</code></pre>
<p>I have a following typ... | <p><code>replacement.search</code> has stdWrap, so you can use <code>char</code>. The ascii code for space is 32, so that will make it:</p>
<pre><code>lib.spaces = TEXT
lib.spaces {
current = 1
stdWrap.replacement {
10 {
search.char = 32
replace = _
wrap = |
}
}
}... | TYPOSCRIPT stdWrap.replacement I Want to replace space with underscore _ | typo3|typoscript|typo3-10.x | 0 | 50 | 1 | 72,870,181 | 72,870,181 | 3 | true | 2022-07-05T13:11:36.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TYPOSCRIPT stdWrap.replacement I Want to replace space with underscore _<p>My typo3 version is 10.4.22</p>
<pre><code>lib.spaces = TEXT
lib.spaces {
curre... |
72,900,300 | R lapply ifelse with multiple statements on list of dataframes<p>I have a list (fc.list) of dataframes ("t1.fc.df", "t2.fc.df") that looks like this:</p>
<pre><code>fc.list$t1.fc.df
ID log2.FC qval
1 5.22161 0
2 4.34383 0
3 3.764772 0.86250849
4 -3.095648 0.9412494
5 -3.4... | <p>There are a few issues with your code but easily fixable.</p>
<ol>
<li><p>You're using <code>unlist(x[column])</code>, it's far easier and legible to use the <code>$</code> to access the data.frame columns.</p>
</li>
<li><p>You used <code>unlist(x[5])</code> and there is no column 5.</p>
</li>
<li><p>You used <code>... | R lapply ifelse with multiple statements on list of dataframes | r|list|dataframe|if-statement|lapply | 0 | 50 | 3 | 72,900,780 | 72,900,780 | 3 | true | 2022-07-07T15:12:31.960Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R lapply ifelse with multiple statements on list of dataframes<p>I have a list (fc.list) of dataframes ("t1.fc.df", "t2.fc.df") that look... |
72,928,327 | Subscription is not assignable to NgIterable<p><strong>Goal:</strong> I want to Display User Data in the Frontend</p>
<p>I have a user model IPerson of the following structure</p>
<pre><code>export interface IPerson {
name: string;
email: string;
passwort: string;
}
</code></pre>
<p>In an auth Service, i created ... | <p>Thinking that you need <a href="https://www.learnrxjs.io/learn-rxjs/operators/transformation/scan" rel="nofollow noreferrer"><code>scan</code></a> rxjs operator to accumulate <code>IPerson</code> object as <code>Observable<IPerson[]></code>.</p>
<pre class="lang-js prettyprint-override"><code>import { scan } f... | Subscription is not assignable to NgIterable | angular|typescript|rxjs | -1 | 50 | 1 | 72,928,525 | 72,928,525 | 3 | true | 2022-07-10T12:00:39.150Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Subscription is not assignable to NgIterable<p><strong>Goal:</strong> I want to Display User Data in the Frontend</p>
<p>I have a user model IPerson of the f... |
72,932,056 | Neo4j Lucene fulltext search<p>I create an fulltext index:</p>
<pre><code>CREATE FULLTEXT INDEX skillAndTranslationsNamesAndDescriptions FOR (n:Skill|Translation) ON EACH [n.name, n.description]
</code></pre>
<p>Also, added a node with name = <code>bash-variables</code></p>
<p>I'm able to successfully query this node w... | <p>Try using the "whitespace" analyzer:</p>
<pre><code>CREATE FULLTEXT INDEX skillAndTranslationsNamesAndDescriptions
FOR (n:Skill|Translation) ON EACH [n.name, n.description]
OPTIONS { indexConfig: {`fulltext.analyzer`: 'whitespace'}}
</code></pre> | Neo4j Lucene fulltext search | neo4j|lucene|cypher|full-text-search | 0 | 50 | 1 | 72,932,540 | 72,932,540 | 3 | true | 2022-07-10T21:34:11.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Neo4j Lucene fulltext search<p>I create an fulltext index:</p>
<pre><code>CREATE FULLTEXT INDEX skillAndTranslationsNamesAndDescriptions FOR (n:Skill|Transla... |
72,949,114 | What is the difference between "int x = (int) x" and "x = (int) x" in java if I assign "double x = 2.3"?<p>if I assign "double x = 2.3", what is the difference between "int x = (int) x" and "x = (int) x" ? I'm new to java and use python before, in python, if I execute "x = 2.3; x = in... | <p>You're re-declaring <code>x</code>, so in the line</p>
<pre><code>int x = (int)x
</code></pre>
<p>The <code>x</code> on the right is not the same <code>x</code> you previously declared. So its value defaults to 0 so <code>(int)x</code> is 0. You normally wouldn't be able to have two <code>x</code> variables. That's ... | What is the difference between "int x = (int) x" and "x = (int) x" in java if I assign "double x = 2.3"? | java|jshell|typecasting-operator | -1 | 50 | 1 | 72,949,190 | 72,949,190 | 3 | true | 2022-07-12T08:19:55.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the difference between "int x = (int) x" and "x = (int) x" in java if I assign "double x = 2.3"?<p>if I assign "double x = 2.3", what is th... |
72,949,294 | R aggregate variable lengths differ error<p>Lots of questions on SO with similar titles, but I can't find any that match my circumstances or adapt them to resolve my error. From what I understand there is an issue with object lengths, but I don't understand why?</p>
<p>I'm looking for a <strong>base R</strong> solution... | <p>I wouldn't use <code>noquote</code> and just concatenate the column names as strings and then change it to a formula.</p>
<pre class="lang-r prettyprint-override"><code>cols.to.agg <- colnames(df)[4:length(df)]
grouping.col <- colnames(df)[3]
form <- paste0('cbind(',
paste(cols.to.agg, colla... | R aggregate variable lengths differ error | r|aggregate | 1 | 50 | 2 | 72,949,621 | 72,949,621 | 3 | true | 2022-07-12T08:33:35.197Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R aggregate variable lengths differ error<p>Lots of questions on SO with similar titles, but I can't find any that match my circumstances or adapt them to re... |
72,964,069 | Merge three columns into one taking into account priority preference<p>I have the following DataFrame in pandas:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>code</th>
<th>town</th>
<th>village</th>
<th>city</th>
</tr>
</thead>
<tbody>
<tr>
<td>01</td>
<td>Brunete</td>
<td>NaN</td>
<td>N... | <p>Let us define the <code>order</code> of columns then select those columns and use <code>backfill</code> along columns axis</p>
<pre><code>order = ['village', 'town', 'city']
df['merged'] = df[order].bfill(axis=1).iloc[:, 0]
</code></pre>
<hr />
<pre><code> code town village city ... | Merge three columns into one taking into account priority preference | python|pandas|dataframe | 2 | 50 | 2 | 72,964,125 | 72,964,125 | 3 | true | 2022-07-13T09:39:10.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Merge three columns into one taking into account priority preference<p>I have the following DataFrame in pandas:</p>
<div class="s-table-container">
<table c... |
72,963,584 | Why des Node JS not execute Asynchronous Function at all?<p>Please consider this example -</p>
<p>P.S - <code>findByIdAndRemove</code> is a Mongoose Function, used to deal with MongoDB.</p>
<p><strong>Block 1 :-</strong></p>
<pre><code>try {
Product.findByIdAndRemove(prodId);
console.log("Product D... | <p>This is an expansion on my comment.</p>
<blockquote>
<p>While trying to delete a product, if I use Block 1, the product wont
be deleted. But the console.log will be executed.</p>
<p>However, while trying to use Block 2, the product WILL be deleted and
then console.log will be executed.</p>
</blockquote>
<p>As you kn... | Why des Node JS not execute Asynchronous Function at all? | javascript|node.js | 1 | 50 | 1 | 72,965,161 | 72,965,161 | 3 | true | 2022-07-13T09:01:55.037Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why des Node JS not execute Asynchronous Function at all?<p>Please consider this example -</p>
<p>P.S - <code>findByIdAndRemove</code> is a Mongoose Function... |
73,002,677 | How to pass extension function as argument?<p>There is an extension functions</p>
<pre class="lang-kotlin prettyprint-override"><code>fun List<Track>.sortByTitle(): List<Track> {
return this.sortedBy { it.title }
}
fun List<Track>.sortByArtist(): List<Track> {
return this.sortedBy { it.... | <p>We can pass functions using <a href="https://kotlinlang.org/docs/lambdas.html#function-types" rel="nofollow noreferrer">function types</a>, for example:</p>
<pre class="lang-kotlin prettyprint-override"><code>fun sortByTitle(owner: String, kind: String) {
sort(owner, kind, List<Track>::sortByTitle)
}
fun ... | How to pass extension function as argument? | kotlin | 1 | 50 | 2 | 73,002,865 | 73,002,865 | 3 | true | 2022-07-16T08:22:17.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to pass extension function as argument?<p>There is an extension functions</p>
<pre class="lang-kotlin prettyprint-override"><code>fun List<Track>.s... |
73,003,757 | return in catch block fails to be executed<p>Basic example that throws an error because <code>tl</code> was not specified:</p>
<pre class="lang-javascript prettyprint-override"><code>function allmatches() {
SpreadsheetApp.getActive().getSheetByName('data').getRange('A1').setValue(tl)
}
</code></pre>
<p>And to know if... | <p>As you can see by the following examples the <code>finally</code> block is run regardless if an error occurs or not. So in the case of the OP <code>ContentService.createTextOutput('Error!');</code> is quickly replaced by <code>ContentService.createTextOutput('Ok!');</code> and the user is unaware of the error.</p>
... | return in catch block fails to be executed | javascript|python|google-apps-script|web-applications | 0 | 50 | 1 | 73,005,221 | 73,005,221 | 3 | true | 2022-07-16T11:21:09.650Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
return in catch block fails to be executed<p>Basic example that throws an error because <code>tl</code> was not specified:</p>
<pre class="lang-javascript pr... |
73,019,140 | Difference between 'NOT IN' and '!= ANY'<p>PostgreSQL version: 14</p>
<p>I have a query that updates a <code>jsonb</code> field and removes items with certain IDs from it:</p>
<pre><code>UPDATE types
SET elements = (
SELECT
CASE
WHEN jsonb_agg(element_obj) IS NULL THEN
'[]'::JSON... | <p>The equivalence of <code>NOT IN</code> is <code>!= ALL</code>, not <code>!= ANY</code>. With <code>!= ANY</code>, you are checking if any value (i.e. at least one) is not equal, which is not what you want.</p> | Difference between 'NOT IN' and '!= ANY' | arrays|postgresql|any|postgres-14 | 0 | 50 | 2 | 73,019,458 | 73,019,458 | 3 | true | 2022-07-18T08:08:37.827Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Difference between 'NOT IN' and '!= ANY'<p>PostgreSQL version: 14</p>
<p>I have a query that updates a <code>jsonb</code> field and removes items with certai... |
72,938,415 | Trying to insert data from windows form to database via mysql, error?<p>I get error at calling <code>cmd.ExecuteNonQuery</code>.</p>
<blockquote>
<p>Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'angelina','biology')'' at lin... | <p>You're using parameters incorrectly. The parameters for a query are the <em>values</em> being used in the query, but you're directly concatenating the values (which is a SQL injection vulnerability) and trying to use the parameters as <em>names</em> of your columns.</p>
<p>The query should be more like this:</p>
<p... | Trying to insert data from windows form to database via mysql, error? | c#|mysql|winforms | 0 | 50 | 1 | 72,938,542 | 72,938,542 | 3 | true | 2022-07-11T12:13:51.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trying to insert data from windows form to database via mysql, error?<p>I get error at calling <code>cmd.ExecuteNonQuery</code>.</p>
<blockquote>
<p>Error: Y... |
72,809,389 | How to find longer Strings from an Array?<p>I want to find Longer Strings from this array:</p>
<p>const myArr = ["first", "second", "third", "fourth", "fifth", "sixth", "seven", "eighth"]</p>
<p>in this array "second","fourth... | <p>Easier if you use filter instead:</p>
<pre><code>const myArr = ["first", "second", "third", "fourth", "fifth", "sixth", "seven", "eighth"]
const longest = myArr.reduce((a, b) => a.length > b.length ? a : b);
const res = myArr.filt... | How to find longer Strings from an Array? | javascript|function | 2 | 50 | 2 | 72,809,407 | 72,809,407 | 3 | true | 2022-06-30T01:26:22.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to find longer Strings from an Array?<p>I want to find Longer Strings from this array:</p>
<p>const myArr = ["first", "second", "... |
72,996,800 | how can i initialize a bi-dimensional vector in a class in C++?<p>I need to define its size in runtime, so I need a vector. I tried the following, but I get a compiling error:</p>
<blockquote>
<p>error: 'V' is not a type</p>
</blockquote>
<pre><code>#include<iostream>
#include<vector>
class graph {
private... | <p>The compiler considers these lines:</p>
<pre><code>std::vector<int> row(V);
std::vector<std::vector<int>> matrix(V,row);
</code></pre>
<p>as member function declarations with parameters that have unknown types and omitted names.</p>
<p>It seems what you need is to use the constructor's member initi... | how can i initialize a bi-dimensional vector in a class in C++? | c++|class|constructor|initialization|stdvector | -1 | 50 | 2 | 72,996,897 | 72,996,897 | 3 | true | 2022-07-15T16:06:03.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how can i initialize a bi-dimensional vector in a class in C++?<p>I need to define its size in runtime, so I need a vector. I tried the following, but I get ... |
72,864,250 | How to specify 'includes' for nested properties in a document in RavenDB<p>I am trying to use RavenDB's REST API to make some calls to my database and I'm wondering if there's a way to use the 'includes' feature to return documents that are nested in a document.</p>
<p>For example, I have an object, <code>Order</code>,... | <p>The syntax to <strong>Query for Related Documents</strong> from the client can be found in this <a href="https://demo.ravendb.net/demos/csharp/related-documents/query-related-documents" rel="nofollow noreferrer">demo</a>:<br>
<a href="https://demo.ravendb.net/demos/csharp/related-documents/query-related-documents" r... | How to specify 'includes' for nested properties in a document in RavenDB | ravendb | 3 | 50 | 1 | 72,866,957 | 72,866,957 | 3 | true | 2022-07-05T05:07:57.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to specify 'includes' for nested properties in a document in RavenDB<p>I am trying to use RavenDB's REST API to make some calls to my database and I'm wo... |
72,955,545 | What happens if a class implements two interfaces that extend the same base interface?<p>Consider the following interfaces in C#:</p>
<pre class="lang-cs prettyprint-override"><code>public interface IUpgradeable
{
public void Upgrade();
}
public interface ISpeedUpgradeable : IUpgradeable
{
public int GetCurre... | <p>There is only one meaning of <code>IUpgradeable</code>. The fact that multiple interfaces inherit it, and add meaning to themselves doesn't change the meaning of the original interface. Your class simply implements <code>ISpeedUpgradeable</code>, <code>IDamageUpgradeable</code>, and <code>IUpgradeable</code>: it doe... | What happens if a class implements two interfaces that extend the same base interface? | c#|inheritance|interface|diamond-problem | 0 | 50 | 1 | 72,955,647 | 72,955,647 | 3 | true | 2022-07-12T16:29:12.687Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What happens if a class implements two interfaces that extend the same base interface?<p>Consider the following interfaces in C#:</p>
<pre class="lang-cs pre... |
72,959,130 | How to extract an n size window substring from any string?<p>Given a list of elements, how to create a window of an arbitrary size, and extract n elements to the left and right from the center? For example, given:</p>
<pre><code>l = ['This', 'document', 'is', 'the', 'second', 'document']
</code></pre>
<p>and a window =... | <p>Here is a way to do what your question asks:</p>
<pre class="lang-py prettyprint-override"><code>l = ['This', 'document', 'is', 'the', 'second', 'document']
window = 2
middle = int((len(l)/2))
sublist = l[max(0, middle - window):min(len(l), middle + window + 1)]
</code></pre>
<p>Output:</p>
<pre><code>['document', '... | How to extract an n size window substring from any string? | python|list|loops|slice | 0 | 50 | 1 | 72,959,257 | 72,959,257 | 3 | true | 2022-07-12T22:48:37.437Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to extract an n size window substring from any string?<p>Given a list of elements, how to create a window of an arbitrary size, and extract n elements to... |
72,773,475 | Rename multiindex level based on other level<p>I have a dataframe with a multiindex column, more or less like so</p>
<pre><code>import pandas as pd
columns = pd.MultiIndex.from_product((("Length", "Weight"), ("Max", "Min"), ("asd",)), names=("Measure", "... | <h3>Update</h3>
<pre><code>measure_to_unit = {"Length": "m", "Weight": "kg"}
l1, l2, l3 = zip(*df.columns)
newcol = pd.MultiIndex.from_arrays([l1, l2, [measure_to_unit[i] for i in l1]])
df.set_axis(newcol, axis=1)
</code></pre>
<p>Output:</p>
<pre><code> Length Weight ... | Rename multiindex level based on other level | python|pandas|multi-index | 0 | 50 | 1 | 72,773,699 | 72,773,699 | 3 | true | 2022-06-27T14:07:00.577Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rename multiindex level based on other level<p>I have a dataframe with a multiindex column, more or less like so</p>
<pre><code>import pandas as pd
columns ... |
72,786,669 | Assign value to complex type without creating new instance<p>Below is my Type which i am using to return api response</p>
<pre><code>public class ApiRespone
{
public Response resp => new Response();
}
public class Response
{
public MetaData metadata { get; set; }
public Data data { get; set; }
}
public ... | <p>Everytime you ask for <code>resp</code> you get a new empty object.</p>
<p>Please change:</p>
<pre><code>public class ApiRespone
{
public Response resp => new Response();
}
</code></pre>
<p>to</p>
<pre><code>public class ApiRespone
{
public Response()
{
resp = new Response();
}
public Respon... | Assign value to complex type without creating new instance | c#|asp.net-core-3.1 | -1 | 50 | 1 | 72,786,764 | 72,786,764 | 3 | true | 2022-06-28T12:43:35.017Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Assign value to complex type without creating new instance<p>Below is my Type which i am using to return api response</p>
<pre><code>public class ApiRespone
... |
72,912,908 | Delete line if a pattern is not there<p>I have a text file with MAC addresses and port numbers like this:</p>
<pre class="lang-none prettyprint-override"><code>aa:bb:cc:dd:ee:ff 1/1
aa:ff:00:55:66:99 1/1
00:11:22:33:44:55 1/1
99:88:77:66:55:44 1/1
ff:ee:dd:cc:bb:aa 1/2
</code></pre>
<p>How can I delete all the lines th... | <p>If you invert the condition and think of it as <em>matching</em> instead of <em>deleting</em>, you can use <code>awk</code> to print out matching lines:</p>
<pre><code>awk '$1 == "aa:bb:cc:dd:ee:ff" || $2 != "1/1"' file
</code></pre> | Delete line if a pattern is not there | bash|shell | 2 | 50 | 4 | 72,913,062 | 72,913,062 | 3 | true | 2022-07-08T14:27:07.983Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Delete line if a pattern is not there<p>I have a text file with MAC addresses and port numbers like this:</p>
<pre class="lang-none prettyprint-override"><co... |
72,942,988 | How can you split text to columns if there are multiple delimiters of the same type in Excel?<p>I have a column that has dates, days, and times in it. I need to split out just the time but there are multiple hyphens, how can I achieve this? Below is what I have.</p>
<div class="s-table-container">
<table class="s-table... | <p>I would also try:</p>
<pre><code>=left(A1,find("-",A1,1)-2)
</code></pre>
<p>And</p>
<pre><code>=mid(A1,find("-",A1,1)+2,len(A1))
</code></pre>
<p>Which will split either side of the first <code>-</code>.</p>
<p>Check for the formatting for your results.</p> | How can you split text to columns if there are multiple delimiters of the same type in Excel? | excel | 0 | 50 | 3 | 72,943,264 | 72,943,264 | 3 | true | 2022-07-11T18:18:48.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can you split text to columns if there are multiple delimiters of the same type in Excel?<p>I have a column that has dates, days, and times in it. I need... |
72,784,221 | Add a content of an array as an element to a list in Java 11<p>I have rather a trivial question on which I am thinking without success.</p>
<p>Suppose we have a snippet of code like this:</p>
<pre class="lang-java prettyprint-override"><code>int x[] = new int[]{3,4};
List<int[]> testList = new ArrayList<>(... | <p>The closest to your code:</p>
<pre><code>Integer[] x = {3, 4};
List<Integer> testList = new ArrayList<>();
Collections.addAll(testList, x); // Size 2.
System.out.println(testList);
</code></pre>
<p>As the List contains the Object class <code>Integer</code> the
<code>int</code>s must be boxed to Integer.<... | Add a content of an array as an element to a list in Java 11 | java|arrays|pass-by-reference | 0 | 50 | 1 | 72,784,336 | 72,784,336 | 3 | true | 2022-06-28T09:46:29.943Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add a content of an array as an element to a list in Java 11<p>I have rather a trivial question on which I am thinking without success.</p>
<p>Suppose we hav... |
72,968,627 | Improving performance (speed) of a function<p>I have a database of patients and their results.
Below are demo dataframes:</p>
<pre><code>import pandas as pd
import numpy as np
from scipy.stats import linregress
data = [[1 , '20210201', 4567, 40],
[1 , '20210604', 4567, 55],
[1 , '20200405', 2574, 42... | <p>This is a great question. Usually when the data is all in memory and then things run for days it is because they have run into an execution combinatorial nightmare. Your pointer to the selection line as the biggest time consumer makes total sense – that this is a CPU-bound process.</p>
<p>If you assume that the <c... | Improving performance (speed) of a function | pandas|dataframe|group-by|apply | 2 | 50 | 2 | 72,971,604 | 72,971,604 | 3 | true | 2022-07-13T15:12:22.870Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Improving performance (speed) of a function<p>I have a database of patients and their results.
Below are demo dataframes:</p>
<pre><code>import pandas as pd
... |
72,782,045 | arrow validation more then 10 fields<p>all I have a question how can I validate more then 10 values with arrow in kotlin.</p>
<pre><code>fun CreateEventDTO.validate(): Validated<IncorrectInput, CreateEventDTO> =
name.isEventNameValid()
.zip(
about.isAboutValid(),
phone.isPhoneValid(),
pric... | <p>Kotlin requires all functions to be explicitly defined, and we cannot define an infinite amount of methods. Therefore Arrow made the decision to limit to 9 arguments.</p>
<p>However, you can easily combine different <code>zip</code> methods with each-other using tuples. For reaching 10 arguments, you can combine <co... | arrow validation more then 10 fields | kotlin|validation|arrow-kt | 1 | 50 | 1 | 72,782,420 | 72,782,420 | 4 | true | 2022-06-28T07:05:42.543Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
arrow validation more then 10 fields<p>all I have a question how can I validate more then 10 values with arrow in kotlin.</p>
<pre><code>fun CreateEventDTO.v... |
72,806,495 | Is there a more elegant way to initialize empty dataframes<pre><code>isd = pd.DataFrame()
ind = pd.DataFrame()
exd = pd.DataFrame()
psd = pd.DataFrame()
visd = pd.DataFrame()
vind = pd.DataFrame()
vexd = pd.DataFrame()
sd = pd.DataFrame()
ise = pd.DataFrame()
idb = pd.DataFrame()
mdd = pd.DataFrame()
add = pd.DataFrame... | <p>Use a dictionary of dataframes, especially of the code for some data frames is going to share some similarities. This will allows doing some operations using loops or functions:</p>
<pre><code>dct = {n: pd.DataFrame() for n in ['isd', 'ind', 'exd']}
</code></pre> | Is there a more elegant way to initialize empty dataframes | python|pandas|dataframe|performance | 2 | 50 | 4 | 72,806,576 | 72,806,576 | 4 | true | 2022-06-29T18:56:54.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a more elegant way to initialize empty dataframes<pre><code>isd = pd.DataFrame()
ind = pd.DataFrame()
exd = pd.DataFrame()
psd = pd.DataFrame()
visd... |
72,853,366 | Insert "Infinity" value in DF16_DEC column<p>I have a table that has column of type <code>DF16_DEC</code>. Since this type is represented by <code>decfloat16</code> in ABAP and the <a href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abenconversion_type_decfloat.htm" rel="nofollow noreferrer">docume... | <p>ABAP does not support infinity or NaN values for decfloats (or for regular <code>TYPE f</code> floating point variables, for that matter). Any attempt to generate such a value through mathematical operations will result in a runtime error.</p>
<p>So if you want to put a value in your table which represents "no ... | Insert "Infinity" value in DF16_DEC column | abap | 2 | 50 | 1 | 72,855,711 | 72,855,711 | 4 | true | 2022-07-04T07:50:59.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Insert "Infinity" value in DF16_DEC column<p>I have a table that has column of type <code>DF16_DEC</code>. Since this type is represented by <code>decfloat16... |
72,885,879 | .net 6 The type of namespace could not be found<p>I created a program with .net 6. When I create add a class and then instantiate it in the main. I get the error</p>
<blockquote>
<p>Error CS0246 The type or namespace name 'AbilityScoreCalculator' could not be found (are you missing a using directive or an assembly ref... | <p>I'm going to assume that your .Net 6 "Main Method Code" is using Top Level Statements, where</p>
<pre><code>AbilityScoreCalculator calculator = new AbilityScoreCalculator();
</code></pre>
<p>Is the <em>entire</em> contents of the Program.cs file. No explicit class, no curly braces, nothing else.</p>
<p>Whe... | .net 6 The type of namespace could not be found | c# | 1 | 50 | 1 | 72,886,046 | 72,886,046 | 4 | true | 2022-07-06T15:05:16.073Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
.net 6 The type of namespace could not be found<p>I created a program with .net 6. When I create add a class and then instantiate it in the main. I get the e... |
72,888,273 | Pandas - Drop rows where *not* totally duplicated<p>I have a DataFrame that contains the following columns (along with others). I am trying to figure out how to remove <strong>all</strong> rows where: For each group number in ID_Dets if there exists more than 1 unique number in ID_Dets_2 then drop all rows.</p>
<p>I ... | <p>You can count the number of unique values per group and set a threshold to have 1 unique value:</p>
<pre><code>df[df.groupby('ID_Dets')['ID_Dets_2'].transform('nunique').eq(1)]
</code></pre>
<p>or:</p>
<pre><code>df.groupby('ID_Dets').filter(lambda g: len(g['ID_Dets_2'].unique())<=1)
</code></pre>
<p>output:</p>
... | Pandas - Drop rows where *not* totally duplicated | python|pandas | 1 | 50 | 2 | 72,888,503 | 72,888,503 | 4 | true | 2022-07-06T18:22:28.733Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas - Drop rows where *not* totally duplicated<p>I have a DataFrame that contains the following columns (along with others). I am trying to figure out ho... |
72,895,350 | Get relay chain blocknumber from parachain in substrate pallet<p>The title is quite self-explanatory, how can i get the blocknumber of the relay chain I'm connected to (Kusama) instead of my local blocknumber ?</p>
<p>All of this in a substrate/cumulus environment</p> | <p>I assume that you mean not Substrate, but Cumulus, to be specific, since you are talking about parachains.</p>
<p>Cumulus parachains' runtimes receive the so called <a href="https://paritytech.github.io/cumulus/cumulus_primitives_core/struct.PersistedValidationData.html" rel="nofollow noreferrer"><code>PersistedVali... | Get relay chain blocknumber from parachain in substrate pallet | blockchain|substrate|polkadot | 1 | 50 | 1 | 72,895,809 | 72,895,809 | 4 | true | 2022-07-07T09:24:19.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get relay chain blocknumber from parachain in substrate pallet<p>The title is quite self-explanatory, how can i get the blocknumber of the relay chain I'm co... |
72,959,324 | How can I use LINQ in C# with a column containing a '-' character?<p>I have a DataTable in C# and I am attempting to use LINQ to select rows. The issue I am encountering is that a hyphenated column name is being interpreted incorrectly.</p>
<p>Here is the code:</p>
<pre><code>DataRow[] matches = myTable.Select("SU... | <p>Thanks to the comments provided, the solution is as follows:</p>
<pre><code>DataRow[] matches = myTable.Select("[SUB-CATEGORY] = '" + sc + "' AND BW = '" + bw + "'");
</code></pre> | How can I use LINQ in C# with a column containing a '-' character? | c#|linq | 3 | 50 | 1 | 72,959,599 | 72,959,599 | 4 | true | 2022-07-12T23:23:16.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I use LINQ in C# with a column containing a '-' character?<p>I have a DataTable in C# and I am attempting to use LINQ to select rows. The issue I am ... |
72,966,987 | Create an array from hard-coded values for use in a LAMBDA function<p>I have recently created a <code>LAMBDA</code> function for recursive substitutions of substrings which works when using a range:</p>
<blockquote>
<p><code>LAMBDA</code> named ReplaceArray</p>
</blockquote>
<pre><code>=LAMBDA(str, list, sub, IF(ROWS(l... | <p>When LAMBDA was first introduced the best way to use it was in the Name Manager. Since then there are a myriad of Helper formula that allow us to use it outside the Name Manager and make the formula simpler and easier to understand.</p>
<p>For example in this case we use <a href="https://support.microsoft.com/en-us... | Create an array from hard-coded values for use in a LAMBDA function | excel|excel-formula|excel-lambda | 1 | 50 | 1 | 72,967,528 | 72,967,528 | 4 | true | 2022-07-13T13:16:11.117Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create an array from hard-coded values for use in a LAMBDA function<p>I have recently created a <code>LAMBDA</code> function for recursive substitutions of s... |
72,878,520 | How to pythonically return different dataframe column calculations<p>I have a function which goes something like:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
import numpy as np
def my_fun(df, calc_type):
if calc_type == 'sum':
return df['col_name'].sum()
elif calc_type == '... | <p>IIUC use:</p>
<pre><code>def my_fun(df, calc_type):
#specify possible functions
if calc_type in ['sum','mean','min','max', 'std']:
return df['col_name'].agg(calc_type)
else:
print ('wrong calc_type')
</code></pre>
<p>Thank you for comment @Himanshu Poddar
, if never calc_type is in... | How to pythonically return different dataframe column calculations | python|pandas|dataframe | 2 | 50 | 1 | 72,878,544 | 72,878,544 | 4 | true | 2022-07-06T05:53:56.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to pythonically return different dataframe column calculations<p>I have a function which goes something like:</p>
<pre class="lang-py prettyprint-overrid... |
72,797,938 | Creating an array of Semaphores C++<p>I am trying to create an array of semaphores, however my code is not running correctly so I am hoping to get some feedback on whether I am doing this correct.</p>
<p>Creating the semaphore array as a global variable, I have:</p>
<pre><code>sem_t sems [10] = {};
</code></pre>
<p>The... | <p>I don't know what you expect the middle part of your process to do. The additional variables you are declaring are independent semaphores from those in the array. Assignment will only copy the <code>sem_t</code> value (which is going to technically cause undefined behavior because you didn't initialize them).</p>
<p... | Creating an array of Semaphores C++ | c++|arrays|pthreads|semaphore | 0 | 50 | 1 | 72,798,027 | 72,798,027 | 4 | true | 2022-06-29T08:10:36.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating an array of Semaphores C++<p>I am trying to create an array of semaphores, however my code is not running correctly so I am hoping to get some feedb... |
72,910,635 | How to delete a record without actually reading the record in RPGLE<p>Recently I came across a question that was asked to me in a RPGLE interview. I was asked how to delete a record without actually reading it in RPGLE. My answer was we can use embedded SQL , but he told in SQL we are still reading the data.
So in this... | <p>You simply provide a factor-1 search argument</p>
<pre><code>C MYKLIST DELETE MYFILE
</code></pre>
<p>In free form,</p>
<pre><code>delete (key1:key2) myfile;
</code></pre>
<p>It's in the <a href="https://www.ibm.com/docs/en/i/7.4?topic=codes-delete-delete-record#zzdelet" rel="nofollow noreferrer">manual... | How to delete a record without actually reading the record in RPGLE | ibm-midrange|rpgle|rpg | 2 | 50 | 1 | 72,912,198 | 72,912,198 | 4 | true | 2022-07-08T11:20:03.613Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to delete a record without actually reading the record in RPGLE<p>Recently I came across a question that was asked to me in a RPGLE interview. I was aske... |
72,907,265 | Replacing positive table values with positive values from a list of uneven vectors<h1>Background</h1>
<p>I recently asked <a href="https://stackoverflow.com/questions/72899527/replacing-a-subset-of-table-values-with-a-list-of-vectors">this question</a>. I however made the example slightly too simple, so I am adding som... | <p>Assume the amount of numbers in each vector in <code>listB</code> equals the amount of positive numbers in each row of <code>tableA</code>, you could solve it by</p>
<pre class="lang-r prettyprint-override"><code>tab <- t(tableA)
tab[tab > 0] <- unlist(listB)
tableA[, c('B', 'C', 'D')] <- t(tab)[, c('B',... | Replacing positive table values with positive values from a list of uneven vectors | r|list|vector | 3 | 50 | 2 | 72,907,519 | 72,907,519 | 4 | true | 2022-07-08T06:05:51Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replacing positive table values with positive values from a list of uneven vectors<h1>Background</h1>
<p>I recently asked <a href="https://stackoverflow.com/... |
73,017,555 | Is an algorithm whose time complexity increases with input but with a limit considered O(n)?<p>if a function's statements execution increases with input but with a limit, would it be considered O(n) or O(1)?</p>
<p>for example:</p>
<pre><code>void func(int n)
{
if (n > 1000)
{
for (in... | <p>It is O(1), not O(n).</p>
<p>Big-O analysis is <em>asymptotic</em>: it intentionally ignores an arbitrarily large initial section of the performance function, in order to accurately describe the large-scale behavior.</p> | Is an algorithm whose time complexity increases with input but with a limit considered O(n)? | algorithm|time-complexity | 1 | 50 | 1 | 73,017,750 | 73,017,750 | 6 | true | 2022-07-18T05:09:29.433Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is an algorithm whose time complexity increases with input but with a limit considered O(n)?<p>if a function's statements execution increases with input but ... |
72,873,687 | [may be duplicate) How to read a number from a file and use it as a variable?<p>I'm new to python so this is most likely basic knowledge, but how do I read a number from a text file and use it as a variable? I'm trying to make a game where it counts your points and saves it to a plain text file, and when you first run ... | <h4>Store one number only</h4>
<pre class="lang-py prettyprint-override"><code>points = 200
# Store points
f = open("points.txt", "w")
f.write(str(points))
f.close()
# Retrieve them now
f = open("points.txt", "r")
points = int(f.read())
</code></pre>
<p>Cheers</p> | [may be duplicate) How to read a number from a file and use it as a variable? | python | -1 | 50 | 2 | 72,873,780 | 72,873,780 | -2 | true | 2022-07-05T17:57:41.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
[may be duplicate) How to read a number from a file and use it as a variable?<p>I'm new to python so this is most likely basic knowledge, but how do I read a... |
72,771,065 | Building go tests from multiple packages into single file<p>Is there any way to build all the test files in a project located inside multiple packages into a single binary file?
To build binary inside a single package, I could use
<code>go test -c</code>.</p>
<p>I need something like <code>go test ./... -c</code>,but t... | <blockquote>
<p>Is there any way to build all the test files in a project located inside multiple packages into a single binary file?</p>
</blockquote>
<p>No.</p> | Building go tests from multiple packages into single file | go|go-testing|go-build | 0 | 50 | 1 | 72,771,692 | 72,771,692 | -1 | true | 2022-06-27T11:05:43.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Building go tests from multiple packages into single file<p>Is there any way to build all the test files in a project located inside multiple packages into a... |
72,786,077 | How do I start from the beginning of the code while keeping the string value?<p>I need to go to line 14 of this code after the code has finished running. How would I do that?</p>
<pre><code>from replit import db
import getpass
import sys
def signup():
db["User"] = input("Enter username:\n")
... | <p>You loop it and then exit whenever you want to.</p>
<pre><code>from replit import db
import getpass
import sys
def signup():
db["User"] = input("Enter username:\n")
db["Pass"] = getpass.getpass("Enter Password:\n")
def login():
print("WIP")
while True: # yo... | How do I start from the beginning of the code while keeping the string value? | python|replit | 1 | 50 | 1 | 72,786,266 | 72,786,266 | -1 | true | 2022-06-28T12:02:51.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I start from the beginning of the code while keeping the string value?<p>I need to go to line 14 of this code after the code has finished running. How... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.