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,284,035 | Conditional mean from different column<p>I do have an R data frame like this:</p>
<pre><code>city2001 <- c('a', 'b', 'a')
grade2001 <- c(5, 5, 7)
city2002 <- c('b', 'b', 'a')
grade2002 <- c(8, 9, 10)
df <- data.frame(city2001, grade2001, city2002, grade2002)
</code></pre>
<p>and would like to return ,</... | <p>Try</p>
<pre><code>mean(df[,grepl("grade",colnames(df))][df[,grepl("city",colnames(df))]=="a"])
[1] 7.333333
</code></pre>
<p>your df (columns) better be sorted.</p>
<p>If you want for all the groups and not just "a"</p>
<pre><code>tapply(
unlist(df[,grepl("grade",... | Conditional mean from different column | r | 0 | 62 | 4 | 72,284,276 | 72,284,276 | 2 | true | 2022-05-18T06:17:14.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Conditional mean from different column<p>I do have an R data frame like this:</p>
<pre><code>city2001 <- c('a', 'b', 'a')
grade2001 <- c(5, 5, 7)
city2... |
72,332,950 | Why the data appears on mutation, but does not appear on query?<p>I have students and they can enroll on different courses. When I create a new student, I have courses ids (array) as an argument to get the course information by the id. I am passing the information to the student courses array. The problem is that when ... | <p>Did you check your database to see if the courses are linked to the student?</p>
<p>The reason why it's not is because in your map, you're again executing a promise, which you should return, and then await all of these promises, before you save the records.</p>
<pre><code>...
const promises = data.coursesIDs.map((id... | Why the data appears on mutation, but does not appear on query? | typescript|graphql|mutation|typegraphql | 0 | 62 | 1 | 72,333,306 | 72,333,306 | 2 | true | 2022-05-21T20:19:35.437Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why the data appears on mutation, but does not appear on query?<p>I have students and they can enroll on different courses. When I create a new student, I ha... |
72,251,201 | How to remove extra tag?<p>First xml file to be updated:</p>
<pre><code><Conf key="11" title="tit">
<Item key="1" >
<Lock con="E0" />
<Vol title="te" description="de">
<All con="1" title="uu" />... | <p>I would approach it this way, and don't need to use the <code>exslt:node-set()</code> extension function.</p>
<p>Create a composite key that uses the <code>@key</code> of the <code>Item</code> and the <code>local-name()</code> of the <code>Widget</code> parent element. Use that composite key value to lookup the cor... | How to remove extra tag? | xml|xpath|xslt|xslt-1.0 | 2 | 62 | 1 | 72,251,664 | 72,251,664 | 3 | true | 2022-05-15T18:40:23.867Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove extra tag?<p>First xml file to be updated:</p>
<pre><code><Conf key="11" title="tit">
<Item key="1" &g... |
72,252,179 | Why does full `constexpr` enabling of a data structure cause the compiled code to be bigger?<p>At <a href="https://youtu.be/uzF4u9KgUWI?t=3127" rel="nofollow noreferrer">this</a> moment of Jason Turner's 2016 CppCon talk "Practical Performance Practices", he mentions that full constexpr enabling of every data... | <p>When implementing a 7-bit cyclic redundancy check (CRC) algorithm on a microcontroller, I find it handy to build a 256-byte lookup table ahead of time, with some code like this:</p>
<pre class="lang-c prettyprint-override"><code>uint8_t crc_table[256];
for (unsigned int i = 0; i < 256; i++)
{
crc_table[i] = som... | Why does full `constexpr` enabling of a data structure cause the compiled code to be bigger? | c++|templates|compiler-construction|constexpr|constexpr-function | 2 | 62 | 1 | 72,252,209 | 72,252,209 | 3 | true | 2022-05-15T21:05:05.433Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does full `constexpr` enabling of a data structure cause the compiled code to be bigger?<p>At <a href="https://youtu.be/uzF4u9KgUWI?t=3127" rel="nofollow... |
72,262,522 | Show rows that appear only once in R dataframe<p>I know that we can use unique() to effectively show a dataframe without duplicate values, but is there an elegant way to show only those rows that appear once in a dataframe?</p>
<p>E.g.,</p>
<pre><code>a = c(10,20,10,10)
b = c(10,30,10,20)
ab = data.frame(a,b)
</code></... | <p>We can use <code>duplicated</code></p>
<pre><code>subset(ab, !(duplicated(ab)|duplicated(ab, fromLast = TRUE)))
</code></pre>
<p>-output</p>
<pre><code> a b
2 20 30
4 10 20
</code></pre> | Show rows that appear only once in R dataframe | r|dataframe | 1 | 62 | 2 | 72,262,538 | 72,262,538 | 3 | true | 2022-05-16T16:27:52.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Show rows that appear only once in R dataframe<p>I know that we can use unique() to effectively show a dataframe without duplicate values, but is there an el... |
72,266,735 | adding to a dataframe column of overlapping times<p>suppose there are many workers for a business, and all of them work different amount of hours that start and end at different hours of the day.</p>
<p>each day, and you are given a list of each workers' start and end times.</p>
<p>what is the fastest and most efficien... | <p>Use list comprehension through the <strong>nine rows</strong> of <code>business_hrs</code> AND <em><strong>NOT vice versa through potentially millions of rows of ppl working data...</strong></em> This should be performant.</p>
<pre><code>import pandas as pd
df = pd.DataFrame([9,10,11,12,13,14,15,16,17], columns=['bu... | adding to a dataframe column of overlapping times | python|pandas | 2 | 62 | 2 | 72,266,925 | 72,266,925 | 3 | true | 2022-05-16T23:47:10.657Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
adding to a dataframe column of overlapping times<p>suppose there are many workers for a business, and all of them work different amount of hours that start ... |
72,272,678 | Having problem with digits recognition in python using opencv, tesseract<p>I'm trying crop an image using opencv and then let tesseract read it, but even the image is quite clear it is not able to recognize numbers out of that image, here are lines of code for the action:</p>
<pre><code>screen_img = cv2.imread(f'data\\... | <p>A magic happens when adding <code>config='--psm 6'</code>.</p>
<p>According to <a href="https://muthu.co/all-tesseract-ocr-options/" rel="nofollow noreferrer">Tesseract OCR options page</a>:</p>
<blockquote>
<p>6 Assume a single uniform block of text.</p>
</blockquote>
<hr />
<p>Code sample:</p>
<pre><code>crop_img ... | Having problem with digits recognition in python using opencv, tesseract | python|opencv|computer-vision|tesseract|python-tesseract | 0 | 62 | 1 | 72,280,720 | 72,280,720 | 3 | true | 2022-05-17T10:47:24.523Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Having problem with digits recognition in python using opencv, tesseract<p>I'm trying crop an image using opencv and then let tesseract read it, but even the... |
72,306,515 | Pandas: Three listed columns to wide format<p>How to expand a set of columns using the first column's values as headers for the other columns?</p>
<p>For example:</p>
<pre class="lang-py prettyprint-override"><code>x = pd.DataFrame({'id':[11,998,3923], 'count':[7,7,7],
'attributes':['VIS,TEMP,MIN','MIN,VIS,TEMP','MIN... | <h3>Solution</h3>
<p>Split the strings in attribute like columns around delimiter <code>,</code> to convert into lists, then <code>explode</code> to convert lists into individual rows, then <code>pivot</code> with columns=<code>attributes</code> to reshape, finally flatten the multindex using <code>map + join</code></p... | Pandas: Three listed columns to wide format | python|pandas|dataframe | 2 | 62 | 2 | 72,307,185 | 72,307,185 | 3 | true | 2022-05-19T14:36:13.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas: Three listed columns to wide format<p>How to expand a set of columns using the first column's values as headers for the other columns?</p>
<p>For exa... |
72,332,168 | Plot looks different everytime i run the code<p>I have a problem with my code. It looks different everytime i run it. Any ideas? I don't see any problem. I am looking at this code since 2h and I can't find the problem...</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
x = np.... | <p>You are using <a href="https://docs.scipy.org/doc/scipy/reference/stats.html" rel="nofollow noreferrer">random statistical distribution</a>, each time you run your code a new random distribution is created.<br />
In order to get repeatability (your code picks always the same random distribution when you run it) you ... | Plot looks different everytime i run the code | python|numpy|matplotlib|math|scipy | 1 | 62 | 1 | 72,332,303 | 72,332,303 | 3 | true | 2022-05-21T18:16:34.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Plot looks different everytime i run the code<p>I have a problem with my code. It looks different everytime i run it. Any ideas? I don't see any problem. I a... |
72,336,014 | Customer retention rate in snowflake<p>I have this formula for the customer retention rate but kinda stuck in translating it into a sql code in snowflake:</p>
<p><strong>Customer Retention rate: number of customers who purchased in the past AND in the period of [last 30 days] / number of customers who have purchased in... | <p>if we check for each customer if they have "old sales" and "new sales"</p>
<pre><code>select customer_id, min(date) as min_date, max(date) as max_date, min_date < (current_date()-30) as old_sales, max_date >= (current_date()-30) as new_sales
from values
(1,'2022-05-01'),
(2,'2022-05... | Customer retention rate in snowflake | sql|statistics|snowflake-cloud-data-platform|analysis | 0 | 62 | 1 | 72,336,356 | 72,336,356 | 3 | true | 2022-05-22T08:42:41.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Customer retention rate in snowflake<p>I have this formula for the customer retention rate but kinda stuck in translating it into a sql code in snowflake:</p... |
72,343,105 | Doubts about the ClassReader and the accept method<p>I would like to know how the "optimization" described in the ASM user manual works.</p>
<p>I took a small snippet from the manual:</p>
<blockquote>
<p>If a ClassReader component detects that a MethodVisitor returned by
the ClassVisitor passed as argument to... | <blockquote>
<ol>
<li>What events does the <code>ClassReader</code> not generate when the <code>MethodVisitor</code> is retrieving from a <code>ClassWriter</code> and this is detected by the accept method?</li>
</ol>
</blockquote>
<p>We are talking about all visit… methods of the <a href="https://asm.ow2.io/javadoc/org... | Doubts about the ClassReader and the accept method | java|bytecode|java-bytecode-asm | 0 | 62 | 2 | 72,345,834 | 72,345,834 | 3 | true | 2022-05-23T03:56:17.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Doubts about the ClassReader and the accept method<p>I would like to know how the "optimization" described in the ASM user manual works.</p>
<p>I t... |
72,346,268 | What does self.model(batch) do in pytorch?<p>I am currently rewriting a PyTorch code to tensorflow. During this I found a line that I don't understand, so I am not able to translate it to tensorflow.</p>
<p>Can someone explain me what this does/ means?</p>
<pre><code>self.model(batch)
</code></pre> | <p>It seems like <code>self.model</code> is a layer/layers of a neural network, derived from <code>nn.Module</code> class.<br />
The call <code>self.model(batch)</code> invoke's <code>self.model</code>'s <code>__call__</code> method with the argument <code>batch</code>.<br />
If you inspect closely, <code>nn.Module.__c... | What does self.model(batch) do in pytorch? | python|pytorch | 0 | 62 | 1 | 72,346,417 | 72,346,417 | 3 | true | 2022-05-23T09:33:23.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What does self.model(batch) do in pytorch?<p>I am currently rewriting a PyTorch code to tensorflow. During this I found a line that I don't understand, so I ... |
72,364,608 | This is a React JS Fetch with a failing POST method<p>I have a simple react application and I am trying to request and post the method and render out the response inside my return div. I am getting a 400 error in my dev tool (network). I have debugged the app so many times. I just can not hit a jackpot. If you run the ... | <p>You are not serializing your object to JSON. You're <em>actually</em> sending <code>[object Object]</code>. Use <code>JSON.stringify</code> for that:</p>
<pre class="lang-js prettyprint-override"><code>const requestOptions = {
method: "POST",
headers: {
"Content-Type": "application/j... | This is a React JS Fetch with a failing POST method | javascript|reactjs | 0 | 62 | 2 | 72,364,755 | 72,364,755 | 3 | true | 2022-05-24T14:21:38.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
This is a React JS Fetch with a failing POST method<p>I have a simple react application and I am trying to request and post the method and render out the res... |
72,369,203 | Why are these dots not equal in python?<p>I am working on texts and have the left dot from an input text and right dot typed from a keyboard. However, in Python, they are not being treated as equal.</p>
<pre class="lang-py prettyprint-override"><code>'․' == '.'
Out[870]: False
</code></pre>
<p>What could be a possible ... | <p>The dot on the left is <em>not</em> a period: it is a <a href="https://www.compart.com/en/unicode/U+2024" rel="nofollow noreferrer">one dot leader</a> Unicode character.</p>
<p>In Python, you can print it by using <code>"\u2024"</code>:</p>
<pre class="lang-py prettyprint-override"><code>print('\u2024')
</... | Why are these dots not equal in python? | python|python-3.x|string|text|nlp | 2 | 62 | 3 | 72,369,251 | 72,369,251 | 3 | true | 2022-05-24T20:39:18.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why are these dots not equal in python?<p>I am working on texts and have the left dot from an input text and right dot typed from a keyboard. However, in Pyt... |
72,370,812 | One function for two different classes with similar properties<p>Hi after failing with inheritance (it got complicated) I stumble onto Generics. I am new to coding in general and C# is my first language.</p>
<p>I have two classes CIMTDXInput, RMTTDXInput which have the same properties but those properties have slightly... | <h1>The why</h1>
<p>So when you say this:</p>
<pre><code>public void MyMethod<T>(T value) where T: ClassA, ClassB
</code></pre>
<p>You're saying that T should be derived from both <code>ClassA</code> and <code>ClassB</code>. Now it would work in this scenario:</p>
<pre><code>public class ClassA
{
public int S... | One function for two different classes with similar properties | c# | 0 | 62 | 2 | 72,370,855 | 72,370,855 | 3 | true | 2022-05-25T00:29:33.907Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
One function for two different classes with similar properties<p>Hi after failing with inheritance (it got complicated) I stumble onto Generics. I am new to ... |
72,374,501 | SQL query for returning nested categories in Google Cloud Spanner?<p>I have the following table in Google Cloud Spanner for categories.</p>
<pre><code>CREATE TABLE categories (
categoryId STRING(36) NOT NULL,
name STRING(128) NOT NULL,
parent BOOL NOT NULL,
parentId STRING(36),
archived BOOL,
FOREIGN KEY (p... | <p>You were almost there, as you need only the child Categories which are not archived, Move the condition <code>childCategories.archived = FALSE</code> to <code>ON</code> instead of <code>WHERE</code> clause.</p>
<p>Putting the filter on <code>WHERE</code> will remove the result from Dataset, however if you put it in... | SQL query for returning nested categories in Google Cloud Spanner? | sql|google-cloud-spanner | 0 | 62 | 1 | 72,374,665 | 72,374,665 | 3 | true | 2022-05-25T08:45:35.613Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL query for returning nested categories in Google Cloud Spanner?<p>I have the following table in Google Cloud Spanner for categories.</p>
<pre><code>CREATE... |
72,400,864 | Freeing up resources while running loops in h2o<p>I am running a loop to upload a csv file from my local machine, convert it to a h2o data frame, then run a h2o model. I then remove the h2o data frame from my r environment and the loop continues. These data frames are massive so I can only have one data frame loaded at... | <p>Removing the object from the R session using <code>rm(h2o_df)</code> will eventually trigger garbage collection in R and the delete will be propagated to H2O. I don't think this is ideal, however.</p>
<p>The recommended way is to use <code>h2o.rm</code> or for your particular use case, it seems like <code>h2o.remove... | Freeing up resources while running loops in h2o | r|h2o | 0 | 62 | 1 | 72,411,068 | 72,411,068 | 3 | true | 2022-05-27T05:31:47.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Freeing up resources while running loops in h2o<p>I am running a loop to upload a csv file from my local machine, convert it to a h2o data frame, then run a ... |
72,248,348 | How to target the elements of the Varargs method in Java inside the function?<p>I wanted to use the varags method to take the input of various integers and find out the maximum & minimum among them.</p>
<pre><code>public class MINMAX {
public static void main(String[] args) {
Scanner in = new Scanner(Sy... | <p>To begin, imagine how many <code>Math.min</code> you need if you have 10 inputs instead of 3.</p>
<p>What you need is a method which can accept different number of inputs(that's why we have varargs), so that there is no need to change anything when you want to support more inputs. Hence you need to handle varargs(wh... | How to target the elements of the Varargs method in Java inside the function? | java|function|methods|variadic-functions | 1 | 62 | 3 | 72,248,717 | 72,248,717 | 3 | true | 2022-05-15T12:40:47.780Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to target the elements of the Varargs method in Java inside the function?<p>I wanted to use the varags method to take the input of various integers and f... |
72,267,116 | Floating local IP for multiple Virtual Machines<p>On Google Cloud Platform I need to create two virtual machines that will act as the main server and replication server (as a database).</p>
<p>It happens that I will have several applications that will connect to the main server, which requires me to define in these app... | <p>Instead use an internal L7 <a href="https://cloud.google.com/load-balancing/docs/l7-internal" rel="nofollow noreferrer">load balancer</a>. See the <a href="https://cloud.google.com/load-balancing/docs/choosing-load-balancer" rel="nofollow noreferrer">comparision</a> in order to decide if this is suitable. This <a hr... | Floating local IP for multiple Virtual Machines | postgresql|google-cloud-platform|high-availability|google-cloud-networking|google-vpc | 1 | 62 | 1 | 72,267,327 | 72,267,327 | 3 | true | 2022-05-17T00:58:30.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Floating local IP for multiple Virtual Machines<p>On Google Cloud Platform I need to create two virtual machines that will act as the main server and replica... |
72,274,500 | Why is a default interface method used instead of a class field?<p>I have code like below. Interface with default implementation. And the user who uses this interface. But for some reason in the switch case my code uses the default implementation of the interface for the "Name' instead of the class implementation.... | <p>As mentioned in comments, you need to implement the interface using the same shape in your class - as a property with a get.</p>
<pre><code>public interface IUser
{
// Interface with default implementation
public string Name { get => "Tom"; }
}
// User using this interface
public class BenUser ... | Why is a default interface method used instead of a class field? | c#|.net | 0 | 62 | 3 | 72,274,699 | 72,274,699 | 4 | true | 2022-05-17T12:59:11.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is a default interface method used instead of a class field?<p>I have code like below. Interface with default implementation. And the user who uses this ... |
72,301,574 | How do I grant a capability to an account after a module has been deployed?<p>I have my contract deployed on the testnet and I am trying to call (mint-nft) which has no arguments, but it does have a require-capability ACCOUNT_GUARD. I am getting error as follows:</p>
<pre><code>Error from (api.testnet.chainweb.com): : ... | <p>Capabilities must be <em>acquired</em> before <code>require-capability</code> will succeed. See <a href="https://pact-language.readthedocs.io/en/stable/pact-reference.html#expressing-capabilities-in-code-defcap" rel="nofollow noreferrer">https://pact-language.readthedocs.io/en/stable/pact-reference.html#expressing-c... | How do I grant a capability to an account after a module has been deployed? | pact-lang | 2 | 62 | 1 | 72,312,578 | 72,312,578 | 4 | true | 2022-05-19T09:00:15.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I grant a capability to an account after a module has been deployed?<p>I have my contract deployed on the testnet and I am trying to call (mint-nft) w... |
72,351,966 | How to iterate the first index value twice before going to the next index position?<p>I'm trying to make a for loop that iterates each index twice before going to the next one, for example if I have the following list:</p>
<pre><code>l = [1,2,3]
</code></pre>
<p>I would like to iterate it if it was in this way:</p>
<pr... | <p>The most obvious thing would be a generator function that yields each item in the iterable twice:</p>
<pre><code>def twice(arr):
for val in arr:
yield val
yield val
for x in twice([1, 2, 3]):
print(x)
</code></pre>
<p>If you need a list, then</p>
<pre><code>l = list(twice([1, 2, 3]))
</code></p... | How to iterate the first index value twice before going to the next index position? | python|loops|for-loop|iterator | 0 | 62 | 5 | 72,352,008 | 72,352,008 | 4 | true | 2022-05-23T16:33:52.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to iterate the first index value twice before going to the next index position?<p>I'm trying to make a for loop that iterates each index twice before goi... |
72,359,316 | Removing elements with conditions from an array of objects<p>Let's call reversed what {"src":"A", "target":"B"} is to {"src":"B", "target":"A"}.
As a first step I want to remove all reversed objects from the array.
My code right below is no... | <p>In the <code>reduce()</code> callback, you can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex" rel="nofollow noreferrer"><code>findIndex()</code></a> to check if you have already accumulated the reverse element, and <a href="https://developer.mozilla.org... | Removing elements with conditions from an array of objects | javascript | 3 | 62 | 2 | 72,359,489 | 72,359,489 | 4 | true | 2022-05-24T08:05:59.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Removing elements with conditions from an array of objects<p>Let's call reversed what {"src":"A", "target":"B"} is to... |
72,390,649 | Keeping selection in TTreeView after OnExit<p>I have a <code>TTreeView</code> component I use to display the hierarchical structure in a form and I'd like to be able to select some components and "manipulate" them e.g. clicking a button to move them.</p>
<p>My problem is as soon as I click the button the sele... | <p>Set the <code>HideSelection</code> property of the tree view to <code>False</code></p>
<pre><code>TreeView.HideSelection := false;
</code></pre> | Keeping selection in TTreeView after OnExit | delphi|treeview | 0 | 62 | 1 | 72,391,530 | 72,391,530 | 4 | true | 2022-05-26T10:52:54.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Keeping selection in TTreeView after OnExit<p>I have a <code>TTreeView</code> component I use to display the hierarchical structure in a form and I'd like to... |
72,369,715 | OCaml `Map.Make` input module<p>I am following the example <a href="https://v2.ocaml.org/api/Map.html" rel="nofollow noreferrer">here</a>.</p>
<pre><code>module IntPairs =
struct
type t = int * int
let compare (x0,y0) (x1,y1) =
match Stdlib.compare x0 x1 with
| 0 -> Stdlib.compare y0 y1
| c -> c
e... | <p>When you specify the type <code>Map.OrderedType</code> you make the type of the key abstract. Instead, try the following and you'll find your code works.</p>
<pre><code>module IntPairs : Map.OrderedType with type t = int * int =
struct
type t = int * int
let compare (x0,y0) (x1,y1) =
match Stdlib.compare x0 ... | OCaml `Map.Make` input module | ocaml | 3 | 62 | 1 | 72,370,008 | 72,370,008 | 4 | true | 2022-05-24T21:33:08.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
OCaml `Map.Make` input module<p>I am following the example <a href="https://v2.ocaml.org/api/Map.html" rel="nofollow noreferrer">here</a>.</p>
<pre><code>mod... |
72,385,858 | function at the end of code- why do i have to place it?<p>I'm just starting my adventure with Python. Unfortunately, I can't figure out why, at the end of my code, I have to add <code>myfunc()</code>. Without it my code doesn't display.</p>
<p>How is it if I use more than one definition then I have to put each defini... | <p>First, you don't need to put all your code into a function. Your code could be rewritten as this:</p>
<pre class="lang-py prettyprint-override"><code>sum = a + b
print(sum)
</code></pre>
<p>And it would work fine. <strong>A function, by definition, is a block of code that is given a name</strong>, so you can use it ... | function at the end of code- why do i have to place it? | python | -1 | 62 | 2 | 72,385,887 | 72,385,887 | 4 | true | 2022-05-26T01:53:58.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
function at the end of code- why do i have to place it?<p>I'm just starting my adventure with Python. Unfortunately, I can't figure out why, at the end of m... |
72,358,131 | C Random Number generator returning address<p>A part of my code is to randomly generate an array with numbers between 0 and 999. I do this with a random number generator. However everytime it does it and returns the array, the <code>intArray[8]</code> to <code>intArray[12]</code> have what I presume is the address. How... | <p>the <code>int* intArray = (int*)malloc(sizeof(double));</code> is allocating a memory buffer of a single <code>sizeof(double)</code> (typically 4 or 8 bytes). Ive changed that to <code>int* intArray = (int*)malloc(sizeof(int) * intNum);</code> to malloc the amount of ints you are going to store. To do that i moved t... | C Random Number generator returning address | c|random | 1 | 62 | 1 | 72,358,249 | 72,358,249 | 7 | true | 2022-05-24T06:29:46.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C Random Number generator returning address<p>A part of my code is to randomly generate an array with numbers between 0 and 999. I do this with a random numb... |
72,255,683 | how can implement coordinator in UITabBarController<p>i have a UITabBarViewController that i have created programmatically and i had imported all my 3 UIViewControllers , Now I wanna add Coordinator to my Project and i want to add Coordinator to all my 3 UIViewControllers.
how can i Use It?</p>
<pre><code>class MainTab... | <p>this file should remove and add an other file.
i named TabCoordinator with this Code:</p>
<pre><code>final class TabCoordinator: NSObject, TabBarCoordinatorProtocol {
// Root View Controller
var rootViewController: UIViewController {
return tabController
}
// Empty UITabBarController
let ... | how can implement coordinator in UITabBarController | ios|swift|uitabbarcontroller|coordinator | -1 | 62 | 1 | 72,258,861 | 72,258,861 | -1 | true | 2022-05-16T07:41:01.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how can implement coordinator in UITabBarController<p>i have a UITabBarViewController that i have created programmatically and i had imported all my 3 UIView... |
72,804,263 | Separating two print() outputs under a while loop<blockquote>
<p>Question: Enter a value for <em>n</em>, and the code takes <em>n</em> floating
numbers and prints out the first highest and second-highest numbers.</p>
</blockquote>
<p>Sample Output 1:</p>
<pre><code>Enter number of real numbers: 5
Number#1: 45.23
Numbe... | <p>Put the while loop under else statement. It will not execute as long as n==1</p> | Separating two print() outputs under a while loop | python|python-3.x|while-loop | 0 | 62 | 2 | 72,815,533 | 72,815,533 | 1 | true | 2022-06-29T15:42:15.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Separating two print() outputs under a while loop<blockquote>
<p>Question: Enter a value for <em>n</em>, and the code takes <em>n</em> floating
numbers and ... |
72,857,662 | How to make sure only one boolean box is ticked at a time<p>I have a Boolean button where I want a user to only click or choose one.
I am using Microsoft Dynamic Nav 2015.</p>
<p><a href="https://i.stack.imgur.com/0QqCj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0QqCj.png" alt="enter image descr... | <p>In the <code>OnValidate()</code> trigger on the page field, create a local variable of the record and do something like this; it will set all other votes to <code>FALSE</code> when you set one to <code>TRUE</code>:</p>
<pre><code>IF Vote = TRUE THEN BEGIN
theRec.SETRANGE(Vote, TRUE);
IF NOT theRec.ISEMPTY TH... | How to make sure only one boolean box is ticked at a time | microsoft-dynamics|erp|dynamics-business-central|microsoft-dynamics-nav | 0 | 62 | 1 | 73,077,848 | 73,077,848 | 1 | true | 2022-07-04T13:37:57.023Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make sure only one boolean box is ticked at a time<p>I have a Boolean button where I want a user to only click or choose one.
I am using Microsoft Dyn... |
72,956,258 | how to make discord.py bot to send a specific message if the command is on cooldown<p>I'm trying to make a discord.py bot have a command which a user can use only once an hour. I want the bot to send a message "The command is on cooldown" when someone uses the command more than once an hour. This is the code ... | <ol>
<li><p>If you want to create commands for your bot - you better use <code>ext.commands</code> extension part of the <code>discord.py</code> library. It prevents spaghetti code, gives better perfomance, it's easier to understand and there is command cooldown functionality, needed for your question and many more ben... | how to make discord.py bot to send a specific message if the command is on cooldown | python|discord|discord.py | -1 | 62 | 1 | 72,957,194 | 72,957,194 | 1 | true | 2022-07-12T17:31:26.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to make discord.py bot to send a specific message if the command is on cooldown<p>I'm trying to make a discord.py bot have a command which a user can use... |
72,995,274 | How to remove all but last n commits from git history to save space<p>I use git to backup and restore folders that can change on my system and they can get really large as useless history accumulates. I only need the last 4 or so commits, how can I squash or delete the whole history except for the last n commits?</p> | <p>Disclaimer: Your first sentence may have unfortunately tainted this question:</p>
<blockquote>
<p>I use git to backup and restore folders that can change on my system and they can get really large as useless history accumulates.</p>
</blockquote>
<p>If the history is "useless", than perhaps Git isn't the c... | How to remove all but last n commits from git history to save space | git | -1 | 62 | 1 | 73,000,056 | 73,000,056 | 1 | true | 2022-07-15T14:07:16.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove all but last n commits from git history to save space<p>I use git to backup and restore folders that can change on my system and they can get r... |
72,806,920 | How do I define two mutually dependent parameters in Python?<p>I want to create a Python class with two mutually inclusive parameters that are dependent on each other. The user must either provide a value for both parameters or neither. If one parameter is specified without the other, an exception should be raised.</p>... | <p>You could express the mutual exclusive <code>^</code>-operator.</p>
<pre><code>if (start_date is None) ^ (end_date is None):
print('Error')
</code></pre>
<p>Here the table of values for the <code>^</code>-operator</p>
<pre><code>from itertools import product
def xor_table_of_values():
"""
... | How do I define two mutually dependent parameters in Python? | python|parameters | 0 | 62 | 4 | 72,807,839 | 72,807,839 | 1 | true | 2022-06-29T19:32:48.150Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I define two mutually dependent parameters in Python?<p>I want to create a Python class with two mutually inclusive parameters that are dependent on e... |
73,005,707 | Get a confusion matrix , predicted probability plot, set a cutoff value using glmnet package in R<p>I was trying to do logistic lasso using glmnet package in R.
I found a method to find an optimal value of lambda on internet, but I don't know how to get the confusion matrix and plot the predicted probabilities.
Here, I... | <p>I couldn't really get your example data to give any usable predictions, so here's an example that comes with the <code>glmnet</code> package:</p>
<pre><code>library(glmnet)
data(BinomialExample)
x <- BinomialExample$x
y <- BinomialExample$y
# Fit a model using `cv.glmnet`
cfit <- cv.glmnet(x, y, family = &... | Get a confusion matrix , predicted probability plot, set a cutoff value using glmnet package in R | r|confusion-matrix|glmnet|lasso-regression | 0 | 62 | 1 | 73,066,569 | 73,066,569 | 1 | true | 2022-07-16T16:00:59.423Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get a confusion matrix , predicted probability plot, set a cutoff value using glmnet package in R<p>I was trying to do logistic lasso using glmnet package in... |
72,776,312 | Filtering a column for exactly one word and three words in sql server<p>I'm trying to scan one column and return only rows that have one or three words. I have tried using the below query snip but it didn't return anything. Any suggestion?</p>
<pre><code>SELECT
Column_1
Column_2
FROM Table
WHERE
Colu... | <p>If your words are separated by <code>;</code> and you can trust that , one way is by counting them :</p>
<pre><code>select *
from tablename
where
(datalength(Column_1) - datalength(replace(Column_1,';',''))) / datalength(';') in (1,2)
</code></pre> | Filtering a column for exactly one word and three words in sql server | sql|sql-server | 1 | 62 | 1 | 72,776,704 | 72,776,704 | 2 | true | 2022-06-27T17:43:14.197Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filtering a column for exactly one word and three words in sql server<p>I'm trying to scan one column and return only rows that have one or three words. I ha... |
72,773,321 | DirectX:- How to copy a pointer image data to the existing D2D1Bitmap?<p>I've 4 image byte array with the same resolution 640*480. I'm trying to copy the byte array data from memory if the D2D1Bitmap is already available. After copying, d2dContext.DrawBitmap(bitmap) method fails, Here is the code,</p>
<p>Any pointers o... | <p>An <a href="https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1bitmap" rel="nofollow noreferrer">ID2D1Bitmap</a> is a context-bound resource, since it's created from a <code>ID2D1RenderTarget</code> interface using <a href="https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1render... | DirectX:- How to copy a pointer image data to the existing D2D1Bitmap? | xaml|uwp|directx|direct2d | 2 | 62 | 1 | 72,781,119 | 72,781,119 | 2 | true | 2022-06-27T13:56:42.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
DirectX:- How to copy a pointer image data to the existing D2D1Bitmap?<p>I've 4 image byte array with the same resolution 640*480. I'm trying to copy the byt... |
72,818,142 | Check If An Array of String Contains Number<p>I am trying to accomplish a task and pretty close to complete. Here is the scenario - For array of string, I require to sort according to the number of letters in each element as follows:</p>
<pre><code> string[] str = {"aaa", "cccc", "a"};
</... | <p>It looks like you're trying to sort the array by item length, except for any item that's a number, which should be placed in the corresponding index.</p>
<p>If that's the case, then you could first get all the non-number items, sort them by length, then sort the number items and insert them into their appropriate in... | Check If An Array of String Contains Number | c# | -1 | 62 | 2 | 72,820,142 | 72,820,142 | 2 | true | 2022-06-30T15:08:56.187Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check If An Array of String Contains Number<p>I am trying to accomplish a task and pretty close to complete. Here is the scenario - For array of string, I re... |
72,832,147 | delete images containing specific word in its name using python<p>In the directory there are multiple images with names:
<a href="https://i.stack.imgur.com/wYawx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wYawx.png" alt="image names" /></a></p>
<p>I want to delete all images with "340"... | <p>I'm not sure why you need to use Python and can't just use your shell (in bash it would just be <code>rm desktop/images/*340*</code>)</p>
<p>But in Python I think the shortest way would be</p>
<pre class="lang-py prettyprint-override"><code>import os, glob
for file in glob.glob("desktop/images/*340*"):
... | delete images containing specific word in its name using python | python|regex | -1 | 62 | 2 | 72,832,319 | 72,832,319 | 2 | true | 2022-07-01T16:22:10.040Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
delete images containing specific word in its name using python<p>In the directory there are multiple images with names:
<a href="https://i.stack.imgur.com/w... |
72,256,467 | Is it possible to change Flutter's AutoComplete order in VS code?<p>I have a question.
Is it possible to change Flutter's AutoComplete order in VS code?</p>
<p>If I try to put an IconButton,
IconButton Snippet is recommended, and autocomplete is as follows.</p>
<p>for example</p>
<pre><code>IconButton(onPressed: onPres... | <p>If you have not typed any prefix and are seeing the "full list" of code completion, then the ordering is determined by the Dart analysis server. They should be sorted with "relevant" items at the top (where "relevant" is a computed score that takes into account a number of things).</p>
... | Is it possible to change Flutter's AutoComplete order in VS code? | flutter|dart|visual-studio-code | 0 | 62 | 1 | 72,834,058 | 72,834,058 | 2 | true | 2022-05-16T08:49:44.717Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to change Flutter's AutoComplete order in VS code?<p>I have a question.
Is it possible to change Flutter's AutoComplete order in VS code?</p>
... |
72,885,324 | Find the distance between letters in the keyboard<p>I am trying to find the minimum distance between two letters in the 'qwerty' keyboard, for example if i evaluating letters <code>q</code> and <code>w</code> the minimum distance should be 1, since they are together in the keyboard, letter <code>q</code> and <code>e</c... | <p>Instead of saving all possible pairs by hand, I think saving position of each letter and calculating distance would be much easier.</p>
<p>For example, <code>q</code> is (0, 0), <code>w</code> is (1, 0), <code>a</code> is (0, 1), and so on.
First element represents X coordinate and second element represents Y coordi... | Find the distance between letters in the keyboard | python|algorithm | 3 | 62 | 3 | 72,885,435 | 72,885,435 | 2 | true | 2022-07-06T14:28:03.707Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find the distance between letters in the keyboard<p>I am trying to find the minimum distance between two letters in the 'qwerty' keyboard, for example if i e... |
72,888,223 | Converting struct into short int array<p>Hello I have a following structure:</p>
<pre><code>struct TestStruct{
unsigned char a;
unsigned char b;
unsigned char c;
unsigned char d;
};
struct TestStruct test;
test.a = 0x01;
test.b = 0x02;
test.c = 0x01;
test.d = 0x02;
unsigned short int *ptr = (unsigned ... | <p>In computers, there is a concept of <a href="https://en.wikipedia.org/wiki/Endianness" rel="nofollow noreferrer">endianess</a>. In short, when storing a multi-byte field, you must choose between storing the most significant byte first (big-endian), or the least significant byte first (little-endian). This difference... | Converting struct into short int array | c|struct|hex|byte | 1 | 62 | 2 | 72,888,819 | 72,888,819 | 2 | true | 2022-07-06T18:16:57.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting struct into short int array<p>Hello I have a following structure:</p>
<pre><code>struct TestStruct{
unsigned char a;
unsigned char b;
... |
72,893,803 | How to disable ListTile?<p>I need to disable the ListTile when at least one character is entered into the text field. I wrote the code, but I don’t understand how to write a function for <code>onChanged</code>. How can I do this?</p>
<pre class="lang-dart prettyprint-override"><code> bool _isEnableTile = true;
... | <p>Try This if you got any error let me know.</p>
<pre><code>bool isAble=true;
ListTile(
title: const Text("Lable"),
enabled: isAble,
),
TextField(
onChanged: (value) {
if (value.length > 0) {
setState(() {
... | How to disable ListTile? | flutter|dart | -1 | 62 | 1 | 72,893,965 | 72,893,965 | 2 | true | 2022-07-07T07:24:23.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to disable ListTile?<p>I need to disable the ListTile when at least one character is entered into the text field. I wrote the code, but I don’t understan... |
72,903,439 | Count an array of objects<pre><code>const array = [
{ date: '2022-01-03', answer: 'yes' },
{ date: '2022-01-03', answer: 'no' },
{ date: '2022-01-03', answer: 'no' },
{ date: '2022-01-04', answer: 'yes' },
{ date: '2022-01-04', answer: 'yes' },
{ date: '2022-01-05', answer: 'yes' },
{ date: '2022-01-05', ... | <p>Your <code>reduce</code> is close; it's just a matter of making sure you create objects within each date key to count the yes/no answers.</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-ove... | Count an array of objects | javascript|arrays|object|reduce | 1 | 62 | 6 | 72,903,477 | 72,903,477 | 2 | true | 2022-07-07T19:45:40.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Count an array of objects<pre><code>const array = [
{ date: '2022-01-03', answer: 'yes' },
{ date: '2022-01-03', answer: 'no' },
{ date: '2022-01-03', ... |
72,912,186 | Flutter: animate text color<p>I am trying to animate some text in my flutter app so that each word's color changes, one after the other - kind of like in karaoke:</p>
<p><img src="https://i.stack.imgur.com/WjXdA.gif" alt="" /></p>
<p>I've been looking at packages like animated_text_kit but so far have not found a ready... | <p>You can use this widget</p>
<pre class="lang-dart prettyprint-override"><code> MyAnimatedText(
sentence: "The quick brown fox jumps over the lazy dog.",
)
</code></pre>
<p><strong>MyAnimatedText</strong> widget</p>
<pre class="lang-dart prettyprint-override"><code>class MyAnimatedTex... | Flutter: animate text color | flutter|dart|text|flutter-animation | 1 | 62 | 1 | 72,914,709 | 72,914,709 | 2 | true | 2022-07-08T13:32:39.533Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter: animate text color<p>I am trying to animate some text in my flutter app so that each word's color changes, one after the other - kind of like in kar... |
72,927,791 | Does C compiler automatically cast literals to parameter types when passing to functions?<p>I have a doubt regarding the casting of types in C. Is it safe to pass literals to function parameters(expecting different types but compatible types) without explicitly casting? For example here is an example code:</p>
<pre><co... | <p>If an argument in a function call corresponds to a parameter with a declared type, the argument is converted to the parameter type, per C 2018 6.5.2.2 7.</p>
<p>If the argument does not correspond to a parameter with a declared type, the <em>default argument promotions</em> are performed. This occurs when the argume... | Does C compiler automatically cast literals to parameter types when passing to functions? | c|casting | 0 | 62 | 1 | 72,927,853 | 72,927,853 | 2 | true | 2022-07-10T10:31:28.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does C compiler automatically cast literals to parameter types when passing to functions?<p>I have a doubt regarding the casting of types in C. Is it safe to... |
72,932,097 | When do Svelte derived stores cause a re-render?<p>If dealing with a store shaped like this:</p>
<pre><code>{
"count": 0,
"items": []
}
</code></pre>
<p>And having two derived stores (<code>$countStore</code> and <code>$itemsStore</code>) that return the respective fields, updating <code>items</... | <p>Svelte uses a function called <a href="https://github.com/sveltejs/svelte/blob/4617c0d5f5af1dae09cc00ce0134e433588a62d1/src/runtime/internal/utils.ts#L39" rel="nofollow noreferrer"><code>safe_not_equal</code></a> to check whether a value potentially changed; this is not unique to derived stores. <code>derived</code>... | When do Svelte derived stores cause a re-render? | svelte|svelte-store | 1 | 62 | 1 | 72,932,257 | 72,932,257 | 2 | true | 2022-07-10T21:44:09.947Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When do Svelte derived stores cause a re-render?<p>If dealing with a store shaped like this:</p>
<pre><code>{
"count": 0,
"items": []... |
72,913,120 | How to disable auto-indenting in NetBeans IDE 14?<h2>Short Version</h2>
<p>How do i disable automatic indenting when i press <kbd>Enter</kbd> in NetBeans IDE?</p>
<h2>Long Version</h2>
<p>Consider some code, with my insertion caret at the end of the last line:</p>
<p><code>byte[] data;</code><br />
<code>try {</code><b... | <p>It is straightforward to turn off automatic indentation in NetBeans 14, but the process is not intuitive for Java source. These settings must be applied in sequence after navigating to the <strong>Tools > Options > Editor > Formatting</strong> screen:</p>
<ul>
<li><p>Select <strong>Language:</strong> <em>Al... | How to disable auto-indenting in NetBeans IDE 14? | netbeans|netbeans-14 | 1 | 62 | 1 | 72,933,670 | 72,933,670 | 2 | true | 2022-07-08T14:43:21.820Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to disable auto-indenting in NetBeans IDE 14?<h2>Short Version</h2>
<p>How do i disable automatic indenting when i press <kbd>Enter</kbd> in NetBeans IDE... |
72,936,048 | How to sort and fetch the data based on certain condition in array of objects?<p>I have 2 array of objects one for USA and another for Canada. The data goes in the following way</p>
<pre><code>const data = [
{country: {cntryShortName:"USA"}}
{country: {cntryShortName:"USA"}}
{country: {cntryShortNam... | <p>you can do something like this</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const data = [
{country: {cntryShortName:"USA"}},
{country: {cntryShortName:"USA"}},
{country:... | How to sort and fetch the data based on certain condition in array of objects? | javascript|reactjs | 0 | 62 | 5 | 72,936,166 | 72,936,166 | 2 | true | 2022-07-11T09:04:35.217Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to sort and fetch the data based on certain condition in array of objects?<p>I have 2 array of objects one for USA and another for Canada. The data goes ... |
72,950,636 | Python - Print(df) Only Showing First Row<p>I am a beginner to python. This seems like something that would have been asked but I have been trying to search for the answer for 3 days at this point and can't find it.</p>
<p>I created a dataframe using pd after running pytesseract on an image. Everything is fine except o... | <p>Your problem lies with how you initialize and then update the <code>pd.DataFrame()</code>.</p>
<pre><code>import pandas as pd
from datetime import datetime
float_in = [0.0,0.5,1.0]
float_out = [0.0,0.5,1.0,1.5]
# this line just gives you 1 value:
date_date = datetime.strptime('01/01/2022 ', '%d/%m/%Y ')
# date_dat... | Python - Print(df) Only Showing First Row | python|python-3.x|pandas | 3 | 62 | 2 | 72,950,980 | 72,950,980 | 2 | true | 2022-07-12T10:13:26.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python - Print(df) Only Showing First Row<p>I am a beginner to python. This seems like something that would have been asked but I have been trying to search ... |
72,952,470 | Cannot set headers after they are sent to the client in express<p>i registered successfully which inserting record in my mongodb but when i try to login error is occur on line " !user && res.status(401).json("Wrong User Name"); " that</p>
<pre><code>Cannot set headers after they are sent to ... | <p>You need to end the execution of the function when you call res.status().json(), otherwise it will just proceed and you will again set res.status().json(). This is causing the error.</p>
<p>Modify to something like:</p>
<pre><code>const router = require('express').Router();
const User = require("../models/User&... | Cannot set headers after they are sent to the client in express | javascript|node.js|express|mongoose | 0 | 62 | 1 | 72,952,594 | 72,952,594 | 2 | true | 2022-07-12T12:38:31.563Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cannot set headers after they are sent to the client in express<p>i registered successfully which inserting record in my mongodb but when i try to login erro... |
72,956,346 | Swift Map Observable<T> to Observable<T><p>Im confused about converting RxSwift Observable<T> to Observable<T></p>
<p>I have function for networking like this:</p>
<pre><code>func createOrder(request: AcquirebatchOrder) -> Observable<AcquirebatchOrderResult> {
//Do networking stuff and will ret... | <p>You're needlessly nesting things.</p>
<p>To go from <code>Observable<A></code> to an <code>Observable<B></code> using <code>map</code>, you need to give it a function of type <code>(A) -> B</code>.</p>
<p>What you did was give it a function from <code>(AcquirebatchOrderResult) -> Observable<Tran... | Swift Map Observable<T> to Observable<T> | ios|swift|observable|rx-swift | 0 | 62 | 1 | 72,956,387 | 72,956,387 | 2 | true | 2022-07-12T17:38:45.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift Map Observable<T> to Observable<T><p>Im confused about converting RxSwift Observable<T> to Observable<T></p>
<p>I have function for network... |
72,954,467 | How to mount PVC to a (katib) Job specification?<p>I'd like to mount a PVC to a (katib) Job specification but can't find anything in the documentation nor any example?</p>
<p>I'm pretty sure that this should be possible as a Job is orchestrating pods and pods can do so. Or am I missing something?</p>
<p>Please find bel... | <p>You can add the volume and volume mount to your Katib job template so that all the HPO jobs on Katib can share the same volumes. e.g.</p>
<pre><code>apiVersion: batch/v1
kind: Job
spec:
template:
spec:
containers:
- name: training-container
image: docker.io/romeokienzler/claimed-train-m... | How to mount PVC to a (katib) Job specification? | kubernetes|kubeflow|kubeflow-katib | 0 | 62 | 1 | 72,957,957 | 72,957,957 | 2 | true | 2022-07-12T15:03:29.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to mount PVC to a (katib) Job specification?<p>I'd like to mount a PVC to a (katib) Job specification but can't find anything in the documentation nor an... |
72,978,033 | Failed to include signed in time and ip address of users in the jwt token?<p>What approach to follow to include <code>signed-in time</code> and <code>ip address</code> of users in the jwt token?</p>
<p>Do I need to add extension attributes for them separately like below?</p>
<pre><code>https://graph.microsoft.com/v1.0/... | <p>Please <strong>note</strong> that using client credentials flow, you cannot get optional claims in the token.</p>
<p>Alternatively, you can make use of either <strong><a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow" rel="nofollow noreferrer">Authorization code flow</... | Failed to include signed in time and ip address of users in the jwt token? | jwt|azure-ad-graph-api|bearer-token | 1 | 62 | 1 | 72,979,214 | 72,979,214 | 2 | true | 2022-07-14T09:11:45.640Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Failed to include signed in time and ip address of users in the jwt token?<p>What approach to follow to include <code>signed-in time</code> and <code>ip addr... |
72,989,756 | Azure pythonsdk to fetch list of blobs in ADLS Gen2<p>I am fetching the list of blob store using python sdk from Classic Azure Blob Store</p>
<pre class="lang-py prettyprint-override"><code>from azure.storage.blob import BlobServiceClient
...
def __init__ (self, key, blob_accnt_name):
self._blob_acct_url = f'https... | <ul>
<li><p>Well, the function used in both the cases i.e., <code>list_blobs</code> and <code>get_paths</code> will give a generator which will lazily follow the tokens.</p>
</li>
<li><p>But the generator itself contain different things in case of <code>list_blobs</code> as the name suggest it will contain blobs whic... | Azure pythonsdk to fetch list of blobs in ADLS Gen2 | azure-blob-storage|azure-data-lake-gen2|azure-python-sdk | 1 | 62 | 1 | 72,993,511 | 72,993,511 | 2 | true | 2022-07-15T06:18:12.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Azure pythonsdk to fetch list of blobs in ADLS Gen2<p>I am fetching the list of blob store using python sdk from Classic Azure Blob Store</p>
<pre class="lan... |
73,014,449 | How to plot a pie plot inside a donut plot<p>The data in csv format:</p>
<pre><code>,H,E,C
A,8393.0,2872.0,5649.0
R,4360.0,2188.0,3892.0
N,2029.0,1137.0,4714.0
D,3234.0,1436.0,6761.0
C,754.0,743.0,1185.0
Q,3529.0,1278.0,2844.0
E,6649.0,2053.0,5248.0
G,2338.0,2200.0,10054.0
H,1389.0,1006.0,2112.0
I,4348.0,4210.0,2734.0
... | <p>You could adapt the example code of <a href="https://matplotlib.org/stable/gallery/pie_and_polar_charts/pie_and_donut_labels.html" rel="nofollow noreferrer">matplotlib's pie chart example</a>. For the values in the donut, you can concatenate all column values (reversed to have 'A' at the left) and use three times t... | How to plot a pie plot inside a donut plot | python|matplotlib|seaborn|pie-chart|donut-chart | 1 | 62 | 1 | 73,015,861 | 73,015,861 | 2 | true | 2022-07-17T18:43:12.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to plot a pie plot inside a donut plot<p>The data in csv format:</p>
<pre><code>,H,E,C
A,8393.0,2872.0,5649.0
R,4360.0,2188.0,3892.0
N,2029.0,1137.0,4714... |
73,028,183 | Get row when a value first exceeds a threshold and then remains above it<p>I have the following dataframe:</p>
<pre><code>ID Date Value
1 2010-08-01 6
1 2011-05-01 8
1 2011-12-01 7
1 2012-08-01 6
1 2013-01-01 6
1 2014-04-01 10
1 2014-08-01 8
1 2015-01-01 9
1 2016-01-01 9
1 2017-01-01 8
2 199... | <p>Not clear about the <code>remains</code> case - i.e. suppose an ID have 'Value' less than 8 for the last element, then it is not clear whether to return row for that ID or not. The below solution will skip those 'ID' (if exists)</p>
<pre><code>library(dplyr)
library(data.table)
df1 %>%
group_by(ID) %>%
... | Get row when a value first exceeds a threshold and then remains above it | r|dplyr | 3 | 62 | 3 | 73,028,507 | 73,028,507 | 2 | true | 2022-07-18T20:22:09.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get row when a value first exceeds a threshold and then remains above it<p>I have the following dataframe:</p>
<pre><code>ID Date Value
1 2010-08-01 ... |
72,905,560 | Angular project working on localhost but not on GitHub Pages<p>I am making a todo list in Angular that also saves and restores on refresh, and on localhost I can add to the list
and the item displays below the add button. On GitHub Pages, when I click add it does nothing.</p>
<p><a href="https://github.com/jusmccar/Tod... | <h4>The Problem</h4>
<p>The problem is not from GitHub Pages. It is from the Angular code itself.</p>
<p>The code works well except for one thing. On a first-time visit of the Angular application in a browser, the <code>todos</code> key has never been set before in <code>localStorage</code> in that domain (GitHub Pages... | Angular project working on localhost but not on GitHub Pages | angular|typescript|github-pages | 0 | 62 | 1 | 72,905,639 | 72,905,639 | 2 | true | 2022-07-08T00:40:50.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular project working on localhost but not on GitHub Pages<p>I am making a todo list in Angular that also saves and restores on refresh, and on localhost I... |
73,002,711 | How to toggle display style using vanilla JS on multiple elements<p>I wasn't sure how to write that question logically, I pretty much figured the togglw out, but I struggle with something else. When I click on one element and open it, I want to click on another one to open and the previously opened to close. It doesn't... | <p>Using <code>toggle</code> won't work as it is always <code>false</code> when an answer is showing.</p>
<p>Instead, save the style of the clicked option <strong>before</strong> wiping all the answers, and then use it to determine whether or not to show the answer.</p>
<p>If <code>this.lastElementChild.style.display</... | How to toggle display style using vanilla JS on multiple elements | javascript | 2 | 62 | 3 | 73,002,940 | 73,002,940 | 2 | true | 2022-07-16T08:29:04.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to toggle display style using vanilla JS on multiple elements<p>I wasn't sure how to write that question logically, I pretty much figured the togglw out,... |
72,769,882 | How to recover non-project file protection in PhpStorm?<p>This dialog appears when I try to edit non-project files.
I chose the 1st option, but I want to recover this protection. Restart didn't help.</p>
<p><a href="https://i.stack.imgur.com/OpDXz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OpDXz... | <p>Starting at some version, the IDE will no longer show this dialog for the recently edited files. You need to remove such a file from the recently edited files list to get back this popup for that file.</p>
<p>Sadly you cannot do this from the UI so you will have to edit the config files directly. This will be a bit ... | How to recover non-project file protection in PhpStorm? | php|phpstorm|jetbrains-ide | 1 | 62 | 1 | 72,770,811 | 72,770,811 | 2 | true | 2022-06-27T09:32:36.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to recover non-project file protection in PhpStorm?<p>This dialog appears when I try to edit non-project files.
I chose the 1st option, but I want to rec... |
72,876,029 | numpy.roll horizontally on a 2D ndarray with different values<p>Doing <code>np.roll(a, 1, axis = 1)</code> on:</p>
<pre><code>a = np.array([
[6, 3, 9, 2, 3],
[1, 7, 8, 1, 2],
[5, 4, 2, 2, 4],
[3, 9, 7, 6, 5],
])
</code></pre>
<p>results in the correct:</... | <p>By specifying a tuple in <code>np.roll</code> you can roll an array along various axes. For example, <code>np.roll(a, (3,2), axis=(0,1))</code> will shift each element of <code>a</code> by 3 places along axis 0, and it will also shift each element by 2 places along axis 1. <code>np.roll</code> does not have an optio... | numpy.roll horizontally on a 2D ndarray with different values | python|numpy|multidimensional-array | 1 | 62 | 1 | 72,876,248 | 72,876,248 | 2 | true | 2022-07-05T22:06:23.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
numpy.roll horizontally on a 2D ndarray with different values<p>Doing <code>np.roll(a, 1, axis = 1)</code> on:</p>
<pre><code>a = np.array([
[... |
72,889,327 | Using post method in scrapy getting error<p>I am using post method in scrapy but they give me these error <code>TypeError: __init__() got an unexpected keyword argument 'data'</code> is there any solution bascillay I am trying scrape data from the table these is my page link <a href="https://www.benrishi-navi.com/engli... | <ol>
<li><p>You have to use <strong>FormRequest.from_response</strong> in lieu of FormRequest</p>
</li>
<li><p>Use <strong>formdata</strong> as parameter instead of data</p>
</li>
<li><p>Use formdata/payload as key-value pairs meaning as dictionary</p>
</li>
<li><p>Avoid injecting so many unnecessary headers</p>
</li>... | Using post method in scrapy getting error | python|web-scraping|scrapy | 0 | 62 | 1 | 72,890,434 | 72,890,434 | 2 | true | 2022-07-06T20:09:48.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using post method in scrapy getting error<p>I am using post method in scrapy but they give me these error <code>TypeError: __init__() got an unexpected keywo... |
72,971,974 | How to get the checked values from a checkbox in Angular?<p>A dynamic checkbox is created from the list of cartoonData. On selecting each cartoon in a checkbox, I need to read the values in typescript function.</p>
<pre><code>In HTML File
<div *ngFor="let cartoon of cartoonsData">
<input type=&... | <p>First add a reference on the input such as <code>#checkbox</code>:</p>
<pre class="lang-html prettyprint-override"><code><div *ngFor="let cartoon of cartoonsData">
<input #checkbox type="checkbox" (change)="onChange($event)" />
<label for="checkbox" >... | How to get the checked values from a checkbox in Angular? | angular|typescript | 0 | 62 | 2 | 72,972,211 | 72,972,211 | 2 | true | 2022-07-13T20:00:32.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get the checked values from a checkbox in Angular?<p>A dynamic checkbox is created from the list of cartoonData. On selecting each cartoon in a checkb... |
73,010,821 | Swift: how to wait for sound to be played?<p>Hey I have programmed a recorder app just like voice memos from apple. I also have the same sounds for starting and stopping the recording. The problem is that the sound at the start is on the recording. Is there a way to wait for the sound to be finished playing and only th... | <p>For anyone with the same problem, this is how I solved it:</p>
<pre><code>@State var recorder: AVAudioRecorder!
@State var isRecording = false // boolean, true -> recorder is recording
let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let fileName = url.appendingPathComponent(&... | Swift: how to wait for sound to be played? | swift|avaudiorecorder|completionhandler | 0 | 62 | 1 | 73,011,555 | 73,011,555 | 2 | true | 2022-07-17T09:56:22.030Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift: how to wait for sound to be played?<p>Hey I have programmed a recorder app just like voice memos from apple. I also have the same sounds for starting ... |
72,845,452 | Pandas Dataframe: Retrieve the Maximum Value in a Pandas Dataframe using .groupby and .idxmax()<p>I have a Pandas Dataframe that contains a series of Airbnb Prices grouped by <em>neighbourhood group</em> <em>neighbourhood</em> and <em>room_type</em>. My objective is to return the Maximum Average Price for each <em>roo... | <p>Approach using <code>Series.nlargest()</code>:</p>
<pre><code># Get mean price per room_type per neighbourhood
means = df.groupby(['neighbourhood', 'room_type'])['price'].mean()
# Get the maximum mean price per room_type per neighbourhood
max_means = (means.groupby(level=0, group_keys=False)
.nlar... | Pandas Dataframe: Retrieve the Maximum Value in a Pandas Dataframe using .groupby and .idxmax() | python|pandas|dataframe|pandas-groupby | 0 | 62 | 1 | 72,847,649 | 72,847,649 | 2 | true | 2022-07-03T09:41:00.397Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas Dataframe: Retrieve the Maximum Value in a Pandas Dataframe using .groupby and .idxmax()<p>I have a Pandas Dataframe that contains a series of Airbnb ... |
72,846,709 | having trouble with my event identifying the hashset from my command class minecraft plugin (spigot)<p>So I'm experimenting with hashmaps/sets and I can't get my event class to recognize the contents of my hashset. The toggle command works (identifies and sends back correct results of if the player is in the set or not... | <p>You can't use the object-oriented way in your case. Every time a command is triggered, Spigot creates a new instance of your <code>HashCommand</code> class. Spigot does not use the instance you created in your event listener: <code>public HashCommand hashCommand = new HashCommand();</code>. Having multiple instances... | having trouble with my event identifying the hashset from my command class minecraft plugin (spigot) | java|minecraft|spigot | -1 | 62 | 1 | 72,846,773 | 72,846,773 | 2 | true | 2022-07-03T13:00:03.103Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
having trouble with my event identifying the hashset from my command class minecraft plugin (spigot)<p>So I'm experimenting with hashmaps/sets and I can't ge... |
73,014,968 | convert gender from character to numeric value in R<p>I want to convert the character variable of gender into numeric. The structure of gender variable in character is like this:</p>
<pre><code>$ Gender : chr "Woman" "Man" "Non-binary"
</code></pre>
<p>I have used this metho... | <p>We can use:</p>
<pre><code>ms$Gender <- match(ms$Gender, c("Woman", "Man", "Non-binary"))
</code></pre> | convert gender from character to numeric value in R | r | 0 | 62 | 2 | 73,015,023 | 73,015,023 | 2 | true | 2022-07-17T19:59:55.550Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
convert gender from character to numeric value in R<p>I want to convert the character variable of gender into numeric. The structure of gender variable in ch... |
72,938,150 | how can I create a category for ungrouped data?<p>I'm trying to create a category for scraped data that isn't grouped but I get this error. I'm wondering if there is a way I can get around it.</p>
<pre><code>Traceback (most recent call last):
File "C:\Users\MUHUMUZA IVAN\Desktop\JobPortal\test.py", line 128... | <p>Instead of using <strong><code>Category.objects.get(title="...")</code></strong> in each <strong><code>if/elif</code></strong> block
you can choose one of these methods to get related <code>the_category</code> object:</p>
<h2>Custom function with handled <code>DoesNotExist</code> exception:</h2>
<pre class... | how can I create a category for ungrouped data? | python|django | 0 | 62 | 1 | 72,938,499 | 72,938,499 | 2 | true | 2022-07-11T11:51:45.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how can I create a category for ungrouped data?<p>I'm trying to create a category for scraped data that isn't grouped but I get this error. I'm wondering if ... |
72,897,748 | MYSQL delete from large table increase the delete time for each transaction<p>I am trying to delete data from table which contains almost 6,000,000,000 records , with where clause.</p>
<p>here is the stored procedure I am using and running from command prompt MySQL in windows.</p>
<pre><code>DELIMITER $$
CREATE DEFINER... | <p>You need to add an index to the column with which you are using to find the record(s) to be deleted.</p>
<p>With an index, MySQL knows exactly where the records are to be found so it can go straight to the record(s).</p>
<p>Without an index, then the table must be searched row by row.</p>
<p>The difference is, witho... | MYSQL delete from large table increase the delete time for each transaction | mysql|query-optimization | 1 | 62 | 2 | 72,898,167 | 72,898,167 | 2 | true | 2022-07-07T12:22:35.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MYSQL delete from large table increase the delete time for each transaction<p>I am trying to delete data from table which contains almost 6,000,000,000 recor... |
72,825,656 | checking if input1 and input2 is in list of strings<p>I am trying to print names that equal to inputs</p>
<p>for example :</p>
<pre><code>if input1 = 'A' and input2 = 'G'
print("Arsalan Ghasemi")
</code></pre>
<p>so my code works but for some names it's not working</p>
<p>if input = 'S' and second input ... | <pre class="lang-py prettyprint-override"><code>names = ['Arsalan Ghasemi', 'Ali Bahonar', 'Negin Soleimani', 'Farzaneh Talebi', 'Sina Ghahremani',
'Saman Sorayaie', 'Abtin Tavanmand', 'Masoud Jahani', 'Roya Pendar', 'Zeynab Arabi',
'Amirhossein Tajbakhsh', 'Aria Irani']
def names_with_input(input1,... | checking if input1 and input2 is in list of strings | python|string|list | -4 | 62 | 3 | 72,825,783 | 72,825,783 | 2 | true | 2022-07-01T07:19:17.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
checking if input1 and input2 is in list of strings<p>I am trying to print names that equal to inputs</p>
<p>for example :</p>
<pre><code>if input1 = 'A' and... |
72,932,234 | How to properly use databases in development?<p>I'm struggling with finding out how to properly test stuff on my local PC and then transfer that over to production.
So here is my situation:</p>
<p>I got a project in NodeJS/typescript, and I'm using Prisma in it for managing my database. On my server I just run a MySQL ... | <p>Always use the <strong>same brand and same version</strong> database in development and testing that you will eventually deploy to. There are compatibility differences between brands, i.e. an SQL query that works on SQLite does not necessarily work the same on MySQL, and vice-versa. Even data types and schema defini... | How to properly use databases in development? | mysql|node.js|typescript|development-environment|prisma | 1 | 62 | 1 | 72,932,307 | 72,932,307 | 2 | true | 2022-07-10T22:16:13.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to properly use databases in development?<p>I'm struggling with finding out how to properly test stuff on my local PC and then transfer that over to prod... |
72,954,183 | Linux sed regex replace with capture groups<p>I have a file containing directory entries in the following format:</p>
<pre><code><item><ln></ln><fn>Some person</fn><ct>07123456789</ct><sd>37</sd><rt>1</rt><bw>1</bw></item>
</code></pre>... | <p>You may use this <code>sed</code> with 2 capture groups:</p>
<pre class="lang-bash prettyprint-override"><code>sed -E 's~(.*<ct>[0-9]{11}</ct>.*<bw>)1(</bw>.*)~\10\2~' file
<item><ln></ln><fn>Some person</fn><ct>07123456789</ct><sd>37</sd>... | Linux sed regex replace with capture groups | regex|linux|sed | 1 | 62 | 2 | 72,954,266 | 72,954,266 | 2 | true | 2022-07-12T14:42:49.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Linux sed regex replace with capture groups<p>I have a file containing directory entries in the following format:</p>
<pre><code><item><ln></l... |
72,922,731 | Why is the pointer to my allocated memory for my type not being realloc'd properly?<p>I am working on a file system of sorts in my free time and I have ran into an issue with reallocating memory for a pointer to a typedef struct.
file_t:</p>
<pre><code>typedef struct {
char *fileName;
FILE *filePointer;
cha... | <p>When you allocated memory for <code>currentDir</code> with <code>malloc</code>, you did not allocate any memory for <code>currentDir->files</code> to point to. As such, you cannot <code>realloc</code> it.</p>
<p>Allocating memory for a struct that contains pointer members does allocate memory <em>for</em> the poi... | Why is the pointer to my allocated memory for my type not being realloc'd properly? | c|dynamic-memory-allocation | 1 | 62 | 1 | 72,922,817 | 72,922,817 | 2 | true | 2022-07-09T15:42:58.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is the pointer to my allocated memory for my type not being realloc'd properly?<p>I am working on a file system of sorts in my free time and I have ran i... |
72,991,086 | Firestore, Python, update fields in documents retrieved by compound query<p>I need to update a bunch of documents in a Firestore database.
I'm successfully retrieving them by using a query, but now I should update the same field in each of them and I'm having troubles with it.
This is what I tried:</p>
<pre class="lang... | <p>You also have to specify the collection reference and get the document id when iterating the <code>stream()</code>. See sample code below:</p>
<pre><code># Collection Reference
col_ref = db.collection(u'CollectionName')
doc_ref_generator = col_ref.where(u'UID', u'==', user_id).where(u'Status', u'==', "Active&qu... | Firestore, Python, update fields in documents retrieved by compound query | python|google-cloud-firestore | 0 | 62 | 1 | 72,994,688 | 72,994,688 | 2 | true | 2022-07-15T08:22:05.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firestore, Python, update fields in documents retrieved by compound query<p>I need to update a bunch of documents in a Firestore database.
I'm successfully r... |
72,908,223 | ScrollViewer conflicts with Grid ColumnDefinition if content is too big<p>This is more of a general question to figure out if this is intentional behavior or a bug in .NET</p>
<pre class="lang-xml prettyprint-override"><code><Grid Width="200" Height="200">
<ScrollViewer VerticalScrollBa... | <p>This behavior is related to the <code>ScrollViewer</code>. <code>ScrollViewer</code> allows an infinite width, which obviously does not work well when measuring the spanning column width, where at least one column is dynamic (<code>*</code> or <code>Auto</code>).</p>
<p><code>Grid</code> will always try to stretch t... | ScrollViewer conflicts with Grid ColumnDefinition if content is too big | .net|wpf | 0 | 62 | 1 | 72,941,356 | 72,941,356 | 2 | true | 2022-07-08T07:42:50.793Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ScrollViewer conflicts with Grid ColumnDefinition if content is too big<p>This is more of a general question to figure out if this is intentional behavior or... |
72,871,482 | Scala: Future recover in Future traverse<p>I have a method, which may throw an Exception depends on passed value:</p>
<pre><code> private def transform(in: Int): Future[Boolean] = in match {
case i if i < 0 => Future.successful(true)
case i if i > 0 => Future.successful(false)
case i if i == 0 =... | <p>The problem is that you are throwing <em>outside</em> of a <code>Future</code>. You need to wrap your exception in a <code>Future</code>, otherwise what happens is that the method itself throws instead of returning a failed <code>Future</code>. You can simplify your method as follows:</p>
<pre><code>def transform(in... | Scala: Future recover in Future traverse | scala|future | 1 | 62 | 2 | 72,872,422 | 72,872,422 | 2 | true | 2022-07-05T14:53:57.887Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scala: Future recover in Future traverse<p>I have a method, which may throw an Exception depends on passed value:</p>
<pre><code> private def transform(in: I... |
72,892,050 | Mark repeated id with a-b relationship in dataframe<p>I'm trying to create a relationship between repeated ID's in dataframe. For example take 91, so 91 is repeated 4 times so for first 91 entry <strong>first</strong> column row value will be updated to <strong>A</strong> and <strong>second</strong> will be updated to ... | <p>You can perform a mapping using a <code>cumcount</code> per group as source:</p>
<pre><code>from string import ascii_uppercase
# mapping dictionary
# this is an example, you can use any mapping
d = dict(enumerate(ascii_uppercase))
# {0: 'A', 1: 'B', 2: 'C'...}
g = df.groupby('id')
c = g.cumcount()
m = g['id'].tran... | Mark repeated id with a-b relationship in dataframe | python|pandas | 2 | 62 | 2 | 72,892,322 | 72,892,322 | 2 | true | 2022-07-07T03:42:39.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mark repeated id with a-b relationship in dataframe<p>I'm trying to create a relationship between repeated ID's in dataframe. For example take 91, so 91 is r... |
72,817,641 | float vector and pointer returns different values even though they have same adress<p>I have a class which returns <code>vector<vector<float>></code> with its <code>getTemplates()</code> function. My code is as follows for this case:</p>
<pre><code>cout << "Get [0][0] " << s.getTemplat... | <p><code>s.getTemplates()</code> returns a temporary which (in this particular instance) goes out of scope at the end of the statement that contains it.</p>
<p><code>float *embFloat</code> is therefore a dangling pointer - i.e. it's pointing to an object that no longer exists.</p> | float vector and pointer returns different values even though they have same adress | c++ | -1 | 62 | 1 | 72,817,685 | 72,817,685 | 2 | true | 2022-06-30T14:33:35.797Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
float vector and pointer returns different values even though they have same adress<p>I have a class which returns <code>vector<vector<float>></c... |
72,796,891 | how to get partition number and block device name seperating from a path in c program?<p>I have path name like this str[20]="/dev/sda1" and needs to get partion number i.e '1' and device name "sda1" seperatly stored in variables.</p>
<p>I tried something like this to get string but I want both parti... | <p>In this case you can reuse the <code>str</code> buffer, but I will not use <code>sscanf</code>, try with <code>strcspn</code>, it works even if the path doesn't have a number:</p>
<pre><code>#include <stdio.h>
#include <string.h>
int main(void)
{
char str[] = "/dev/sda1";
char num[size... | how to get partition number and block device name seperating from a path in c program? | c|linux | 1 | 62 | 2 | 72,797,386 | 72,797,386 | 2 | true | 2022-06-29T06:46:02.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to get partition number and block device name seperating from a path in c program?<p>I have path name like this str[20]="/dev/sda1" and needs t... |
72,911,783 | Two Way Binding between Sibling Components<p>I am having an issue where i can't pass data from one component to the next using 2-way binding.</p>
<p>The structure is this</p>
<pre><code><div class="container">
<component-one> "Containers Input Tag" and ngModel </component-one>
<... | <p>For inter child data communication, it's better to use <code>subject</code> or <code>behavior</code>, that allows the publish/subscribe mechanism.</p>
<p>In a service file, define a subject:</p>
<pre><code>SomeServie {
private dataSource = new Subject<any>();
dataObservable$ = this.dataSource.asObservable(... | Two Way Binding between Sibling Components | angular | -1 | 62 | 1 | 72,912,159 | 72,912,159 | 2 | true | 2022-07-08T12:58:48.797Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Two Way Binding between Sibling Components<p>I am having an issue where i can't pass data from one component to the next using 2-way binding.</p>
<p>The stru... |
72,909,531 | How to change value with PyScript wihtout reloading page<p>is it possible to print my example code like i would do it in an normal Console. it just prints the values at once without waiting and doesn't delete the previous one.</p>
<pre><code> <!DOCTYPE html>
<html lang ="en">
<head>
&... | <p>You need to update the DOM to overwrite the previous value:</p>
<pre><code>...
<body>
<div id="myNum" style="background: red;"></div>
<py-script>
import asyncio
for x in range (1,10):
element = document.getElementById('myNum')
element.innerHTML = x
await a... | How to change value with PyScript wihtout reloading page | python|html|pyscript | 1 | 62 | 1 | 72,909,627 | 72,909,627 | 2 | true | 2022-07-08T09:43:46.440Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to change value with PyScript wihtout reloading page<p>is it possible to print my example code like i would do it in an normal Console. it just prints th... |
72,913,047 | Deselect edit control win32 c++<p>How would I go about deselecting the text in edit control?</p>
<p>After entering the input I want the user to be able to deselect the edit control.
Because even after you click out of it and press a key, it gets entered into the edit.</p>
<p>Here is the code for my edit control:</p>
<p... | <p>You could use the same trick that works to dismiss dropdown list (of combo box), popup menus, and the like.</p>
<ol>
<li><p>You'll need to subclass the EDIT control so you receive messages first to your own window procedure.</p>
</li>
<li><p>In your textbox subclass <code>WM_SETFOCUS</code> handler, call <code>SetCa... | Deselect edit control win32 c++ | c++|winapi | -1 | 62 | 2 | 72,913,927 | 72,913,927 | 2 | true | 2022-07-08T14:37:56.580Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deselect edit control win32 c++<p>How would I go about deselecting the text in edit control?</p>
<p>After entering the input I want the user to be able to de... |
72,789,915 | Typescript Omit seems to transform an union into an intersection<p>I have this type</p>
<pre><code>type Cartesian = { kind: 'cartesian'; x: number; y: number; }
type Polar = { kind: 'polar'; angle: number; distance: number }
type Movement = { name: string } & (Cartesian | Polar);
</code></pre>
<p>that I can use lik... | <p>You probably want <a href="https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types" rel="nofollow noreferrer">Distributive conditional types</a>. From the docs</p>
<p><code>When conditional types act on a generic type, they become distributive when given a union type.</co... | Typescript Omit seems to transform an union into an intersection | javascript|typescript|union-types|intersection-types | 2 | 62 | 1 | 72,790,170 | 72,790,170 | 3 | true | 2022-06-28T16:13:03.430Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typescript Omit seems to transform an union into an intersection<p>I have this type</p>
<pre><code>type Cartesian = { kind: 'cartesian'; x: number; y: number... |
72,799,817 | How to reorder Wagtail admin menu items<p>There are some custom menu items in the admin's menu, it is easy to order them (the items marked in red below).
Just set <code>menu_order</code> of the custom <code>ModelAdmin</code> object.</p>
<p>The question is how to reorder the built-in menu items, such as Pages, Images, M... | <p>You can use the <a href="https://docs.wagtail.org/en/stable/reference/hooks.html#construct-main-menu" rel="nofollow noreferrer"><code>construct_main_menu</code> hook</a> to modify existing menu items.</p>
<p>For example, to move the Pages item to the bottom, place this code in a <code>wagtail_hooks.py</code> file wi... | How to reorder Wagtail admin menu items | django|wagtail | 1 | 62 | 1 | 72,800,701 | 72,800,701 | 3 | true | 2022-06-29T10:27:36.107Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to reorder Wagtail admin menu items<p>There are some custom menu items in the admin's menu, it is easy to order them (the items marked in red below).
Jus... |
72,815,007 | Android How to save a String from edittext into an array?<pre><code>package com.example.addarray;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.Arrays;... | <p>You create a new array with each click. No need to create a new array on every click. It is possible to save new values in ArrayList.</p>
<pre><code>public class MainActivity extends AppCompatActivity {
private ArrayList<String> list = new ArrayList<String>();
// *******
button.setOnClickList... | Android How to save a String from edittext into an array? | java|android|android-studio | -1 | 62 | 1 | 72,815,202 | 72,815,202 | 3 | true | 2022-06-30T11:30:23.733Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Android How to save a String from edittext into an array?<pre><code>package com.example.addarray;
import androidx.appcompat.app.AppCompatActivity;
import a... |
72,829,442 | Using variables inside for loop scope outside of it. Possible in python, but not in C#<p>In python, I've gotten into the habit of using variables inside a for loop outside of its "scope". For example:</p>
<pre class="lang-py prettyprint-override"><code>l = ["one", "two", "three"]... | <p>First attempt is more correct, but the compiler is telling you that in certain cases (where your collection is empty), j will never be assigned to. Your solution is nearly there, but instead of <code>j="test"</code>, I would use <code>j = null</code>, and then after your foreach, make sure j is not null be... | Using variables inside for loop scope outside of it. Possible in python, but not in C# | c#|for-loop|scope | -2 | 62 | 4 | 72,829,523 | 72,829,523 | 3 | true | 2022-07-01T12:43:09.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using variables inside for loop scope outside of it. Possible in python, but not in C#<p>In python, I've gotten into the habit of using variables inside a fo... |
72,862,691 | plot multiple country maps with fixed size and layout<p>I am trying to plot a a series of maps (NZ, Australia and Argentina) in a grid, with some parts of the grid being empty. I am using ggplot to create the individual maps and then patchwork to sow together the grid.</p>
<p>I expect the result to be a 3x3 grid with 3... | <p>This is a bit of a hack which I use quite often when I have to export maps. The basic idea is to not plot or export the map directly but instead add it to an empty background plot first via <code>patchwork::inset_element</code>.</p>
<p>For the first plot I dropped <code>theme_void</code> from the background plot whi... | plot multiple country maps with fixed size and layout | r|ggplot2|sf|patchwork | 1 | 62 | 1 | 72,862,787 | 72,862,787 | 3 | true | 2022-07-04T23:10:07.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
plot multiple country maps with fixed size and layout<p>I am trying to plot a a series of maps (NZ, Australia and Argentina) in a grid, with some parts of th... |
72,876,003 | C# OutOfRangeException that should be impossible<p>I am so confessed right now I don't even know how to properly form this question.
I have some code (as shown below) that is run on a different thread with the variable <strong>i</strong> not being referenced anywhere else that could interfere with it here. I just don't... | <p>You ts list depends on solver.Grid[x,y]. I am sure that some of your code that is not visible on the screen makes some changes of solver.Grid, probably deletes some times, or replaces them. This is what causing the error.</p> | C# OutOfRangeException that should be impossible | c#|visual-studio-2022 | 0 | 62 | 1 | 72,876,086 | 72,876,086 | 3 | true | 2022-07-05T22:00:25.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# OutOfRangeException that should be impossible<p>I am so confessed right now I don't even know how to properly form this question.
I have some code (as sho... |
72,941,766 | Non-Standard Syntax Error in Thread Constructor<p>I'm currently looking at producing a C++ library. I've not much experience with C++ and have what is probably a very basic question about class instance method calling.</p>
<h1>main.cpp</h1>
<pre class="lang-cpp prettyprint-override"><code>msgserver m;
std::thread t1(m.... | <p>The syntax for a getting a pointer to a member function is <code>&<class name>::<function_name></code>.</p>
<p>In this case <code>&msgserver::startServer</code> would be the correct expression. Since <code>std::invoke</code> is used on the background thread, you need to pass the object to call th... | Non-Standard Syntax Error in Thread Constructor | c++ | 0 | 62 | 2 | 72,942,189 | 72,942,189 | 3 | true | 2022-07-11T16:29:42.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Non-Standard Syntax Error in Thread Constructor<p>I'm currently looking at producing a C++ library. I've not much experience with C++ and have what is probab... |
72,962,915 | matplotlib stackplot: how to assign specific color<p>I am making a grid of multiple matplotlib stackplots. As-is the colors are assigned randomly to each area/group, which means they are not consistent across the plots. An example:</p>
<pre><code>a = [1, 3, 5]
b = [3, 4, 5]
c = [4, 5, 6]
d = [6, 7, 8]
x = [0, 1, 2]
fi... | <p>You can create <code>dict</code> base <code>labels</code> and <code>colors</code> and then use them for plotting with constant color for each label in different plots.</p>
<pre><code>import matplotlib.pyplot as plt
a = [1, 3, 5]
b = [3, 4, 5]
c = [4, 5, 6]
d = [6, 7, 8]
x = [0, 1, 2]
dct_color = {'a':'blue', 'b':... | matplotlib stackplot: how to assign specific color | python|matplotlib | 1 | 62 | 1 | 72,963,215 | 72,963,215 | 3 | true | 2022-07-13T08:10:06.853Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
matplotlib stackplot: how to assign specific color<p>I am making a grid of multiple matplotlib stackplots. As-is the colors are assigned randomly to each are... |
72,980,091 | Exercise 1.3 SICP why doesn't it work with 'when'?<pre><code>#!/usr/bin/env racket
#lang racket/base
;Define a procedure that takes three numbers as arguments and returns the sum of the
;squares of the two larger numbers.
(define (procsq a b c)
(when (and (< a b)(> c a))(+ (* b b)(* c c)))
(when (and (<... | <p>A procedure returns the value of the last expression in the body. Each <code>when</code> is calculating a value, but they're not being returned because it's not the last expression. It then goes to the next <code>when</code>. The result is the value of the last <code>when</code>, which will be <code>#<void></c... | Exercise 1.3 SICP why doesn't it work with 'when'? | scheme|racket|sicp | 0 | 62 | 2 | 72,980,182 | 72,980,182 | 3 | true | 2022-07-14T11:56:44.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Exercise 1.3 SICP why doesn't it work with 'when'?<pre><code>#!/usr/bin/env racket
#lang racket/base
;Define a procedure that takes three numbers as argumen... |
72,982,814 | Increment number in JSON file with python<p>I'm learing on how json files work, and I was tryng to make something that I thought it was simple, but I've been having problems, I have this code:</p>
<pre><code>import json
id = 696969969696
warns = 10
with open('warn.json', 'r', encoding='utf-8') as f:
guilds_dict =... | <p>Firstly, two notes:</p>
<ul>
<li>Once the json is loaded, it is a regular python dictionary. This operation is essentially unrelated to json.</li>
<li><code>id</code> is already a function in python, used to get the memory address of an object. It's generally recommended to avoid overriding builtins; consider using ... | Increment number in JSON file with python | python|json | 0 | 62 | 2 | 72,983,010 | 72,983,010 | 3 | true | 2022-07-14T15:11:56.727Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Increment number in JSON file with python<p>I'm learing on how json files work, and I was tryng to make something that I thought it was simple, but I've been... |
72,917,721 | How do I replace "NA" with "missing" when using CSV.read in Julia?<p>I have a csv file with a few NAs sprinkled in. Due to their presence, the columns containing the NAs are classified as strings rather than floats.</p>
<p>I just want to read the csv file with NAs in a way that Julia recognizes "NA" as a miss... | <p>Use the <code>missingstring="NA"</code> keyword argument as described in the <a href="https://csv.juliadata.org/stable/examples.html#missing_string_example" rel="nofollow noreferrer">documentation</a>.</p> | How do I replace "NA" with "missing" when using CSV.read in Julia? | csv|julia|na|missing-data | 2 | 62 | 1 | 72,917,815 | 72,917,815 | 3 | true | 2022-07-08T22:55:29.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I replace "NA" with "missing" when using CSV.read in Julia?<p>I have a csv file with a few NAs sprinkled in. Due to their presence, the columns contai... |
72,852,004 | Why Random range give same output value every time?<p>Here is the code which i used to for implementing Random class</p>
<pre><code>class Program
{
public static void Main()
{
for (int j = 0; j < 5; j++)
{
foreach (var item in GenerateRandomList(new List<int>() { 1, 2, 3, 4... | <p><code>new Random()</code> creates a new random number generator instance, with the default seed.</p>
<blockquote>
<p>In .NET Framework, the default seed value is time-dependent. In .NET Core, the default seed value is produced by the thread-static, pseudo-random number generator. From <a href="https://docs.microsoft... | Why Random range give same output value every time? | c#|.net|random | -1 | 62 | 1 | 72,852,045 | 72,852,045 | 3 | true | 2022-07-04T05:10:06.023Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why Random range give same output value every time?<p>Here is the code which i used to for implementing Random class</p>
<pre><code>class Program
{
publi... |
72,973,390 | Is there a way to filter a map without duplicating it?<p>I have to filter this map:</p>
<pre><code>Map<int, String> example = <int,string>{
100 : 'Flutter'
200 : 'SUPERFLUTTER'
300 : 'dart'
}
</code></pre>
<p>The filter should only return the entries that have the filter parameter,
if the filter parameter i... | <p>You want to create a new map, which contains only the entries of an existing map which satisfies some criterion.
In this case the criterion is only about the value.</p>
<p>I agree that copying the entire map, just to remove some of the entries afterwards, seems unnecessarily expensive. Not in time, it's still just l... | Is there a way to filter a map without duplicating it? | dart|maps | 1 | 62 | 1 | 72,978,170 | 72,978,170 | 3 | true | 2022-07-13T22:42:05.870Z | 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 filter a map without duplicating it?<p>I have to filter this map:</p>
<pre><code>Map<int, String> example = <int,string>{
100 :... |
72,811,201 | How can I use a string read from `std::cin` to look up an existing variable by name?<p>I'm currently trying to make a sort of a shopping cart. When the program asks for items, i type them in; but it needs to remember the values so it can use them later in the code.</p>
<p>I have this code so far:</p>
<pre><code>#includ... | <p>You could create a <a href="https://cplusplus.com/reference/map/map/" rel="nofollow noreferrer"><code>map</code></a> with <code>string</code> keys and <code>int</code> values, store the necessary data in that map (instead of separate variables), and use the value read from <code>std::cin</code> as an index.</p>
<p>T... | How can I use a string read from `std::cin` to look up an existing variable by name? | c++ | 0 | 62 | 2 | 72,811,239 | 72,811,239 | 3 | true | 2022-06-30T06:31:35.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I use a string read from `std::cin` to look up an existing variable by name?<p>I'm currently trying to make a sort of a shopping cart. When the progr... |
72,848,969 | How to troubleshoot Scrapy shell response 403 error<p>A few months ago I followed <a href="https://www.youtube.com/watch?v=7dnNA4cTUO4&lc=Ugyn7bzOnvnN5kHJHhJ4AaABAg" rel="nofollow noreferrer">this</a> Scrapy shell method to scrape a real estate listings webpage and it worked perfectly.</p>
<p>I pulled my <code>cook... | <p>The cookie is not what's causing the problem. (see below)
I think the issue here is that with 'view=map', its looking for a 'referer' key in the header dict (in addition to other header keys). I would suggest adding a key/pair of 'referer':"url" in your headers. Alternatively you can try less heavy approac... | How to troubleshoot Scrapy shell response 403 error | python|web-scraping|cookies|scrapy|response | 0 | 62 | 1 | 72,849,400 | 72,849,400 | 3 | true | 2022-07-03T18:30:39.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to troubleshoot Scrapy shell response 403 error<p>A few months ago I followed <a href="https://www.youtube.com/watch?v=7dnNA4cTUO4&lc=Ugyn7bzOnvnN5kH... |
73,008,068 | How to decline a request, if another one is already processed for the same user-id?<p>I am trying to implement some kind of sync-service.
Two clients with different user-agents may <code>POST/PATCH</code> to <code>/sync/user/{user_id}/resource</code> at the same time <strong>with the same</strong> <code>user_id</code>.... | <p>There're many ways to do this (distributed locking) in a distributed system, some I can come up with by far:</p>
<ol>
<li>Use a <code>redis</code> (or any other similar services) lock . Then you can lock each <code>user_id</code> on receiving the first request and reject other requests for the same <code>user_id</co... | How to decline a request, if another one is already processed for the same user-id? | go|synchronization | 1 | 62 | 1 | 73,008,527 | 73,008,527 | 3 | true | 2022-07-16T22:34:21.333Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to decline a request, if another one is already processed for the same user-id?<p>I am trying to implement some kind of sync-service.
Two clients with di... |
72,845,365 | Apply properties to every project you create in Visual Studio<p>I'm trying to learn C++20 but I need to enable std:c++latest everytime I create a project in Visual Studio 2022.
Is there a way I can enable it for every project I create?
Thanks in advance.</p> | <p>Yes, you can achieve this by using a .props file that enables modification for default values or create your own template project.</p>
<p>If you want to enable full modification use the .props file.
If not, use a new template.</p>
<p>Props file:
File path is usually in the directory:</p>
<pre><code>C:\Program Files ... | Apply properties to every project you create in Visual Studio | visual-studio|c++20 | 1 | 62 | 1 | 72,845,468 | 72,845,468 | 3 | true | 2022-07-03T09:26:55.020Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Apply properties to every project you create in Visual Studio<p>I'm trying to learn C++20 but I need to enable std:c++latest everytime I create a project in ... |
72,998,034 | create firebase project operation has timed out<p>I am trying to create new firebase project, But after going through the steps, at the final yellow spinning progress it shows when creating, it freezes and shows <code>The operation has timed out. Please restart and try again</code> in red.</p>
<p>It actually creates th... | <p><em>firebaser here</em></p>
<p><strong>There was indeed an outage in project creation in the Firebase console, which is recovering as we speak. Some other Firebase services are experienced problems and are recovering. Check the <a href="https://status.firebase.google.com/" rel="nofollow noreferrer">Firebase status d... | create firebase project operation has timed out | firebase|firebase-realtime-database|google-cloud-functions|firebase-console | 1 | 62 | 1 | 72,998,278 | 72,998,278 | 3 | true | 2022-07-15T17:59:10.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
create firebase project operation has timed out<p>I am trying to create new firebase project, But after going through the steps, at the final yellow spinning... |
72,841,463 | Find most frequent value but when there is a tie, choose the most recent in tidyverse<p>So let's say I have some data like this:</p>
<pre><code>ID value date
001 A 2015-12-06
001 A 2015-12-07
001 A 2015-12-08
002 B 2015-12-09
002 C 2015-12-10
003 A 2015-12-11
003 B 2015-12-12
002 ... | <p>You can use the following code:</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
df %>%
group_by(ID) %>%
mutate(n = n()) %>%
filter(date == max(date)) %>%
summarise(value = value[1])
#> # A tibble: 4 × 2
#> ID value
#> <int> <chr>
#> 1 1 A
#... | Find most frequent value but when there is a tie, choose the most recent in tidyverse | r|dplyr|tidyverse|window-functions | 1 | 62 | 2 | 72,841,513 | 72,841,513 | 3 | true | 2022-07-02T18:21:02.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find most frequent value but when there is a tie, choose the most recent in tidyverse<p>So let's say I have some data like this:</p>
<pre><code>ID value da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.