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,168,232 | Hash value not injecting other variable's value in powershell<p>I have a hashtable like below in powershell</p>
<pre><code> $children = @{'key'='value\\$child\\Parameters'}
</code></pre>
<p>Now consider the below:</p>
<pre><code>$child = "hey"
$parent = "$child ho"
Write-Host $parent
</code></pre... | <p>The problem here is with quotes. If you change the single quotes to double quotes you can see the interpolation will work as expected.</p>
<pre><code>$child = "hey"
$children = @{"key"="value\\$child\\Parameters"}
</code></pre>
<p>Here is the relevant part from the <a href="https://docs... | Hash value not injecting other variable's value in powershell | powershell | 0 | 52 | 1 | 72,168,286 | 72,168,286 | 3 | true | 2022-05-09T07:16:20.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hash value not injecting other variable's value in powershell<p>I have a hashtable like below in powershell</p>
<pre><code> $children = @{'key'='value\\$chil... |
72,148,935 | Does laravel sanctum only generate access_token?<p>I am trying to understand the basic flow of <code>laravel sanctum</code> in a SPA(vuejs) application. So far what I understood is:</p>
<p>#It creates a middleware for API authentication</p>
<p>#When a user attempts login, it generates the <code>access_tokens</code> and... | <p>Sanctum does not only authenticate with tokens but also does regular session authentication. The authentication method is automatically determined based on the request, if it comes from the same domain, authentication is done with cookie/session, if the request comes from a different domain or no session cookie is f... | Does laravel sanctum only generate access_token? | laravel|vue.js | 0 | 641 | 1 | 72,157,431 | 72,157,431 | 3 | true | 2022-05-07T02:06:59.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does laravel sanctum only generate access_token?<p>I am trying to understand the basic flow of <code>laravel sanctum</code> in a SPA(vuejs) application. So f... |
72,229,753 | Invariant Violation: requireNativeComponent: "BVLinearGradient" was not found in the UIManager<p>the error above is shown in this import</p>
<pre><code> import React from 'react';
import {
View,
Text,
TouchableOpacity,
Dimensions,
StyleSheet,
StatusBar,
Image
} from 'react-native'... | <p>Try:</p>
<ol>
<li><p>For iOS</p>
<ul>
<li><code>cd ios</code></li>
<li><code>pod install</code></li>
<li>rebuild project</li>
</ul>
</li>
<li><p>For Android:</p>
<ul>
<li>Uninstall application in Android emulator</li>
<li><code>cd Android</code></li>
<li><code>./gradlew clean && ./gradlew cleanBuildCache</co... | Invariant Violation: requireNativeComponent: "BVLinearGradient" was not found in the UIManager | react-native | 0 | 433 | 2 | 72,229,928 | 72,229,928 | 3 | true | 2022-05-13T12:38:43.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Invariant Violation: requireNativeComponent: "BVLinearGradient" was not found in the UIManager<p>the error above is shown in this import</p>
<pre><code> ... |
72,178,407 | how count the second elements of a nested list where they have the first elements identical?<p>I have a nested list like below:</p>
<pre><code>[['A',4],['U',9],['O',9],['A',1],['O',2],['O',1]]
</code></pre>
<p>How I can count the second elements if they have the same first element?</p>
<p>output:</p>
<pre><code>A,5
U,9... | <p>Use a <a href="https://docs.python.org/3/library/collections.html#collections.Counter" rel="nofollow noreferrer"><code>Counter</code></a>.</p>
<pre><code>from collections import Counter
L = [['A', 4], ['U', 9], ['O', 9], ['A', 1], ['O', 2], ['O', 1]]
c = Counter()
for item, count in L:
c[item] += count
</code>... | how count the second elements of a nested list where they have the first elements identical? | python|list | 0 | 42 | 3 | 72,178,455 | 72,178,455 | 3 | true | 2022-05-09T21:31:16.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how count the second elements of a nested list where they have the first elements identical?<p>I have a nested list like below:</p>
<pre><code>[['A',4],['U',... |
72,156,660 | What would a specific example of a simple async/await function be expressed as Promises?<p>I'm trying to understand the relationship between <code>async</code>/<code>await</code> and <code>Promise</code>s in TypeScript and have gotten myself a but too confused, I think.</p>
<p>Im particular, I'm trying to understand ho... | <p>Assuming that <code>downloadAsync</code> returns a Promise and that <code>console.log</code> doesn't throw, this</p>
<pre><code>const downloadFileAA = async () => {
try {
console.log( 'Starting download (with async/await)... ' )
const result = await downloadResumable.downloadAsync()
co... | What would a specific example of a simple async/await function be expressed as Promises? | javascript|typescript|async-await|promise | 0 | 57 | 1 | 72,156,709 | 72,156,709 | 3 | true | 2022-05-07T22:03:18.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What would a specific example of a simple async/await function be expressed as Promises?<p>I'm trying to understand the relationship between <code>async</cod... |
72,140,483 | powershell return value $? and custom exit code<p>I installed powershell on Linux-Box.
At end of my *.PS1 file I put the following code:</p>
<pre><code>Exit 2222
</code></pre>
<p>I run my ps1 file such as:</p>
<pre><code>pwsh-lts -File my.ps1
</code></pre>
<p>But I can't access to 2222. How can I access it?</p> | <p>Bash reflects the last exist code via the <code>$?</code> variable.</p>
<p>Let's give it a try (I'm using bash on Ubuntu on WSL2, but you'll find the same behavior in bash on any little-endian platform):</p>
<pre><code>mathias@laptop:~/test$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Descrip... | powershell return value $? and custom exit code | bash|powershell|return-value | 0 | 75 | 1 | 72,140,694 | 72,140,694 | 3 | true | 2022-05-06T11:05:32.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
powershell return value $? and custom exit code<p>I installed powershell on Linux-Box.
At end of my *.PS1 file I put the following code:</p>
<pre><code>Exit ... |
72,140,689 | virtualenv not activated on windows 11<p>Im using python 10 and windows-11
i try to activate venv with the following command</p>
<pre><code>.\onlineShop\Scripts\activate.bat
</code></pre>
<p>I create venv using following command</p>
<pre><code>python -m venv onlineShop
</code></pre>
<p>My pip list</p>
<pre><code>Packag... | <p>According to Microsoft Tech Support, it might be a problem with Execution Policy Settings. To fix it, you should try executing the <code>Set-ExecutionPolicy Unrestricted -Scope Process</code></p>
<p>OR IF this problem is not gone Then please read this <a href="https://stackoverflow.com/questions/18713086/virtualenv-... | virtualenv not activated on windows 11 | python|python-3.x|windows|python-venv | 0 | 646 | 2 | 72,140,763 | 72,140,763 | 3 | true | 2022-05-06T11:22:31.790Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
virtualenv not activated on windows 11<p>Im using python 10 and windows-11
i try to activate venv with the following command</p>
<pre><code>.\onlineShop\Scri... |
72,197,058 | Github Secrets are not really secured, how to secure secrets permanently<p>I don't know why Github secrets are really called secrets, because it can be printed out by any person working in organization with push access, i.e. they create branch use below trick to print secret and then delete the branch, and with snap of... | <p>First off, GitHub has an article on <a href="https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions" rel="nofollow noreferrer">Security hardening for actions</a>, which contains some general recommendations.</p>
<hr />
<p>In general, you want to distinguish between public and intern... | Github Secrets are not really secured, how to secure secrets permanently | yaml|github-actions|workflow|aws-secrets-manager | 0 | 600 | 2 | 72,197,943 | 72,197,943 | 3 | true | 2022-05-11T07:30:28.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Github Secrets are not really secured, how to secure secrets permanently<p>I don't know why Github secrets are really called secrets, because it can be print... |
72,161,074 | Sorting the list by two parameters simultaneously C#<p>I would like to sort lists with structures by certain fields/properties of structures. For example there is a structure:</p>
<pre><code>public struct Some
{
public int index;
public DateTime date;
}
</code></pre>
<p>Do I have an opportunity to sort such a s... | <p>Yes you can using <a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/" rel="nofollow noreferrer">LINQ</a></p>
<p>with the <a href="https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.orderby?view=net-6.0" rel="nofollow noreferrer">OrderBy</a> method</p>
<p><code>Or... | Sorting the list by two parameters simultaneously C# | c#|sorting | 0 | 44 | 4 | 72,161,101 | 72,161,101 | 3 | true | 2022-05-08T12:39:01.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sorting the list by two parameters simultaneously C#<p>I would like to sort lists with structures by certain fields/properties of structures. For example the... |
72,151,894 | How do I add the values from three arrays?<p>Is there an easy way to add the elements of arrays together? Let's say I have 3 arrays.</p>
<pre><code>[15,22,35,40]
[10,20,12,20]
[11,24,14,22]
</code></pre>
<p>What I want to do is add up the totals so it would be:</p>
<pre><code>[36,66,61,82]
</code></pre>
<p>and then ov... | <p><strong>Solution:</strong></p>
<pre><code>function myFunction(data) {
return data[data.length-1].map((i, index) => i =
data.reduce((prev, curr) => prev + curr[index], 0)
)
}
</code></pre>
<p><strong>Example:</strong></p>
<pre><code>const productA = [15,22,35,40]
const productB = [10,20... | How do I add the values from three arrays? | google-apps-script|google-sheets | 0 | 49 | 1 | 72,152,308 | 72,152,308 | 3 | true | 2022-05-07T11:04:11.573Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I add the values from three arrays?<p>Is there an easy way to add the elements of arrays together? Let's say I have 3 arrays.</p>
<pre><code>[15,22,3... |
72,189,039 | How to call a function in another component from a different component in react js?<p>I having two files header.js and upload.js. In upload.js I have a popup modal which should be open when I click upload button in the header.js</p>
<p>So basically I want to call setOpened function present in upload.js from header.js<... | <p>To echo @I-vasilich-I's comment about <a href="https://reactjs.org/docs/lifting-state-up.html" rel="nofollow noreferrer">lifting state up</a>, you should move your modal open state to a higher level (like in <code>App</code>) and pass that state to each child that needs it.</p>
<p>For example</p>
<pre><code>const He... | How to call a function in another component from a different component in react js? | javascript|reactjs | 0 | 67 | 1 | 72,189,265 | 72,189,265 | 3 | true | 2022-05-10T15:24:04.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to call a function in another component from a different component in react js?<p>I having two files header.js and upload.js. In upload.js I have a popup... |
72,207,832 | how to put the results of summarise() function into the dataframe in r<p>I made a minimal reproducible example, but my real data is really huge</p>
<pre class="lang-r prettyprint-override"><code>a_p_ <-c(0.1, 0.3, 0.03, 0.03)
b_p_ <-c(0.2, 0.003, 0.1, 0.00001)
c_2<-c(1,2,5,23)
c_p_<-c(0.001, 0.002,0.002,0.0... | <p>You could do</p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
list(results_1, results_2) %>%
map_dfr(. %>% summarise(across(contains("_p_"), ~ mean(.x > 0.05))))
#> a_p_ b_p_ c_p_
#> 1 0.50 0.5 0.0
#> 2 0.75 0.5 0.5
</code></pre>
<p><sup>Created on 2022-05-11... | how to put the results of summarise() function into the dataframe in r | r|summarize | 0 | 52 | 3 | 72,207,934 | 72,207,934 | 3 | true | 2022-05-11T21:34:10.733Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to put the results of summarise() function into the dataframe in r<p>I made a minimal reproducible example, but my real data is really huge</p>
<pre clas... |
72,173,149 | NestJS: Control exit code on application shutdown?<p>Using <code>app.close()</code> to shut down a nestjs application gracefully, as per the NestJS docs.</p>
<p>However, when I call it, it returns an exit code of 1 as if there was an error.</p>
<p>How can I modify the exit code to <code>0</code> for a particular shutdo... | <p>The process core module provides a handy method that allows you to programmatically exit from a Node.js program: process.exit().
<br> When Node.js runs this line, the process is immediately forced to terminate.</p>
<p>This means that any callback that's pending, any network request still being sent, any filesystem a... | NestJS: Control exit code on application shutdown? | node.js|nestjs | 0 | 726 | 1 | 72,173,205 | 72,173,205 | 3 | true | 2022-05-09T13:54:29.727Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NestJS: Control exit code on application shutdown?<p>Using <code>app.close()</code> to shut down a nestjs application gracefully, as per the NestJS docs.</p>... |
72,172,667 | Excel copy cell from a column if value is starting with Formula<p>I have this kind of column in my Excel:</p>
<pre><code>A B
gbgdf,
dsfsd,
gdgdf,
TC-EVTgfdsfs,
gdfgd,
</code></pre>
<p>I am willing to copy every cell that is <strong>NOT</strong> starting with 'TC-EVT'</p>
<p>I tried to use different formu... | <p><em><strong>Try</strong></em> this formula, assuming you are using either <strong>O365</strong> or <strong>Excel 2021</strong></p>
<p><a href="https://i.stack.imgur.com/ABW4J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ABW4J.png" alt="FORMULA_SOLUTION" /></a></p>
<p>• Formula used in cell <cod... | Excel copy cell from a column if value is starting with Formula | excel|copy|formula | 0 | 60 | 2 | 72,172,734 | 72,172,734 | 3 | true | 2022-05-09T13:21:18.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Excel copy cell from a column if value is starting with Formula<p>I have this kind of column in my Excel:</p>
<pre><code>A B
gbgdf,
dsfsd,
gdg... |
72,189,827 | Calculating Lag for dataframe in R?<p>If I have the following dataframe/tibble in R:</p>
<pre><code>tibble(
period =
c(
"2010Q1",
"2010Q2",
"2010Q3",
"2010Q4",
"2010END",
"2011Q1",
"2011Q2",
"... | <p>If every year is divided into 5 periods, <code>lag(...,5)</code> should take the value 5 rows earlier that the one you are calculating.</p>
<pre><code>example %>%
mutate(calculation = values - lag(values,5))
</code></pre>
<p>Output:</p>
<pre><code># A tibble: 30 x 3
period values calculation
<chr>... | Calculating Lag for dataframe in R? | r|dplyr|data.table|tidyverse | 0 | 73 | 3 | 72,189,917 | 72,189,917 | 3 | true | 2022-05-10T16:18:55.053Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculating Lag for dataframe in R?<p>If I have the following dataframe/tibble in R:</p>
<pre><code>tibble(
period =
c(
"2010Q1",
... |
72,172,916 | find the smallest period in list of dates<p>is there a way an idea to find the smallest period in list of dates:</p>
<pre><code>A: startDate|----------------------|EndDate
B: startDate|------------|EndDate
C: startDate|-----------------|EndDate
</code></pre>
<p>the smallest period is in this exemple is B.
I need an ide... | <p>Calculate the difference in time to get a sequence of timeSpans, and pick the smallest one. For example using LINQ</p>
<pre><code>var shortestPeriod = myDates.Min(d => d.startDate - s.EndDate);
</code></pre>
<p>If you want the actual start and end dates for the shortest interval you could use <a href="https://mor... | find the smallest period in list of dates | c#|algorithm|datetime | 0 | 63 | 1 | 72,173,160 | 72,173,160 | 3 | true | 2022-05-09T13:38:50.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
find the smallest period in list of dates<p>is there a way an idea to find the smallest period in list of dates:</p>
<pre><code>A: startDate|----------------... |
72,155,867 | Maintain Paragraph Indentation even after Image Ends<p>I am a beginner in HTML/CSS. I am trying to write a paragraph on side of image. But when paragraph reaches end of container it goes to next line but does not respect the indentation.</p>
<p>What I want to achieve is:</p>
<pre><code>IMG Paragraph Text Paragraph Text... | <p>Let's say we are taking a container to make them side by side. In markup there are few ways to do such thing. Let's take a container <code>div.</code></p>
<pre><code><div class='container'>
</div>
</code></pre>
<p>inside of this container we are gonna have our image and paragraph.</p>
<pre><code><div ... | Maintain Paragraph Indentation even after Image Ends | html|css | 0 | 44 | 1 | 72,155,968 | 72,155,968 | 3 | true | 2022-05-07T19:40:18.707Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Maintain Paragraph Indentation even after Image Ends<p>I am a beginner in HTML/CSS. I am trying to write a paragraph on side of image. But when paragraph rea... |
72,140,974 | What is underlying data structure of std::deque and how does it's iterator work?<p>I know that std::deque has the different chunks of contiguous memory and iterator is invalidated by inserting or erasing the middle of deque.</p>
<p>In addition to it, if I insert to the end side of element of deque, iterator is not vali... | <p>The key point is that a deque is made of several chunks of contiguous memory.</p>
<p>When you add an element in the first position then there are two situations:</p>
<p>Either the first chunk has still place to add an element:</p>
<pre><code> | | | first element | second element | .... | ...
^
inse... | What is underlying data structure of std::deque and how does it's iterator work? | c++|iterator|stddeque | 0 | 111 | 1 | 72,141,207 | 72,141,207 | 3 | true | 2022-05-06T11:46:34.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is underlying data structure of std::deque and how does it's iterator work?<p>I know that std::deque has the different chunks of contiguous memory and i... |
72,202,247 | Merge multiple key in dictionary with same values inside an array<p>I need to merge three dictionaries with array values into a single dict based on if they have same values inside the array. The dictionaries is like this:</p>
<pre class="lang-py prettyprint-override"><code>data = {
'A1':['Cheese','Cupcake', 'Salad','S... | <p>Given you use case, you could use <a href="https://docs.python.org/3/library/itertools.html#itertools.combinations" rel="nofollow noreferrer"><code>itertools.combinations</code></a> and <a href="https://docs.python.org/3/tutorial/datastructures.html#sets" rel="nofollow noreferrer"><code>set</code></a> <a href="https... | Merge multiple key in dictionary with same values inside an array | python | 0 | 37 | 1 | 72,202,293 | 72,202,293 | 3 | true | 2022-05-11T13:49:14.333Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Merge multiple key in dictionary with same values inside an array<p>I need to merge three dictionaries with array values into a single dict based on if they ... |
72,204,663 | How to insert a field at the top of an object?<p>This is my code</p>
<pre><code>element='{"x":"zero"}'
example='[
{
"a":"one",
"b":"two",
"c":"three"
},
{
"d":"four",
"e":"five",
"f&q... | <p>In order for the new field to appear at the top, the object that holds it must appear first in the addition statement. For example:</p>
<pre><code>$ jq --argjson el "$element" 'map($el + .)' <<< $example
[
{
"x": "zero",
"a": "one",
"b&... | How to insert a field at the top of an object? | json|jq | 0 | 32 | 1 | 72,204,758 | 72,204,758 | 3 | true | 2022-05-11T16:37:11.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to insert a field at the top of an object?<p>This is my code</p>
<pre><code>element='{"x":"zero"}'
example='[
{
"a":"... |
72,214,038 | How to match at least two conditions in r<p>I have a dataframe:</p>
<pre><code>df1<-data.frame(A=rnorm(100,mean = 10,sd=1),B=rnorm(100,mean = 10,sd=1))
</code></pre>
<p>and 4 conditions:</p>
<pre><code>cond1<-df1$A+1>df1$B
cond2<-df1$A+2>df1$B
cond3<-df1$A+3>df1$B
cond4<-df1$A+4>df1$B
</code>... | <p>Here is one way using sums.</p>
<p>At least two:</p>
<pre><code>df1[(cond1+cond2+cond3)>=2,"A"]=0
</code></pre>
<p>Less than two:</p>
<pre><code>df1[(cond1+cond2+cond3)<2,"A"]=0
</code></pre>
<p>Cond1 and at least one of cond2 or cond3:</p>
<pre><code>df1[cond1+(cond2+cond3)>=1,"A&q... | How to match at least two conditions in r | r | 0 | 25 | 1 | 72,214,089 | 72,214,089 | 3 | true | 2022-05-12T10:34:16.520Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to match at least two conditions in r<p>I have a dataframe:</p>
<pre><code>df1<-data.frame(A=rnorm(100,mean = 10,sd=1),B=rnorm(100,mean = 10,sd=1))
</... |
72,205,651 | How to get value inside div inside ul inside li with Javascript?<p>I'm not learning jQuery yet, so javascript please. here is the HTML like below</p>
<pre><code><ul style="position: absolute;">
<li style="position: absolute;">
<div role="checkbox" class="fil... | <p>Grab the dogs by the <code>dog-123</code> class name, and then <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer"><code>map</code></a> over the (converted to an array) node list to create a new array of names from each node's text content.</... | How to get value inside div inside ul inside li with Javascript? | javascript|html | 0 | 159 | 2 | 72,205,844 | 72,205,844 | 3 | true | 2022-05-11T18:02:55.020Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get value inside div inside ul inside li with Javascript?<p>I'm not learning jQuery yet, so javascript please. here is the HTML like below</p>
<pre><c... |
72,184,187 | return address of dlsym and Address of Function Pointer assigned<pre><code>void* l = dlsym(lib,"_ZN11Environment9LibLogger14log_processingEiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEjS6_z");
*(void **)&log_fcn = l;
std::cout<<"Address"<<<<l<<"LOG_FCN &quo... | <p>There is an <code>operator <<</code> for <code>void*</code>, but not for function pointers.<br />
Function pointers are implicitly converted to <code>bool</code>, not <code>void*</code>, and <code>bool</code> prints as <code>0</code> or <code>1</code> by default.</p>
<p>Your <code>1</code> output indicates tha... | return address of dlsym and Address of Function Pointer assigned | c++|c++11|dll|function-pointers|dlsym | 0 | 63 | 1 | 72,184,456 | 72,184,456 | 3 | true | 2022-05-10T09:53:10.010Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
return address of dlsym and Address of Function Pointer assigned<pre><code>void* l = dlsym(lib,"_ZN11Environment9LibLogger14log_processingEiNSt7__cxx111... |
72,212,903 | How do I write the 4 bytes of an int32_t to a binary file in big-endian order in C?<p>I want to write the 4 bytes of an <code>int32_t</code> to a binary file in big-endian order. I used <code>fwrite()</code> directly with a pointer to my <code>int32_t</code>, and it somewhat works, but the problem is that my integer is... | <p>Thanks pmg for writing the answer in the comment:</p>
<p>Assuming <code>CHAR_BIT == 8</code>:</p>
<pre class="lang-c prettyprint-override"><code>unsigned char value[4];
value[0] = (uint32_t)specialInt >> 24;
value[1] = (uint32_t)specialInt >> 16;
value[2] = (uint32_t)specialInt >> 8;
value[3] = (ui... | How do I write the 4 bytes of an int32_t to a binary file in big-endian order in C? | c|endianness | 0 | 244 | 2 | 72,213,300 | 72,213,300 | 3 | true | 2022-05-12T09:12:14.760Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I write the 4 bytes of an int32_t to a binary file in big-endian order in C?<p>I want to write the 4 bytes of an <code>int32_t</code> to a binary file... |
72,177,386 | SCSS - Is there a 'self' indentifier?<p>I want to add SCSS on the body, for default, and respecify them on the P and LI tags (not in total control of the site, and wanna stop plugins from hijacking my p's and li's).</p>
<p>So I have to do something like this</p>
<pre><code>body{
color:#000;
p,li{
color:#000;
... | <pre><code>body{
&,p,li{color:#000;}
}
</code></pre> | SCSS - Is there a 'self' indentifier? | css|sass | 0 | 61 | 1 | 72,177,426 | 72,177,426 | 3 | true | 2022-05-09T19:37:24.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SCSS - Is there a 'self' indentifier?<p>I want to add SCSS on the body, for default, and respecify them on the P and LI tags (not in total control of the sit... |
72,075,856 | Firestore: Inequality filter property and first sort order must be the same. Failing where condition and order in different fields. Is this Expected?<p>I have a collection of documents like this:</p>
<pre><code>{
uid: <UNIQUE_USER_ID>,
lastLoggedIn: <TIMESTAMP_IN_NUMBER>,
...
}
</code></pre>
<p>whe... | <p>As the error message says, in order to be able to use <code>not-in</code> you must first order on the same field:</p>
<pre><code>Server.db
.collection(firebasePaths.funfuse_verified_users)
.orderBy('uid')
.where('uid', 'not-in', notToIncludeAccounts)
.orderBy('lastLoggedIn', 'desc')
.startAt(star... | Firestore: Inequality filter property and first sort order must be the same. Failing where condition and order in different fields. Is this Expected? | javascript|google-cloud-firestore | 0 | 787 | 1 | 72,077,851 | 72,077,851 | 4 | true | 2022-05-01T10:23:05.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firestore: Inequality filter property and first sort order must be the same. Failing where condition and order in different fields. Is this Expected?<p>I hav... |
72,098,016 | How do I add characters to the beginning of each collapsed result of paste0?<p>I'm trying to construct the input json input for mongodb query.</p>
<p>I have a vector that contains ids</p>
<pre><code>[1] "62708dc95baeeff0a37571ab" "62708dc95baeeff0a37571ac"
</code></pre>
<p>I want to create a JSON ob... | <pre><code>x <- c("62708dc95baeeff0a37571ab", "62708dc95baeeff0a37571ac")
DF <- data.frame(oid = x)
library(jsonlite)
toJSON(DF)
#[{"oid":"62708dc95baeeff0a37571ab"},{"oid":"62708dc95baeeff0a37571ac"}]
</code></pre> | How do I add characters to the beginning of each collapsed result of paste0? | r | 0 | 33 | 1 | 72,098,182 | 72,098,182 | 4 | true | 2022-05-03T10:21:54.150Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I add characters to the beginning of each collapsed result of paste0?<p>I'm trying to construct the input json input for mongodb query.</p>
<p>I have ... |
72,150,925 | While loop PL/SQL read a string backwards<p>i need help with this question, Using PL/SQL how can I read a string backwards using the while loop?</p>
<p>I know that with the for loop there is a method called reverse but I don't know how I can do it with the while loop. If you can help me I appreciate it</p> | <p>Here's one option:</p>
<pre><code>SQL> set serveroutput on
SQL>
SQL> declare
2 l_str varchar2(20) := 'Littlefoot';
3 i number;
4 retval varchar2(20);
5 begin
6 i := length(l_str);
7 while i <> 0 loop
8 retval := retval || substr(l_str, i, 1);
9 i := i... | While loop PL/SQL read a string backwards | oracle|plsql | 0 | 68 | 1 | 72,151,040 | 72,151,040 | 4 | true | 2022-05-07T08:48:26.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
While loop PL/SQL read a string backwards<p>i need help with this question, Using PL/SQL how can I read a string backwards using the while loop?</p>
<p>I kno... |
72,150,851 | Efficiently upsert thousands of records to mongodb<p>We have a database containing around ~20 Million records with an indexed field <strong>order_id</strong>.</p>
<p>Every day, after each hour, we receive an incremental update, starting from ~2K and growing to ~50K records which some might be new, and others are update... | <p>You have a mostly efficient technique; your query field is indexed and you are using bulk operations. I would be surprised if this is running slowly, even on 50k records.</p>
<p>If you want to squeeze the last drop of performance out, this approach may be quicker. It deletes all the incoming records and re-inserts t... | Efficiently upsert thousands of records to mongodb | python-3.x|pandas|mongodb|airflow|pymongo | 0 | 90 | 1 | 72,151,457 | 72,151,457 | 4 | true | 2022-05-07T08:37:48.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Efficiently upsert thousands of records to mongodb<p>We have a database containing around ~20 Million records with an indexed field <strong>order_id</strong>... |
72,153,704 | Why are thenables that return a promise based on the same promise as the thenable not working<p>A promise <code>p1</code> is chained with a thenable that returns a again a chained promise <code>p2</code>.
<code>p2</code> is <code>p1</code> chained with a console.log statement:</p>
<pre class="lang-js prettyprint-overri... | <p>You've created promises that depend on each other in order to resolve, so neither resolve.</p>
<p>When you return a Promise from inside a <code>.then</code>, the Promise that that <code>.then</code> resolves to will only fulfill when the returned Promise fulfilled. So</p>
<pre><code>p1 = p0.then(() => {
// ...
... | Why are thenables that return a promise based on the same promise as the thenable not working | javascript|promise | 0 | 29 | 1 | 72,153,726 | 72,153,726 | 4 | true | 2022-05-07T15:01:55.230Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why are thenables that return a promise based on the same promise as the thenable not working<p>A promise <code>p1</code> is chained with a thenable that ret... |
72,155,086 | How to create multiple combinations of columns from a pandas dataframe?<p>I’ll illustrate my problem with a drawing:</p>
<p><a href="https://i.stack.imgur.com/R9Nnf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R9Nnf.png" alt="enter image description here" /></a></p>
<p>I have a pandas dataframe wi... | <p>If you can separate column names to lists according to their types, then your problem becomes a question of finding the Cartesian product of these lists. Once you find the Cartesian product, you can iterate over it and filter your DataFrame with a combination of column names (there are <code>(3 choose 1) * 1 * (2 ch... | How to create multiple combinations of columns from a pandas dataframe? | python|python-3.x|pandas|combinations|combinatorics | 0 | 134 | 1 | 72,155,254 | 72,155,254 | 4 | true | 2022-05-07T17:50:08.587Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create multiple combinations of columns from a pandas dataframe?<p>I’ll illustrate my problem with a drawing:</p>
<p><a href="https://i.stack.imgur.co... |
72,162,530 | Parsing horrible timestamp C#<p>I have a timestamp from a server of the form <code>20220505 17:36:29</code> - it has 2 whitespaces, and I do not trust the sender to always send the same number of whitespaces in future revisions - ideally would like to handle any number of whitespaces the same.</p>
<p>I tried this with... | <p>If you want to handle any amount of whitespace, there are two options:</p>
<ul>
<li>Use a regular expression (or similar) to get it into a canonical format with a single space</li>
<li>Split on spaces and then parse the first and last parts separately. (Or split on spaces, recombine the first and last parts and pars... | Parsing horrible timestamp C# | c#|datetime|nodatime | 0 | 226 | 4 | 72,162,701 | 72,162,701 | 4 | true | 2022-05-08T15:31:38.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Parsing horrible timestamp C#<p>I have a timestamp from a server of the form <code>20220505 17:36:29</code> - it has 2 whitespaces, and I do not trust the s... |
72,168,414 | How does the const a = express() works exactly?<p>I recently started learning Node/express. One doubt is bugging me for a couple of weeks now. I know what this does, and I've been able to get past it. But I cannot wrap my head around the logic used in the line 'const a = express()'.</p>
<pre><code>express = require('ex... | <p>Perhaps the confusion is in assuming that the default export of the <code>express</code> module is something other than a function, but as others have pointed out, the <a href="https://expressjs.com/en/4x/api.html" rel="nofollow noreferrer">default export</a> of <code>express</code> <em>is</em> a function. Once impo... | How does the const a = express() works exactly? | javascript|node.js|express | 0 | 85 | 1 | 72,168,593 | 72,168,593 | 4 | true | 2022-05-09T07:34:08.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does the const a = express() works exactly?<p>I recently started learning Node/express. One doubt is bugging me for a couple of weeks now. I know what th... |
72,171,810 | Disable GCC simplification of expressions known at compile time<p>Suppose I have the following C line:</p>
<pre><code>int a = 4 + 7;
</code></pre>
<p>When compiling this line, GCC will always produce something like <code>mov DWORD PTR [rbp-X], 0xb</code>, as the result of this computation is constant and known at compi... | <blockquote>
<p>Is there a way to disable this behaviour to have a mov 4, add 7 instead?</p>
</blockquote>
<p>No. Evaluation of elementary constant expressions is built into the compiler.</p> | Disable GCC simplification of expressions known at compile time | c|gcc|compiler-optimization | 0 | 60 | 1 | 72,171,857 | 72,171,857 | 4 | true | 2022-05-09T12:12:48.360Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Disable GCC simplification of expressions known at compile time<p>Suppose I have the following C line:</p>
<pre><code>int a = 4 + 7;
</code></pre>
<p>When co... |
72,172,459 | How do I force max 4 decimals without rounding up in C# / .NET<p>Example variables:</p>
<pre><code>var example1 = 1,12345638282382384;
var example2 = 12,12;
var example3 = 30,19999;
</code></pre>
<p>Result what I want:</p>
<pre><code>example1 = 1,1234;
example2 = 12,12; // 12,1200 would be better but isn't that import... | <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.math.round?view=net-6.0" rel="nofollow noreferrer">Math.Round</a> allows you to specify the rounding behavior you want, eg <code>Math.Round(example1,4,MidpointRounding.ToZero)</code> produces <code>1.1234</code>.</p>
<pre><code>C# > var example1 = 1.123... | How do I force max 4 decimals without rounding up in C# / .NET | c#|.net|winforms|parameters | 0 | 92 | 2 | 72,172,670 | 72,172,670 | 4 | true | 2022-05-09T13:03:19.720Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I force max 4 decimals without rounding up in C# / .NET<p>Example variables:</p>
<pre><code>var example1 = 1,12345638282382384;
var example2 = 12,12;... |
72,173,066 | Haskell - Non-exhaustive patterns in my function<p>I want to make a function that selects the given indexed elements from a list.</p>
<p>For example:</p>
<pre><code>reconstruct' [1,4] "bear" = [br]
reconstruct' [2,3,4] [1,2,3,4,5] = [2,3,4]
</code></pre>
<p>Function definition:</p>
<pre><code>reconstruct' ::... | <p>You are not capturing the situation when the list of indices is empty:</p>
<pre><code>reconstruct' [] _ = []
</code></pre> | Haskell - Non-exhaustive patterns in my function | haskell|recursion|exception|functional-programming | 0 | 79 | 1 | 72,173,214 | 72,173,214 | 4 | true | 2022-05-09T13:49:34.713Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Haskell - Non-exhaustive patterns in my function<p>I want to make a function that selects the given indexed elements from a list.</p>
<p>For example:</p>
<pr... |
72,176,166 | Is there an if-let one liner shorthand?<p>I would like to be able to use if-let in a similar fashion to the commonly used if-else shorthand: <code><condition> ? <expression1> : <expression2></code>. This syntax would look something like this:</p>
<pre><code><let condition creating variable v1> ?... | <p>You can write this using <code>map</code>:</p>
<pre><code>let dict = getName().map { name in ["name": name] } ?? ["error": "no name"]
</code></pre>
<p>The closure parameter is <code><let condition creating variable v1></code>, and the closure's return value is the <code><expres... | Is there an if-let one liner shorthand? | swift|if-statement|syntax|option-type | 0 | 104 | 1 | 72,176,396 | 72,176,396 | 4 | true | 2022-05-09T17:43:48.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there an if-let one liner shorthand?<p>I would like to be able to use if-let in a similar fashion to the commonly used if-else shorthand: <code><condit... |
72,187,190 | Plot zeros in a different colour to colour scale in ggplot2<p>I have a data frame, df:</p>
<pre><code>df <- structure(list(animal = c("cat", "cat", "cat", "cat", "cat",
"cat", "cat", "cat", "cat", "cat", "cat&qu... | <p>You could use <code>scale_fill_gradientn</code>. Set your three colours to white, off-white and red, and set the values at which they reach these colors as 0, the smallest possible non-zero number, and 1.</p>
<pre class="lang-r prettyprint-override"><code>ggplot(df, aes_string(x = "id", y = "tissue&qu... | Plot zeros in a different colour to colour scale in ggplot2 | r|ggplot2 | 0 | 32 | 1 | 72,187,247 | 72,187,247 | 4 | true | 2022-05-10T13:24:08.337Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Plot zeros in a different colour to colour scale in ggplot2<p>I have a data frame, df:</p>
<pre><code>df <- structure(list(animal = c("cat", &qu... |
72,189,733 | Array not able to be copied into new variable<p>while I am trying to develop my app, i keep getting the following error:</p>
<p><code>TypeError: Invalid attempt to spread non-iterable instance.</code></p>
<p>The error states a spread operator is being placed on a non-iterable but I am doing this on an array so it does ... | <p>Array.push returns a new length of array (number), not array.
You should do something like</p>
<pre><code>for (....) {
copyOfNames.push(copy[j].name)
copyOfNumbers.push(copy[j].number)
}
setFindNames(copyOfNames)
setFindNumbers(copyOfNumbers)
</code></pre> | Array not able to be copied into new variable | javascript|arrays|reactjs|react-hooks | 0 | 48 | 2 | 72,189,842 | 72,189,842 | 4 | true | 2022-05-10T16:11:55.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Array not able to be copied into new variable<p>while I am trying to develop my app, i keep getting the following error:</p>
<p><code>TypeError: Invalid atte... |
72,191,778 | Split a string and create dummies in R<p>I have something like <code>val1</code> where the separator is <code>,</code>. I would like to split <code>val1</code> and then create dummies. how to get around with this. many thanks in advance.</p>
<pre><code>val1 <- c("ab, cd, ef", "", "gh")
... | <p>In <code>base R</code>, use <code>strsplit</code> to split the 'val1' based on the <code>,</code> and any space following into a <code>list</code>, set the names of the <code>list</code> with 'val2', <code>stack</code> it to a two column data.frame and apply <code>table</code></p>
<pre><code>out <- table(stack(se... | Split a string and create dummies in R | r|string|split|tidyr|data-manipulation | 0 | 30 | 1 | 72,191,806 | 72,191,806 | 4 | true | 2022-05-10T19:03:19.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Split a string and create dummies in R<p>I have something like <code>val1</code> where the separator is <code>,</code>. I would like to split <code>val1</cod... |
72,192,440 | Python lint issue : invalid escape sequence '\/'<p>This is my python code line which is giving me <strong>invalid escape sequence '/'</strong> lint issue.</p>
<pre><code>pattern = 'gs:\/\/([a-z0-9-]+)\/(.+)$' # for regex matching
</code></pre>
<p>It is giving me out that error for all the backslash I used here .
any ... | <p>There's two issues here:</p>
<ol>
<li>Since this is not a raw string, the backslashes are string escapes, not regexp escapes. Since <code>\/</code> is not a valid string escape sequence, you get that warning. Use a raw string so that the backslashes will be ignored by the string parser and passed to the regexp engin... | Python lint issue : invalid escape sequence '\/' | python|lint | 0 | 82 | 1 | 72,192,507 | 72,192,507 | 4 | true | 2022-05-10T20:13:04.380Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python lint issue : invalid escape sequence '\/'<p>This is my python code line which is giving me <strong>invalid escape sequence '/'</strong> lint issue.</... |
72,194,489 | Can you set the default value/instance of a class for use in the default operator<p>The title mostly says it. Is it possible to define the result value of a <code>default(T)</code> call? I'm not sure whether this would actually be useful, but one of the use-cases that I can think of is the <code>.FirstOrDefault()</code... | <blockquote>
<p>Is it possible to define the result value of a default(T) call?</p>
</blockquote>
<p>No.</p>
<ul>
<li><code>default(T) where T : struct</code> is <em>always</em> the value of <code>T</code> where its underlying memory is entirely zero-valued bytes.</li>
<li><code>default(T) where T : class</code> is <em... | Can you set the default value/instance of a class for use in the default operator | c# | 0 | 75 | 1 | 72,194,604 | 72,194,604 | 4 | true | 2022-05-11T01:33:36.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can you set the default value/instance of a class for use in the default operator<p>The title mostly says it. Is it possible to define the result value of a ... |
72,196,435 | Python Pandas: Select inverse of dataframe grouby<p>Say I have a pandas data frame called <code>df_all</code>.
I then wish to group by columns <code>Foo</code>, and select only the last row for each grouped by set:</p>
<pre class="lang-py prettyprint-override"><code># E.g.
# Foo Bar Baz
# 1 1 1
# 1 2 2
# 2 ... | <p>What about:</p>
<pre><code>df_inverse = df_all[df_all.duplicated(subset='Foo', keep='last')]
print(df_inverse)
</code></pre>
<pre><code> Foo Bar Baz
0 1 1 1
2 2 1 2
3 2 3 4
</code></pre> | Python Pandas: Select inverse of dataframe grouby | python|pandas | 0 | 79 | 3 | 72,196,487 | 72,196,487 | 4 | true | 2022-05-11T06:37:34.773Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Pandas: Select inverse of dataframe grouby<p>Say I have a pandas data frame called <code>df_all</code>.
I then wish to group by columns <code>Foo</cod... |
72,196,916 | Fastest way to do loop over 2D arrays in Cython<p>I am trying to loop over 2 2d arrays in Cython. The arrays have the following shape:
<code>ranges_1</code> is a 6000x3 array of <code>int64</code>, while <code>ranges_2</code> is a 2000x2 of <code>int64</code>. This iteration needs to be perfomed around 10000 times. Thi... | <p>What you measure in your benchmarks is mainly <strong>compilation artefacts and overheads</strong>.</p>
<p>First of all, Cython use the default compiler installed on your machine preferred by the Python stack. On Linux, it should be GCC. On Windows, it is certainly MSVC if installed, otherwise MinGW (if any). Meanwh... | Fastest way to do loop over 2D arrays in Cython | python|performance|optimization|cython | 0 | 123 | 1 | 72,199,711 | 72,199,711 | 4 | true | 2022-05-11T07:18:29.553Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fastest way to do loop over 2D arrays in Cython<p>I am trying to loop over 2 2d arrays in Cython. The arrays have the following shape:
<code>ranges_1</code> ... |
72,204,956 | Find element in array of x depth Javascript<p>Is it possible to use the <code>find()</code> method within an array of depth x?</p>
<p>For example, suppose I have the following array of objects, call it <code>test</code>:</p>
<pre><code>[
{
"id": "1",
"title": "Firs... | <p><code>find</code> cannot do this, but you can use it in a recursive approach:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function findDeep(arr, predicate) {
let res... | Find element in array of x depth Javascript | javascript|arrays | 0 | 45 | 1 | 72,205,241 | 72,205,241 | 4 | true | 2022-05-11T17:01:57.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find element in array of x depth Javascript<p>Is it possible to use the <code>find()</code> method within an array of depth x?</p>
<p>For example, suppose I ... |
72,206,877 | C - ceil/float rounding to int guarantees<p>I'm wondering if there are any circumstances where code like this will be incorrect due to floating point inaccuracies:</p>
<pre class="lang-c prettyprint-override"><code>#include <math.h>
// other code ...
float f = /* random but not NAN or INF */;
int i = (int)floo... | <p>The C standard is sloppy in specifying floating-point behavior, so it is technically not completely specified that <code>floorf(f)</code> produces the correct floor of <code>f</code> or that <code>ceilf(f)</code> produces the correct ceiling of <code>f</code>.</p>
<p>Nonetheless, no C implementations I am aware of g... | C - ceil/float rounding to int guarantees | c|floating-accuracy | 0 | 47 | 1 | 72,207,091 | 72,207,091 | 4 | true | 2022-05-11T19:50:03.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C - ceil/float rounding to int guarantees<p>I'm wondering if there are any circumstances where code like this will be incorrect due to floating point inaccur... |
72,221,860 | How to derive an object type with another object's values in Typescript?<p>I'm trying to create a function that will return a generic object type with keys that are derived from an argument passed into that function. A simplified example:</p>
<pre class="lang-js prettyprint-override"><code>// What do I put here for thi... | <p>Sure it is, with a mapped type:</p>
<pre><code>type ObjectB<T extends { name: string }> = {
[K in T["name"]]: string;
};
</code></pre>
<p>You will notice the <code>extends { name: string }</code> after <code>T</code>. This is a generic constraint, which is <em>similar</em> to a function parameter... | How to derive an object type with another object's values in Typescript? | typescript|typescript-generics | 0 | 62 | 1 | 72,222,116 | 72,222,116 | 4 | true | 2022-05-12T20:42:29.683Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to derive an object type with another object's values in Typescript?<p>I'm trying to create a function that will return a generic object type with keys t... |
72,228,444 | remove consecutive substrings from a string without importing any packages<p>I want to remove <strong>consecutive "a" substrings</strong> and replace them with <strong>one "a"</strong> from a string <strong>without importing any packages</strong>.
For example, I want to get <code>abbccca</code> from... | <p>This method will remove a determined repeated char from your string:</p>
<pre><code>def remove_dulicated_char(string, char):
new_s = ""
prev = ""
for c in string:
if len(new_s) == 0:
new_s += c
prev = c
if c == prev and c == char:
co... | remove consecutive substrings from a string without importing any packages | python|string|replace|substring | 0 | 76 | 5 | 72,228,588 | 72,228,588 | 4 | true | 2022-05-13T10:54:15.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
remove consecutive substrings from a string without importing any packages<p>I want to remove <strong>consecutive "a" substrings</strong> and repla... |
72,226,554 | Is there an Object-Oriented way to use standard reporting events?<p>Is there an Object-Oriented way to create functionality for the standard reporting events like <code>INITIALIZATION</code> or <code>AT SELECTION-SCREEN</code>?</p> | <p>As far as I am aware, there isn't an object-oriented alternative to the classic reporting events.</p>
<p>What I usually do when I am in an object-oriented mood but want to create a classic report with selection screen is to create a local class <code>lcl_main</code> and then write code like this:</p>
<pre><code>INIT... | Is there an Object-Oriented way to use standard reporting events? | abap | 0 | 112 | 1 | 72,230,319 | 72,230,319 | 4 | true | 2022-05-13T08:27:05.597Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there an Object-Oriented way to use standard reporting events?<p>Is there an Object-Oriented way to create functionality for the standard reporting events... |
72,236,167 | Getting objects before validating data Django REST<p>I have to create a new <code>Chat</code> object using this view:</p>
<pre><code>class ChatListCreateView(ListCreateAPIView):
permission_classes = [IsAuthenticated]
serializer_class = ChatSerializer
def get_queryset(self):
data = Chat.objects.filt... | <p>I think you need to add the <code>employee_ids</code> field in the serializer.</p>
<pre><code>class ChatSerializer(serializers.ModelSerializer):
created_by = SimpleEmployeeSerializer(read_only=True)
employees = SimpleEmployeeSerializer(many=True, read_only=True)
title = serializers.CharField(max_... | Getting objects before validating data Django REST | python|django|django-rest-framework|django-serializer | 0 | 58 | 2 | 72,237,382 | 72,237,382 | 4 | true | 2022-05-13T23:11:31.973Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting objects before validating data Django REST<p>I have to create a new <code>Chat</code> object using this view:</p>
<pre><code>class ChatListCreateView... |
72,237,507 | Alternative function for case match in haskell<p>I am writing an API in Haskell which involves a DB query.
Function will be something like do a db query and then return the response back.</p>
<pre class="lang-hs prettyprint-override"><code>doAPICall :: Request -> (Monad m Response)
doAPICall req = do
maybeValDB ... | <p>Perhaps what you're looking for is <a href="https://hackage.haskell.org/package/base-4.16.1.0/docs/Prelude.html#v:maybe" rel="nofollow noreferrer"><code>maybe</code></a>?</p>
<pre class="lang-hs prettyprint-override"><code>doAPICall :: Request -> (Monad m Response)
doAPICall req = do
maybeValDB <- getValFr... | Alternative function for case match in haskell | haskell|pattern-matching | 0 | 72 | 1 | 72,238,121 | 72,238,121 | 4 | true | 2022-05-14T05:10:47.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Alternative function for case match in haskell<p>I am writing an API in Haskell which involves a DB query.
Function will be something like do a db query and ... |
72,241,507 | errno vs errors returned by library functions<p>For <code>errno</code>, there are a bunch of library functions, like <code>strerror()</code>, etc. to convert or print the error code.</p>
<p>But what about the error codes returned by library functions?</p>
<p>E.g. <code>write()</code> will return <code>EAGAIN</code>, <c... | <p><code>EAGAIN</code>, <code>EBADF</code> etc. are symbols for system error numbers, <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html" rel="nofollow noreferrer">defined in <code>errno.h</code></a>. They are compatible with <code>strerror</code> and related functions.</p>
<p>Note that <a ... | errno vs errors returned by library functions | c|libraries|error-handling | 0 | 82 | 1 | 72,241,508 | 72,241,508 | 4 | true | 2022-05-10T15:59:54.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
errno vs errors returned by library functions<p>For <code>errno</code>, there are a bunch of library functions, like <code>strerror()</code>, etc. to convert... |
72,234,754 | How to call render functions in Vue 3 composition api?<p>Back in vue 2 i used to call <code>render()</code> like that:</p>
<pre><code>export default {
mounted(){
...
},
render(){
...
},
methods(){
...
}
}
</code></pre>
<p>I'm now trying to do the same with Vue 3 and the c... | <p>As per my understanding, <code>h()</code> is a short form to create the vnodes and accept 3 parameters.</p>
<pre><code>h(
tag name,
props/attributes,
array of children
)
</code></pre>
<p>As per my understanding, In <code>create_canvas</code> you are trying to create a <code>div</code> which contains a <c... | How to call render functions in Vue 3 composition api? | javascript|vue.js | 0 | 1,047 | 2 | 72,255,275 | 72,255,275 | 4 | true | 2022-05-13T19:49:22.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to call render functions in Vue 3 composition api?<p>Back in vue 2 i used to call <code>render()</code> like that:</p>
<pre><code>export default {
mo... |
72,200,886 | Local variable initialized inside 'if' is still available after that 'if' in C#<p>Have not found an answer to this question yet (proboply because I am looking wrong for it). I was just wondering following. Why is it not possible to have this code:</p>
<pre class="lang-cs prettyprint-override"><code>if (obj is string st... | <p>The question is, why is the error: <em>"Error CS0128 A local variable or function named 'str' is already defined in this scope"</em> .</p>
<p>The answer is, The code <code>if (obj is string str1)</code> is syntactic sugar for declaring a variable and assigning it.</p>
<p>I used <a href="https://sharplab.io... | Local variable initialized inside 'if' is still available after that 'if' in C# | c#|if-statement|scope | 0 | 87 | 2 | 72,201,062 | 72,201,062 | 4 | true | 2022-05-11T12:14:41.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Local variable initialized inside 'if' is still available after that 'if' in C#<p>Have not found an answer to this question yet (proboply because I am lookin... |
72,171,739 | How can I make this JS repetitive code shorter<p>I just wrote this piece of code that does the thing it's supposed to do, although it's really messy and pretty repetitive and I'm wondering how can I make it much shorter and concise.</p>
<pre><code>if(id==1 && player == "playerOne"){
Object.assig... | <p>Assuming</p>
<p>a) there are no more than two players</p>
<p>b) you don't care that this code handles <code>id < 1</code> and <code>id > 9</code></p>
<p>It looks to me like you could reduce this to a single line.</p>
<pre><code>Object.assign(player == "playerOne" ? playerOne : playerTwo, fighters[id ... | How can I make this JS repetitive code shorter | javascript|reactjs | 0 | 63 | 4 | 72,171,859 | 72,171,859 | 4 | true | 2022-05-09T12:06:43.380Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I make this JS repetitive code shorter<p>I just wrote this piece of code that does the thing it's supposed to do, although it's really messy and pret... |
72,146,183 | Is it possible to provide estimate hrs or minutes for progress completion? - PROGRESS 4GL<p>I am using below query for progress completion which shows how much percentage is completed in record updating process. My question or doubt here is Is it possible to provide estimated hrs/minutes for this progress completion?</... | <p>This variant here relies on NUM-RESULTS as suggested by nwahmaet and uses a DATETIME-TZ Variable and the INTERVAL function to determine the runtime. Output is done only every 1000's iteration so that the display of the Progress does not cause more load than the processing.</p>
<pre><code>&scoped Table Customer
... | Is it possible to provide estimate hrs or minutes for progress completion? - PROGRESS 4GL | openedge|progress-4gl | 0 | 81 | 3 | 72,150,212 | 72,150,212 | 4 | true | 2022-05-06T18:54:32.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to provide estimate hrs or minutes for progress completion? - PROGRESS 4GL<p>I am using below query for progress completion which shows how mu... |
72,233,035 | Get temp path with file name<p>I want to get path to file like this > <strong>%ENV%/%FILE_NAME%.docx</strong></p>
<p>But c++ doesn't make sense at all and nothing works..<br>
I would use std::string but it's not compatible so I tried multiple ways of converting it to char[] or char* but none of them works and I'm al... | <p>Using <code>appendCharToCharArray()</code> is just horribly inefficient in general, and also you are leaking lots of memory with the way you are using it. Just use <code>std::string</code> instead. And yes, you <em>can</em> use <code>std::string</code> in this code, it is perfectly "compatible" if you us... | Get temp path with file name | c++ | 0 | 57 | 1 | 72,233,722 | 72,233,722 | 4 | true | 2022-05-13T16:56:17.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get temp path with file name<p>I want to get path to file like this > <strong>%ENV%/%FILE_NAME%.docx</strong></p>
<p>But c++ doesn't make sense at all and... |
72,179,857 | Optimizing randomization in C# Windows Form Application<p>I am making an UNO game for a C# course using the Windows Form template in Visual Studio. I have run into a little problem while randomizing the user's starting hand. I am using a Random object to randomize the cards, and, when I start the project, they are all ... | <p>When simulating a card game in code, you should actually do it like you would with real cards, i.e. randomise the entire deck and then take one card at a time from that deck. I would do that something like this:</p>
<pre class="lang-cs prettyprint-override"><code>private Random rng = new Random;
private Queue<int... | Optimizing randomization in C# Windows Form Application | c# | 0 | 66 | 1 | 72,180,080 | 72,180,080 | 4 | true | 2022-05-10T01:43:50.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Optimizing randomization in C# Windows Form Application<p>I am making an UNO game for a C# course using the Windows Form template in Visual Studio. I have ru... |
72,116,153 | How to convert RGBA color codes to 8 Digit Hex in PHP?<p>I'm attempting to convert some <a href="https://en.wikipedia.org/wiki/RGBA_color_model" rel="nofollow noreferrer">rgba</a> values into a format suitable for <a href="https://en.wikipedia.org/wiki/SubStation_Alpha" rel="nofollow noreferrer">SubStation Alpha subtit... | <p>You can use the <code>printf()</code> family of functions to convert to a properly padded hex string. Decimals cannot be represented in hex, so the value is taken as a fraction of 0xFF.</p>
<pre class="lang-php prettyprint-override"><code>$rgba = "rgba(123,100,23,.5)";
// get the values
preg_match_all(&qu... | How to convert RGBA color codes to 8 Digit Hex in PHP? | php|colors|subtitle|rgba | 0 | 276 | 2 | 72,118,891 | 72,118,891 | 4 | true | 2022-05-04T16:10:12.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert RGBA color codes to 8 Digit Hex in PHP?<p>I'm attempting to convert some <a href="https://en.wikipedia.org/wiki/RGBA_color_model" rel="nofollo... |
72,118,331 | SQL ERROR : Column already has a DEFAULT bound to it<p>I have a table as below with a default value column as [IsProcessed]</p>
<pre><code>IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[Kovair_JileEventHistory]')
AND type in (N'U'))
BEGIN
CREATE TABLE... | <p>This is flawed:</p>
<pre><code>IF NOT EXISTS
(
SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[DF__Kovair_Ji__IsPro__5224328E]')
AND type = 'D'
)
</code></pre>
<p>For a few reasons:</p>
<ol>
<li><p>You let the system name the constraint, which means every time you create the table, that syste... | SQL ERROR : Column already has a DEFAULT bound to it | sql|sql-server | 0 | 267 | 1 | 72,118,362 | 72,118,362 | 4 | true | 2022-05-04T19:13:40Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL ERROR : Column already has a DEFAULT bound to it<p>I have a table as below with a default value column as [IsProcessed]</p>
<pre><code>IF NOT EXISTS (SEL... |
72,229,044 | Is there a way to store full DDL of View or Procedure definition from another database in separate table<p>I'm trying to store DDLs of some views and stored procedures in a separate table in the <code>Dump</code> database. There are too many similar databases on the server. But some objects are redundant. They will be ... | <p>Not sure why you're storing module definitions as XML but you should be able to do this in one step, without the cursor, unsupported system procedures from decades ago, and <code>INFORMATION_SCHEMA</code> which is <a href="https://sqlblog.org/2011/11/03/the-case-against-information_schema-views" rel="nofollow norefe... | Is there a way to store full DDL of View or Procedure definition from another database in separate table | sql-server|tsql | 0 | 70 | 1 | 72,229,377 | 72,229,377 | 4 | true | 2022-05-13T11:43:51.813Z | 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 store full DDL of View or Procedure definition from another database in separate table<p>I'm trying to store DDLs of some views and stored ... |
72,167,333 | I want to delete the captured image via wechat_camera_picker Flutter<p>For image_picker MainActivity destruction I wanted to use other plugin to pick image. And I found <code>wechat_camera_picker</code> as an alternative. But there was a problem while capturing the image. The captured image saved on <strong>Local Stora... | <p>you can use the below function to delete the locally stored file.</p>
<pre><code> Future<bool> deleteFile(File pickedFile) async {
try {
await pickedFile.delete();
return true;
} catch (e) {
return false;
}
}
</code></pre>
<p>You can check the <a href="https://api.flutter.d... | I want to delete the captured image via wechat_camera_picker Flutter | flutter|android-camera|imagepicker|flutter-image|flutter-assetimage | 0 | 89 | 1 | 72,169,177 | 72,169,177 | 4 | true | 2022-05-09T05:28:24.357Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I want to delete the captured image via wechat_camera_picker Flutter<p>For image_picker MainActivity destruction I wanted to use other plugin to pick image. ... |
72,173,630 | Why 'git add *' doesn't track deleted files?<p>As shown in the picture, the <code>git add *</code> command does not track a <code>.sh</code> file whose name <em>does not</em> start with a dot. But if I specify the file in the git add command, it can track it. I wonder why this happens?</p>
<p><a href="https://i.stack.i... | <p>What you want to do is <code>git add --all</code>.</p>
<p>The reason for <code>git add *</code> not working is that the shell will expand the <code>*</code> argument to a list of all the names of the files/folders in the current directory.</p>
<p>But because <code>commit.sh</code> does not exist, your shell with not... | Why 'git add *' doesn't track deleted files? | linux|git | 0 | 40 | 1 | 72,173,915 | 72,173,915 | 4 | true | 2022-05-09T14:26:52.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why 'git add *' doesn't track deleted files?<p>As shown in the picture, the <code>git add *</code> command does not track a <code>.sh</code> file whose name ... |
72,223,336 | Values do not match<p>I am pretty sure I am not squinting hard enough to see where the mismatch is ... but I have been staring at my screen for a long time and thus asking this question.</p>
<p>My MLI file looks like</p>
<pre><code>type ('k, 'v) t
val empty: ('k, 'v) t
val find: 'k -> ('k, 'v) t -> 'v option
... | <p>From the erroneous type <code>a -> 'a -> ('a, 'a) t -> ('a, 'a) t</code> you can see that your code is doing something that makes the compiler deduce that keys and values are the same type. This isn't what you want--the whole reason to have two type parameters <code>(k, v)</code> is so the types are indepen... | Values do not match | ocaml | 0 | 49 | 1 | 72,223,556 | 72,223,556 | 4 | true | 2022-05-13T00:30:24.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Values do not match<p>I am pretty sure I am not squinting hard enough to see where the mismatch is ... but I have been staring at my screen for a long time a... |
72,199,923 | Change numeric(0) to NA in pipe, but return unchanged otherwise<p>How to recode vector to NA if it is zero length (numeric(0)), but return the vector unchanged if not? Preferably in tidyverse using pipes.</p>
<p>My attempt:</p>
<pre><code>library(tidyverse)
empty_numeric <- numeric(0)
empty_numeric |>
if_els... | <p>You can’t use a vectorised <code>if_else</code> here because its output is the same length as its input (i.e. always a single element). Instead, you’ll need to use conventional <code>if</code>. And neither will work with the built-in <code>|></code> pipe since that restricts how the call can be formed (in particu... | Change numeric(0) to NA in pipe, but return unchanged otherwise | r|tidyverse | 0 | 39 | 1 | 72,200,217 | 72,200,217 | 4 | true | 2022-05-11T11:05:42.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change numeric(0) to NA in pipe, but return unchanged otherwise<p>How to recode vector to NA if it is zero length (numeric(0)), but return the vector unchang... |
72,210,117 | Vertex not read in opengl<p>I have a question, what should I do when some part of the vertex not read by opengl? I mean when I run the code, it didn't follows my coordinate grid which i did on graph paper and even after I delete that vertex, it still showed the same output. I wanted to make maple leaf.</p>
<p>I want to... | <p>This is your polygon:</p>
<p><a href="https://i.stack.imgur.com/4l0tS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4l0tS.png" alt="enter image description here" /></a></p>
<p>Your shape is not convex and <code>GL_POLYGON</code> stipulates:</p>
<blockquote>
<p><code>GL_POLYGON</code></p>
<p>Draw... | Vertex not read in opengl | c++|opengl | 0 | 98 | 1 | 72,210,691 | 72,210,691 | 4 | true | 2022-05-12T04:23:19.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vertex not read in opengl<p>I have a question, what should I do when some part of the vertex not read by opengl? I mean when I run the code, it didn't follow... |
72,189,626 | simplest way to prevent accesing array beyond range in C<p>I'm wondering if there is any easier way to prevent accessing array beyond range than using <code>if()</code> statement.
I have switch case code for arduino like this with many cases:</p>
<pre class="lang-c prettyprint-override"><code>switch(a){
case 3: ... | <p>The Answer was written when the question used the tag <code>c</code>, not <code>c++</code> and edited later. The FastLED library is clearly implemented in C++.</p>
<p>You could wrap the array access in a function that implements the checks.</p>
<p>The following function assumes that the array <code>leds</code> and <... | simplest way to prevent accesing array beyond range in C | c++ | 0 | 75 | 1 | 72,189,823 | 72,189,823 | 4 | true | 2022-05-10T16:03:47.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
simplest way to prevent accesing array beyond range in C<p>I'm wondering if there is any easier way to prevent accessing array beyond range than using <code>... |
72,184,747 | C# What is the point of the using statement?<p>I'm not talking about references to assemblies, rather the using statement within the code.</p>
<p>For example what is the difference between this:</p>
<pre><code>using (DataReader dr = .... )
{
...stuff involving data reader...
}
</code></pre>
<p>and this:</p>
<pre><c... | <p>The point of a <code>using</code> statement is that the object you create with the statement is implicitly disposed at the end of the block. In your second code snippet, the data reader never gets closed. It's a way to ensure that disposable resources are not held onto any longer than required and will be released e... | C# What is the point of the using statement? | c#|garbage-collection|using-statement | 0 | 54 | 2 | 72,184,774 | 72,184,774 | 4 | true | 2022-05-10T10:33:47.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# What is the point of the using statement?<p>I'm not talking about references to assemblies, rather the using statement within the code.</p>
<p>For example... |
72,230,958 | What is the proper way to pass a reactive pinia state as axios params?<p>I am trying to use two pinia stores for my axios params but when I send the axios request, the state is sent as a whole proxy object.</p>
<p><strong>stores/product-filter.js</strong></p>
<pre class="lang-js prettyprint-override"><code>import { def... | <p>In <code>stores/product.js</code>, you are passing the entire store to Axios.
It seems you want to pass just the state of the store, so try this:</p>
<pre class="lang-js prettyprint-override"><code>fetchProducts() {
return axios.get(process.env.API_URL + "product", {
params: {
limit: pagination... | What is the proper way to pass a reactive pinia state as axios params? | axios|vuejs3|pinia | 0 | 727 | 1 | 72,232,646 | 72,232,646 | 4 | true | 2022-05-13T14:09:59.967Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the proper way to pass a reactive pinia state as axios params?<p>I am trying to use two pinia stores for my axios params but when I send the axios re... |
72,236,510 | In Common Lisp (SBCL) how do you parse a file?<p>I have a file: <code>test.lisp</code> with this content:</p>
<pre><code>(+ 3 3)
(let ((n 3)) (+ n 1))
(let ((n 4))
(+ n 1))
(defun d (f)
(let ((n 3)
(f 4)
(g 3))
(if (= n 0)
(+ n f g)
(* n f g))))
</code></pre>
<p>I am trying to read the file... | <p>What you search for is <code>read</code> instead of <code>read-line</code> which reads expression-wise (and is used by lisp interpreters).</p>
<pre><code>(with-open-file (stream "test1.lisp")
(loop for expr = (read stream nil 'eof)
until (eq expr 'eof)
collect expr))
;; ((+ 3 3) (LET ((N 3)) (+ N... | In Common Lisp (SBCL) how do you parse a file? | file|parsing|common-lisp|sbcl | 0 | 135 | 2 | 72,237,255 | 72,237,255 | 4 | true | 2022-05-14T00:32:11.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In Common Lisp (SBCL) how do you parse a file?<p>I have a file: <code>test.lisp</code> with this content:</p>
<pre><code>(+ 3 3)
(let ((n 3)) (+ n 1))
(let... |
72,209,322 | How do get the working directory after a cd in a makefile?<p>I just need to be able to assign the value of <code>pwd</code> after <code>cd</code> to a variable so I can open a file in my web browser, but I can't seem to figure out how to do that in a Makefile. Interestingly, when searching other answers about people wh... | <p>The methods you've tried are all evaluated by <code>make</code> before the shell command is ever executed. You need to write a shell command that outputs the current directory, one that executes after the <code>cd</code>.</p>
<p>The simplest option is <code>pwd</code>:</p>
<pre><code>compile:
cp outputs/outfile.... | How do get the working directory after a cd in a makefile? | bash|macos|makefile|gnu-make|pwd | 0 | 82 | 1 | 72,209,374 | 72,209,374 | 4 | true | 2022-05-12T01:59:13.010Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do get the working directory after a cd in a makefile?<p>I just need to be able to assign the value of <code>pwd</code> after <code>cd</code> to a variab... |
72,164,964 | Vector as value in JSON (C++/nlohmann::json)<p>I want to have something like that:</p>
<pre><code>{ "rooms": [ "room1", "room2", "room3", etc ] }
</code></pre>
<p>I have an <code>std::vector<std::string></code> of the name of the rooms, and I would like to convert it so the... | <p>You can create a Json array directly from the <code>std::vector<std::string></code> so something like this will work:</p>
<pre class="lang-cpp prettyprint-override"><code>#include <nlohmann/json.hpp>
#include <iostream>
#include <string>
#include <vector>
using json = nlohmann::json;
... | Vector as value in JSON (C++/nlohmann::json) | c++|json|nlohmann-json | 0 | 493 | 1 | 72,165,021 | 72,165,021 | 4 | true | 2022-05-08T20:45:46.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vector as value in JSON (C++/nlohmann::json)<p>I want to have something like that:</p>
<pre><code>{ "rooms": [ "room1", "room2"... |
72,156,597 | Power to n implementation that produces wrong results for negative exponent<p>In the following (naive) implementation of a <code>pow(x, n)</code> method, ignoring completely any optimized approach, I find the following problem:</p>
<pre><code>public double pow(double x, int n) {
boolean negative = n < 0;
lon... | <p><code>Math.abs(n)</code> is still an <code>int</code>, and only afterwards it is assigned to a <code>long</code>, Therefore, the absolute value of <code>-2147483648</code> was <code>-2147483648</code> again (this is noted in <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#abs-int-" rel="norefe... | Power to n implementation that produces wrong results for negative exponent | java|algorithm|math|division|exponent | 0 | 108 | 1 | 72,156,657 | 72,156,657 | 5 | true | 2022-05-07T21:52:57.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Power to n implementation that produces wrong results for negative exponent<p>In the following (naive) implementation of a <code>pow(x, n)</code> method, ign... |
72,165,852 | Why does Option<NonZeroU32> not require using explicit Some?<p>I have noticed by accident that the following code compiles and works, but I am curious why?
I understand why Option of u32 requires an explicit Some, but I don't understand why NonZeroU32 is special and actually forbids from explicitly using Some.</p>
<pre... | <p><a href="https://doc.rust-lang.org/stable/std/num/struct.NonZeroU32.html#method.new" rel="noreferrer"><code>NonZeroU32::new()</code></a> return <code>None</code> if the argument <code>n</code> is zero. The <code>Option</code> is a failure indicator of the function. It's a very common pattern in Rust and have no rela... | Why does Option<NonZeroU32> not require using explicit Some? | rust|algebraic-data-types | 0 | 122 | 2 | 72,165,883 | 72,165,883 | 5 | true | 2022-05-08T23:56:21.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does Option<NonZeroU32> not require using explicit Some?<p>I have noticed by accident that the following code compiles and works, but I am curious why?
I... |
72,173,184 | How to assign two dimensional initializer list in c++?<p>I inherited my class from vector and I would like to be able to assign list to my class like to vector.</p>
<p>My code is as follows:</p>
<pre><code>#include <vector>
using namespace std;
template<typename T>
class Matrix
: public vector<vecto... | <p>Just bring <code>std::vector</code> constructor to your class scope:</p>
<pre class="lang-cpp prettyprint-override"><code>template <typename T> class Matrix : public vector<vector<T>> {
public:
using vector<vector<T>>::vector;
};
</code></pre>
<p><a href="https://godbolt.org/z/b3b... | How to assign two dimensional initializer list in c++? | c++|vector|initializer-list | 0 | 55 | 1 | 72,173,260 | 72,173,260 | 5 | true | 2022-05-09T13:56:58.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to assign two dimensional initializer list in c++?<p>I inherited my class from vector and I would like to be able to assign list to my class like to vect... |
72,174,690 | How to not use friend declaration when equipping a class with `operator<<`<p>I understand that we'd want to do something like this to override <code>operator<<</code></p>
<pre><code>#include <iostream>
class Point
{
private:
double m_x{};
double m_y{};
double m_z{};
public:
Point(double x=... | <p>You can just declare <code>operator<<</code> as a free function in the same namespace as <code>Point</code> (in this case, the global namespace) and ADL will take care of it:</p>
<pre><code>#include <iostream>
class Point {
private:
double m_x{};
double m_y{};
double m_z{};
public:
... | How to not use friend declaration when equipping a class with `operator<<` | c++ | 0 | 55 | 3 | 72,174,740 | 72,174,740 | 5 | true | 2022-05-09T15:42:22.707Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to not use friend declaration when equipping a class with `operator<<`<p>I understand that we'd want to do something like this to override <code>operator... |
72,177,104 | Define fromInteger function in Num instance on in Haskell<blockquote>
<p>I tried to make it so that in the console the following</p>
<p>1 :: AlgebraicGraph Int</p>
<p>Will produce</p>
<p>Vertex 1</p>
</blockquote>
<pre><code>data AlgebraicGraph a
= Empty
| Vertex a
| Overlay (AlgebraicGraph a) (... | <pre><code>fromInteger x = Vertex x
</code></pre>
<p>The problem is that <code>x :: Integer</code> there, not <code>Num a => a</code>. Do this instead:</p>
<pre><code>fromInteger x = Vertex (fromInteger x)
</code></pre> | Define fromInteger function in Num instance on in Haskell | haskell | 0 | 103 | 1 | 72,177,132 | 72,177,132 | 5 | true | 2022-05-09T19:09:22.007Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Define fromInteger function in Num instance on in Haskell<blockquote>
<p>I tried to make it so that in the console the following</p>
<p>1 :: AlgebraicGraph I... |
72,188,576 | How to order queries execution in SQL script so that they are executed in the right order?<p>Let's say that I have three tables:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Table</th>
<th>References</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>-</td>
</tr>
<tr>
<td>B</td>
<td>A</td>
... | <p>The typical solution is to decouple the table creation from the constraint creation. For example, your script could look like:</p>
<pre><code>CREATE TABLE C(...);
CREATE TABLE A(...);
CREATE TABLE B(...);
alter table c add constraint fk1 foreign key (x) references b (y);
alter table b add constraint fk2 foreign key... | How to order queries execution in SQL script so that they are executed in the right order? | sql|sql-server | 0 | 67 | 2 | 72,188,663 | 72,188,663 | 5 | true | 2022-05-10T14:53:04.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to order queries execution in SQL script so that they are executed in the right order?<p>Let's say that I have three tables:</p>
<div class="s-table-cont... |
72,188,400 | how to connect two table that has no relation in rails<p>I have a table called foods and categories, but this table has no relation, I want to connect them through another table called food_category. And I want to make one-to-one relation between food and category maybe the diagram looks like this</p>
<p><a href="http... | <p>Yes, this is possible. You just need to do</p>
<pre><code>has_one :category, through: :food_categories
</code></pre>
<p>as discussed in the <a href="https://guides.rubyonrails.org/v6.1/association_basics.html#the-has-many-through-association" rel="noreferrer">Rails docs here</a>.</p>
<p>However, this is a long-winde... | how to connect two table that has no relation in rails | ruby-on-rails|ruby|postgresql|activerecord|relational-database | 0 | 33 | 2 | 72,188,710 | 72,188,710 | 5 | true | 2022-05-10T14:40:17.503Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to connect two table that has no relation in rails<p>I have a table called foods and categories, but this table has no relation, I want to connect them t... |
72,189,263 | Put two TextFields in a row in Compose<p>I'm trying to put a drop down for US states that uses a TextField and a TextField in a Row and the second TextField (zip) does not show up. What am I doing wrong?</p>
<p>Here is how I'm declaring the row:</p>
<pre><code> Row (Modifier.fillMaxWidth()) {
StateSelection... | <pre><code>Row (Modifier.fillMaxWidth()) {
StateSelection(
modifier = Modifier.weight(1f)
...
)
Spacer(modifier = Modifier.width(8.dp))
ShippingField(
modifier = Modifier.weight(1f),
...
)
}
</code></pre>
<p>You should do it like above, and then pass the modifie... | Put two TextFields in a row in Compose | android|row|android-jetpack-compose | 0 | 361 | 2 | 72,189,624 | 72,189,624 | 5 | true | 2022-05-10T15:37:01.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Put two TextFields in a row in Compose<p>I'm trying to put a drop down for US states that uses a TextField and a TextField in a Row and the second TextField ... |
72,211,560 | Vuex: Why disable strict mode?<p>I don't see any cons to using strict mode with this <code>vuex</code>. The performances seem better and it is easier to debug. So, why disable that mode?</p> | <p>Strict mode should not be used in production. Strict mode runs a synchronous deep watcher on the state tree for detecting inappropriate mutations, and this can slow down the application. To avoid changing strict to false each time you want to create a production bundle, you should use a build tool that makes the str... | Vuex: Why disable strict mode? | vue.js|vuex | 0 | 252 | 1 | 72,211,695 | 72,211,695 | 5 | true | 2022-05-12T07:23:10.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vuex: Why disable strict mode?<p>I don't see any cons to using strict mode with this <code>vuex</code>. The performances seem better and it is easier to debu... |
72,211,978 | Chaining predicates into one using the Stream API<p>I have a list of predicates (<code>List<Predicate<String>></code>) which I want to chain into one using <code>or</code> methods. How can I use the Stream API to achieve that?</p> | <p>You can use <code>reduce</code> to join them all together with <code>or</code>, yielding a single <code>Predicate<String></code>. Like this:</p>
<pre><code>List<Predicate<String>> predicates = getPredicates();
Predicate<String> p = predicates.stream()
.reduce(s -> false, Predicate::or... | Chaining predicates into one using the Stream API | java|stream|predicate | 0 | 47 | 1 | 72,212,027 | 72,212,027 | 5 | true | 2022-05-12T07:59:05.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Chaining predicates into one using the Stream API<p>I have a list of predicates (<code>List<Predicate<String>></code>) which I want to chain into... |
72,221,004 | Join two dimension tables that don't have a shared key column?<p>I have a Employee info (one row per employee) table and a Calendar table (one row per day).</p>
<p>I want a results table that has one row per day for each employee.</p>
<p>employee table</p>
<div class="s-table-container">
<table class="s-table">
<thead>... | <p>A cross join is what you want:</p>
<pre><code>SELECT * FROM EMPLOYEE_TABLE
CROSS JOIN CALENDAR_TABLE;
</code></pre>
<p>A cross join literally just multiplies the number of rows in the first table with the number of rows in the second table.</p> | Join two dimension tables that don't have a shared key column? | sql|sql-server | 0 | 36 | 1 | 72,221,176 | 72,221,176 | 5 | true | 2022-05-12T19:15:29.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Join two dimension tables that don't have a shared key column?<p>I have a Employee info (one row per employee) table and a Calendar table (one row per day).<... |
72,225,897 | Spread operator for props are not passing to component<p>I am having an issue passing spread operator props to components. Instead of returning a list with values, it is returning an empty list.</p>
<p>This is how I'm passing in my props to the component</p>
<pre><code>const APIKey = "abc";
const url = "... | <p>React pass all props as first argument of react functional component.
So This is an object.</p>
<p>Correct way to get other <em>props</em> is , <code>...props</code>.</p>
<p>So:</p>
<pre><code>const FunctionName = ({ anotherPropIhave, ...props }) => {
const { APIKey, url } = props;
}
</code></pre> | Spread operator for props are not passing to component | reactjs|react-props | 0 | 44 | 2 | 72,225,954 | 72,225,954 | 5 | true | 2022-05-13T07:30:25.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spread operator for props are not passing to component<p>I am having an issue passing spread operator props to components. Instead of returning a list with v... |
72,183,658 | Does Java have a similar post method diamond operator that C# has?<p>The Unity project makes frequent use of C# functions that supply a type in a diamond operator after the method name. In the Unity source code it's defined like this:</p>
<pre><code>public static T FindObjectOfType<T>() where T : Object
{
re... | <p>Java has a similar construct, but the name "diamond operator" is reserved (ok, not really 'reserved', but used) for something slightly different.</p>
<p>In the construct</p>
<pre class="lang-java prettyprint-override"><code>final List<String> stringList = new ArrayList<>();
</code></pre>
<p>the... | Does Java have a similar post method diamond operator that C# has? | java|c#|generics | 0 | 96 | 2 | 72,184,075 | 72,184,075 | 5 | true | 2022-05-10T09:16:09.427Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does Java have a similar post method diamond operator that C# has?<p>The Unity project makes frequent use of C# functions that supply a type in a diamond ope... |
72,200,214 | Passing array in a c function using address operator gives a warning<p>I was trying to pass an array to a method. I tried following ways:</p>
<ol>
<li>func2(ARRAY_NAME, length) => WORKS, no warning</li>
<li>func2(&ARRAY_NAME[0], length) => WORKS, no warning</li>
<li>func2(&ARRAY_NAME, length) => WORKS,... | <p>As it is clear written in the error message</p>
<pre><code>functionTest.c:8:27: note: expected ‘unsigned char *’ but argument is of type ‘unsigned char (*)[200]’
8 | void func2(unsigned char* buf, int length)
</code></pre>
<p>the function expects a pointer of the type <code>unsigned char *</code> but the argumen... | Passing array in a c function using address operator gives a warning | arrays|c|pointers|implicit-conversion|gcc-warning | 0 | 60 | 2 | 72,200,567 | 72,200,567 | 5 | true | 2022-05-11T11:26:06.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing array in a c function using address operator gives a warning<p>I was trying to pass an array to a method. I tried following ways:</p>
<ol>
<li>func2(... |
72,201,421 | How to do is >> std::skipws >> through multiple indices of an array?<p>Let's say you have <code>std::array<int, SIZE> a</code>, and you have saved each element of <code>a</code> into a file in one line separated by a space. Then you want to read them with a <code>std:istream& is</code> via:</p>
<pre><code>is... | <blockquote>
<p>How to write this generically for any value of SIZE.</p>
</blockquote>
<p>There are control structures for repeating an operation a variable number of times: <strong>loops</strong>.</p>
<p>For example:</p>
<pre><code>is >> std::skipws;
for(auto& el : a) {
is >> el;
}
</code></pre> | How to do is >> std::skipws >> through multiple indices of an array? | c++|iterator|fstream|istream | 0 | 39 | 1 | 72,201,606 | 72,201,606 | 5 | true | 2022-05-11T12:53:31.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do is >> std::skipws >> through multiple indices of an array?<p>Let's say you have <code>std::array<int, SIZE> a</code>, and you have saved each... |
72,231,790 | Self deleting button<p>I have a TScrollBox with a bunch of TPanels with some TButtons generated at runtime.
I need to delete the TPanel when one TButton is clicked but doing that in OnClick end in an access violation...</p>
<pre><code>procedure TMainForm.ButanClick(Sender: TObject);
var
vParentPanel: TPanel;
begin
... | <p>You cannot safely destroy the parent <code>TPanel</code> (or the <code>TButton</code> itself) from inside the <code>TButton</code>'s <code>OnClick</code> event. The VCL still needs access to the <code>TPanel</code>/<code>TButton</code> for a beat after the event handler exits. So, you need to delay the destruction... | Self deleting button | delphi|button|panel|free|self | 0 | 123 | 2 | 72,232,876 | 72,232,876 | 5 | true | 2022-05-13T15:10:38.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Self deleting button<p>I have a TScrollBox with a bunch of TPanels with some TButtons generated at runtime.
I need to delete the TPanel when one TButton is c... |
72,141,161 | How do I measure the time it takes a for loop to run to completion?<p>I'm trying to debug the length of time <code>for i in image_list:</code> takes to complete, there are two possibilities as to how this loop ends. Either true or false. True occurs if it finds a positive image match, and false occurs if it doesn't.</p... | <p>I would use a boolean as the return value to only have a single return statement. I find it easier to read that way. And use a break statement instead.</p>
<pre><code>def detection(image_list):
res = False
# start timer
loop_time = time.time()
for i in image_list:
needle_img = i[0]
... | How do I measure the time it takes a for loop to run to completion? | python | 0 | 83 | 4 | 72,141,256 | 72,141,256 | 5 | true | 2022-05-06T12:01:49.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I measure the time it takes a for loop to run to completion?<p>I'm trying to debug the length of time <code>for i in image_list:</code> takes to compl... |
72,189,776 | How to exclude most dissimilar value of set in R?<p>I have a df looking like this but larger:</p>
<pre><code>values <- c(22,16,23,15,14.5,19)
groups <- rep(c("a","b"), each = 3)
df <- data.frame(groups, values)
</code></pre>
<p>I have between 1-3 values per group (in the example 3 values fo... | <p>If you're looking for <strong>one</strong> value to discard, you can remove the observation that has the highest distance from the mean value per group:</p>
<pre class="lang-r prettyprint-override"><code>df %>%
group_by(groups) %>%
mutate(dist = abs(values - mean(values))) %>%
filter(dist != max(di... | How to exclude most dissimilar value of set in R? | r|dataframe|subset|similarity|exclude | 0 | 39 | 1 | 72,189,825 | 72,189,825 | 5 | true | 2022-05-10T16:15:05.560Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to exclude most dissimilar value of set in R?<p>I have a df looking like this but larger:</p>
<pre><code>values <- c(22,16,23,15,14.5,19)
groups <-... |
72,183,252 | Oracle TRUNC function doesn't work in perl<p>I try to insert the created field in my_table. The created field has a datetime type. In my_table the field my_created has a date format. So I try to TRUNC the created field. However I'm getting the error <code>ORA-01830: date format picture ends before converting entire inp... | <blockquote>
<p>How can I get only the date without time?</p>
</blockquote>
<p>In Oracle, a <code>DATE</code> is a binary data type that is composed of 7 bytes representing: century, year-of-century, month, day, hour, minute and second. It <strong>ALWAYS</strong> has those binary components so if you want an Oracle <co... | Oracle TRUNC function doesn't work in perl | oracle|perl | 0 | 57 | 1 | 72,188,467 | 72,188,467 | 5 | true | 2022-05-10T08:49:07.030Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Oracle TRUNC function doesn't work in perl<p>I try to insert the created field in my_table. The created field has a datetime type. In my_table the field my_c... |
72,213,794 | setlocale() has no effect on macOS<p>I am using <a href="https://en.cppreference.com/w/c/locale/setlocale" rel="nofollow noreferrer">the example program for <code>setlocale()</code> from cppreference.com</a> on a macOS 10.14.6 system, however, the output is not localized. I checked that the return value from <code>setl... | <p>From the terminal, <a href="https://www.freebsd.org/cgi/man.cgi?query=locale" rel="nofollow noreferrer"><code>locale -a</code></a> can be used to see all available locales.</p>
<p>On my system<sup>1</sup>, <code>locale -a | grep de_</code> yields the following results</p>
<pre class="lang-none prettyprint-override">... | setlocale() has no effect on macOS | c|macos|locale | 0 | 82 | 1 | 72,214,861 | 72,214,861 | 5 | true | 2022-05-12T10:16:11.400Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
setlocale() has no effect on macOS<p>I am using <a href="https://en.cppreference.com/w/c/locale/setlocale" rel="nofollow noreferrer">the example program for ... |
72,071,138 | How can I extend an SQL table with new primary keys as well as add up values for exisiting keys?<p>I want to join or update the following two tables and also add up <code>df</code> for existing words. So if the word <code>endeavor</code> does not exist in the first table, it should be added with its <code>df</code> val... | <p>You just need to UNION the two tables first, then aggregate on the word. Since the tables are identically structured it's very easy. Look at this fiddle. I have used maria 10.3 since you didn't specify, but these queries should be completely compliant with (just about) any DBMS.</p>
<p><a href="https://dbfiddle.u... | How can I extend an SQL table with new primary keys as well as add up values for exisiting keys? | sql|join|mariadb|sql-update | 0 | 31 | 1 | 72,071,305 | 72,071,305 | 5 | true | 2022-04-30T18:30:50.200Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I extend an SQL table with new primary keys as well as add up values for exisiting keys?<p>I want to join or update the following two tables and also... |
72,162,736 | ordering of sorted() when ties are present<p>Consider this simple example</p>
<pre><code>x = [1,2,3,4]
y = [1,2,2,4]
</code></pre>
<p>The code below returns a tuple containing elements from x and y sorted by decreasing order of the number in y list.</p>
<pre><code>sorted(zip(x,y), key = lambda x: x[1], reverse = True)
... | <p>See <a href="https://docs.python.org/3/howto/sorting.html#sort-stability-and-complex-sorts" rel="noreferrer">Sort Stability and Complex Sorts</a> in Sorting HOWTO:</p>
<blockquote>
<p>Sorts are guaranteed to be stable. That means that when multiple records have the same key, their original order is preserved.</p>
</... | ordering of sorted() when ties are present | python | 0 | 53 | 2 | 72,162,772 | 72,162,772 | 6 | true | 2022-05-08T15:53:13.613Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ordering of sorted() when ties are present<p>Consider this simple example</p>
<pre><code>x = [1,2,3,4]
y = [1,2,2,4]
</code></pre>
<p>The code below returns ... |
72,210,923 | Try correcting to the name of an existing method, or defining a method named 'OutlineButton' in flutter 3.0.0. it isn't defined for the type<p>I've installed <code>flutter 3.0.0</code>. Now I'm getting error that <code>OutlinedButton</code> isn't defined for the type.</p>
<p><strong>Error:</strong></p>
<blockquote>
<p>... | <p>That widget have been changed to <code>OutlinedButton</code>.</p>
<pre><code>Old Widget was : OutlineButton
Old Theme was : ButtonTheme
New Widget is : OutlinedButton
New Theme is : OutlinedButtonTheme
</code></pre>
<p>Here's an example :</p>
<pre><code>OutlinedButton(
style: OutlinedButton.styleFrom(
sh... | Try correcting to the name of an existing method, or defining a method named 'OutlineButton' in flutter 3.0.0. it isn't defined for the type | flutter|dart | 0 | 3,599 | 2 | 72,210,990 | 72,210,990 | 6 | true | 2022-05-12T06:22:46.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Try correcting to the name of an existing method, or defining a method named 'OutlineButton' in flutter 3.0.0. it isn't defined for the type<p>I've installed... |
72,187,471 | How to get the total count of for each in laravel blade<pre class="lang-html prettyprint-override"><code><h3>
@php $i = 0 @endphp
@foreach ($dischargePatients as $patient)
@if ($patient->GetPatientDistrict() == auth()->user()->district_assigned)
{{ ++$i }}
@else
... | <p>Its better to count the users in the patientDistrict in the controller and give the view the new variable</p>
<pre class="lang-php prettyprint-override"><code>$patientsInDistrict = collect($dischargePatients)
->filter(function($patient) {
return $patient->GetPatientDistrict() == auth()->user()-&... | How to get the total count of for each in laravel blade | laravel | 0 | 38 | 1 | 72,187,638 | 72,187,638 | 6 | true | 2022-05-10T13:42:54.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get the total count of for each in laravel blade<pre class="lang-html prettyprint-override"><code><h3>
@php $i = 0 @endphp
@foreach ($di... |
72,170,321 | Unable to match results of php hash_hmac() and coldfusion hmac()<p>I am working on encrypting a URL and converting a working script from PHP to ColdFusion. I have completed 95% of the work but I am stuck at this point after trying many solutions available on StackOverflow. My results are still not matching. I confirmed... | <blockquote>
<p>saltBin and keyBin values are the same on both scripts</p>
</blockquote>
<p>Yes, those values are the same, but the <em>data</em> being hashed isn't. That's why the results don't match.</p>
<p>The php code hashes the concatenated <em>binary</em> of the salt and path variables. To illustrate using a simp... | Unable to match results of php hash_hmac() and coldfusion hmac() | php|hash|coldfusion|sha256 | 0 | 224 | 1 | 72,180,184 | 72,180,184 | 7 | true | 2022-05-09T10:12:35.057Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to match results of php hash_hmac() and coldfusion hmac()<p>I am working on encrypting a URL and converting a working script from PHP to ColdFusion. I... |
72,144,888 | Why casting a very large long number to int gives us a strange output (Java)?<p>I was practicing some castings in Java and I faced a situation for which I couldn't find any answers, anywhere. There are a lot of similar questions with answers, but none gave me an explanation for this particular case.</p>
<p>When I do so... | <p>165787121844687L in hex notation = 0000 96C8 5281 81CF</p>
<p>1384219087 in hex notation = 5281 81CF</p>
<p>So the cast truncated the top 32 bits as expected.</p>
<pre class="lang-sh prettyprint-override"><code> 32-bits
deleted
▼▼▼▼ ▼... | Why casting a very large long number to int gives us a strange output (Java)? | java|casting|long-integer | 0 | 109 | 3 | 72,144,958 | 72,144,958 | 7 | true | 2022-05-06T16:44:27.150Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why casting a very large long number to int gives us a strange output (Java)?<p>I was practicing some castings in Java and I faced a situation for which I co... |
72,148,253 | Haskell - Incorrect distance returning from Haversine<p>I have the code below for calculating the Haversine distance between a list of airports, however it is consistently returning the incorrect value. For example, running the code below on ORD (Chicago) and JFK (NYC) by running <code>haversine (head $ allAirports) (l... | <p>You have a typo in here:</p>
<pre><code>r_y2 = to_rad y1
</code></pre>
<p>— should be <code>y2</code> instead of <code>y1</code>. If you fix it, you get ~<code>738</code> which is the correct answer. Your desired number, 827, seems to be what Google Maps shows for a driving distance, accounting for roads, etc. If y... | Haskell - Incorrect distance returning from Haversine | haskell|math|distance|haversine | 0 | 113 | 1 | 72,148,912 | 72,148,912 | 7 | true | 2022-05-06T23:19:20.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Haskell - Incorrect distance returning from Haversine<p>I have the code below for calculating the Haversine distance between a list of airports, however it i... |
72,163,454 | Each label address used, adds 24 bytes more (plus 8 bytes (totalling 32 bytes)) to the .o file's total size<p>In my FASM project (Object), I'm trying to create a jump-table and I use <code>dq</code> for each jump address but there is a problem!<br />
For each <code>dq .jmp1</code> (jump address definition), 24 bytes mo... | <p>Remember that a <code>.o</code> file is not just a flat image of the code and data you assembled; it also contains metadata, such as <a href="https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-54839.html" rel="noreferrer">relocations</a>.</p>
<p>Since <code>dq .jmp1</code> references a symbol whose absolute... | Each label address used, adds 24 bytes more (plus 8 bytes (totalling 32 bytes)) to the .o file's total size | assembly|x86-64|executable|fasm|object-files | 0 | 61 | 1 | 72,163,853 | 72,163,853 | 9 | true | 2022-05-08T17:19:04.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Each label address used, adds 24 bytes more (plus 8 bytes (totalling 32 bytes)) to the .o file's total size<p>In my FASM project (Object), I'm trying to crea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.