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,340,578
Loop through a dictionary in C# with a list of values<p>I have a dictionary</p> <pre><code>public Dictionary&lt;string, List&lt;string&gt;&gt; myDic = new Dictionary&lt;string, List&lt;string&gt;&gt;(2) { {&quot;Key1&quot;, new List&lt;string&gt; {&quot;Val1&quot;, &quot;Val2&quot;, &quot;Val3&quot;} }, {&quot;...
<p>you can do something like with out testing it.</p> <pre><code>foreach (var keyValuePair in myDic) { Console.WriteLine(keyValuePair.Key); foreach (var s in keyValuePair.Value) { Console.WriteLine(s); } } </code></pre> <p>Or with index forloop</p> <pre><code>foreach (var keyValuePair in myDic) ...
Loop through a dictionary in C# with a list of values
c#
3
69
1
72,340,623
72,340,623
3
true
2022-05-22T19:11:07.387Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Loop through a dictionary in C# with a list of values<p>I have a dictionary</p> <pre><code>public Dictionary&lt;string, List&lt;string&gt;&gt; myDic = new Di...
72,359,513
How to catch an exception in a task?<p>In the following example exception is not intercepted and the program keeps running as if nothing happened. Is there a global error handler that can intercept such exceptions? Here's playground <a href="https://dotnetfiddle.net/hFsxg3" rel="nofollow noreferrer">link</a>.</p> <p><s...
<p>Since your <code>Task.Run</code> is not <code>await</code>ed that's why it it considered as a fire and forget task. The <code>Task</code> itself could not throw exception (it only populates its <code>Exception</code> property), the <code>await</code> or <code>.GetAwaiter().GetResult()</code> can.</p> <p>The <code>Ta...
How to catch an exception in a task?
c#|.net
1
69
1
72,360,534
72,360,534
3
true
2022-05-24T08:22:07.430Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to catch an exception in a task?<p>In the following example exception is not intercepted and the program keeps running as if nothing happened. Is there a...
72,380,333
Why cant I add two methods to a class using v-bind<p>Using vue.js 2 I need to dynamically add classes to a &lt;tr&gt; element.</p> <p><strong>What works (single method call)</strong></p> <pre><code>:tbody-tr-class=&quot;urgentEnquiryMixin_rowColour&quot; </code></pre> <p><strong><strong>What doesn't work</strong> (two ...
<p>You can use class directly for optional classes.</p> <p>You can even use class as well to have classes that always work:</p> <pre class="lang-html prettyprint-override"><code>&lt;div class=&quot;static&quot; :class=&quot;{ active: isActive, 'text-danger': hasError }&quot; &gt;&lt;/div&gt; </code></pre> <p>So cre...
Why cant I add two methods to a class using v-bind
vue.js|vuejs2|vue-component
1
69
1
72,380,444
72,380,444
3
true
2022-05-25T15:21:13.727Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why cant I add two methods to a class using v-bind<p>Using vue.js 2 I need to dynamically add classes to a &lt;tr&gt; element.</p> <p><strong>What works (sin...
72,261,472
Select the first element from the first list, the second element from the second list, and so on, in a nested list<p>Let's say I have a list like this:</p> <p><code>lst &lt;- list(list(1,2,3),list(4,5,6),list(7,8,9))</code></p> <p>I would then like to extract the elements 1, 5, and 9. How should I do that in an efficie...
<p>You can use the <code>sapply</code> using the length of the list and the function to subset the list as below:</p> <pre><code>sapply(1:length(lst), function(x) lst[[x]][[x]]) </code></pre>
Select the first element from the first list, the second element from the second list, and so on, in a nested list
r|list
2
69
4
72,261,557
72,261,557
4
true
2022-05-16T15:10:36.950Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Select the first element from the first list, the second element from the second list, and so on, in a nested list<p>Let's say I have a list like this:</p> <...
72,391,109
How do I pass ILogger to a static class, so it's suitable for unit tests as well<p>How do I pass <code>ILogger&lt;T&gt;</code> to the static class <code>Policies</code> and its static method <code>RateLimit(...)</code>, so it's suitable for both the <code>Client.TooManyRequestsAsync</code> and the <code>PoliciesTests.T...
<p>You can create an instance of ILogger using NullLoggerFactory.Instance.CreateLogger().</p> <p>So your example will looks like:</p> <pre><code>public class PoliciesTests { private readonly ILogger&lt;PoliciesTests&gt; _logger = NullLoggerFactory.Instance.CreateLogger&lt;PoliciesTests&gt;(); [Fact] ...
How do I pass ILogger to a static class, so it's suitable for unit tests as well
c#|.net|logging|ilogger
0
69
2
72,391,571
72,391,571
4
true
2022-05-26T11:30:26.543Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I pass ILogger to a static class, so it's suitable for unit tests as well<p>How do I pass <code>ILogger&lt;T&gt;</code> to the static class <code>Poli...
72,308,584
Unnest matrix in base R<p>Consider a nested matrix of this form, of which each element is a vector, list, or dataframe:</p> <pre class="lang-r prettyprint-override"><code>m &lt;- matrix(replicate(3, list(1:3))) m # [,1] #[1,] integer,3 #[2,] integer,3 #[3,] integer,3 </code></pre> <p>How does one &quot;unnest&...
<p>Use <code>c</code>:</p> <pre class="lang-r prettyprint-override"><code>c(m) #[[1]] #[1] 1 2 3 # #[[2]] #[1] 1 2 3 # #[[3]] #[1] 1 2 3 </code></pre>
Unnest matrix in base R
r|matrix|nested|base-r
1
69
5
72,308,607
72,308,607
4
true
2022-05-19T17:12:20.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unnest matrix in base R<p>Consider a nested matrix of this form, of which each element is a vector, list, or dataframe:</p> <pre class="lang-r prettyprint-ov...
72,264,241
Creating a function that makes an inversed matrix<p>I'm new to haskell and would like some ideas on how to create a function that would take every head element of multilist's lists and add it to a new multilist, then move on to second column and etc.. So far I only know how to write a function for the first column: <co...
<p>We can write this function directly, and you've got the exact right idea to start with. Get the heads first, and then make a recursive call.</p> <p>Assuming all of the lists are of the same length,</p> <pre><code>inverted :: [[a]] -&gt; [[a]] inverted [] = [] -- Degenerate case inverted xss | null (head xss) = [] ...
Creating a function that makes an inversed matrix
haskell
2
69
1
72,264,360
72,264,360
5
true
2022-05-16T18:53:52.840Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Creating a function that makes an inversed matrix<p>I'm new to haskell and would like some ideas on how to create a function that would take every head eleme...
72,344,701
different behavior for different "for"s in benchmark<p>We can write a simple benchmark using <a href="https://github.com/google/benchmark" rel="nofollow noreferrer">google benchmark</a> or <a href="https://www.quick-bench.com/" rel="nofollow noreferrer">https://www.quick-bench.com/</a>,</p> <pre><code>static void range...
<p>The <code>begin</code>/<code>end</code> functions are documented with <a href="https://github.com/google/benchmark/blob/main/include/benchmark/benchmark.h#L609" rel="noreferrer">a warning</a>: says &quot;These functions should not be called directly&quot;</p> <blockquote> <p>These functions should not be called dire...
different behavior for different "for"s in benchmark
c++|for-loop|google-benchmark
1
69
1
72,345,736
72,345,736
5
true
2022-05-23T07:26:12.853Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: different behavior for different "for"s in benchmark<p>We can write a simple benchmark using <a href="https://github.com/google/benchmark" rel="nofollow nore...
72,256,050
Does std::mutex enforce cache cohesion?<p>I have a non-atomic variable <code>my_var</code> and an <code>std::mutex my_mut</code>. I assume up to this point in the code, the programmer has followed this rule:</p> <blockquote> <p>Each time the programmer modifies or writes to <code>my_var</code>, he locks and unlocks <co...
<p>C++ operates on the relations between operations not some particular hardware terms (like cache cohesion). So C++ Standard has a <em>happens-before</em> relationship which roughly means that whatever <em>happened before</em> completed all its side-effects and therefore is visible at the moment that happened after.</...
Does std::mutex enforce cache cohesion?
c++|caching|synchronization|mutex|atomic
3
69
1
72,256,571
72,256,571
6
true
2022-05-16T08:13:48.137Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Does std::mutex enforce cache cohesion?<p>I have a non-atomic variable <code>my_var</code> and an <code>std::mutex my_mut</code>. I assume up to this point i...
72,356,247
Unicode to integer conversion visual studio bug<p>Im trying to convert a unicode character to an integer and encountered a bug in visual studio not sure if its a bug or something im doing wrong</p> <p>The project has unicode character set and not multibyte.</p> <pre><code>#include &lt;windows.h&gt; #include &lt;iostrea...
<p>Wide characters in Visual Studio are only 16 bits, meaning they won't hold a value greater than 65535. You're getting the first half of the character encoded in UTF-16, which is d83e dd80.</p>
Unicode to integer conversion visual studio bug
c++|windows|unicode|visual-studio-2022
1
69
1
72,356,633
72,356,633
6
true
2022-05-24T01:15:06.343Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unicode to integer conversion visual studio bug<p>Im trying to convert a unicode character to an integer and encountered a bug in visual studio not sure if i...
72,253,554
std::array of structures initializater list syntax<p>Consider the following C++ code:</p> <pre><code>struct My_Struct { int a; int b; }; </code></pre> <p>Now I want to declare a constant std::array of these structures:</p> <p>Option A:</p> <pre><code>const std::array&lt;My_Struct,2&gt; my_array = { {1,2}, {2,3}...
<p><code>std::array</code> is a class that contains an actual array. It looks something like this:</p> <pre><code>template &lt;typename T, size_t N&gt; struct array { T _unspecified_name[N]; // Member functions. }; </code></pre> <p>Note that <code>std::array</code> has no constructors or private data members,...
std::array of structures initializater list syntax
c++|stdarray
0
69
3
72,253,688
72,253,688
9
true
2022-05-16T02:08:37.110Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: std::array of structures initializater list syntax<p>Consider the following C++ code:</p> <pre><code>struct My_Struct { int a; int b; }; </code></pre> <p...
72,920,849
Modify multiprocess function to accept a list of args<p>How do I update the <code>multi_proc_parallel_functions</code> function below to accept a list of args. This is using the <a href="https://pypi.org/project/multiprocess/" rel="nofollow noreferrer">multiprocess</a> module.</p> <p>Please note I will be using this w...
<p>This would be one way of doing it (with positional argument support):</p> <pre class="lang-py prettyprint-override"><code>import multiprocessing as mp def parallel_functions(function, send_end, *args): send_end.send(function(*args)) def multi_proc_parallel_functions(function_list, target_func): jobs = [] ...
Modify multiprocess function to accept a list of args
python
2
69
2
72,924,953
72,924,953
1
true
2022-07-09T11:07:40.610Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Modify multiprocess function to accept a list of args<p>How do I update the <code>multi_proc_parallel_functions</code> function below to accept a list of arg...
72,919,096
how can I refetch with getServerSideProps in next on a click on client side?<p>I am using next.js, and trying to refresh the page with SSR data on a click of a button, doing like so:</p> <pre class="lang-js prettyprint-override"><code>import type { NextPage } from 'next' import { useState } from 'react' type HomeProps...
<p>Because of the way <code>getServerSideProps</code> works, you could refresh the data on the client-side using <code>router</code> object.</p> <p>For example, when you click your button it could call a function to programmatically navigate to that same page using: <code>router.replace(router.asPath)</code>.</p> <p>Th...
how can I refetch with getServerSideProps in next on a click on client side?
reactjs|next.js
0
69
2
72,919,412
72,919,412
1
true
2022-07-09T05:09:44.447Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how can I refetch with getServerSideProps in next on a click on client side?<p>I am using next.js, and trying to refresh the page with SSR data on a click of...
72,791,180
Removes all but the first occurrence of a given char in the string<p>I'm a beginner in C# and I'm stuck at this problem.</p> <pre><code> string original = &quot;foo bar foo $ bar $ foo bar $ &quot;; string desired_output = &quot;foo bar foo $ bar foo bar&quot;; </code></pre> <p>I found a rough code but the resul...
<pre><code>string original = &quot;foo bar foo $ bar $ foo bar $ &quot;; string desired_output = &quot;foo bar foo $ bar foo bar&quot;; string result = original; int index = original.IndexOf(&quot;$&quot;)+1; if (index &gt; 0) { result = (original.Substring(0, index) + original.Substring(index).Replace(&q...
Removes all but the first occurrence of a given char in the string
c#
0
69
3
72,791,449
72,791,449
1
true
2022-06-28T18:01:11.897Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Removes all but the first occurrence of a given char in the string<p>I'm a beginner in C# and I'm stuck at this problem.</p> <pre><code> string original = &...
72,831,656
Serializing object methods with Pickle<p>I'm trying to understand the behaviour of the <code>pickle</code> module.</p> <p>It seems to me that <code>pickle</code> doesn't save methods, only attributes.</p> <p>Here is what I mean with a code:</p> <pre><code>import pickle class Person: def __init__(self, name): ...
<p>The short answer is no, you cannot pickle methods but you can pickle <em><strong>functions (built-in and user-defined) accessible from the top level of a module (using def, not lambda).</strong></em></p> <p><a href="https://docs.python.org/3/library/pickle.html#what-can-be-pickled-and-unpickled" rel="nofollow norefe...
Serializing object methods with Pickle
python|serialization|pickle
2
69
2
72,831,925
72,831,925
1
true
2022-07-01T15:41:16.657Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Serializing object methods with Pickle<p>I'm trying to understand the behaviour of the <code>pickle</code> module.</p> <p>It seems to me that <code>pickle</c...
72,881,417
SalesChannelContextFactory creates context without RuleIds<p>I have some code which is executed via cli command and creates orders and sends confirmation mail. Therefor the order bound sales channel rule ids need to be considered. So I'm creating a Saleschannelcontext with the SalesChannelContextFactory given and used ...
<p>You need to inject <code>Shopware\Core\Checkout\Cart\CartRuleLoader</code> and call <code>loadByToken</code>. This will hydrate the array of rule IDs. You may also call <code>loadByCart</code> if you want to consider rules evaluating a cart's content.</p> <pre class="lang-php prettyprint-override"><code>$options = [...
SalesChannelContextFactory creates context without RuleIds
shopware|shopware6
0
69
1
72,882,284
72,882,284
1
true
2022-07-06T09:54:49.350Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SalesChannelContextFactory creates context without RuleIds<p>I have some code which is executed via cli command and creates orders and sends confirmation mai...
72,918,187
wait for child not working (roblox studio)<pre><code>local find = script.Parent find.Touched:Connect(function(touched) local de = find:FindFirstChild(&quot;Humanoid&quot;) if de == true then print(&quot;we found a human!&quot;) end </code></pre> <p>end)</p> <p>is not working?? I'm new to this but i just don't ...
<p>The reason why your script is not functioning as intended is because <code>:FindFirstChild()</code> will return an object. (not a boolean)</p> <p>So your statement is practically stating</p> <pre class="lang-lua prettyprint-override"><code>local part = Instance.new(&quot;Part&quot;) if part == true then -- Part does...
wait for child not working (roblox studio)
lua|roblox
1
69
2
72,925,795
72,925,795
1
true
2022-07-09T00:50:13.420Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: wait for child not working (roblox studio)<pre><code>local find = script.Parent find.Touched:Connect(function(touched) local de = find:FindFirstChild(&qu...
72,843,240
What happens in a convolution when the stride is larger than the kernel?<p>I recently was experiment with convolutions and transposed convolutions in Pytorch. I noticed with the <code>nn.ConvTranspose2d</code> API (I haven't tried with the normal convolution API yet), you can specify a stride that is larger than the ke...
<p>As you already guessed - when the stride is larger than the kernel size, there are input pixels that do not participate in the convolution operation.<br /> It's up to you - the designer of the architecture to decide whether this property is a bug or a feature. In some cases, I took advantage of this property to igno...
What happens in a convolution when the stride is larger than the kernel?
python|pytorch|conv-neural-network|convolution
1
69
1
72,864,492
72,864,492
1
true
2022-07-03T00:23:06.667Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What happens in a convolution when the stride is larger than the kernel?<p>I recently was experiment with convolutions and transposed convolutions in Pytorch...
72,957,948
Python weighted quantile as R wtd.quantile()<p>I want to convert the <code>R</code> package <code>Hmisc::wtd.quantile()</code> into python.</p> <p>Here is the example in R:<br /> <a href="https://i.stack.imgur.com/ELuRY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ELuRY.png" alt="enter image descr...
<p>I am Python-illiterate, but from what I see and after some quick checks I can tell you the following.</p> <p>Here you use uniform (sampling) weights, so you could also directly use the <code>quantile()</code> function. Not surprisingly, it gives the same results as <code>wtd.quantile()</code> with uniform weights:</...
Python weighted quantile as R wtd.quantile()
python|r|numpy|quantile|hmisc
0
69
1
72,959,319
72,959,319
1
true
2022-07-12T20:18:29.820Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python weighted quantile as R wtd.quantile()<p>I want to convert the <code>R</code> package <code>Hmisc::wtd.quantile()</code> into python.</p> <p>Here is th...
72,874,675
Conditional (row-wise) formating of currency, number, and percentage in R DT (datatable)<p>I have column in my DT output (in Shiny) that has a numeric value whose units depend on another column. Some values are percentages, some are currency, and some are plain numbers.</p> <p>For example, I would like to turn this inp...
<p>EDIT: here's a solution borrowing from the approach here: <a href="https://stackoverflow.com/a/35657820/6851825">https://stackoverflow.com/a/35657820/6851825</a></p> <p>You are seeking to sort a formatted column based on the underlying data instead of its varied formatted appearance. You can do this by using an unfo...
Conditional (row-wise) formating of currency, number, and percentage in R DT (datatable)
r|dt
0
69
2
72,875,276
72,875,276
1
true
2022-07-05T19:37:32.433Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Conditional (row-wise) formating of currency, number, and percentage in R DT (datatable)<p>I have column in my DT output (in Shiny) that has a numeric value ...
72,774,206
Simple CompletableFuture.supplyAsync() leads to IllegalMonitorStateException error<p>I'm trying this in java8:</p> <pre><code> public static void main(String[] args) throws Exception { CompletableFuture&lt;Integer&gt; future = CompletableFuture.supplyAsync( () -&gt; { return 911; }); future.whenComplete(...
<p>The exception whose stack trace is shown is thrown by <code>future.wait()</code> and is not related to the <code>error</code> argument of the second <code>CompleableFuture</code>. It occurs because <code>wait()</code> requires the thread invoking it to be holding the object's monitor. See <a href="https://docs.oracl...
Simple CompletableFuture.supplyAsync() leads to IllegalMonitorStateException error
java|exception|monitor|completable-future
0
69
2
72,774,461
72,774,461
2
true
2022-06-27T14:56:36.603Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Simple CompletableFuture.supplyAsync() leads to IllegalMonitorStateException error<p>I'm trying this in java8:</p> <pre><code> public static void main(Strin...
72,780,916
How to create a refresh button with 4 different data end points in React?<p>I created a table on(table.js) with 4 different endpoints(app.js) I would like to add a refresh button that will refresh the data when clicked on. How would I do that with 4 different endpoints? I did try the interval but it refreshed the whole...
<p>It doesn't matter how complex the refresh is, put it all in one function:</p> <pre><code>const App = () =&gt; { const fetchAndSet = () =&gt; { // all the fetch and sets } useEffect(() =&gt; { fetchAndSet(); }, []); return &lt;Table refresh={fetchAndSet} /&gt;; } </code></pre>
How to create a refresh button with 4 different data end points in React?
javascript|html|reactjs|react-native
1
69
2
72,780,991
72,780,991
2
true
2022-06-28T04:56:57.467Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create a refresh button with 4 different data end points in React?<p>I created a table on(table.js) with 4 different endpoints(app.js) I would like to...
72,783,021
How can I define a function in Lean prover? (In "A function is injective then has left inverse")<p>I want to prove the fact &quot;A function is injective, then it has left-inverse.&quot; in Lean Prover.</p> <p>As you know, in standard proof of this theorem, ( <a href="https://math.stackexchange.com/questions/2099699/le...
<p>Use <code>if...then...else</code> to make a case by case definition.</p> <pre><code>import tactic open function open_locale classical -- Theorem: if A is nonempty then an injective function from it -- has a one-sided inverse example (A B : Type) [inhabited A] (f : A → B) (hf : injective f) : ∃ g : B → A, g ∘ f ...
How can I define a function in Lean prover? (In "A function is injective then has left inverse")
lean
0
69
2
72,783,288
72,783,288
2
true
2022-06-28T08:19:30.737Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I define a function in Lean prover? (In "A function is injective then has left inverse")<p>I want to prove the fact &quot;A function is injective, th...
72,798,639
Create a deeply nested object<p>I have the following object</p> <pre><code>const categories = [ { id: 1, name: &quot;Main&quot;, parent: null }, { id: 2, name: &quot;Computers&quot;, parent: 1 }, { id: 3, name: &quot;Components&quot;, parent: 2 }, { id: 4, name:...
<p>Indeed, you are very close.</p> <p>You need to change this line:</p> <pre><code>return recursiveBuild(node.parent); </code></pre> <p>to these lines:</p> <pre><code>recursiveBuild(node.parent); return node; </code></pre> <p>Here is the working snippet:</p> <p><div class="snippet" data-lang="js" data-hide="false" data...
Create a deeply nested object
javascript|recursion
1
69
2
72,798,836
72,798,836
2
true
2022-06-29T09:02:36.480Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create a deeply nested object<p>I have the following object</p> <pre><code>const categories = [ { id: 1, name: &quot;Main&quot;, parent: null ...
72,811,912
Casting a column from hexadecimal string to uint64?<p>As part of the kaggle competition (<a href="https://www.kaggle.com/competitions/amex-default-prediction/overview" rel="nofollow noreferrer">https://www.kaggle.com/competitions/amex-default-prediction/overview</a>), I'm trying to take advantage of a trick where they ...
<p>The values you return from <code>func</code> are:</p> <pre><code>13914591055249847850 11750091188498716901 </code></pre> <p>These values are larger than can be represented with a <code>pl.Int64</code>. Which is what polars uses for python's <code>int</code> type. If a values overflows, polars instead uses <code>Floa...
Casting a column from hexadecimal string to uint64?
python-polars
0
69
1
72,812,298
72,812,298
2
true
2022-06-30T07:33:50Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Casting a column from hexadecimal string to uint64?<p>As part of the kaggle competition (<a href="https://www.kaggle.com/competitions/amex-default-prediction...
72,814,496
Perl warning regarding strange locale setting<p>I'm currently trying to execute a shell-script in which a perl-exection is also embedded:</p> <pre><code>$script_dir/gen-cfg.pl \ --prefix=&quot;$outdir&quot; --no-skip-sequences-without-src \ &quot;${!cfgset/#/${src_cfg_dir}}&quot; \ &quot;${src_cfg_dir}seque...
<p>This means that environment variable <code>LANG</code> is set to <code>ZZ</code>, possibly from having done</p> <pre class="lang-bash prettyprint-override"><code>export LANG=ZZ </code></pre> <p>Silence the warning by fix this environment variable (e.g. by unsetting it).</p>
Perl warning regarding strange locale setting
shell|perl
1
69
1
72,816,711
72,816,711
2
true
2022-06-30T10:49:58.080Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Perl warning regarding strange locale setting<p>I'm currently trying to execute a shell-script in which a perl-exection is also embedded:</p> <pre><code>$scr...
72,826,249
Difference between differents test-flags of go test<p>I am planning to run my Cucumber test in go (using Godog) &amp; I came up with the following possibility of commands to run my tests.</p> <p>Can someone point out the differences here? What is the recommended way &amp; what's the use-case of each cover mode etc?</p>...
<p>This is answered on the GO blog: <a href="https://go.dev/blog/cover#heat-maps" rel="nofollow noreferrer">https://go.dev/blog/cover#heat-maps</a>:</p> <blockquote> <ul> <li>set: did each statement run?</li> <li>count: how many times did each statement run?</li> <li>atomic: like count, but counts precisely in parallel...
Difference between differents test-flags of go test
unit-testing|go|testing|cucumber|go-testing
1
69
1
72,826,688
72,826,688
2
true
2022-07-01T08:10:25.580Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Difference between differents test-flags of go test<p>I am planning to run my Cucumber test in go (using Godog) &amp; I came up with the following possibilit...
72,831,605
Cannot find name `data`, but it's defined<p>I have the following error: &quot;Cannot find name 'data'.&quot;, but I <em>have</em> defined it.</p> <pre><code>const initialState = () =&gt; { try { const data = window.localStorage.getItem('auth'); } catch (e) { const data = null; } if (!data) { return...
<p>You should define <code>data</code> variable outside <code>try</code> block first with <code>let</code> and give it value inside <code>try</code> only after that.</p>
Cannot find name `data`, but it's defined
javascript|typescript
-2
69
2
72,831,648
72,831,648
2
true
2022-07-01T15:36:47.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cannot find name `data`, but it's defined<p>I have the following error: &quot;Cannot find name 'data'.&quot;, but I <em>have</em> defined it.</p> <pre><code>...
72,838,522
C++ how to make a series of statements atomic?<p>I have a program which have multiple threads running. Inside the main thread, a class variable maybe changed by operations from different threads. So I will like to make sure that within a series of steps involving the variable, no other threads may change the variable m...
<p>From the comments, it seems your view of a mutex is that it serves to protect a <em>single</em> block of code, so that no two threads can execute it simultaneously. But that is too narrow a view.</p> <p>What a mutex really does is ensure that no two threads can have it locked simultaneously. So you can have multip...
C++ how to make a series of statements atomic?
c++|multithreading
-1
69
2
72,841,372
72,841,372
2
true
2022-07-02T10:58:51.990Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C++ how to make a series of statements atomic?<p>I have a program which have multiple threads running. Inside the main thread, a class variable maybe changed...
72,870,120
Function not showing up in OnClick() for unity<p>I've been trying to get a function to return a number to change the text in a button. However, I can not use the functions I wrote with OnClick(). I won't show up.</p> <p>Here is the script I've been working with.</p> <pre><code>using System.Collections; using System.Col...
<p>To be able to set a callback here it must be <code>public void</code>, not <code>public int</code>.</p> <p>Also, your code will not change any text. To be able to do this, you need to assign the text label you want to change to a class field. So, it will look like this:</p> <pre><code>public class DiceRollerBehavior...
Function not showing up in OnClick() for unity
c#|unity3d
0
69
1
72,870,480
72,870,480
2
true
2022-07-05T13:16:36.477Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Function not showing up in OnClick() for unity<p>I've been trying to get a function to return a number to change the text in a button. However, I can not use...
72,877,499
How do I get the correct score in ReactJs?<p>I am making a trivia app in React. Right now, my userScore is always showing 0. However, when I use console.log, I get the correct number of answers that I picked. On the quiz page, I get the percentage of the answers correct. So, I have 7 questions for the trivia. I want my...
<p>Looks like the state <code>scoreAfterQuiz</code> isn't getting its latest value in the submission payload due to the <a href="https://reactjs.org/docs/faq-state.html#why-is-setstate-giving-me-the-wrong-value" rel="nofollow noreferrer">asynchronous nature of setState</a>. Try returning the computed value in the <code...
How do I get the correct score in ReactJs?
reactjs
1
69
1
72,877,683
72,877,683
2
true
2022-07-06T03:00:03.887Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get the correct score in ReactJs?<p>I am making a trivia app in React. Right now, my userScore is always showing 0. However, when I use console.log,...
72,916,886
Clean Architecture And DDD Rich Model Validations<p>I am new to clean architecture and DDD, watched some courses about them and currently reading DDD the book by Eric Evans, I have read some discussions about where to put the validations in the domain layer or in the application layer (within the commands) and I feel t...
<p>The thing is that in Domain-Driven Design you usually don't have CRUD like (create, read, update, delete) use cases because it is better suited for <a href="https://cqrs.wordpress.com/documents/task-based-ui/" rel="nofollow noreferrer">task-based user interfaces</a>. If you happen to only have such simple cases with...
Clean Architecture And DDD Rich Model Validations
domain-driven-design|clean-architecture
1
69
1
72,924,115
72,924,115
2
true
2022-07-08T20:53:09.213Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Clean Architecture And DDD Rich Model Validations<p>I am new to clean architecture and DDD, watched some courses about them and currently reading DDD the boo...
72,936,420
How can I get images and environment variables from GKE(GCP) using cloud function(python)?<p>I need to get images and environment variables from GKE cluster using python. I`ve already seen the python container library for gcp, but it seems like there is no such logic as I need <a href="https://github.com/googleapis/pyt...
<p>You can use Google Cloud client libraries to interact with Google Cloud services, for instance GKE, Cloud Functions or other GCP product.</p> <p>If you want to interact with Kubernetes itself (hosted on GKE or elsewhere, but what you want is to read the control plane configuration to get pod/container configuration ...
How can I get images and environment variables from GKE(GCP) using cloud function(python)?
python|google-cloud-platform|google-cloud-functions|google-kubernetes-engine
0
69
1
72,943,723
72,943,723
2
true
2022-07-11T09:34:49.843Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I get images and environment variables from GKE(GCP) using cloud function(python)?<p>I need to get images and environment variables from GKE cluster ...
72,946,615
Inverting a triangular matrix in python/numpy/scipy<p>I am looking to invert a (lower) triangular matrix that comes from the Cholesky decomposition of <code>A</code>, as <code>A = L @ L.T</code>. There are a few potential solutions, including <a href="https://stackoverflow.com/questions/6042308/numpy-inverting-an-upper...
<p>Echoing the previous post, it is often unnecessary to obtain the explicit inverse, and refactoring the code to call a triangular solver routine wherever it is used next is usually preferable. Using a triangular solver with identity as the complementary argument produces the explicit inverse if it is really necessary...
Inverting a triangular matrix in python/numpy/scipy
python|numpy|scipy|matrix-inverse|matrix-decomposition
0
69
1
72,946,786
72,946,786
2
true
2022-07-12T03:08:03.753Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Inverting a triangular matrix in python/numpy/scipy<p>I am looking to invert a (lower) triangular matrix that comes from the Cholesky decomposition of <code>...
72,947,398
Can I attach files directly to the executable in Rust?<p>I have a DLL file that I want to copy to several locations on the computer.</p> <p>I don't want this file sitting around in my folder like a potato, so I want the file placed directly into the executable and copy it from there instead.</p>
<p>Short answer: You can but depending on use case it might not always be best way to get thing done.</p> <h2>Use <code>include_bytes!</code> or <code>include_str!</code></h2> <ul> <li>If it is something like README file, Lisence, json config or something use <a href="https://doc.rust-lang.org/std/macro.include_str.htm...
Can I attach files directly to the executable in Rust?
rust|binaryfiles
0
69
1
72,947,480
72,947,480
2
true
2022-07-12T05:26:55.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can I attach files directly to the executable in Rust?<p>I have a DLL file that I want to copy to several locations on the computer.</p> <p>I don't want this...
72,952,988
@media query works fine in Chrome, but not working on mobile<p>I made an app by React. Everything is fine on laptop Chrome. But When I checked on my phone, @media query is not working. I read almost all questions and answers on stackoverflow. I could not find solution.</p> <pre><code>&lt;meta name=&quot;viewport&quot; ...
<p>It is most likely your phone is wider than <code>400px</code> therefore doesn't enter the media query condition.</p> <p>You can achieve what you want without using media queries, just using <code>max-width</code> with <code>width</code> like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-con...
@media query works fine in Chrome, but not working on mobile
html|reactjs|media-queries
0
69
1
72,953,090
72,953,090
2
true
2022-07-12T13:19:05.420Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: @media query works fine in Chrome, but not working on mobile<p>I made an app by React. Everything is fine on laptop Chrome. But When I checked on my phone, @...
72,955,750
update_forward_refs() fails for dynamically-created model<p>When I create a pydantic model dynamically via <code>create_model()</code> then in some situations <code>update_forward_refs()</code> can't find the relevant definition.</p> <p>This works:</p> <pre><code>from typing import List, Union from pydantic import Base...
<p><a href="https://github.com/samuelcolvin/pydantic/blob/f529e0d3541d3cab0aa9c2795a747cd8af4968e5/pydantic/main.py#L786" rel="nofollow noreferrer"><code>update_forward_refs()</code></a> admits a <code>**localns: Any</code> parameter. It seems that in this case you can pass <code>Bar=Bar</code> to <code>update_forward_...
update_forward_refs() fails for dynamically-created model
python-3.x|pydantic
0
69
1
72,960,026
72,960,026
2
true
2022-07-12T16:46:06.770Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: update_forward_refs() fails for dynamically-created model<p>When I create a pydantic model dynamically via <code>create_model()</code> then in some situation...
72,975,310
Is variable assignment within if conditions possible?<p>You know how in C and JavaScript variable assignments can take place within conditions, such as</p> <pre><code>if ( boolean || (val = func(args)) == case1 ) { /* Perform A */ } else if ( val == case2) { /* Perform B */ } ... </code></pre> <p>such that don't ne...
<p>You can use <code>set</code> and other commands in an <code>expr</code>-ression, and <code>set</code> returns the newly assigned value, so...</p> <pre><code>set boolean true proc func {} { return case2 } if {$boolean &amp;&amp; [set val [func]] eq &quot;case1&quot;} { puts &quot;case 1 found&quot; } elseif {$va...
Is variable assignment within if conditions possible?
tcl
0
69
1
72,976,254
72,976,254
2
true
2022-07-14T04:46:19.130Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is variable assignment within if conditions possible?<p>You know how in C and JavaScript variable assignments can take place within conditions, such as</p> <...
72,979,088
Json string to Hashmap Java<p>I was trying to convert the json string to hashmap using <code>com.fasterxml.jackson.databind.ObjectMapper</code>.</p> <pre><code>String str = &quot;{\&quot;key\&quot;:\&quot;[{\&quot;one\&quot;:\&quot;value\&quot;}]\&quot;}&quot;; ObjectMapper mapper = new ObjectMapper(); try { HashMa...
<p>JSON string is not valid. If the value of <code>key</code> is a string, then you need to escape <code>\&quot;</code>. This means you need to tell to 'Java' to escape also the <code>\</code> character.</p> <p>Change the string to <code>String str = &quot;{\&quot;key\&quot;:\&quot;[{\\\&quot;one\\\&quot;:\\\&quot;valu...
Json string to Hashmap Java
java|json|objectmapper
-1
69
1
72,979,285
72,979,285
2
true
2022-07-14T10:31:30.397Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Json string to Hashmap Java<p>I was trying to convert the json string to hashmap using <code>com.fasterxml.jackson.databind.ObjectMapper</code>.</p> <pre><co...
72,985,432
Calculate number of word occurrences in Stream<String> with characters in front or behind<p>I'm searching large logfiles for specific words. I've found some basic solutions on this if the String contains white spaces. But what I need is to find all occurrences of a specific word that can be surrounded by any character....
<p>Using org.apache.commons.lang3.StringUtils#countMatches:</p> <pre><code>bufferReader = Files.newBufferedReader(Paths.get(file)); Integer count = bufferReader != null ? bufferReader.lines().mapToInt(line -&gt; StringUtils.countMatches(line, &quot;hello&quot;)).sum() : null; </code></pre> <p>More ways to count matches...
Calculate number of word occurrences in Stream<String> with characters in front or behind
java|java-stream
0
69
1
72,986,681
72,986,681
2
true
2022-07-14T18:57:11.357Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calculate number of word occurrences in Stream<String> with characters in front or behind<p>I'm searching large logfiles for specific words. I've found some ...
73,001,790
Python dictionary list unique items<p>I have below input</p> <pre><code> [{&quot;ip&quot;: &quot;1.2.3.4&quot;, &quot;bytes&quot;: 10}, {&quot;ip&quot;: &quot;2.3.4.10&quot;, &quot;bytes&quot;: 10}, {&quot;ip&quot;: &quot;5.6.2.3&quot;, &quot;bytes&quot;: 10}, {&quot;ip&quot;: &quot;1.2.3.4&quot;, &quot;bytes&q...
<p>Using a simple loop:</p> <pre><code>out = {} for d in logs_json: if d['ip'] in out: out[d['ip']]['bytes'] += d['bytes'] else: out[d['ip']] = d.copy() result = list(out.values()) </code></pre> <p>Output:</p> <pre><code>[{'ip': '1.2.3.4', 'bytes': 35}, {'ip': '2.3.4.10', 'bytes': 17}, {'ip':...
Python dictionary list unique items
python
1
69
3
73,001,878
73,001,878
2
true
2022-07-16T05:36:50.940Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python dictionary list unique items<p>I have below input</p> <pre><code> [{&quot;ip&quot;: &quot;1.2.3.4&quot;, &quot;bytes&quot;: 10}, {&quot;ip&quot;: &...
73,004,848
VBA Copy/Paste Alternatives - Charts Flash/Flicker<p>Would like to try another way to copy/paste data from one worksheet to another. I've read the <code>.copy</code> and <code>.paste</code> script is inefficient and slow. I believe this is why my charts in another worksheet keep flickering/flashing to the point of not ...
<p>How about an alternate approach which doesn't use the clipboard?</p> <pre class="lang-vb prettyprint-override"><code>Private Sub Worksheet_Calculate() If Not Worksheets(&quot;Dashboard&quot;).ToggleButton1.Value Then Exit Sub On Error GoTo SafeExit Application.EnableEvents = False Application.Scree...
VBA Copy/Paste Alternatives - Charts Flash/Flicker
arrays|excel|vba|events|copy-paste
0
69
2
73,006,205
73,006,205
2
true
2022-07-16T14:05:14.347Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: VBA Copy/Paste Alternatives - Charts Flash/Flicker<p>Would like to try another way to copy/paste data from one worksheet to another. I've read the <code>.cop...
73,012,005
Expansion of multiple parameter packs of types and integer values<p>I <strong>previously</strong> asked <a href="https://stackoverflow.com/a/73008959/2369597">this question</a>, which basically asked how do I change the following &quot;pseudo code&quot; to get the result the comments show:</p> <pre><code>struct MyStruc...
<p>It's not possible to <em>generate</em> specializations, but you don't actually need those.</p> <p>It's not possible to have more than one template parameter pack per class template, so we'll have to work with a single one, with a helper struct that combines both a type and its index into a single type.</p> <pre><cod...
Expansion of multiple parameter packs of types and integer values
c++|templates|c++17
1
69
1
73,012,066
73,012,066
2
true
2022-07-17T12:59:05.643Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Expansion of multiple parameter packs of types and integer values<p>I <strong>previously</strong> asked <a href="https://stackoverflow.com/a/73008959/2369597...
73,021,064
Optapy Error "return SolverFactory.create(solver_config) TypeError: Unable to convert"<p>I am working on an optapy project and I am getting this error in the solver phase.</p> <pre><code>\optapy\optaplanner_api_wrappers.py&quot;, line 310, in solver_factory_create return SolverFactory.create(solver_config) TypeErro...
<p>The issue is in your <code>@constraint_provider</code> (which is not shown in the question). The error was raised when trying to convert the list returned by <code>defined_constraints</code> into a <code>list</code> of <code>Constraint</code>. In particular, the <code>@constraint_provider</code> must return a list o...
Optapy Error "return SolverFactory.create(solver_config) TypeError: Unable to convert"
python|optimization|optaplanner|optapy
0
69
1
73,024,204
73,024,204
2
true
2022-07-18T10:44:20.857Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Optapy Error "return SolverFactory.create(solver_config) TypeError: Unable to convert"<p>I am working on an optapy project and I am getting this error in the...
72,978,311
Find substring in ansible_hostname<p>I need to check all the cities in the country variable list to see if they contain the city name in the Ansible hostname variable.</p> <p>It means running hosts can contain a city name in its own hostname.</p> <pre class="lang-yaml prettyprint-override"><code>- name: Find city ga...
<p>Some errors in your code</p> <ul> <li>Jinja delimiters do not nest. If you are inside a statement delimiter <code>{% ... %}</code>, you do not need an expression delimiter <code>{{ ... }}</code>: <pre><code>{% if city in ansible_hostname %} </code></pre> </li> <li>You will need a nested loop, as the cities are in a ...
Find substring in ansible_hostname
ansible|jinja2|ansible-template
3
69
2
72,978,934
72,978,934
2
true
2022-07-14T09:31:47.143Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find substring in ansible_hostname<p>I need to check all the cities in the country variable list to see if they contain the city name in the Ansible hostname...
72,994,590
SELECT COUNT(DISTINCT column) doesn't work<p>Why DISTINCT UID doesn't work in my code below?</p> <pre><code>$q = mysql_fetch_array(mysql_query(&quot;SELECT COUNT(DISTINCT UID) AS TOTAL, SUM(CASE WHEN SYSTEM = 'Android' THEN 1 ELSE 0 END) AS A, SUM(CASE WHEN SYSTEM = 'IOS' THEN 1 ELSE 0 END) AS I, SUM(CA...
<p>The <code>distinct</code> keyword is supposed to be outside like below,</p> <pre><code>SELECT DISTINCT column1, column2, ... FROM table_name; ? </code></pre> <p>Also, you are trying to sum few things, It should be something like below,</p> <pre><code>SELECT UID, COUNT(UID) AS TOTAL, SUM(CASE WHEN SYSTEM = 'An...
SELECT COUNT(DISTINCT column) doesn't work
php|mysql|sql
-6
69
1
72,995,941
72,995,941
2
true
2022-07-15T13:15:34.840Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SELECT COUNT(DISTINCT column) doesn't work<p>Why DISTINCT UID doesn't work in my code below?</p> <pre><code>$q = mysql_fetch_array(mysql_query(&quot;SELECT C...
72,858,444
numpy.einsum substantially speeds up computation - but numpy.einsum_path shows no speedup, what am I missing?<p>I have an odd case where I can see <code>numpy.einsum</code> speeding up a computation but can't see the same in <code>einsum_path</code>. I'd like to quantify/explain this possible speed-up but am missing so...
<p>That <code>path</code> just looks at alternative orders when working with more than 2 arguments. With just 2 arguments that analysis does nothing. Your <code>diag(dot)</code></p> <pre><code>In [113]: np.diag(a.dot(a)) Out[113]: array([ 15, 54, 111]) </code></pre> <p>The equivalent using <code>einsum</code> is:</...
numpy.einsum substantially speeds up computation - but numpy.einsum_path shows no speedup, what am I missing?
python|arrays|numpy|performance|numpy-einsum
3
69
2
72,859,148
72,859,148
2
true
2022-07-04T14:38:32.370Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: numpy.einsum substantially speeds up computation - but numpy.einsum_path shows no speedup, what am I missing?<p>I have an odd case where I can see <code>nump...
73,023,698
JS array reorder based on count<p>I am trying to use CSS column to replicate a masonry grid and it works perfectly except for the order. To make this work I want to take my array of items and re order the items so to make them read from left to right.</p> <p>I know how many columns there are column count(may change fro...
<p>I think the best way to do this is to break the data into &quot;buckets&quot; to order them based on the number of columns you have, then flatten those buckets back into a single-dimensional array for output/display purposes. The below solution will handle any data length and any number of columns and return a re-or...
JS array reorder based on count
javascript|arrays
0
69
1
73,024,069
73,024,069
2
true
2022-07-18T14:08:05.087Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JS array reorder based on count<p>I am trying to use CSS column to replicate a masonry grid and it works perfectly except for the order. To make this work I ...
73,022,823
How can I import a nested json object into a pandas dataframe?<p>I have a json object like this:</p> <pre><code>[{'currency_pair': 'UOS_USDT', 'orders': [{'account': 'spot', 'amount': '1282.84', 'create_time': '1655394430', 'create_time_ms': 1655394430129, 'curr...
<pre><code>import pandas as pd data = [{'currency_pair': 'UOS_USDT', 'orders': [{'account': 'spot', 'amount': '1282.84', 'create_time': '1655394430', 'create_time_ms': 1655394430129, 'currency_pair': 'UOS_USDT', 'fee': '0', 'fee_curr...
How can I import a nested json object into a pandas dataframe?
python|json|pandas|dataframe
0
69
3
73,023,410
73,023,410
2
true
2022-07-18T13:08:38.240Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I import a nested json object into a pandas dataframe?<p>I have a json object like this:</p> <pre><code>[{'currency_pair': 'UOS_USDT', 'orders': [{...
72,981,202
How does this code to create an array of sequential numbers work?<p>I found this code online and it works; however, I can't work out how!</p> <p>Can anyone please explain how this code works?</p> <pre class="lang-js prettyprint-override"><code>const arr_seq = Array.apply(null, { length: 10 }).map(Number.call, Number)...
<p><code>Array.apply</code> expects an array(-like) value for its second argument. It will then create an argument for each slot in this array-like object.</p> <p>Since this code passes <code>{ length: 5 }</code> as argument, the <code>apply</code> method will call <code>Array</code> with 5 values. But when reading <co...
How does this code to create an array of sequential numbers work?
javascript|arrays
2
69
2
72,981,631
72,981,631
2
true
2022-07-14T13:19:21.183Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How does this code to create an array of sequential numbers work?<p>I found this code online and it works; however, I can't work out how!</p> <p>Can anyone p...
72,958,809
Overwriting inf in many columns<p>I have a dataframe with many columns that have occurances of <code>inf</code>. I'd like to replace these with <code>null</code>. All of the column names in question start with the string &quot;ratio_&quot;.</p> <p>This is what I've tried, but I get new columns with the title &quot;lite...
<p>You were on the right track. You can use the <a href="https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.Expr.keep_name.html#polars.Expr.keep_name" rel="nofollow noreferrer"><code>keep_name</code></a> expression.</p> <p>Let's expand your example.</p> <pre class="lang-py prettyprint-override"><code...
Overwriting inf in many columns
python-polars
1
69
1
72,958,863
72,958,863
2
true
2022-07-12T21:56:35.553Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Overwriting inf in many columns<p>I have a dataframe with many columns that have occurances of <code>inf</code>. I'd like to replace these with <code>null</c...
72,776,216
Snakemake: Mismatched Wildcards Variable Values for "output" Rule<p>I am encountering a problem that doesn't seem to occur consistently between folders.</p> <p>Essentially, I thought I had a Snakemake pipeline that would work to copy files into folders (with different destinations for different subfolders). I am curre...
<p>To me it looks like it pairs the input to your <code>copy_folders</code> rule correctly because you're using an input function that only uses your <code>sample</code> wildcard to get it. For the output, though, there's a mismatch because if you run the Snakefile without specifying another target, it wants all combin...
Snakemake: Mismatched Wildcards Variable Values for "output" Rule
python|wildcard|directory-structure|snakemake|cp
1
69
2
72,785,416
72,785,416
2
true
2022-06-27T17:35:25.163Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Snakemake: Mismatched Wildcards Variable Values for "output" Rule<p>I am encountering a problem that doesn't seem to occur consistently between folders.</p> ...
72,790,473
How do I parse a text file and get a count of unique values?<p>I have file:</p> <pre><code>If MARA.MTART in ('ZPLW', 'ZFTW'), then MARA.PSTAT like '%K%' If MARA.MTART in ('ZPLW', 'ZFTW'), then MARA.MATKL = '99999999' </code></pre> <p>and I want to parse it by, adding each Word after the &quot;.&quot; to a list (MTART, ...
<h3>Python:</h3> <p>This can easily be accomplished using regular expressions, via the <code>re</code> library. <a href="https://docs.python.org/3/library/re.html#re.findall" rel="nofollow noreferrer">Documentation</a> for the <code>.findall()</code> method can be found here.</p> <p>The lines of the data file are itera...
How do I parse a text file and get a count of unique values?
python|list
3
69
4
72,791,018
72,791,018
2
true
2022-06-28T16:55:48.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I parse a text file and get a count of unique values?<p>I have file:</p> <pre><code>If MARA.MTART in ('ZPLW', 'ZFTW'), then MARA.PSTAT like '%K%' If M...
73,029,305
Why does an iterator of `ToString` items requires them to be `Display` also?<p>The following code:</p> <pre><code>enum MyEnum { A, B, } impl ToString for MyEnum { fn to_string(&amp;self) -&gt; String { match *self { Self::A =&gt; format!(&quot;A&quot;), Self::B =&gt; format!...
<p><code>[MyEnum::A, MyEnum::B].iter()</code> creates an iterator whose item is <code>&amp;MyEnum</code>. <code>&amp;MyEnum</code> does not implement <code>ToString</code>, only <code>MyEnum</code> does. This works:</p> <pre class="lang-rust prettyprint-override"><code>enum MyEnum { A, B, } impl ToString for M...
Why does an iterator of `ToString` items requires them to be `Display` also?
rust|traits|type-bounds
3
69
1
73,029,356
73,029,356
2
true
2022-07-18T22:37:53.140Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does an iterator of `ToString` items requires them to be `Display` also?<p>The following code:</p> <pre><code>enum MyEnum { A, B, } impl ToStrin...
73,021,055
useState not showing updated value in useEffect in React<p>I have a useState</p> <p><code>const [started, setStarted] = useState(false);</code></p> <p>then I have a function where on click it sets the setStarted to true</p> <p><code>setStarted(true)</code></p> <p>then I have a useEffect and in there I have an Intersect...
<p>You need to include <code>started</code> as a dependency for <code>useEffect</code>. It should be as follow:</p> <pre><code>useEffect(() =&gt; { if (started) { // Do something with started } }, [started]) </code></pre> <p>When you have an empty dependency array, the <code>useEffect</code> will only run...
useState not showing updated value in useEffect in React
reactjs|use-effect|use-state|intersection-observer
1
69
1
73,021,462
73,021,462
2
true
2022-07-18T10:43:34.297Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: useState not showing updated value in useEffect in React<p>I have a useState</p> <p><code>const [started, setStarted] = useState(false);</code></p> <p>then I...
73,006,091
Python multiprocessing connection recv_bytes not returning data<p>I'm trying to use the <code>multiprocessing</code> module to implement a simple network traffic forwader.</p> <p>My application listens on a port, and when it receives an inbound connection it makes an outgoing TCP connection to another server and then s...
<p>It seems like you don't actually want or need the functionality of <code>mp.Pipe</code> or <code>mp.connection.Connection</code> objects, so here it makes sense to skip that, and just use <code>socket.socket</code>, and maybe <code>socketserver</code> (which could be done with just <code>socket</code>, but has a goo...
Python multiprocessing connection recv_bytes not returning data
python|multiprocessing|network-programming
2
69
1
73,014,564
73,014,564
2
true
2022-07-16T16:53:51.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python multiprocessing connection recv_bytes not returning data<p>I'm trying to use the <code>multiprocessing</code> module to implement a simple network tra...
72,803,180
Angles of a Point with X, Y, Z using GLM<p>I have two points, one represents the cursor(a cube) and another one represents the position of the Camera.</p> <p>Now to find out which face the camera is facing I have done something like this</p> <pre><code> glm::vec3 direction = glm::normalize(cursorPos - cameraPos); ...
<p>You made this code hard to understand and maintain. Here is method which do not need large mind power.</p> <p>Just 6 vectors defining directions and trying find one which is closest to direction:</p> <pre class="lang-cpp prettyprint-override"><code>Facing findOrientation(glm::vec3 direction) { struct FacingNorma...
Angles of a Point with X, Y, Z using GLM
c++|glm-math
0
69
1
72,804,299
72,804,299
2
true
2022-06-29T14:32:27.480Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angles of a Point with X, Y, Z using GLM<p>I have two points, one represents the cursor(a cube) and another one represents the position of the Camera.</p> <p...
72,876,864
Calling Functions from within class using CTypes<p>I am trying to call a function from within a class which from what I understand, you just call as expected &quot;object.class.function&quot; is this correct, or am I doing something else wrong?</p> <p>cLibrary.c</p> <pre><code>#include &lt;stdio.h&gt; #include &quot;cl...
<p><code>ctypes</code> understands C linkage and a C++ library normally needs to create <code>extern &quot;C&quot;</code> wrapper functions. In this special case you can force <code>ctypes</code> to load the name-decorated C++ symbol for the static method, but it isn't recommended.</p> <p>Here's both demonstrated:</p>...
Calling Functions from within class using CTypes
python|ctypes
1
69
1
72,877,128
72,877,128
2
true
2022-07-06T00:43:16.407Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calling Functions from within class using CTypes<p>I am trying to call a function from within a class which from what I understand, you just call as expected...
72,848,603
Why do we use (bytes) instead of (bits) in pointers arithmetic and array's addresses?<p>Why is each element of an int array separated by (4)?</p> <p>I watched and read many info on pointers arithmetic, but they don't really explain what happen under the hood, they say &quot; an int is 4 bytes&quot; and then they just a...
<p>It doesn't <em>have</em> to be this way. But it's the way all &quot;byte addressable&quot; machines work, and those are by far the most popular type today.</p> <p>The basic idea — and it <em>is</em> a basic idea, there's nothing secret or fancy or obscure about it — is just that you represent the computer's memory ...
Why do we use (bytes) instead of (bits) in pointers arithmetic and array's addresses?
arrays|c|pointers|memory-address
0
69
2
72,848,659
72,848,659
2
true
2022-07-03T17:32:23.867Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why do we use (bytes) instead of (bits) in pointers arithmetic and array's addresses?<p>Why is each element of an int array separated by (4)?</p> <p>I watche...
72,789,609
How to add new column's name in dataframe saving previous one (python)?<p>have this with column name = <code>A</code>:</p> <pre><code> A 0 B 1 C 2 D </code></pre> <p>How to make this with column name = <code>N</code>:</p> <pre><code> N 0 A 1 B 2 C 3 D </code></pre> <p>this not working in my case:</p> <pre><c...
<p>Try this:</p> <pre><code>df.T.reset_index().set_axis(['N']).T.reset_index(drop=True) </code></pre> <p>Output:</p> <pre><code> N 0 A 1 B 2 C 3 D </code></pre> <p>It is a lot easier to move a dataframe index into the columns of a dataframe than to move the column header of a dataframe into a row of a dataframe.<...
How to add new column's name in dataframe saving previous one (python)?
python|pandas|dataframe
0
69
2
72,789,710
72,789,710
2
true
2022-06-28T15:50:43.300Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add new column's name in dataframe saving previous one (python)?<p>have this with column name = <code>A</code>:</p> <pre><code> A 0 B 1 C 2 D </c...
72,840,051
How to upload a custom data model in firestore flutter<p>I am using firestore for some task and i have a custom model of product and i want to push that data in that specific model in firestore but didn't get any success</p>
<p>Convert your model into map and upload the map instead. You will not be able to upload custom objects to Firestore. You can convert your model into map using something like this, where <strong>foo</strong> and <strong>bar</strong> are fields of your custom object:</p> <pre><code>Map&lt;String, dynamic&gt; getMap() {...
How to upload a custom data model in firestore flutter
flutter|dart|google-cloud-firestore|mode
0
69
1
72,840,099
72,840,099
2
true
2022-07-02T14:56:30.537Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to upload a custom data model in firestore flutter<p>I am using firestore for some task and i have a custom model of product and i want to push that data...
72,894,417
Group by a variable in dataframe R<p>I have a dataframe like below,</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Date</th> <th>cat</th> <th>cam</th> <th>reg</th> <th>per</th> </tr> </thead> <tbody> <tr> <td>22-01-05</td> <td>A</td> <td>60</td> <td>120</td> <td>50</td> </tr> <tr> <td>22-0...
<p>I am not sure why your expected <code>per</code> values are like that, but maybe you want the following:</p> <pre class="lang-r prettyprint-override"><code>df &lt;- data.frame(Date = c(&quot;22-01-05&quot;, &quot;22-01-05&quot;, &quot;22-01-08&quot;, &quot;22-01-08&quot;), cat = c(&quot;A&quot;, &qu...
Group by a variable in dataframe R
r
-2
69
3
72,894,655
72,894,655
2
true
2022-07-07T08:14:15.853Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Group by a variable in dataframe R<p>I have a dataframe like below,</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Date</th> <t...
72,818,353
How to compare with the previous line after reassignment<p>Compare each row of column A with the previous row If greater than, reassign to the value of the previous row If less than, the value is unchanged Now the problem is that each time the comparison is made with the original value What I want is, to compare with t...
<p>Are you trying to do <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.cummin.html#pandas-dataframe-cummin" rel="nofollow noreferrer"><code>cummin</code></a>?</p> <pre><code>df['compare_min'] = df['A'].cummin() </code></pre> <p>Output:</p> <pre><code> A compare compare_min 0 5 5.0 ...
How to compare with the previous line after reassignment
python|pandas|numpy
0
69
1
72,818,662
72,818,662
2
true
2022-06-30T15:25:23.187Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to compare with the previous line after reassignment<p>Compare each row of column A with the previous row If greater than, reassign to the value of the p...
72,771,724
how to add a record in a sub-level transaction using procedure in genexus without Business Componet<p>I'm just learning more about genexus and wanted to know if there was a way to do this.</p> <p>As the title says, i just want to know how to add a sublevel Transaccion without using Business component, I have readed the...
<p>Suppose you hold the Person Id in <code>&amp;PersonId</code>, then you would issue:</p> <pre><code>new PersonId = &amp;PersonId CityId = ... CityName = ... when duplicate // This is optional ... // do something if there already exists a tuple PersonId/CityId with those values endnew </code></pre> <p>In th...
how to add a record in a sub-level transaction using procedure in genexus without Business Componet
genexus
0
69
2
72,772,330
72,772,330
3
true
2022-06-27T11:59:57.097Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to add a record in a sub-level transaction using procedure in genexus without Business Componet<p>I'm just learning more about genexus and wanted to know...
72,848,816
Does compound assignment of two unsigned integers of the same type always operate as if using that type's modular arithmetic?<p>Here is a conjecture:</p> <p>For expression <code>a op b</code> where <code>a</code> and <code>b</code> are of the same unsigned integral type <code>U</code>, and <code>op</code> is one of the...
<p>Counter example:</p> <p><code>int</code> has width <code>31</code> plus one bit for sign, <code>unsigned short</code> has width <code>16</code>. With <code>a</code> and <code>b</code> of type <code>unsigned short</code>, after integral promotions, the operation is performed in <code>int</code>.</p> <p>If <code>a</co...
Does compound assignment of two unsigned integers of the same type always operate as if using that type's modular arithmetic?
c++|unsigned-integer|modular-arithmetic
0
69
1
72,849,041
72,849,041
3
true
2022-07-03T18:04:07.723Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Does compound assignment of two unsigned integers of the same type always operate as if using that type's modular arithmetic?<p>Here is a conjecture:</p> <p>...
72,914,347
How to convert a text string 20200821144500 into date and time format in r?<p>I have a date/time column saved like this 20200821144500. How do I convert it to date and time format? I tried as.POSIXct('20200821144500',format=&quot;%Y-%m-%d %H:%M:%S&quot;) which returned NA. Am I using the wrong format or is there anothe...
<p>The main feature here is to tell which is first year month or day etc.. in the string. and to use HMS , because:</p> <ul> <li>hms, hm and ms usage is defunct, please use HMS, HM or MS instead. Deprecated in version '1.5.6'.</li> </ul> <pre><code>library(lubridate) string &lt;- &quot;20200821144500&quot; parse_date...
How to convert a text string 20200821144500 into date and time format in r?
r|datetime
3
69
3
72,914,419
72,914,419
3
true
2022-07-08T16:26:25.070Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert a text string 20200821144500 into date and time format in r?<p>I have a date/time column saved like this 20200821144500. How do I convert it t...
72,920,894
Reference to a vector element become invalid after n iterations<p>Program stop occur in this line</p> <pre><code>guess = secret; </code></pre> <p>From that, I guess that reference is broken, because if I change reference to simple value</p> <pre><code>const string secret = word_list[idx_word]; </code></pre> <p>the prog...
<p>word_list[0]; - this is a non-const operation in a QVector (see <a href="https://doc.qt.io/qt-5/qvector.html#operator-5b-5d" rel="nofollow noreferrer">documentation</a>, there is even a note about the possible detach) and since the reference count of your word_list is two due to the copy to possible_answers some lin...
Reference to a vector element become invalid after n iterations
c++|qt
1
69
1
72,921,342
72,921,342
3
true
2022-07-09T11:13:38.350Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reference to a vector element become invalid after n iterations<p>Program stop occur in this line</p> <pre><code>guess = secret; </code></pre> <p>From that, ...
72,922,685
How do I pull specific fields from this XML file using R or Python?<p>I am attempting to convert <a href="https://reports.adviserinfo.sec.gov/reports/CompilationReports/IA_INDVL_Feed_07_09_2022.xml.zip" rel="nofollow noreferrer">this XML file</a> from this <a href="https://adviserinfo.sec.gov/compilation" rel="nofollow...
<p>If you are using R, it is straightforward to get these fields using the xml2 or rvest packages. For example, using the first xml file in the linked zip folder:</p> <pre class="lang-r prettyprint-override"><code>library(rvest) entries &lt;- read_html(path_to_xml) %&gt;% html_nodes(xpath = &quot;//info&quot;) res...
How do I pull specific fields from this XML file using R or Python?
python|r|xml
0
69
2
72,923,240
72,923,240
3
true
2022-07-09T15:36:27.147Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I pull specific fields from this XML file using R or Python?<p>I am attempting to convert <a href="https://reports.adviserinfo.sec.gov/reports/Compila...
72,929,682
Filter data using JSON query in Ansible to extract data from an ansible_fact<p>I have created this playbook to extract all mount points starting with any element in the variable <code>whitelist</code> matching the <code>type= ext2, ext3, ext4</code>.</p> <p>The problem is that I can get all <code>mount_points</code> bu...
<p>You don't really need a json query here IMO. An easy way is to filter the list with <code>match</code> and construct a regex containing all possible prefixes:</p> <pre class="lang-yaml prettyprint-override"><code>- name: show my filtered mountpoints: vars: start_regex: &quot;{{ whitelist | map('regex_escape') ...
Filter data using JSON query in Ansible to extract data from an ansible_fact
linux|ansible|jinja2
2
69
2
72,930,338
72,930,338
3
true
2022-07-10T15:31:16.810Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Filter data using JSON query in Ansible to extract data from an ansible_fact<p>I have created this playbook to extract all mount points starting with any ele...
72,785,061
Is it problematic to repeat the same import in multiple modules?<p>I am writing modules right now and several of these import <code>numpy</code>. For example, the simplest kind of module just creates a namespace:</p> <pre><code>import numpy as np pi=np.pi </code></pre> <p>Here, I have to <code>import numpy</code> – but...
<p>Python has separate concepts of <em>importing</em> and <em>loading</em> a module:</p> <ul> <li><em>loading</em> actually creates an in-memory representation of the module. This may run arbitrary code, create arbitrary objects, and produces a <code>module</code> object.</li> <li><em>importing</em> only <em>binds</em>...
Is it problematic to repeat the same import in multiple modules?
python|python-import
1
69
2
72,785,562
72,785,562
3
true
2022-06-28T10:45:30.340Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it problematic to repeat the same import in multiple modules?<p>I am writing modules right now and several of these import <code>numpy</code>. For example...
72,990,131
Why does an empty String returns false when comparing to boolean in ruby?<p>It might be a dumb question, but can someone please explain this:</p> <pre class="lang-rb prettyprint-override"><code>if &quot;&quot; true else false end =&gt; true (OK) </code></pre> <pre class="lang-rb prettyprint-override"><code>!!(&quot...
<p>The basic concept of this question is a deep misunderstanding of Ruby operators. Here's the short of it - there's no such thing as operators in Ruby! All this <code>!</code>, <code>=</code>, <code>==</code> and <code>===</code> that you throw around - these are not operators.</p> <p>So what's going on?</p> <p>Ruby i...
Why does an empty String returns false when comparing to boolean in ruby?
ruby
-1
69
3
72,990,412
72,990,412
3
true
2022-07-15T06:59:07.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does an empty String returns false when comparing to boolean in ruby?<p>It might be a dumb question, but can someone please explain this:</p> <pre class=...
72,943,155
Change 3 rows which have the smallest value among all values in R<p>I have a data that looks like this</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th style="text-align: center;">x</th> <th style="text-align: center;">y</th> </tr> </thead> <tbody> <tr> <td style="text-align: center;">3</td>...
<p>You could do this as a one-liner in base R. Use <code>rank</code> to get the order each entry takes, find which rank is below 4, then use <code>ifelse</code> to select 't' or 'f' based on this.</p> <pre class="lang-r prettyprint-override"><code>within(df, y &lt;- ifelse(rank(x) &lt; 4, &quot;t&quot;, &quot;f&quot;))...
Change 3 rows which have the smallest value among all values in R
r|database|variables|var
-1
69
3
72,943,307
72,943,307
3
true
2022-07-11T18:36:20.187Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change 3 rows which have the smallest value among all values in R<p>I have a data that looks like this</p> <div class="s-table-container"> <table class="s-ta...
72,878,029
More efficient way of pandas dataframe manipulation: filtering and melting<p>I have a dataset that I need to parse and manipulate from long to wide. Each row represents a single person and there are multiple columns representing instances of a measure (uk-biobank formatted):</p> <pre><code>import pandas as pd # initial...
<p>Given:</p> <pre><code> id 3-0.0 3-1.0 3-2.0 4-0.0 4-1.0 4-2.0 0 1 20 10 5 10 5 20 1 2 21 11 6 11 6 21 2 3 19 29 7 29 7 19 3 4 18 12 8 12 8 18 </code></pre> <p>Doing:</p> <pre><code>unique_people = df.fi...
More efficient way of pandas dataframe manipulation: filtering and melting
python|pandas|dataframe|data-manipulation
3
69
4
72,878,202
72,878,202
3
true
2022-07-06T04:39:40.477Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: More efficient way of pandas dataframe manipulation: filtering and melting<p>I have a dataset that I need to parse and manipulate from long to wide. Each row...
72,873,159
Calculating CRC16 on Vec<u8><p>I'm sending and receiving raw binary data via the serial port, so I have a predefined message stored in a <code>u8</code> vector. I need to calculate the 16bit CRC and append that onto the end before sending it, however I keep running into issues with casting and integer overflows. This i...
<p>I didn't look at the details, just made it compile.</p> <p>First, <code>Vec</code> is not needed, any slice is suitable (even if it comes from a <code>Vec</code>).</p> <p><code>byte</code> is a reference to a <code>u8</code> in this slice, thus <code>*byte</code> is a copy of this <code>u8</code> (since <code>u8</co...
Calculating CRC16 on Vec<u8>
rust|crc|crc16
1
69
1
72,873,762
72,873,762
3
true
2022-07-05T17:05:31.320Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calculating CRC16 on Vec<u8><p>I'm sending and receiving raw binary data via the serial port, so I have a predefined message stored in a <code>u8</code> vect...
72,915,428
How to keep decimal accuracy when dividing with floating points<p>I am working on a project, and I need to divide a very large 64 bit <code>long</code> value. I absolutely do not care about the whole number result, and only care about the decimal value. The problem is that when dividing a large <code>long</code> with a...
<p>If your language provides an exact <code>fmod</code> implementation you can do something like this:</p> <pre><code>double rem = fmod(long_value, double_value); return rem / double_value; </code></pre> <p>If <code>long_value</code> does not convert exactly to a <code>double</code> value, you could split it into two h...
How to keep decimal accuracy when dividing with floating points
math|floating-point|division
2
69
3
72,916,199
72,916,199
3
true
2022-07-08T18:13:32.197Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to keep decimal accuracy when dividing with floating points<p>I am working on a project, and I need to divide a very large 64 bit <code>long</code> value...
73,002,132
rowSums() to count number of both non-missing and unique values<p>Let's say I have this dataframe</p> <pre><code>&gt; df mr_daterd mr_daterd_fu1 mr_daterd_fu2 1 2018-03-05 2018-03-05 &lt;NA&gt; 2 2019-05-04 &lt;NA&gt; 2020-03-05 3 2020-01-03 2020-06-06 2021-04-02 </code></pre> <p>Each r...
<p><code>dplyr</code> solution using <code>n_distinct</code> and <code>c_across</code>.</p> <pre><code>df %&gt;% rowwise %&gt;% mutate(n_mri = n_distinct( c_across(contains('mr_daterd')), na.rm=TRUE)) %&gt;% ungroup() # A tibble: 3 × 4 # Rowwise: mr_daterd mr_daterd_fu1 mr_daterd_fu2 n_mri &lt;...
rowSums() to count number of both non-missing and unique values
r|dataframe|dplyr|rowsum
1
69
4
73,002,223
73,002,223
3
true
2022-07-16T06:48:59.147Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: rowSums() to count number of both non-missing and unique values<p>Let's say I have this dataframe</p> <pre><code>&gt; df mr_daterd mr_daterd_fu1 mr_daterd...
72,807,283
constexpr_assert on embedded (--fno-exceptions)<p>Is it possible to implement a thing such as <code>&quot;constexpr assert&quot;</code> on bare metal? I would normally use a <code>throw</code> statement as it is mentioned <a href="https://stackoverflow.com/questions/8626055/c11-static-assert-within-constexpr-function">...
<p>Since you know you're being constant evaluated, all you need to trigger a failure is to do something that's not valid to do during constant evaluation.</p> <p>The easiest of these is to invoke a non-<code>constexpr</code> function:</p> <pre class="lang-cpp prettyprint-override"><code>void on_error(char const* msg) {...
constexpr_assert on embedded (--fno-exceptions)
c++|c++20|constexpr
0
69
1
72,807,412
72,807,412
4
true
2022-06-29T20:11:10.993Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: constexpr_assert on embedded (--fno-exceptions)<p>Is it possible to implement a thing such as <code>&quot;constexpr assert&quot;</code> on bare metal? I woul...
72,862,883
Why is the return value of args.length 6 when I provide 3 command line arguments for my program<p>When I provide my Java Command line arguments with this : <code>Calculate 3 * 3</code> and when I print <code>args.length</code> before making my operations, it returns 6 in the case of a multiplication.</p> <p>Here is a s...
<p>The <code>*</code> has a special meaning (all files in the current directory) to the command interpreter that starts <code>java</code>. This happens for all programs. Quote the <code>*</code>.</p> <pre><code>java Calculate 3 &quot;*&quot; 3 </code></pre> <p>My advice would be to handle standard input (not arguments)...
Why is the return value of args.length 6 when I provide 3 command line arguments for my program
java|arguments|command-line-arguments
1
69
1
72,862,893
72,862,893
4
true
2022-07-05T00:03:17.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is the return value of args.length 6 when I provide 3 command line arguments for my program<p>When I provide my Java Command line arguments with this : <...
72,881,340
C pointer to incomplete struct type and later struct type completion VS. pointer to undeclared type T_t and later type T_t declaration<p>The following is a legal fragment in C:</p> <pre><code>/* Example 1. */ struct B *p; /* p: pointer to incomplete struct type B */ /* This declaration completes the struct type B. */...
<p>Because of the <code>struct</code> keyword, it is known what kind of entity <code>struct B</code> refers to, even before <code>struct B</code> is declared. It is a type --- a <code>struct</code> type, to be more precise. It is an incomplete type, because the declaration of <code>struct B</code> has not been seen yet...
C pointer to incomplete struct type and later struct type completion VS. pointer to undeclared type T_t and later type T_t declaration
c|pointers|struct|language-lawyer|incomplete-type
2
69
2
72,881,636
72,881,636
4
true
2022-07-06T09:49:21.827Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C pointer to incomplete struct type and later struct type completion VS. pointer to undeclared type T_t and later type T_t declaration<p>The following is a l...
72,818,141
How to elegantly filter a java stream repeatedly until a single result is found?<p>I have the following function which attempts to progressively narrow down an input collection until a single element is found, i.e. filtering is supposed to stop when a single item has been found as applying additional filters may result...
<p>You can put all the conditions into a <code>List</code> and loop over it, applying one filter on each iteration until there is only one element left.</p> <pre class="lang-java prettyprint-override"><code>List&lt;Predicate&lt;MyObject&gt;&gt; conditions = List.of(this::firstCondition, this::secondCondition, this::thi...
How to elegantly filter a java stream repeatedly until a single result is found?
java|java-stream
-1
69
2
72,818,296
72,818,296
5
true
2022-06-30T15:08:50.770Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to elegantly filter a java stream repeatedly until a single result is found?<p>I have the following function which attempts to progressively narrow down ...
72,819,606
How to assign multiple variables in parallel in shell<p>ATM my current thoughts are, to do it like this:</p> <pre><code>a_NODE=$(node -v) &amp; a_NPM=v$(npm -v) &amp; a_YARN=v$(yarn -v) &amp; a_CURL=v$(curl --version | head -n 1 | awk '{ print $2 }') &amp; wait echo &quot;Node: $a_NODE&quot; echo &quot;NPM:...
<p>Background commands run in subshells, so the variable assignments aren't in the original shell process.</p> <p>Redirect the outputs to files, and read those files in the main shell.</p> <pre><code>node -v &gt; /tmp/node.$$ &amp; npm -v &gt; /tmp/npm.$$ &amp; yarn -v &gt; /tmp/yarn.$$ &amp; curl --version | head -n 1...
How to assign multiple variables in parallel in shell
bash|shell|parallel-processing|sh
0
69
2
72,819,736
72,819,736
5
true
2022-06-30T17:07:34.590Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to assign multiple variables in parallel in shell<p>ATM my current thoughts are, to do it like this:</p> <pre><code>a_NODE=$(node -v) &amp; a_NPM=v$(npm ...
72,823,056
How to build a barrier by rust asm?<p>In gcc, we can use <code>asm volatile(&quot;&quot;:::&quot;memory&quot;);</code></p> <p>But I can't find a option similar to &quot;memory&quot; in document of rust inline asm.</p> <p>Is there any way to do that?</p>
<p>In Rust, memory clobbering is the default. You should use <code>options(nomem)</code> to opt it out.</p> <p><a href="https://rust.godbolt.org/z/56oKcr6f4" rel="noreferrer">For example</a>:</p> <pre class="lang-rust prettyprint-override"><code>pub unsafe fn no_nomem() { std::arch::asm!(&quot;&quot;); } pub unsaf...
How to build a barrier by rust asm?
rust|inline-assembly|memory-barriers
3
69
1
72,823,143
72,823,143
5
true
2022-06-30T23:39:47.003Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to build a barrier by rust asm?<p>In gcc, we can use <code>asm volatile(&quot;&quot;:::&quot;memory&quot;);</code></p> <p>But I can't find a option simil...
73,005,616
Add padding to JavaFX WebView (not Android)<p>I want to add padding to a <code>WebView</code> in JavaFX, like you can add padding to a label.</p> <p>I have already found <a href="https://stackoverflow.com/questions/9170042/how-to-add-padding-around-a-webview">this</a> stack overflow discussion about <code>WebView</code...
<p>As shown <a href="https://stackoverflow.com/a/37935114/230513">here</a>, you can use the <a href="https://docs.oracle.com/javase/8/javafx/api/javafx/scene/layout/BorderPane.html" rel="noreferrer"><code>BorderPane</code></a> <em>Optional Layout Constraints</em> to add &quot;Margin space around the outside of the chil...
Add padding to JavaFX WebView (not Android)
java|javafx|webview
3
69
2
73,006,265
73,006,265
5
true
2022-07-16T15:50:24.487Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add padding to JavaFX WebView (not Android)<p>I want to add padding to a <code>WebView</code> in JavaFX, like you can add padding to a label.</p> <p>I have a...
73,019,207
A Dockerfile with 2 ENTRYPOINT<p>I am learning about docker, specificially how to write docker file. Recently I came across this one and couldn't understand why there are 2 <strong>ENTRYPOINT</strong> in it.</p> <p>The original file is in this link <a href="https://github.com/CosmWasm/rust-optimizer/blob/main/Dockerfil...
<p>You can keep replacing the entry point down the file, however, that's a multi-stage docker file. so if you build a given stage then you'll get a different entry point.</p> <p>For example:</p> <pre><code>docker build --target rust-optimizer . </code></pre> <p>will build up to and including that stage which when run w...
A Dockerfile with 2 ENTRYPOINT
docker|rust|dockerfile
1
69
1
73,019,437
73,019,437
5
true
2022-07-18T08:14:16.803Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: A Dockerfile with 2 ENTRYPOINT<p>I am learning about docker, specificially how to write docker file. Recently I came across this one and couldn't understand ...
72,954,446
Log4j2 security hotspot issue<p>This is the code for configuring log4j2.xml file. The problem is that sonar is showing security hotspot issue at setConfiguration. How to avoid it?</p> <pre><code>String propFile = &quot;log4j2.xml&quot;; LoggerContext logcontext = (org.apache.logging.log4j.core.LoggerContext) LogManag...
<blockquote> <p>Sonar is showing security hotspot issue.</p> </blockquote> <p>It is not an issue. It is Sonar advising you that you need to <strong>review</strong> that section of code for possible security problems.</p> <p>This is what the <a href="https://docs.sonarqube.org/latest/user-guide/security-hotspots/" rel="...
Log4j2 security hotspot issue
java|sonarqube|log4j2
0
69
2
72,954,666
72,954,666
5
true
2022-07-12T15:01:35.367Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Log4j2 security hotspot issue<p>This is the code for configuring log4j2.xml file. The problem is that sonar is showing security hotspot issue at setConfigura...
72,912,336
Making sense of how Julia copies variables<p>I am trying to make sense of how Julia copies and treats variables. Take a look at the following examples and the following questions:</p> <pre><code>a = 1 b = 1 a === b #why do they share the same address? I defined them independently a = 1 b = a a === b #true, this makes ...
<p>Something that none of the other answer's touch on is that <code>x === y</code> does not mean &quot;Do <code>x</code> and <code>y</code> have the same address in memory?&quot; as your questions suggests. Rather, as the <a href="https://docs.julialang.org/en/v1/base/base/#Core.:===" rel="nofollow noreferrer">document...
Making sense of how Julia copies variables
copy|julia
4
69
3
72,915,569
72,915,569
7
true
2022-07-08T13:43:31.553Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Making sense of how Julia copies variables<p>I am trying to make sense of how Julia copies and treats variables. Take a look at the following examples and th...
72,852,411
Complexity of three for loops<p>I was wondering if time complexity of the following code is O(n^3) or O(n^2)</p> <pre><code>public void firstMethod() { for (int i = 0; i &lt; 6; i++) { for (int j = 0; j &lt; 6; j++) { secondMethod(); } } } public void secondMethod(){ for (int i ...
<p>This is O(1) because the runtime is constant. The bounds of each loop never change, so the method's runtime will never change.</p> <p>Now, had you written the following:</p> <pre><code>public void firstMethod(int n) { for (int i = 0; i &lt; n; i++) { for (int j = 0; j &lt; n; j++) { secondMet...
Complexity of three for loops
java|time-complexity
1
69
2
72,852,446
72,852,446
7
true
2022-07-04T06:14:01.317Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Complexity of three for loops<p>I was wondering if time complexity of the following code is O(n^3) or O(n^2)</p> <pre><code>public void firstMethod() { f...
72,769,404
Expo React Native onPress navigation.openDrawer() not working. thank you in advance for your support<p>I am unable to open the Drawer by pressing the header button, I tried many times but I failed to solve the issue. here below is the issue I am getting- Menu.js:65 Uncaught TypeError: navigation.openDrawer is not a fun...
<p>You can try the following</p> <pre><code>import { DrawerActions } from '@react-navigation/native'; options={{ headerLeft: () =&gt; ( &lt;Button onPress={() =&gt; navigation.dispatch(DrawerActions.openDrawer())} title=&quot;Open Drawer&quot; color=&quot;#00cc00&quot;...
Expo React Native onPress navigation.openDrawer() not working. thank you in advance for your support
reactjs|react-native|expo|navigation-drawer
0
70
2
72,769,919
72,769,919
0
true
2022-06-27T08:55:08.650Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Expo React Native onPress navigation.openDrawer() not working. thank you in advance for your support<p>I am unable to open the Drawer by pressing the header ...
72,771,534
How to stop kubelet service running in an RKE kubernetes worker node<p>I need to simulate Node &quot;NotReady&quot; status for a node and tried to stop kubelet to achieve that. But am getting the below error. Looks like this is not the right command for my k8s environment. I need this to verify the working of taints an...
<p>RKE is a K8s distribution that runs entirely within Docker containers as per <a href="https://rancher.com/docs/rke/latest/en/" rel="nofollow noreferrer">documentation</a>. That means that none of the K8s services are native Linux services. Try <code>docker ps</code>, and you'll find a container named <code>kubelet</...
How to stop kubelet service running in an RKE kubernetes worker node
kubernetes
0
70
2
72,771,809
72,771,809
0
true
2022-06-27T11:44:21.027Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to stop kubelet service running in an RKE kubernetes worker node<p>I need to simulate Node &quot;NotReady&quot; status for a node and tried to stop kubel...
72,773,740
How to highlight specific <li> element?<p>i am trying to learn react at the moment and i can't find a solution for following problem:</p> <p>I am fetching some .json data which look like that:</p> <pre><code>[ { &quot;answerOptions&quot;: [ &quot;Answer A&quot;, &quot;Answer B&quot;, &quot;Answer C&quot;, &quot...
<p>Just loop over the items in the array and map them to styled <code>&lt;li&gt;</code> elements.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="true"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const { useState } = React; c...
How to highlight specific <li> element?
javascript|reactjs|json
-1
70
3
72,774,183
72,774,183
0
true
2022-06-27T14:26:04.770Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to highlight specific <li> element?<p>i am trying to learn react at the moment and i can't find a solution for following problem:</p> <p>I am fetching so...
72,776,893
Mapping fields of List to fields of a single Object<p>Suppose, I have a List of cats like this:</p> <pre><code>[Cat[name=&quot;Minnie&quot;, age=3], Cat[name=&quot;Pixie&quot;, age=1], Cat[name=&quot;Kazy&quot;, age=5]] </code></pre> <p>And an Object Cats with fields:</p> <pre><code>class Cats { int MinnieAge; int Pixi...
<p>If you want to use streams you can start from implementing a collector:</p> <pre class="lang-java prettyprint-override"><code>public class CatsCollector implements Collector&lt;Cat, Cats, Cats&gt; { @Override public Supplier&lt;Cats&gt; supplier() { return () -&gt; new Cats(); } @Override ...
Mapping fields of List to fields of a single Object
java|spring|stream|mapping|mapstruct
-1
70
2
72,777,212
72,777,212
0
true
2022-06-27T18:36:15.623Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mapping fields of List to fields of a single Object<p>Suppose, I have a List of cats like this:</p> <pre><code>[Cat[name=&quot;Minnie&quot;, age=3], Cat[name...
72,777,129
How to access a file while writing a Java external library<p>I am writing a small Java Library (say project A) to be used externally (as a .JAR) in any other project (project B).</p> <p>This is how project A looks like :</p> <pre><code>projectA --src/main/java --packageOne .... --packageTwo --A.java // need...
<p>So with the help of <a href="https://stackoverflow.com/a/72777182/14137326">Hiran's response</a> and digging around (also <a href="https://stackoverflow.com/questions/16953897/how-to-read-a-text-file-inside-a-jar">this</a>) I figured it out.</p> <p>File structure of the library you are writing :</p> <pre><code>proje...
How to access a file while writing a Java external library
java|jar|external
0
70
2
72,783,434
72,783,434
0
true
2022-06-27T18:58:28.457Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to access a file while writing a Java external library<p>I am writing a small Java Library (say project A) to be used externally (as a .JAR) in any other...
72,809,995
Can you upload a custom struct to a Firestore using Swift<p>I am creating an app where I have a custom struct called Piece. This piece has a string name, a string location, and a map/ dict. Is there a way to save this to Firestore?</p> <p>Example code but this is what I will need to upload.</p> <pre><code>struct Piece ...
<p>yes - this is possible. I wrote a long blog post about this: <a href="https://peterfriese.dev/posts/firestore-codable-the-comprehensive-guide/" rel="nofollow noreferrer">Mapping Firestore Data in Swift - The Comprehensive Guide</a>.</p> <p>In your case, here is how you would do this:</p> <p>First, make your struct (...
Can you upload a custom struct to a Firestore using Swift
swift|firebase|google-cloud-firestore
0
70
1
72,811,975
72,811,975
0
true
2022-06-30T03:25:54.960Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can you upload a custom struct to a Firestore using Swift<p>I am creating an app where I have a custom struct called Piece. This piece has a string name, a s...
72,778,445
How to configure ingress controller with multiple paths for the same service?<p>I have a separate ingress-internal (manifests) for the backend and the frontend. My backend service has several endpoints: one with GraphqQL and two Rest. After deploying the project, I find that when I request the Rest endpoint (POST reque...
<p>This the backend ingress that I arrived to work successfullywith:</p> <pre><code>apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: mcs-thirdparty-ingress namespace: namespace spec: ingressClassName: nginx-internal rules: - host: bilels.exemple.com http: paths: - path: / ...
How to configure ingress controller with multiple paths for the same service?
kubernetes-ingress|quarkus|nginx-ingress|ingress-controller
0
70
1
72,817,138
72,817,138
0
true
2022-06-27T21:23:23.903Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to configure ingress controller with multiple paths for the same service?<p>I have a separate ingress-internal (manifests) for the backend and the fronte...
72,816,292
Mistake in validation in Laravel<p>Something is wrong with my validation. Data from the form is created and I can see it when I use the dd() function. But when it comes to creating and sending that data to the database it creates an empty row. My Laravel version is 8.83.17. Here's my route:</p> <pre><code>Route::middle...
<pre><code> protected $fillable = [ 'name_en','body_en','name_ua','body_ua','name_ru',' body_ru','meta_title_en','meta_description_en','meta_keywords_en','meta_title_ua','meta_description_ua','meta_keywords_ua','meta_title_ru','meta_description_ru','meta_keywords_ru','image','price','status' ]; </code></pre>
Mistake in validation in Laravel
php|laravel|laravel-8
1
70
1
72,817,453
72,817,453
0
true
2022-06-30T13:00:45.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mistake in validation in Laravel<p>Something is wrong with my validation. Data from the form is created and I can see it when I use the dd() function. But wh...
72,818,632
Defining linked list structure with struct in c program<p>I created a linked list using a C program. My codes are below.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdbool.h&gt; struct node { int data; int key; struct node *next; }; struct node *c...
<p>The simplest solution is to modify your list managing functions so that they take a <code>struct MyList*</code> parameter, and change all references to <code>head</code> and <code>numberOfElements</code> to <code>list-&gt;head</code> and <code>list-&gt;numberOfElements</code>, then put a <code>struct MyList</code> i...
Defining linked list structure with struct in c program
c|pointers|struct|linked-list
0
70
1
72,818,896
72,818,896
0
true
2022-06-30T15:46:46.737Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Defining linked list structure with struct in c program<p>I created a linked list using a C program. My codes are below.</p> <pre><code>#include &lt;stdio.h&...
72,794,570
error TS2322: Type 'null' is not assignable to type 'Partial<IConfig> | (() => Partial<IConfig>)'<p>Installed and followed <strong>Quickstart</strong> instructions of <a href="https://www.npmjs.com/package/ngx-mask" rel="nofollow noreferrer"><code>ngx-mask</code></a> for app.module.ts:</p> <pre><code>import { NgxMaskMo...
<p>Solution: <code>Partial&lt;IConfig&gt;</code> --&gt; <code>Partial&lt;null|IConfig&gt;</code></p>
error TS2322: Type 'null' is not assignable to type 'Partial<IConfig> | (() => Partial<IConfig>)'
ngx-mask
-1
70
1
72,820,759
72,820,759
0
true
2022-06-29T00:39:51.407Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: error TS2322: Type 'null' is not assignable to type 'Partial<IConfig> | (() => Partial<IConfig>)'<p>Installed and followed <strong>Quickstart</strong> instru...
72,807,101
How to measure TTFB with Puppeteer?<p>Is it possible to calculate the <a href="https://en.wikipedia.org/wiki/Time_to_first_byte" rel="nofollow noreferrer">TTFB</a> with Puppeteer?</p> <p>I couldn't find anything in their docs.</p> <p>I currently have this code:</p> <pre><code>const browser = await puppeteer.launch(laun...
<p>This is how I solved it:</p> <pre class="lang-js prettyprint-override"><code>const browser = await puppeteer.launch(launchOptions); const page = await browser.newPage(); await page.goto(url); const navigationTimingJson = await page.evaluate(() =&gt; JSON.stringify(performance.getEntriesByType(&quot;navigation&quot...
How to measure TTFB with Puppeteer?
puppeteer
1
70
3
72,822,801
72,822,801
0
true
2022-06-29T19:52:21.647Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to measure TTFB with Puppeteer?<p>Is it possible to calculate the <a href="https://en.wikipedia.org/wiki/Time_to_first_byte" rel="nofollow noreferrer">TT...
72,835,377
SQL Oracle how to extract xml tag content in a blob column<p>There is an xml that is in a column of type BLOB (in oracle) and I need to access a certain tag from that xml. Until then I can retrieve the column this way:</p> <pre><code>SELECT TRIM(UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(my_column_blob, 1024))) as tag_na...
<p>Use <code>XMLTYPE</code> and <code>XMLTABLE</code>:</p> <pre class="lang-sql prettyprint-override"><code>SELECT x.c FROM table_name t CROSS JOIN XMLTABLE( '/a/b/c' PASSING XMLTYPE(t.value, 1) COLUMNS c VARCHAR2(200) PATH './text()' ) x; </code></pre> <p>Or <code>...
SQL Oracle how to extract xml tag content in a blob column
sql|xml|oracle|oracle11g
0
70
2
72,841,668
72,841,668
0
true
2022-07-01T23:18:13.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL Oracle how to extract xml tag content in a blob column<p>There is an xml that is in a column of type BLOB (in oracle) and I need to access a certain tag ...
72,807,423
How can I automate after the I entred my credentials in the login page after it redirected me to a different URL?<p>So I wanted to create a simple program that when executed, opens a chrome website, goes to my router's settings page, and modify the speed of the internet as I request from the program. This is my code in...
<p>The page you are trying to automate contains frames. Selenium is not capable to easily traverse through the frames as each frame is the full-fledged HTML document. But Selenium has tools to <a href="https://www.selenium.dev/documentation/webdriver/browser/frames/" rel="nofollow noreferrer">switch to current frame an...
How can I automate after the I entred my credentials in the login page after it redirected me to a different URL?
python-3.x|selenium|css-selectors|selenium-chromedriver
0
70
1
72,848,433
72,848,433
0
true
2022-06-29T20:24:50.830Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I automate after the I entred my credentials in the login page after it redirected me to a different URL?<p>So I wanted to create a simple program th...