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,154,407 | How to check month number?<p>I have a current month number in format: <code>dd</code> as <code>01, 02...12</code>.</p>
<p>And incoming month as <code>01</code> or <code>1</code>.</p>
<p>How to check if imcoming month is less then current month?</p> | <p>Cast your month to int first.</p>
<pre><code>dd = "01"
if int(dd) < month:
pass
</code></pre> | How to check month number? | python | -4 | 44 | 1 | 72,154,430 | 72,154,430 | 0 | true | 2022-05-07T16:23:52.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check month number?<p>I have a current month number in format: <code>dd</code> as <code>01, 02...12</code>.</p>
<p>And incoming month as <code>01</cod... |
72,183,188 | compare 2 arrays and get key of one with value of the other one in React<p>So in React, I have 2 arrays:</p>
<pre><code>const arr1 = [
{id: 1, name: 'Hello'}
{id: 2, name: 'Dear'}
{id: 3, name: 'World'}
]
const arr2 = ['Hello', 'Dear']
</code></pre>
<p>I would like the arr2 values to be the id of the arr1 and end up w... | <p>Loop through <code>arr2</code> and find the item with the same name in <code>arr1</code>. Then take the id of that item.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>cons... | compare 2 arrays and get key of one with value of the other one in React | javascript|reactjs | -4 | 34 | 1 | 72,183,271 | 72,183,271 | 0 | true | 2022-05-10T08:42:48.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
compare 2 arrays and get key of one with value of the other one in React<p>So in React, I have 2 arrays:</p>
<pre><code>const arr1 = [
{id: 1, name: 'Hello'}... |
72,208,155 | Python why this if statement returns True?<p>I am wondering why it returns True:</p>
<pre><code>if False or True and True == True and (False == True or False == (not True)) or False and False and True:
pass
</code></pre>
<p>doesn't it accept "and False" part in the end as False?
doesn't all statements wit... | <p>Starting with:</p>
<pre><code>False or True and True == True and (False == True or False == (not True)) or False and False and True
</code></pre>
<p>Solve parentheses first:</p>
<pre><code>(False == True or False == (not True))
</code></pre>
<p>Solve parentheses first - <code>not True</code> is <code>False</code>:</... | Python why this if statement returns True? | python|python-3.x|if-statement|boolean|boolean-logic | -3 | 51 | 1 | 72,208,355 | 72,208,355 | 0 | true | 2022-05-11T22:15:29.573Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python why this if statement returns True?<p>I am wondering why it returns True:</p>
<pre><code>if False or True and True == True and (False == True or False... |
72,173,012 | How to toggle between two images on click without using JavaScript<p>In a HTML document, I have <code><img src="cat-thumbnail.jpg"></code>. When the user clicks on the image, I want to display another image instead: <code><img src="cat-full.jpg"></code>. The user should be able to toggle... | <p>I have found a solution that works without JavaScript:</p>
<p>HTML:</p>
<pre class="lang-html prettyprint-override"><code><label>
<input class="image-toggler" type="checkbox">
<img class="thumbnail" src="cat-thumbnail.jpg">
<img class="full"... | How to toggle between two images on click without using JavaScript | html|css|css-selectors | -3 | 104 | 1 | 72,173,073 | 72,173,073 | 0 | true | 2022-05-09T13:45:27.997Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to toggle between two images on click without using JavaScript<p>In a HTML document, I have <code><img src="cat-thumbnail.jpg"></code>. W... |
72,081,603 | can i install kubernetes on amazon linux 2<p>I'm having trouble Installing kubeadm on my amazon linux 2 instance specifically when i try to create a cluster,
when i try Installing runtime i get to chose which one to use :
containerd
CRI-O
Docker Engine
Mirantis Container Runtime
first of all i'm wondering which one i s... | <p>hi, hope you are enjoying your kubernetes Journey !</p>
<p>First off, you I wanna tell you that you can use whichever you want between the container runtime you want to install.</p>
<p>You can use docker if you are not familiar with the others but containerd is in my opinion the best lightweight alternative ( contai... | can i install kubernetes on amazon linux 2 | kubernetes|amazon-ec2|centos7|kubectl|cri-o | -3 | 772 | 1 | 72,081,995 | 72,081,995 | 1 | true | 2022-05-02T01:35:17.607Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
can i install kubernetes on amazon linux 2<p>I'm having trouble Installing kubeadm on my amazon linux 2 instance specifically when i try to create a cluster,... |
72,139,021 | PHP header() redirect is working when I serve the page from VS code, but not when I fire the script from a cron job or a Cli<p>I have a simple PHP script that queries MySQL DB and deletes(unlinks) file(s) from an uploads folder when a condition (expiry timestamp) is met. Then it redirects to another PHP script. I have ... | <p>The <code>header</code> function just issues a HTTP response header to be sent back to a client when the script ends. Clearly, that only makes sense in the context of a HTTP request.</p>
<p>And again hopefully it's self-evident that running the script via CLI or cron is not a HTTP context. Therefore, issuing any kin... | PHP header() redirect is working when I serve the page from VS code, but not when I fire the script from a cron job or a Cli | php|mysql|cron | -3 | 43 | 1 | 72,139,251 | 72,139,251 | 1 | true | 2022-05-06T09:14:53.473Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PHP header() redirect is working when I serve the page from VS code, but not when I fire the script from a cron job or a Cli<p>I have a simple PHP script tha... |
72,140,647 | Button not showing when using JS to dynamically add to page<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function addElements(mailbox) {
if (mailbox != 'sent') {
let action... | <p>Your <code>querySelector</code> for <code>actionDivArchiveBtn</code> is incorrect. Because you search by <code>id</code> but in layout it is <code>class</code> so I changed in layout <code>class</code> to <code>id</code> and now it works. But may be you need <code>class</code> in layout then change <code>#</code> to... | Button not showing when using JS to dynamically add to page | javascript|fetch-api | -3 | 43 | 1 | 72,141,130 | 72,141,130 | 1 | true | 2022-05-06T11:19:53.200Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Button not showing when using JS to dynamically add to page<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<... |
72,145,374 | Converting the values of the dictionary in to a file in Python<p>I have a dictionary say : <code>my_map_dict</code> which looks something like below:</p>
<pre><code>{2: [['1', '2', '4', '4', '0', '2', '0', '0.67'], ['5', '6', '3', '8', '0', '2', '1', '0.67'], ['6', '9', '4', '9', '0', '2', '2', '0.67'], ['4', '3', '6',... | <p>Flatten the values of your dictionary to a single <code>list</code> of lists, and use the <code>csv</code> module to write to file:</p>
<pre><code>import csv
with open("output.csv","w",newline="") as f:
writer = csv.writer(f)
writer.writerows([item for sublist in d.values() for... | Converting the values of the dictionary in to a file in Python | python | -3 | 34 | 1 | 72,145,420 | 72,145,420 | 1 | true | 2022-05-06T17:30:05.943Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting the values of the dictionary in to a file in Python<p>I have a dictionary say : <code>my_map_dict</code> which looks something like below:</p>
<pr... |
72,150,285 | Can anybody explain the time complexity of this code?<p><a href="https://i.stack.imgur.com/DbDV9.jpg" rel="nofollow noreferrer">Explain time complexity of the code given in the picture</a></p> | <p>So basically you have two loops, the top one is quite simple, but the second one is a tad bit more tricky.</p>
<pre><code>for (i = n/2; i < n; i) // ~n/2 so O(n)
for(j = 0; j < n; j = 2 * j) // How many times does this run for n
</code></pre>
<p>So <code>j</code> doubles after every iteration until we reac... | Can anybody explain the time complexity of this code? | time-complexity | -5 | 34 | 1 | 72,150,453 | 72,150,453 | 1 | true | 2022-05-07T07:11:43.723Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can anybody explain the time complexity of this code?<p><a href="https://i.stack.imgur.com/DbDV9.jpg" rel="nofollow noreferrer">Explain time complexity of th... |
72,152,985 | Which Solution is better in leetCode in terms of Runtime and Memory Usage?<p>I know it might be a stupid question but how do i know which solution is better in leetCode</p>
<p><a href="https://i.stack.imgur.com/BGm5H.png" rel="nofollow noreferrer">view image</a></p> | <p>"Which is better" is always a matter of opinion. In your particular application, is execution time or memory use more of a problem? Then optimize for that aspect.</p>
<p>In terms of leetcode, I understand it's a sort of quiz, but for numbers that small, my response is "who cares?". I don't car... | Which Solution is better in leetCode in terms of Runtime and Memory Usage? | java|memory|runtime | -5 | 87 | 1 | 72,153,614 | 72,153,614 | 1 | true | 2022-05-07T13:28:10.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Which Solution is better in leetCode in terms of Runtime and Memory Usage?<p>I know it might be a stupid question but how do i know which solution is better ... |
72,154,743 | How can I set formatting for just a time duration in a Google Sheet using Google Apps Script?<p>In another program, I calculate the duration of an event. The result is in seconds. In the outside program (using LuaScript), I convert this seconds result into a string as "hh:mm:ss.SSS" format. I then POST this t... | <p>If the original value is in seconds as in <code>5.323</code> for five seconds and 323 milliseconds, you can convert it to a dateserial value by dividing it like this:</p>
<p><code>dataserial = seconds / 24 / 60 / 60</code></p>
<p>Append the resulting value to the spreadsheet and format the cell or the whole column a... | How can I set formatting for just a time duration in a Google Sheet using Google Apps Script? | datetime|google-apps-script|google-sheets | -5 | 255 | 1 | 72,155,533 | 72,155,533 | 1 | true | 2022-05-07T17:09:29.913Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I set formatting for just a time duration in a Google Sheet using Google Apps Script?<p>In another program, I calculate the duration of an event. The... |
72,165,055 | New potential vulnerability in Laravel logout<p>there is a strange problem which might be a not discovered issue in Laravel security, it goes like this: while I submit an ajax form to update or insert to the database (a lot of data that takes too much time) and I logout from another tab in the middle of it, the request... | <p>For most people this is not a security vulnerability.</p>
<p>This happens because Laravel checks authentication at middlewares, that runs BEFORE calling the controller method. So at the time your request starts, you're still authenticated.</p> | New potential vulnerability in Laravel logout | laravel | -4 | 60 | 1 | 72,165,092 | 72,165,092 | 1 | true | 2022-05-08T20:59:00.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
New potential vulnerability in Laravel logout<p>there is a strange problem which might be a not discovered issue in Laravel security, it goes like this: whil... |
72,143,685 | Why isn't an IEC 60559 conformant implementation required to define __STDC_IEC_559__ (to 1)?<p>The C (C99+) standard requires (though implicitly) a conforming implementation to define <code>__STDC__</code> to 1.</p>
<p>However, the C standard does not require an IEC 60559 conformant implementation to define <code>__STD... | <p>It's in the implementation's own best interest to define it. C17 6.10.8.3:</p>
<blockquote>
<p><code>__STDC_IEC_559__</code> The integer constant <code>1</code>, intended to indicate conformance to the
specifications in annex F (IEC 60559 floating-point arithmetic).</p>
</blockquote>
<p>While it technically would be... | Why isn't an IEC 60559 conformant implementation required to define __STDC_IEC_559__ (to 1)? | c|language-lawyer|c11|standards-compliance | -4 | 68 | 1 | 72,170,808 | 72,170,808 | 1 | true | 2022-05-06T15:08:05.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why isn't an IEC 60559 conformant implementation required to define __STDC_IEC_559__ (to 1)?<p>The C (C99+) standard requires (though implicitly) a conformin... |
72,175,338 | Why are we using currsum[n+1] and then on line no. 23 currsum[i] = currsum[i-1] + arr[i-1];?<ol>
<li>Why is she using [n+1] instead of N directly and then that line no. 23 what is that equality?</li>
<li>Why do we use INT_MIN for Maximum numbers or arrays, and `INT_MAX for minimum things?</li>
</ol>
<pre><code>#include... | <ol>
<li>Have you heard of <a href="https://stackoverflow.com/questions/72133195/need-help-to-understand-logic-in-the-code/72133457#72133457">prefix sums</a>? (aka running totals, cumulative sums, scans). <code>N+1</code> is used because prefix sums also needs to include an empty subarray.</li>
<li>You use <code>INT_MI... | Why are we using currsum[n+1] and then on line no. 23 currsum[i] = currsum[i-1] + arr[i-1];? | c++|arrays|sum|cumulative-sum | -4 | 46 | 1 | 72,175,608 | 72,175,608 | 1 | true | 2022-05-09T16:32:00.857Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why are we using currsum[n+1] and then on line no. 23 currsum[i] = currsum[i-1] + arr[i-1];?<ol>
<li>Why is she using [n+1] instead of N directly and then th... |
72,174,291 | Labeling horizontal bar using matplotlib bar_label<p>I'd like to display the value of the bar on each bar with <code>pyplot.barh()</code> and <code>ax.bar_label</code>.</p>
<p>I've read the document <a href="https://matplotlib.org/stable/gallery/lines_bars_and_markers/bar_label_demo.html" rel="nofollow noreferrer">http... | <p>the issue is that the <code>bar_label</code> is a new feature and available in matplotlib version 3.4 or later - ref this <a href="https://discourse.matplotlib.org/t/axessubplot-object-has-no-attribute-bar-label/21985/2" rel="nofollow noreferrer">link</a>. Check the version of matplotlib using</p>
<pre><code>import ... | Labeling horizontal bar using matplotlib bar_label | python|matplotlib|bar-chart | -3 | 1,476 | 1 | 72,175,620 | 72,175,620 | 1 | true | 2022-05-09T15:12:57.640Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Labeling horizontal bar using matplotlib bar_label<p>I'd like to display the value of the bar on each bar with <code>pyplot.barh()</code> and <code>ax.bar_la... |
72,176,655 | How do I replace elements in two-dimensional array in python?<p>My task is to replace all the elements whose both indexes are odd with 1, and all the elements whose both indexes are even with -1.</p> | <p>You can replace elements by using a double index like: <code>array[y][x]</code> if <code>array</code> is list of lists.</p>
<p>This is a example:</p>
<pre class="lang-py prettyprint-override"><code>array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
length = len(array)
for y in range(length):
for x in range(length):
... | How do I replace elements in two-dimensional array in python? | python|arrays|data-science | -3 | 312 | 3 | 72,176,761 | 72,176,761 | 1 | true | 2022-05-09T18:27:28.127Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I replace elements in two-dimensional array in python?<p>My task is to replace all the elements whose both indexes are odd with 1, and all the elemen... |
72,178,169 | How do I reduce list of dictionaries<p>I have a list of dictionaries in python. For example</p>
<pre><code>mylist = [
{'a': 'x', 'b':'y', 'c':'z'},
{'a':'e','b':'f','c':'g'},
{'a':'h','b':'i','c':'j'}
]
</code></pre>
<p>how can i map this into</p>
<pre><code>mynewlist = [
{'a':'x'},
{'a','e'},
{... | <p>You can use list comprehension to do this:</p>
<pre><code>mynewlist = [{'a': item['a']} for item in mylist]
</code></pre>
<p>Loop over the list and just grab the <code>a</code> value from the dict. For <code>mynewlist2</code>, just do the same thing, but with 2 values:</p>
<pre><code>mynewlist2 = [{'a': item['a'], ... | How do I reduce list of dictionaries | python|dictionary|map-function | -3 | 56 | 2 | 72,178,234 | 72,178,234 | 1 | true | 2022-05-09T20:58:45.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I reduce list of dictionaries<p>I have a list of dictionaries in python. For example</p>
<pre><code>mylist = [
{'a': 'x', 'b':'y', 'c':'z'},
{... |
72,180,441 | JSONDecodeError when trying to write to JSON file<p>I have a json file where each entry has a corresponding list. This is what it looks like:</p>
<pre><code>{
"/home/onur/PycharmProjects/file-tagging/data/world_building_budget.txt": [],
"/home/onur/PycharmProjects/file-tagging/data/data3/world_el... | <p>Read, manipulate, write:</p>
<pre><code>with open('content-log.json', 'r') as f:
json_data = json.load(f)
for key in json_data:
if filter in key:
json_data[key].append(tag)
with open('content-log.json', 'w') as f:
json.dump(json_data, f)
</code></pre> | JSONDecodeError when trying to write to JSON file | python|json|jsondecodeerror | -3 | 33 | 1 | 72,180,512 | 72,180,512 | 1 | true | 2022-05-10T03:33:39.640Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JSONDecodeError when trying to write to JSON file<p>I have a json file where each entry has a corresponding list. This is what it looks like:</p>
<pre><code>... |
72,181,967 | how to convert whole array to string in javascript<p>I got a question in the interview that he asked to convert the whole array into a String. I tried with toString() but that's not worked for his output.</p>
<p>input</p>
<pre><code>let a=['20','30','50']
</code></pre>
<p>expected output</p>
<pre><code>"['20','30'... | <p>Assuming the <em>"output"</em> is the <strong>content</strong> of this string you want, you can <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer">map</a> the values first to wrap them in single-quotes, then join the array with com... | how to convert whole array to string in javascript | javascript|node.js|ecmascript-6 | -3 | 86 | 2 | 72,182,069 | 72,182,069 | 1 | true | 2022-05-10T07:05:07.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to convert whole array to string in javascript<p>I got a question in the interview that he asked to convert the whole array into a String. I tried with t... |
72,190,747 | I have a slight issue with my code and im not sure<p>I've just started learning python and wanted to make a discord bot hoping to learn some coding on the way. Right now im trying to make a chatbot and im facing an issue.</p>
<pre class="lang-py prettyprint-override"><code>from prsaw import RandomStuff
rs = RandomStuff... | <p>It looks like you need to pass api_key to RandomStuff. So instead of this:</p>
<pre><code>rs = RandomStuff(async_mode = True)
</code></pre>
<p>Try this:</p>
<pre><code>rs = RandomStuff(async_mode = True, api_key = api_key)
</code></pre>
<p><a href="https://api-docs.pgamerx.com/guides/api-key" rel="nofollow noreferre... | I have a slight issue with my code and im not sure | python|discord|discord.py | -3 | 48 | 1 | 72,190,801 | 72,190,801 | 1 | true | 2022-05-10T17:34:13.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I have a slight issue with my code and im not sure<p>I've just started learning python and wanted to make a discord bot hoping to learn some coding on the wa... |
72,192,463 | Merging array of object in to a single array of object<p>I am trying to merge all the items object from a JSON file into a single item object. The JSON file structure looks like this;</p>
<pre><code>[
{"items":["product1","product2","product3"]},
{"items":["pro... | <p>Use <code>Array.reduce()</code> and the spread operator to push the items into a single object and array:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const arr = [
{"i... | Merging array of object in to a single array of object | javascript|arrays|json | -3 | 38 | 3 | 72,192,613 | 72,192,613 | 1 | true | 2022-05-10T20:14:55.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Merging array of object in to a single array of object<p>I am trying to merge all the items object from a JSON file into a single item object. The JSON file ... |
72,195,178 | Why does my enemy keep teleporting to the origin in unity?<p>I just started making a game. For whatever reason, the enemy continuously teleports to the origin for no reason. Here is my code so far;</p>
<pre><code>using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBe... | <p>This is because <code>transform.forward</code> is a result axis, not a specific location, and gives you numbers around -1 to 1. To fix that just try:</p>
<pre><code>transform.position += transform.forward * speed * Time.deltaTime;
</code></pre> | Why does my enemy keep teleporting to the origin in unity? | c#|unity3d | -3 | 82 | 1 | 72,195,860 | 72,195,860 | 1 | true | 2022-05-11T03:47:07.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does my enemy keep teleporting to the origin in unity?<p>I just started making a game. For whatever reason, the enemy continuously teleports to the origi... |
72,196,041 | Passing a list of list instead of a list in Python<p>I am writing a code to mutate a list of strings, where the list contains 6 elements, where the first 4 are the attributes and the fifth one is the class, and the last one is the fitness. Now I want to pick a random attribute position and mutate that positions attribu... | <p>The requirement is quite confusing, but I'll answer with the following understanding:
You want to pass a list of lists, and get mutation for each list in the list.
If this understanding is wrong, you'll have to explain your requirement better.
From purely a code perspective you can simple change your mutation functi... | Passing a list of list instead of a list in Python | python | -3 | 56 | 1 | 72,196,192 | 72,196,192 | 1 | true | 2022-05-11T05:55:50.293Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing a list of list instead of a list in Python<p>I am writing a code to mutate a list of strings, where the list contains 6 elements, where the first 4 a... |
72,202,486 | Swift 5 - how to define struct/type as array?<p>Say I've defined <code>Position</code> struct like this:</p>
<pre><code>struct Movement : Codable {
var x: Int
var y: Int
var delay: Int
}
</code></pre>
<p>Now I want to pass around <code>[0,0,0]</code> instead of <code>{"x":0,"y":0,"d... | <p>You could decode it directly into the wanted format</p>
<pre><code>let data = #"[{"x":1,"y":2,"delay":123},{"x":2,"y":2,"delay":25}]"#.data(using: .utf8)!
let array = try! JSONDecoder().decode([[String: Int]].self, from: data)
.map { [$0[&quo... | Swift 5 - how to define struct/type as array? | swift | -3 | 64 | 2 | 72,204,334 | 72,204,334 | 1 | true | 2022-05-11T14:05:38.397Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift 5 - how to define struct/type as array?<p>Say I've defined <code>Position</code> struct like this:</p>
<pre><code>struct Movement : Codable {
var x... |
72,204,426 | Destroying/removing a static text in c++ win32<p>I am using win32 API in c++ and I have a static piece of text. How would I delete the static text when the user presses a button? I can't figure out to do that.</p> | <p>Assuming you have the window handle <code>hwnd</code> of the <code>STATIC</code> control, you can delete it via <code>DestroyWindow(hwnd)</code> or simply make it not be visible with <code>ShowWindow(hwnd, SW_HIDE)</code>.</p> | Destroying/removing a static text in c++ win32 | c++|winapi|win32gui | -3 | 101 | 1 | 72,204,493 | 72,204,493 | 1 | true | 2022-05-11T16:19:17.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Destroying/removing a static text in c++ win32<p>I am using win32 API in c++ and I have a static piece of text. How would I delete the static text when the u... |
72,206,917 | how to hide a div on page load with a 5 second delay<p>so what i want to do is to hide the element for the first 5 seconds the i want the element to show after 5 secs of page load
i have tried many methods but nothing worked yet</p>
<p>here is my code:</p>
<pre><code> <div id="main_sec_2"></div>
<... | <p>If you want to use JavaScript, then your JavaScript code isn't working for a few reasons.</p>
<hr />
<p>Below is some working JavaScript code. (The explanation is below it.)</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="sni... | how to hide a div on page load with a 5 second delay | javascript|html|css | -3 | 83 | 2 | 72,207,662 | 72,207,662 | 1 | true | 2022-05-11T19:54:07.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to hide a div on page load with a 5 second delay<p>so what i want to do is to hide the element for the first 5 seconds the i want the element to show aft... |
72,211,208 | JavaScript: Convert array of objects into array of object of array of object<p>JavaScript: Convert array of objects into array of object of array of objects</p>
<p>Convert: Input</p>
<p>[{date: 2021, name: 'New York', price: 452}, {date: 2020, name: 'New York', price: 452}, {date: 2021, name: 'Oregon', price: 452} , ..... | <p>You can do something like this</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const data = [{date: 2021,name: 'New York',price: 452}, {date: 2020,name: 'New York',price: 45... | JavaScript: Convert array of objects into array of object of array of object | javascript|arrays | -5 | 44 | 1 | 72,211,306 | 72,211,306 | 1 | true | 2022-05-12T06:51:43.073Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaScript: Convert array of objects into array of object of array of object<p>JavaScript: Convert array of objects into array of object of array of objects<... |
72,214,889 | python beautifulsoup how to get data as json format?<p>I want to get data as json format. Right now I am getting data as dictionary which little bit messy for me. Here is my code:</p>
<pre><code>my_dict = {"job_title":[],"time_posted":[],"number_of_proposal":[],"page_link":[]};
f... | <p>You can change the structure with the following code:</p>
<pre><code>my_list = []
for i in range(len(my_dict["job_title"])):
my_list.append({
"job_title": my_dict["job_title"][i],
"time_posted": my_dict["time_posted"][i],
"number_of_... | python beautifulsoup how to get data as json format? | python|json|python-3.x|list|beautifulsoup | -4 | 100 | 3 | 72,215,160 | 72,215,160 | 1 | true | 2022-05-12T11:40:36.603Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
python beautifulsoup how to get data as json format?<p>I want to get data as json format. Right now I am getting data as dictionary which little bit messy fo... |
72,223,006 | return in if statement throws conversion error<p>I will apologize in advance for the long post. Just trying to give you all the information I have.</p>
<p>I have an <code>if</code> statement in a method that looks like this:</p>
<pre class="lang-cs prettyprint-override"><code>var comparison = await SystemService.Search... | <p><code>records</code> is of type <code>List<SearchRow></code>, which is not compatible with the type <code>List<SearchResult></code>, you either have to convert the <code>SearchRows</code> to <code>SearchResults</code> (e.g. via a <code>Select</code>) or alter the type accepted by <code>ToCSV</code></p> | return in if statement throws conversion error | c#|.net-6.0 | -3 | 68 | 1 | 72,223,041 | 72,223,041 | 1 | true | 2022-05-12T23:23:31.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
return in if statement throws conversion error<p>I will apologize in advance for the long post. Just trying to give you all the information I have.</p>
<p>I ... |
72,232,310 | iterate and get values from nested arrays<p>In a array with unlimited nested array children it is necessary to get a list of parent and children values.</p>
<p>I need to iterate through an undetermined number of children (number which is not known at first) and get de values.</p>
<pre><code>let data = [{
"id&q... | <p>This is a good use case for a generator function, and <code>yield*</code> for the recursive call:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function* iterData(data) {
... | iterate and get values from nested arrays | javascript | -4 | 38 | 1 | 72,232,393 | 72,232,393 | 1 | true | 2022-05-13T15:53:00.723Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
iterate and get values from nested arrays<p>In a array with unlimited nested array children it is necessary to get a list of parent and children values.</p>
... |
72,235,236 | What are the zIndex stacking values of the <html> and <body> elements?<p>From where does the stacking count start in HTML? for the <code><html></code> and <code><body></code> tags.
I have seen many people writing <code>zIndex: -99</code> to bring the item to the back.</p>
<p>But if <code>z-index: -99</code>... | <p>You aren't exactly using the terminology that the spec uses however I guess you could say they have <code>z-index: 0</code> because if you set any child to <code>z-index: 0</code> it has the default stacking order, if you put a positive z-index then it will go above, and if you put a negative then it will be below.<... | What are the zIndex stacking values of the <html> and <body> elements? | html | -3 | 36 | 1 | 72,235,803 | 72,235,803 | 1 | true | 2022-05-13T20:43:18.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What are the zIndex stacking values of the <html> and <body> elements?<p>From where does the stacking count start in HTML? for the <code><html></code> ... |
72,194,964 | Spurious wakeup with atomics and condition_variables<p><code>std::atomic<T></code> and <code>std::condition_variable</code> both have member <code>wait</code> and <code>notify_one</code> functions. In some applications, programmers may have a choice between using either for synchronization purposes. One goal with... | <blockquote>
<p>My question: should I expect different behavior between <code>std::condition_variable</code>'s and <code>std::atomic<T></code>'s <code>wait</code> functions? For example, should <code>std::condition_variable</code> have fewer spurious wakeups?</p>
</blockquote>
<p><code>std::atomic::wait</code> do... | Spurious wakeup with atomics and condition_variables | c++|atomic|wait|notify|condition-variable | 7 | 138 | 1 | 72,250,620 | 72,250,620 | 1 | true | 2022-05-11T03:11:39.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spurious wakeup with atomics and condition_variables<p><code>std::atomic<T></code> and <code>std::condition_variable</code> both have member <code>wait... |
72,180,874 | How to disable Autonegotiation process in petalinux?<p>I need to disable autonegotiation phase on boot sequence in Petalinux 2019.2. Is there any idea about it? As all you know, an autonegotiation phase is starting automatically by boot sequence and if there is a network dedicates IP for devices this process is complet... | <p>Your question leaves a little to be desired, but it sounds like you don't want the DHCP daemon to start automatically at boot. What you can do is create a small script that disables 'udhcpd' and will auto-run at startup (see <a href="https://docs.xilinx.com/v/u/2019.2-English/ug1144-petalinux-tools-reference-guide"... | How to disable Autonegotiation process in petalinux? | networking|embedded|xilinx|u-boot|petalinux | -3 | 108 | 1 | 72,522,018 | 72,522,018 | 1 | true | 2022-05-10T04:49:19.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to disable Autonegotiation process in petalinux?<p>I need to disable autonegotiation phase on boot sequence in Petalinux 2019.2. Is there any idea about ... |
72,173,195 | How to incorporate the validation set in machine learning?<p>I am trying to learn about machine learning, and I am having trouble understanding when and how to use the validation set. I have understood that it is used to evaluate the candidate models, before checking with the test set, but I don't understand how to pro... | <p>First of all make sure to only create one model keep using this one model. Currently you create a model in every training step and overwrite the old one. Otherwise your model will never improve.</p>
<p>Secondly: The Idea behind the validation set is to evaluate the progress of your training, to see how your model pe... | How to incorporate the validation set in machine learning? | python|validation|machine-learning|training-data | -3 | 59 | 1 | 72,173,401 | 72,173,401 | 1 | true | 2022-05-09T13:57:31.570Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to incorporate the validation set in machine learning?<p>I am trying to learn about machine learning, and I am having trouble understanding when and how ... |
72,183,102 | - Write a function called sumNumbers that accepts a single array of numbers and returns the sum of the numbers in the array<p>I'm really new to JavaScript, So excuse me if this question might seem a little underwhelming.</p>
<p>I'm trying to write a function that performs the following:</p>
<p><strong>1. accepts a sing... | <p>You can <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration" rel="nofollow noreferrer">iterate over the array using a <code>for</code> loop</a> and increment the <code>sum</code> in each iteration and finally return it.</p>
<p>If there are no numbers in the array then the funct... | - Write a function called sumNumbers that accepts a single array of numbers and returns the sum of the numbers in the array | javascript|arrays|sum | -4 | 307 | 1 | 72,183,168 | 72,183,168 | 1 | true | 2022-05-10T08:36:03.173Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
- Write a function called sumNumbers that accepts a single array of numbers and returns the sum of the numbers in the array<p>I'm really new to JavaScript, S... |
72,217,635 | how i can convert char array to int without use parseInt and String.valueOf() (java)<p>need to convert char array to int <strong>without use parseInt and String.valueOf()</strong>,</p>
<p><em><strong>need to realize this method</strong></em></p>
<pre><code>public static int parseInt(char[] str) {
}
</code></pre>
<p>... | <p>It is going to work for your case</p>
<pre><code>public static int parseInt(char[] str) {
int result = 0;
int start = 0;
boolean negative = false;
if(str[0] == '-') {
start = 1;
negative = true;
}
for (int i = start; i < str.length; i++)
... | how i can convert char array to int without use parseInt and String.valueOf() (java) | java|arrays|char|integer | -3 | 56 | 2 | 72,217,870 | 72,217,870 | 1 | true | 2022-05-12T14:39:50.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how i can convert char array to int without use parseInt and String.valueOf() (java)<p>need to convert char array to int <strong>without use parseInt and Str... |
72,183,004 | Get numbers of difference in two strings javascript<p>i have two string</p>
<pre><code>const string1 = "usa(Country), with concealed(O), zipper(Closure)"
const string2 = "usa(Country), with(O), concealed zipper(Closure)"
</code></pre>
<p>I want to find diff in these two string for example in this sc... | <p>I'm presuming the strings need to be compared based on the comma separations, but to be fair there isn't enough details in the question...</p>
<p>Split the strings by comma</p>
<pre><code>// split function will be an array of strings
const split = (str, delimiter) => str.split(delimiter)
</code></pre>
<p>Apply th... | Get numbers of difference in two strings javascript | javascript|string|diff | -3 | 43 | 1 | 72,183,152 | 72,183,152 | 1 | true | 2022-05-10T08:27:56.017Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get numbers of difference in two strings javascript<p>i have two string</p>
<pre><code>const string1 = "usa(Country), with concealed(O), zipper(Closure)... |
72,169,972 | what does -f and -p option to Java command<p>I have a script file which executes the java program like:<br />
<code>java -Dlog.file=/path -Dappname=name -DAsyncLogger.RingBufferSize=200000 -jar /path/main.jar -f /path/testfile -day 20211108 -p /path/test.properties</code></p>
<p><code>-D</code> I understand puts the ... | <p>When you call <code>java</code>, all options after the class name or <code>-jar <jarfile></code> are passed as-is to the <code>public static void main(String[] args)</code> method. In this case, the main method of this JAR will receive the array <code>{"-f", "/path/testfile", "-day&quo... | what does -f and -p option to Java command | java | -4 | 60 | 2 | 72,170,197 | 72,170,197 | 1 | true | 2022-05-09T09:45:35.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
what does -f and -p option to Java command<p>I have a script file which executes the java program like:<br />
<code>java -Dlog.file=/path -Dappname=name -DAs... |
72,191,070 | I"m unable to read .csv rows recursively. Why is this showing me an error: IndexError: list index out of range?<pre><code>def kmlForLab2(x,y):
#XYpoints1_wgs84
#XYpoints1_wgs84.csv
print(x,y)
#Input the file name."JoeDupes3_forearth"
fname = input("Enter file name WITHOUT extensi... | <p>The first problem is the delimiter</p>
<pre><code>data = csv.reader(open(fname + '.csv'), delimiter = ',')
</code></pre>
<p>you are using <code>,</code> (comma) but it seems your file may use tabs as delimiters.</p>
<p>Then, you should use</p>
<pre><code>data = csv.reader(open(fname + '.csv'), delimiter='\t')
</code... | I"m unable to read .csv rows recursively. Why is this showing me an error: IndexError: list index out of range? | python|csv|gis|kml | -3 | 43 | 2 | 72,191,204 | 72,191,204 | 1 | true | 2022-05-10T18:01:35.587Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I"m unable to read .csv rows recursively. Why is this showing me an error: IndexError: list index out of range?<pre><code>def kmlForLab2(x,y):
#XYpoints1... |
72,184,847 | why returning None in functions python?<p><a href="https://i.stack.imgur.com/eZyoy.png" rel="nofollow noreferrer">first image</a>
I was having problem when I run this code I raise exception in function then why none is printing</p>
<p><a href="https://i.stack.imgur.com/8V29F.png" rel="nofollow noreferrer">sec image</a>... | <p>when a python function does not have a return statement it automatically return None.</p>
<p>In the first image, the <code>print(numcheck(5))</code> pass the assert but the function return None so it printed None but <code>print(numcheck(-5))</code> did raise the exception.</p>
<p>In the second image <code>print(num... | why returning None in functions python? | python|python-3.x|function|printing | -3 | 68 | 1 | 72,184,893 | 72,184,893 | 1 | true | 2022-05-10T10:40:21.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why returning None in functions python?<p><a href="https://i.stack.imgur.com/eZyoy.png" rel="nofollow noreferrer">first image</a>
I was having problem when I... |
72,139,538 | Flutter detect PointerEvents over Widget<p>I have a sample code which detects a hovering stylus over a widget.</p>
<p>The code is from <a href="https://stackoverflow.com/a/63026755/479659">this Stackoverflow Quesion</a>.</p>
<p>In short. It binds using <code>GestureBinding.instance?.pointerRouter.addGlobalRoute</code> ... | <p>EDIT</p>
<p>As desribed below, this question has two solutions.</p>
<ol>
<li><p>Set <code>useHybridComposition</code> to true. For slowness, maybe raise an issue to that repo.</p>
</li>
<li><p>Hook at android/ios level instead of Flutter level, and forward events back to Flutter.</p>
</li>
</ol>
<hr />
<p>The debugg... | Flutter detect PointerEvents over Widget | flutter|flutter-layout|flutter-inappwebview | 11 | 346 | 1 | 72,161,212 | 72,161,212 | 1 | true | 2022-05-06T09:53:05.943Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter detect PointerEvents over Widget<p>I have a sample code which detects a hovering stylus over a widget.</p>
<p>The code is from <a href="https://stack... |
72,159,104 | Unusually Large values and negative values of addresses of a variable<p>So I was learning and practicing the concept of Pointers and addresses of variables in C language. But there is one thing that is making me curious. The code that I ran is-</p>
<pre><code> #include <stdio.h>
int main()
{
in... | <p>You have to be careful if you're thinking about pointers as numbers. Internally, they are usually addresses, and they are usually numeric, but they are <em>unsigned</em> numeric. So, no, you typically won't have "negative addresses".</p>
<p>You might not have learned how computers represent negative numb... | Unusually Large values and negative values of addresses of a variable | c|pointers|variables|memory | -3 | 55 | 2 | 72,161,650 | 72,161,650 | 1 | true | 2022-05-08T07:59:05.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unusually Large values and negative values of addresses of a variable<p>So I was learning and practicing the concept of Pointers and addresses of variables i... |
72,164,126 | Return link from Hateos<p>I have this old Spring Hateos code which I want to migrate to the latest version:</p>
<pre><code> Map<String, Link> links = new HashMap<>();
links.put(Link.REL_NEXT, response.getLink(Link.REL_NEXT));
links.put(Link.REL_PREVIOUS, response.getLink(Link.REL_PREVIOUS));
... | <p>Based on your comments & question for migration this is what I am suggesting:</p>
<pre><code>Map<LinkRelation, Optional<Link>> links = new HashMap<LinkRelation, Optional<Link>>();
links.put(IanaLinkRelations.SELF, Optional.of(response.getLink(IanaLinkRelations.SELF)));
links.put(IanaLin... | Return link from Hateos | java|spring|spring-boot|spring-hateoas|hateoas | -7 | 195 | 1 | 72,351,580 | 72,351,580 | 1 | true | 2022-05-08T18:44:00.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Return link from Hateos<p>I have this old Spring Hateos code which I want to migrate to the latest version:</p>
<pre><code> Map<String, Link> links ... |
72,232,364 | How to sort part of values in list?<p>I want to sort the value which startswith <code>chapter </code> in list, but I have no idea to implement this.</p>
<p><strong>my list</strong></p>
<pre><code>["prologue", "chapter 1", "chapter 3", "chapter 2", "sick", "chapter ... | <p>Here is one solution, but I am sure there are a lot more.</p>
<pre><code>my_list = ["prologue", "chapter 1", "chapter 3", "chapter 2", "sick", "chapter 5", "chapter 4"]
to_sort = []
to_sort_index = []
for i, item in enumerate(my_list):
if ite... | How to sort part of values in list? | python | -3 | 53 | 1 | 72,232,454 | 72,232,454 | 1 | true | 2022-05-13T15:57:32.010Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to sort part of values in list?<p>I want to sort the value which startswith <code>chapter </code> in list, but I have no idea to implement this.</p>
<p><... |
72,140,528 | How do I Concatenate or Combine the dictionary of same data to One<p>I have the below set of 7 Dictionaries</p>
<pre><code>{'empid':785, 'empname':'Ibrahim', 'date(2022,5,1)':'Unmarked'}
{'empid':785, 'empname':'Ibrahim', 'date(2022,5,2)':'Unmarked'}
{'empid':785, 'empname':'Ibrahim', 'date(2022,5,3)':'Present'}
{'empi... | <p>Another method:</p>
<pre class="lang-py prettyprint-override"><code>dcts = [
{"empid": 785, "empname": "Ibrahim", "date(2022,5,1)": "Unmarked"},
{"empid": 785, "empname": "Ibrahim", "date(2022,5,2)": "Unmarked"... | How do I Concatenate or Combine the dictionary of same data to One | python|python-3.x|django|dictionary|django-views | -3 | 48 | 3 | 72,140,630 | 72,140,630 | 2 | true | 2022-05-06T11:09:05.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I Concatenate or Combine the dictionary of same data to One<p>I have the below set of 7 Dictionaries</p>
<pre><code>{'empid':785, 'empname':'Ibrahim',... |
72,165,980 | AttributeError: 'str' object has no attribute 'send'<p>So I'm trying to get my on_message event to work without the commands being blocked. I added a <code>await client.process_commands(message)</code> line, but now its telling me that 'str' object has no attribute 'send' which I have no idea what it means. Here is the... | <p><code>message.content</code> is type <code>str</code>. You're calling <code>.send('hello brotha')</code> on it, thus causing that error message. If you're trying to reply to the initial message, you should be doing this:</p>
<pre><code>@client.event
async def on_message(message):
if message.content.lower().start... | AttributeError: 'str' object has no attribute 'send' | python|discord|discord.py | -4 | 567 | 1 | 72,166,041 | 72,166,041 | 2 | true | 2022-05-09T00:35:02.167Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AttributeError: 'str' object has no attribute 'send'<p>So I'm trying to get my on_message event to work without the commands being blocked. I added a <code>a... |
72,173,818 | calling structure into main function<p>I am writing code to find two prime numbers. For this I need to return two values from the function primefactor(). I am using a structure to return the two values.</p>
<pre><code>#include <stdio.h>
#include<stdbool.h>
struct tuple {
long int prime1,prime2;
};
ty... | <p>Anything wrong with the obvious solution?</p>
<pre><code>primefind primes = primeFactor(n);
printf("%ld %ld\n", primes.prime1, primes.prime2);
</code></pre>
<p>You may also consider changing your approach and using function parameters for your return values:</p>
<pre><code>void primeFactor(long int n, long... | calling structure into main function | c|structure | -3 | 51 | 3 | 72,173,985 | 72,173,985 | 2 | true | 2022-05-09T14:40:14.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
calling structure into main function<p>I am writing code to find two prime numbers. For this I need to return two values from the function primefactor(). I a... |
72,178,449 | How to print an index 0 of a list, with for loop?<p>Why does this code, does not return (or print) the 0 index of the list?</p>
<pre><code>N = int(input())
letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
for i in range(N):
... | <p>Because i starts counting at zero.</p>
<p>If you type:</p>
<pre><code>for i in range(10):
print(i)
</code></pre>
<p>You'll see:</p>
<pre><code>0
1
2
3
4
5
6
7
8
9
</code></pre>
<p>If you want to count from 1 to N instead of 0 to N-1, type:</p>
<pre><code>print(letters[i]*(i+1))
</code></pre> | How to print an index 0 of a list, with for loop? | python|list|for-loop | -3 | 81 | 4 | 72,178,503 | 72,178,503 | 2 | true | 2022-05-09T21:38:08.463Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to print an index 0 of a list, with for loop?<p>Why does this code, does not return (or print) the 0 index of the list?</p>
<pre><code>N = int(input())
... |
72,176,207 | Select rows that meet ALL of a dynamic set of ids<p>I have a table that I want to be able to query to get rows that are in a defined sets of value. I can create new table structures if required as this is temporary data used for a leaderboard of sorts.</p>
<p>The Token Sets can be created by grouping many tokens toget... | <p><strong>This is classic <a href="https://www.red-gate.com/simple-talk/databases/sql-server/t-sql-programming-sql-server/divided-we-stand-the-sql-of-relational-division/" rel="nofollow noreferrer">Relational Division</a>.</strong> There are quite a number of different solutions.</p>
<p>If you want to do this across m... | Select rows that meet ALL of a dynamic set of ids | sql|sql-server|tsql|relational-division | -3 | 54 | 2 | 72,178,772 | 72,178,772 | 2 | true | 2022-05-09T17:46:56.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Select rows that meet ALL of a dynamic set of ids<p>I have a table that I want to be able to query to get rows that are in a defined sets of value. I can cr... |
72,191,278 | T-SQL get value from XML<p>I am trying to query XML (SSRS) in SQL Server; I want to get the value from the TO in this case.</p>
<pre><code><ParameterValues>
<ParameterValue>
<Name>TO</Name>
<Value>PacoAT@Stack.com</Value>
</ParameterValue>
<Parame... | <p>You can do it using XQuery</p>
<pre class="lang-sql prettyprint-override"><code>SELECT
[TO] = t.XmlColumn.value('(ParameterValues/ParameterValue[Name/text() = "TO"]/Value/text())[1]', 'varchar(100)')
FROM YourTable t
</code></pre>
<p><code>/</code> is a child node navigation. <code>[]</code> is a predica... | T-SQL get value from XML | sql-server|xml|tsql|xquery-sql | -4 | 44 | 1 | 72,191,707 | 72,191,707 | 2 | true | 2022-05-10T18:19:21.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
T-SQL get value from XML<p>I am trying to query XML (SSRS) in SQL Server; I want to get the value from the TO in this case.</p>
<pre><code><ParameterValue... |
72,200,282 | JavaScript groupBy is not a functio<p>i want to group my Data with the Name of type</p>
<pre><code>const inventory = [
{ name: 'asparagus', type: 'vegetables', quantity: 5 },
{ name: 'bananas', type: 'fruit', quantity: 0 },
{ name: 'goat', type: 'meat', quantity: 23 },
{ name: 'cher... | <p>JavaScript arrays don't have a <code>groupBy</code> method <strong>yet</strong>. See <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/groupBy" rel="nofollow noreferrer">MDN's documentation</a>. It's in nightly Firefox builds at the moment and that's all. <a href="https:... | JavaScript groupBy is not a functio | javascript|arrays | -3 | 41 | 1 | 72,200,417 | 72,200,417 | 2 | true | 2022-05-11T11:30:36.403Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaScript groupBy is not a functio<p>i want to group my Data with the Name of type</p>
<pre><code>const inventory = [
{ name: 'asparagus', type: 'v... |
72,214,122 | How to compress files on MAC M1 and extract on AMD64 machine<p>I am trying to compress files on Mac M1 and use it on my old Mac which is on AMD64 architecture. Now I am facing issue when extracting the files on my old Macbook Pro.</p>
<pre><code>tar (child): gzip: Cannot exec: No such file or directory
tar (child): Err... | <p>It is not a architecture problem, but most likely a problem with a missing <code>gzip</code> installation.<br />
If you are using <code>homebrew</code>, you can install gzip with the following command</p>
<pre><code>brew install gzip
</code></pre>
<p>And then try to untar the file again</p> | How to compress files on MAC M1 and extract on AMD64 machine | macos|extract|tar | -3 | 182 | 1 | 72,214,167 | 72,214,167 | 2 | true | 2022-05-12T10:39:59.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to compress files on MAC M1 and extract on AMD64 machine<p>I am trying to compress files on Mac M1 and use it on my old Mac which is on AMD64 architectur... |
72,217,127 | is substr_replace() in php useless? w3schools<p>As in <a href="https://www.w3schools.com/php/func_string_substr_replace.asp" rel="nofollow noreferrer">https://www.w3schools.com/php/func_string_substr_replace.asp</a></p>
<pre><code><?php
echo substr_replace("Hello","world",0);
?>
</code></pre>
... | <p>It determines which part of the original string to replace with the replacement based on the start and length arguments.</p>
<p>Since you told it to start at <code>0</code> and didn't include a length, it replaces the whole thing.</p>
<p>The function isn't useless, but the way you pass it <code>0</code> and nothing ... | is substr_replace() in php useless? w3schools | php | -4 | 45 | 2 | 72,217,206 | 72,217,206 | 2 | true | 2022-05-12T14:07:31.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
is substr_replace() in php useless? w3schools<p>As in <a href="https://www.w3schools.com/php/func_string_substr_replace.asp" rel="nofollow noreferrer">https:... |
72,224,454 | Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of task<p>I've checked this answer:
<a href="https://stackoverflow.com/a/34834772/13519865">https://stackoverflow.com/a/34834772/13519865</a></p>
<p>It tells us to remove this line</p>
<pre><code>apply plug... | <p>According to the new <a href="https://developer.android.com/studio/releases" rel="nofollow noreferrer">Chipmunk</a> update of Android Studio, if you need to use Google Services, you have to add the following lines of code inside your build.gradle (Project) file:</p>
<pre><code>plugins {
id 'com.android.applicati... | Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of task | android|firebase|kotlin|google-cloud-platform|google-play-services | 9 | 1,766 | 2 | 72,226,009 | 72,226,009 | 2 | true | 2022-05-13T04:28:21.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of task<p>I've checked this answer:
<a href... |
72,178,916 | How to write temporary files to /tmp using Google App Engine?<p>I am trying to create/retrieve temporary files in a directory named /tmp</p>
<p>Based on: <a href="https://cloud.google.com/appengine/docs/standard/python3/using-temp-files" rel="nofollow noreferrer">https://cloud.google.com/appengine/docs/standard/python3... | <p>After checking your picture it seems you are trying to write into <code>./tmp</code> instead of <code>/tmp</code> is this right?</p> | How to write temporary files to /tmp using Google App Engine? | google-app-engine|google-cloud-platform | -3 | 355 | 1 | 72,178,951 | 72,178,951 | 2 | true | 2022-05-09T22:42:13.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to write temporary files to /tmp using Google App Engine?<p>I am trying to create/retrieve temporary files in a directory named /tmp</p>
<p>Based on: <a ... |
72,232,436 | Can any one explain the logic behind this code<p>Sorry for asking this very basic question - but I cannot understand why it does what it does.</p>
<pre><code>a = int(input('Enter No. of rows'))
for i in range (a,0,-1):
print(i*'*')
</code></pre>
<p>Thank you taking time to review and answer this question.</p> | <p>The <code>range</code> function accepts three arguments. The first arg. represents the starting integer, the second arg. represents the integer at which to stop, and the 3 arg. represents how much should the numbers increase by. Therefore, in this case, <code>(start, stop, step) = (a, 0, -1)</code>. This basically m... | Can any one explain the logic behind this code | python-3.x | -4 | 46 | 2 | 72,232,599 | 72,232,599 | 2 | true | 2022-05-13T16:03:08.223Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can any one explain the logic behind this code<p>Sorry for asking this very basic question - but I cannot understand why it does what it does.</p>
<pre><code... |
72,161,183 | A leap year determining C program is not giving any output when inputting 2000, 1900 or 2100 as an input<p>When I am running this C program, and giving 2020, 2024 or other years perfectly divisible by 4, then I am getting expected output i.e. it is a leap year.
<strong>But when I am giving a century year : 1900, 2000 o... | <p>There is a problem in this part of the code:</p>
<pre><code>if (n%4==0)
{
if(n%100 != 0)
{
printf("Leap year");
}
}
</code></pre>
<p>When you enter 1900, it enters the first condition. (Because 1900%4 is equal to zero.) And then, it checks whether or not 1900%100 is zero, and as you ca... | A leap year determining C program is not giving any output when inputting 2000, 1900 or 2100 as an input | c|if-statement|nested-if|leap-year|relational-operators | -5 | 86 | 3 | 72,161,378 | 72,161,378 | 2 | true | 2022-05-08T12:51:12.040Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
A leap year determining C program is not giving any output when inputting 2000, 1900 or 2100 as an input<p>When I am running this C program, and giving 2020,... |
72,199,873 | Java keeps trying to convert my object to int<p>I'm writing up a breadth-first-search algorithm, however when i go to construct my graph i get the error <code>breadth.java:68: error: incompatible types: Node cannot be converted to int: v8.children.add(v8, v7);</code></p>
<p>This happens when i try to add Node objects t... | <p>I'm not sure, because I would need to see the stacktrace, but it appears to me, that it happens at those <code>add(v1, v2, v3)</code> calls.</p>
<p>The thing is, the add-method of ArrayList does not support such an adding where you just list all the items to add (I might be a bit out of date with the newer Java-vers... | Java keeps trying to convert my object to int | java | -5 | 77 | 3 | 72,199,942 | 72,199,942 | 2 | true | 2022-05-11T11:01:47.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java keeps trying to convert my object to int<p>I'm writing up a breadth-first-search algorithm, however when i go to construct my graph i get the error <cod... |
72,147,941 | Add a "i" variable to a variable name C#<p>I have a cube1, cube2, cube3 etc... variables and i want to use something like that:</p>
<pre><code>for (int i = 1; i < 100; i++)
{
Location "cube + i" = new Location();
Console.WriteLine("cube + i + .GetX")
}
</code></pre>
<p>// GetX is a functi... | <p>use an array</p>
<pre><code>var cubes = new Location[100];
for (int i = 0; i < 100; i++)
{
cubes[i] = new Location();
Console.WriteLine(cubes[i].GetX);
}
</code></pre>
<p>or a list - if you are not sure how many and want to add later</p>
<pre><code>var cubes = new List<Location>();
for (int i = 1; i... | Add a "i" variable to a variable name C# | c#|string|variables | -3 | 64 | 1 | 72,147,991 | 72,147,991 | 2 | true | 2022-05-06T22:23:51.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add a "i" variable to a variable name C#<p>I have a cube1, cube2, cube3 etc... variables and i want to use something like that:</p>
<pre><code>for (int i = 1... |
72,199,771 | Convert 45 to 1 and 345 to 2<p>I'm building a carousel with a swiping limit exceeding both left and right of 45px on <strong>each item has 300px width</strong> I wonder How to convert <strong>45 to 1 index and 345 to 2 index</strong>. I have a total of 3 items for the carousel.</p>
<p>I have the following formula for c... | <p>Try using this one:</p>
<pre><code>let val_converter = val => -Math.sign(val)*Math.floor((Math.abs(val)-40)/300 +1);
console.log(val_converter(-645)); // 3
console.log(val_converter(-644)); // 2
console.log(val_converter(-345)); // 2
console.log(val_converter(-344)); // 1
console.log(val_converter(- ... | Convert 45 to 1 and 345 to 2 | javascript|math | -3 | 86 | 1 | 72,202,721 | 72,202,721 | 2 | true | 2022-05-11T10:55:23.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert 45 to 1 and 345 to 2<p>I'm building a carousel with a swiping limit exceeding both left and right of 45px on <strong>each item has 300px width</stron... |
72,159,528 | How to define a function to add cell colour for a table that created by python-docx?<p>I want to define a function to filling header colour,
for now, I am just hard code every object.</p>
<p>Here is the code I used, I tried to define a function to add cell colour.
The error msg shown below:
<a href="https://i.stack.img... | <p>Some things to note</p>
<ol>
<li>You need to be careful of indentation; 'def' should not be indented and don't place it in the middle of a section of code.</li>
<li>There is no need to initialise a variable when assigning to a range; k=1 isn't needed the range is assigned on the next line.</li>
<li>No need to return... | How to define a function to add cell colour for a table that created by python-docx? | python|pandas|openpyxl|openxml|python-docx | -4 | 118 | 1 | 72,166,887 | 72,166,887 | 2 | true | 2022-05-08T09:08:17.440Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to define a function to add cell colour for a table that created by python-docx?<p>I want to define a function to filling header colour,
for now, I am ju... |
72,202,424 | Is there a more concise way to define this simple hat function?<p>I am studying Fourier series and want to plot some of the results in Python. One common function to analyze using Fourier series is the hat function:</p>
<p><img src="https://i.stack.imgur.com/iy9ES.png" alt="example plot here" /></p>
<p>The code below s... | <p>Here's another solution</p>
<pre><code>def hat(x,a,L):
y=x.copy()
y[(x<-a) | (x>a)]=0
y[(x>-a)&(x<0)]+=1
y[x==a]=1
y[(x>0)&(x<a)]*=-1
y[(x>0)&(x<a)]+=1
return y
</code></pre>
<p>in your <code>hat</code> function, you have <code>y[x==a]=1</code> but in t... | Is there a more concise way to define this simple hat function? | python|numpy | -3 | 133 | 1 | 72,202,603 | 72,202,603 | 2 | true | 2022-05-11T14:00:32.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a more concise way to define this simple hat function?<p>I am studying Fourier series and want to plot some of the results in Python. One common fun... |
72,227,101 | What is preventing me from running this code?<pre><code>#include <iostream>
#include <string>
void showResults(std::string* r);
int main()
{
std::string students[10] = { "1", "2", "3" };
std::string* r = students;
showResults(r);
system("pause >> null");
ret... | <p>everything is okay except there is a set of characters should be removed , kind of hidden encoded.</p>
<pre><code>void showResults(std::string* r) {
......
}
</code></pre>
<p>before the first curly brace, remove that, In Clion it show like this</p>
<pre><code>void showResults(std::string* r)ZWSP{
......
}
</code>... | What is preventing me from running this code? | c++ | -5 | 94 | 3 | 72,227,463 | 72,227,463 | 2 | true | 2022-05-13T09:10:19.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is preventing me from running this code?<pre><code>#include <iostream>
#include <string>
void showResults(std::string* r);
int main()
{
st... |
72,218,228 | Why can't I zip a file in Python?<p>So I created a script in Python that takes a user specified file and zips it up as a zip file.</p>
<p>When I tried it out it doesn't work my code complains how the path is not found I have tried so many different things and looked at a lot of tutorials about how to do this none work.... | <p>It appears you are confused about how to build strings, based on this line:</p>
<pre class="lang-py prettyprint-override"><code>with zipfile.ZipFile(("ZipFile", FZ, ".zip"), "w") as z:
</code></pre>
<p>If this were a <em><code>print</code></em> statement, doing <code>print("ZipFile... | Why can't I zip a file in Python? | python | -3 | 50 | 1 | 72,218,595 | 72,218,595 | 2 | true | 2022-05-12T15:20:08.400Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can't I zip a file in Python?<p>So I created a script in Python that takes a user specified file and zips it up as a zip file.</p>
<p>When I tried it out... |
37,640,318 | Checksum in HTTP response header - why not?<p>I'd like to know some kind of file checksum (like SHA-256 hash, or anything else) when I start downloading file from HTTP server. It could be transferred as one of HTTP response headers.</p>
<p>HTTP <code>etag</code> is something similar, but it's used only for invalidatin... | <h2>The checksum provided separately from the file is used for integrity check when doing <code>Non TLS</code> or <code>indirect</code> transfer.</h2>
<p>Maybe I know your doubt because I had the same question about the checksums, let's find it out. </p>
<p>There are two tasks to be considered:</p>
<ol>
<li>File bro... | Checksum in HTTP response header - why not? | http|hash|https|checksum | 15 | 10,254 | 3 | 58,689,351 | 58,689,351 | 5 | true | 2016-06-05T09:20:19.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Checksum in HTTP response header - why not?<p>I'd like to know some kind of file checksum (like SHA-256 hash, or anything else) when I start downloading file... |
53,619,901 | Auto create S3 Buckets on localstack<p>Using localstack in my docker-compose mainly to mimic S3.</p>
<p>I know I can create buckets, that's not the issue. What I would like to do is automatically create the buckets when I run a docker-compose up.</p>
<p>Is there something built in already for localstack?</p> | <p>A change that came in with this <a href="https://github.com/localstack/localstack/commit/4544ad59dffd9b00b84b96ad2450eb6e6c024b46" rel="noreferrer">commit</a> since version <code>0.10.0</code>.</p>
<blockquote>
<p>When a container is started for the first time, it will execute files
with extensions .sh that are foun... | Auto create S3 Buckets on localstack | amazon-s3|docker-compose|localstack | 53 | 28,166 | 3 | 58,490,732 | 58,490,732 | 73 | true | 2018-12-04T19:12:06.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Auto create S3 Buckets on localstack<p>Using localstack in my docker-compose mainly to mimic S3.</p>
<p>I know I can create buckets, that's not the issue. Wh... |
72,139,163 | Does line length affect performance?<p>I have very long lines using lambda. Also, for example, I combined two loops with a condition into one line. Will such actions affect performance? Not for readability! Only I work with the code, and it reads great for me.</p>
<p>Example 1 (I have longer lines):</p>
<pre><code>send... | <p>Java is a compiled language, and line length is irrelevant to the compiler.
However, it will affect the readability of your code. Longer lines are - generally - less readable, which makes it harder to understand your code, and therefor harder to maintain it.</p>
<p>In other words, don't write code like this.</p> | Does line length affect performance? | java | -3 | 60 | 1 | 72,139,249 | 72,139,249 | 3 | true | 2022-05-06T09:27:29.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does line length affect performance?<p>I have very long lines using lambda. Also, for example, I combined two loops with a condition into one line. Will such... |
72,154,135 | Contagion program, Matrices and Syntax issue<p>I am trying to do the following program:
<em>Write a function onstepcontagion : bool array array -> bool array array = that given a rectangular bool matrix, where true represents an infected square and false represent non-infected square it calculates the next step of ... | <p><code>=</code> is the structural equality operator. To set an array element you need to use <code><-</code>.</p>
<p>Also, you should almost never use <code>==</code> because it tests for physical equality, i.e. that references point to the same address in memory. For comparing <code>bool</code>s it doesn't strict... | Contagion program, Matrices and Syntax issue | ocaml | -3 | 51 | 1 | 72,154,320 | 72,154,320 | 3 | true | 2022-05-07T15:52:32.493Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Contagion program, Matrices and Syntax issue<p>I am trying to do the following program:
<em>Write a function onstepcontagion : bool array array -> bool ar... |
72,177,808 | Problems with random "Lists"<p>I want to create a game where a person is drawn out randomly.
Can some1 check the code if everything is setup correctly.
I have tested the code numerous times and its ok in my eyes.
But when I send the code to a review, to an online class I only get 50% score.</p>
<pre><code>import random... | <p>The problem here is almost certainly with <code>randint</code>. Unlike most Python conventions, the parameters to <code>randint</code> are inclusive. That means, if you supply <code>(0,10)</code>, you are going to get numbers from 0 to 10. In your case, if they supply 10 names, using index 10 is going to cause an... | Problems with random "Lists" | python | -3 | 58 | 1 | 72,177,893 | 72,177,893 | 3 | true | 2022-05-09T20:22:26.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Problems with random "Lists"<p>I want to create a game where a person is drawn out randomly.
Can some1 check the code if everything is setup correctly.
I hav... |
72,191,597 | Swift: "with" before parameter in a function<p>I would want to as you term of "with" in Swift.</p>
<p>For example, sometimes I see piece of code like this:</p>
<pre><code>public func configure(with imageName: String) {
myImageView.image = UIImage(named: imageName)
}
</code></pre>
<p>In here, before the para... | <p>This is called external parameter name. the main purpose of it sentence formulation and make it easy for reader. can read more about <a href="https://docs.swift.org/swift-book/LanguageGuide/Functions.html#ID166" rel="nofollow noreferrer">Parameter Names</a> from official documentation.</p> | Swift: "with" before parameter in a function | swift|function|parameters | -3 | 107 | 1 | 72,191,728 | 72,191,728 | 3 | true | 2022-05-10T18:47:41.173Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift: "with" before parameter in a function<p>I would want to as you term of "with" in Swift.</p>
<p>For example, sometimes I see piece of code li... |
72,172,877 | Having a trouble with Google OAuth2 (app has no backend, so client side only)<p>I am trying to implement client side only login using OAuth. Getting the following error:</p>
<pre><code>details: "You have created a new client application that uses libraries for user authentication or authorization that will soon be... | <p>By default, newly created Client IDs are now blocked from using the older Platform Library, existing Client IDs are unaffected. New Client IDs created before July 29th, 2022 can set <code>plugin_name</code> to enable use of the Google Platform Library.</p>
<p>So, in my case the solution was:</p>
<pre><code>window.ga... | Having a trouble with Google OAuth2 (app has no backend, so client side only) | javascript|google-oauth | 10 | 7,887 | 2 | 72,208,134 | 72,208,134 | 3 | true | 2022-05-09T13:35:39.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Having a trouble with Google OAuth2 (app has no backend, so client side only)<p>I am trying to implement client side only login using OAuth. Getting the foll... |
72,222,759 | Unable to Write json variable c# getting an error<p>I get an error when I try to serialize or update a json file. I just want to update the value of <strong>"balance"</strong> inside a json file and I got the idea <a href="https://stackoverflow.com/questions/64774144/update-property-in-json-file-with-c-sharp"... | <p>you have a bug</p>
<pre><code> File.WriteAllText(Login.jsonResponse, json);
</code></pre>
<p>instead of ogin.jsonResponse you have to use a file path</p>
<pre><code>File.WriteAllText(<full file path\Users.json>, json);
</code></pre> | Unable to Write json variable c# getting an error | c#|json|oop|c#-4.0 | -3 | 34 | 1 | 72,222,859 | 72,222,859 | 3 | true | 2022-05-12T22:39:07.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to Write json variable c# getting an error<p>I get an error when I try to serialize or update a json file. I just want to update the value of <strong>... |
72,226,737 | up to 20% Numerical error or Bug in ten line code block<p>Rewriting a single tiny block of code of an application has yielded a considerable performance improvement. The code is 100% sequential, thus there should be no hidden perturbations to the values stored in memory.</p>
<p>Double-checking that the results after co... | <p>Floating point number arithmetic is not <a href="https://en.wikipedia.org/wiki/Distributive_property" rel="nofollow noreferrer">distributive</a>. That means there are cases where the following statement is true</p>
<pre><code>x * (a + b) != x * a + x * b;
</code></pre>
<p>If you move the multiplication out of your l... | up to 20% Numerical error or Bug in ten line code block | c++|c|numerical-methods|rounding-error | -4 | 84 | 1 | 72,227,434 | 72,227,434 | 3 | true | 2022-05-13T08:42:58.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
up to 20% Numerical error or Bug in ten line code block<p>Rewriting a single tiny block of code of an application has yielded a considerable performance impr... |
72,236,445 | How can I wrap a python function in a way that works with with inspect.signature?<p>Some uncontroversial background experimentation up front:</p>
<pre><code>import inspect
def func(foo, bar):
pass
print(inspect.signature(func)) # Prints "(foo, bar)" like you'd expect
def decorator(fn):
def _wrapper(ba... | <p>You can use <code>__signature__</code> (<a href="https://peps.python.org/pep-0362/" rel="nofollow noreferrer">PEP</a>) attribute to modify returned signature of wrapped object. For example:</p>
<pre class="lang-py prettyprint-override"><code>import inspect
def func(foo, bar):
pass
def decorator(fn):
def ... | How can I wrap a python function in a way that works with with inspect.signature? | python|python-decorators | 7 | 116 | 1 | 72,242,606 | 72,242,606 | 3 | true | 2022-05-14T00:13:50.273Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I wrap a python function in a way that works with with inspect.signature?<p>Some uncontroversial background experimentation up front:</p>
<pre><code>... |
72,193,393 | Find the value of variables to maximize return of function in Python<p>I'd want to achieve similar result as how the Solver-function in Excel is working. I've been reading of Scipy optimization and been trying to build a function which outputs what I would like to find the maximal value of. The equation is based on fou... | <h1>Solution</h1>
<p>I will use <code>optuna</code> library to give you a solution to the type of problem you are trying to solve. I have tried using <code>scipy.optimize.minimize</code> and it appears that the loss-landscape is probably quite flat in most places, and hence the tolerances enforce the minimizing algorit... | Find the value of variables to maximize return of function in Python | python|scipy-optimize | 7 | 586 | 2 | 72,252,081 | 72,252,081 | 3 | true | 2022-05-10T22:04:26.430Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find the value of variables to maximize return of function in Python<p>I'd want to achieve similar result as how the Solver-function in Excel is working. I'v... |
72,177,381 | Check if preceding objects exist<p>I need to write a method in Python to check that if a key is provided by the user, the preceding key must also be provided.</p>
<p>Example: If the user provides a list <code>['id_4','id_5','id_6'...]</code>, this will throw an error because the user did not provide the preceding keys,... | <p>If the preceding key must be in the list for each key, by recurrence this means that all key from the start must be present.</p>
<p>I think an ideal tool to validate this is a <code>set</code>:</p>
<pre><code>def valid(l):
return set(l) == {f'id_{i}' for i in range(1, len(l)+1)}
# if you prefer to throw an e... | Check if preceding objects exist | python | -3 | 63 | 2 | 72,177,490 | 72,177,490 | 3 | true | 2022-05-09T19:37:05.463Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check if preceding objects exist<p>I need to write a method in Python to check that if a key is provided by the user, the preceding key must also be provided... |
72,234,309 | Convert string like dict into dict format<p>I have a string that looks like the following:</p>
<pre><code>{
change:"2.429993",
changePercent:"1.475316",
dayVolume:10222078,
exchange:NYQ,
id:CVX,
marketHours:1,
price:"167.14",
priceHint:4,
quoteType:8,
time:3304930430000,
}
</code></pre>
<p... | <p>Could you provide more test data/records?</p>
<pre class="lang-py prettyprint-override"><code>import yaml
from pprint import pprint
data = """{
change:"2.429993",
changePercent:"1.475316",
dayVolume:10222078,
exchange:NYQ,
id:CVX,
marketHours:1,
price:"167.14",
priceHint... | Convert string like dict into dict format | python | -4 | 74 | 2 | 72,234,527 | 72,234,527 | 3 | true | 2022-05-13T18:58:33.047Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert string like dict into dict format<p>I have a string that looks like the following:</p>
<pre><code>{
change:"2.429993",
changePercent:"... |
72,166,104 | I want to use cout more comfortably<p><a href="https://i.stack.imgur.com/BCBip.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BCBip.png" alt="image" /></a></p>
<p>I want to use <code>cout</code> to print out this sentence: "You can build piramid which floor is only odd. not even", but I wa... | <p>Adjacent <a href="https://en.cppreference.com/w/cpp/language/string_literal" rel="nofollow noreferrer">string literals</a> will automatically be concatenated, even if they are on different lines. So you can write it this way instead:</p>
<pre><code>std::cout << "You can only build pyramids whose floor is ... | I want to use cout more comfortably | c++|cout | -3 | 70 | 2 | 72,166,168 | 72,166,168 | 4 | true | 2022-05-09T01:10:07.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I want to use cout more comfortably<p><a href="https://i.stack.imgur.com/BCBip.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BCBip.png" ... |
72,175,922 | Why are traversals defined over Applicatives, fundamentally?<p>I've been on a bit of a "distilling everything to its fundamentals" kick lately, and I've been unable to find clear theoretical reasons for how the Traversable typeclass is defined, only practical ones of "it's useful to be able to traverse o... | <p>I'm not aware of any library that implements those classes, but I'll try to unravel what those classes would represent. I am a programmer, not a category theorist, so take this with a grain of salt.</p>
<h1><code>Applicative</code> variants</h1>
<h2><code>ApplyMagma</code></h2>
<p>The <code>ApplyMagma</code> class h... | Why are traversals defined over Applicatives, fundamentally? | haskell|category-theory|traversable|distributive | 10 | 259 | 2 | 72,180,102 | 72,180,102 | 4 | true | 2022-05-09T17:20:16.947Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why are traversals defined over Applicatives, fundamentally?<p>I've been on a bit of a "distilling everything to its fundamentals" kick lately, and... |
72,194,024 | When do you use the & operator in C language?<p>I was looking over this example from my notes and it doesn't include the & operator, &i, before the i when printing over the loop</p>
<pre><code>#include <stdio.h>
int main() {
int i;
for (i = 1; i < 11; ++i)
{
printf("%d ", i);
... | <p>Generally, you use just the name of an object, like <code>i</code>, when you want its value. In <code>printf("%d ", i)</code>, we want <code>printf</code> to print the value of <code>i</code>, so we just pass <code>i</code>.</p>
<p>In <code>scanf("%d", …)</code>, we do not want to tell <code>scan... | When do you use the & operator in C language? | c | -5 | 55 | 1 | 72,194,132 | 72,194,132 | 4 | true | 2022-05-10T23:49:02.550Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When do you use the & operator in C language?<p>I was looking over this example from my notes and it doesn't include the & operator, &i, before the i... |
72,222,491 | It is possible to create a click button in VBA Excel that opens the VBA editor?<p>I was just wondering:
It is possible to create a click button in VBA Excel that opens the VBA editor when the button is clicked?</p>
<p><strong>UPDATE:</strong>
The point that I was looking for was achieved by @pgSystemTester. In this, I ... | <p>In response to the comments, it seems hard to envision a situation where it's a good idea to be directing "inexperienced users" to the visual basic editor. Similarly, lowering these same users' systems' defenses against malicious code seems unwise.</p>
<p>With that said, you could just try to teach your us... | It is possible to create a click button in VBA Excel that opens the VBA editor? | excel|vba | -3 | 104 | 1 | 72,222,962 | 72,222,962 | 4 | true | 2022-05-12T21:59:14.430Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
It is possible to create a click button in VBA Excel that opens the VBA editor?<p>I was just wondering:
It is possible to create a click button in VBA Excel ... |
72,229,870 | How to return HTML in a Javascript/JSX function return?<p>The following snippet will return and ordinal number if I leave the <code><sup></code> tags out. But I need them so that I can style it differently than the number itself. Right now it returns <code>1[Object Object], 2[Object Object]...n[Object Object]</co... | <p>You appear to be returning JSX. In that case the entire response needs to be a JSX element. Not a number added to a JSX element (which itself is just an object, and adding a number to an object produces the output you're getting, since it's just trying to concatenate strings).</p>
<p>Something like this:</p>
<pre>... | How to return HTML in a Javascript/JSX function return? | reactjs | -4 | 52 | 1 | 72,229,968 | 72,229,968 | 4 | true | 2022-05-13T12:47:51.490Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to return HTML in a Javascript/JSX function return?<p>The following snippet will return and ordinal number if I leave the <code><sup></code> tags o... |
72,193,058 | Google PlayIntegrity API: a Nightmare<p>I need some help guys!! I am a self-taught, newbie in encryption, and after reading, testing, and error for more than two weeks on how to solve this, and finding very little crowd knowledge and almost no documentation from Google.</p>
<p>I am trying to read the integrity verdict,... | <p>Using a cloud server to decode and verify the token is better.
For example, if you going with Java service then the below code will send the integrity token to the google server hence you can verify the response.
Enable PlayIntegrity API in Google Cloud Platform against the app and download the JSON file and configu... | Google PlayIntegrity API: a Nightmare | java|android|google-api|integrity | 12 | 1,402 | 2 | 72,461,439 | 72,461,439 | 4 | true | 2022-05-10T21:18:28.973Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google PlayIntegrity API: a Nightmare<p>I need some help guys!! I am a self-taught, newbie in encryption, and after reading, testing, and error for more than... |
72,228,594 | Invalid signature error from ethers when trying to verify a signature<p>I am working on a dapp that needs to verify users' signatures. When testing with Metamask, everything is okay.</p>
<p>When trying to verify a signature from Ambire wallet, I get "Error: invalid signature string" from ethers.utils.verifyMe... | <p>In order to support smart wallets like Ambire, Gnosis Safe, Argent, and others, you need to <a href="https://eips.ethereum.org/EIPS/eip-1271" rel="noreferrer">implement EIP 1271</a>.</p>
<p>Ambire universal signature verification, supporting:</p>
<ul>
<li>Standard message verification (eth_sign)</li>
<li>712 Typed d... | Invalid signature error from ethers when trying to verify a signature | javascript|ethereum|smartcontracts|signature|ethers.js | 7 | 946 | 1 | 72,260,167 | 72,260,167 | 5 | true | 2022-05-13T11:07:53.820Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Invalid signature error from ethers when trying to verify a signature<p>I am working on a dapp that needs to verify users' signatures. When testing with Meta... |
72,113,637 | How to use PHPMailer, after 30 May 2022 when "Less secure app" is no longer an option?<p>I have been using <a href="https://github.com/PHPMailer/PHPMailer" rel="noreferrer">PHPMailer</a> for a long time to send emails using Google credentials (login and password) by enabling the <code>"Less secure app"</code>... | <p>What you need to do is switch to <a href="https://github.com/PHPMailer/PHPMailer/wiki/Using-Gmail-with-XOAUTH2" rel="nofollow noreferrer">XOAUTH2</a> or to the Gmail API again using Oauth2.</p>
<pre><code>$mail->oauthUserEmail = "[Redacted]@gmail.com";
$mail->oauthClientId = "[Redacted]";
$... | How to use PHPMailer, after 30 May 2022 when "Less secure app" is no longer an option? | php|smtp|gmail|phpmailer | 8 | 6,931 | 2 | 72,117,636 | 72,117,636 | 5 | true | 2022-05-04T13:17:57.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use PHPMailer, after 30 May 2022 when "Less secure app" is no longer an option?<p>I have been using <a href="https://github.com/PHPMailer/PHPMailer" r... |
72,187,763 | How to include a global file type declaration in a TypeScript (Node.js) package<p>I'm working on a package that I am planning to publish publicly on npmjs. Let's call it the "text package".</p>
<p>I would like that by default when installing that package, you can import <code>.txt</code> files directly and ge... | <p><strong>The short answer is:</strong></p>
<p>TypeScript does not support Global types without importing the file referring to the type.</p>
<p><strong>More details:</strong></p>
<p>One example that I found doing this was Next.js - when creating a TypeScript app using <code>npx create-next-app@latest --typescript</co... | How to include a global file type declaration in a TypeScript (Node.js) package | javascript|node.js|typescript|webpack|types | 9 | 1,079 | 2 | 72,296,078 | 72,296,078 | 5 | true | 2022-05-10T14:00:55.870Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to include a global file type declaration in a TypeScript (Node.js) package<p>I'm working on a package that I am planning to publish publicly on npmjs. L... |
72,167,372 | How do I use es6 syntax with split?<pre><code> const {city, country} = input.split(/\s*,\s*/);
</code></pre>
<p>These are both undefined.</p>
<p>Input is <code>los gatos, california</code></p> | <p><code>.split</code> results in an array output but you're destructuring it as if it were an object.</p>
<p>Do</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const [city, co... | How do I use es6 syntax with split? | javascript | -6 | 67 | 1 | 72,167,388 | 72,167,388 | 5 | true | 2022-05-09T05:34:42.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I use es6 syntax with split?<pre><code> const {city, country} = input.split(/\s*,\s*/);
</code></pre>
<p>These are both undefined.</p>
<p>Inpu... |
72,144,829 | Which Java version is the fastest on and is supported by Android?<p>I heard that Java is becoming faster on newer versions of Android that it's almost as fast as C++, and the performance depends on the type of code/operations. Is this true? If it is, which Java version is the fastest on Android and is supported for And... | <blockquote>
<p>I heard that Java is becoming faster on newer versions of Android that it's almost as fast as C++,</p>
</blockquote>
<p>The <a href="https://en.wikipedia.org/wiki/Java_(software_platform)" rel="nofollow noreferrer">Java platform</a> has had performance around that of C++ for a couple decades. Sometimes ... | Which Java version is the fastest on and is supported by Android? | java|android|performance|version|language-comparisons | -4 | 449 | 1 | 72,146,682 | 72,146,682 | 5 | true | 2022-05-06T16:40:49.210Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Which Java version is the fastest on and is supported by Android?<p>I heard that Java is becoming faster on newer versions of Android that it's almost as fas... |
72,228,914 | Excel convert digits into respective words<p><img src="https://i.stack.imgur.com/RlnDI.png" alt="Click to view Image" /></p>
<p>I would like to convert the number of digits in excel into respective words as shown in the picture above. How can I achieve this functionality in an excel sheet? Thanks for the answers.</p> | <ol>
<li>In <strong>Formulas > Name Manager</strong>, define a named array containing the names of the digits as text:<br />
<a href="https://i.stack.imgur.com/RnLzy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RnLzy.png" alt="enter image description here" /></a></li>
<li>Select the range B2:E3. Enter t... | Excel convert digits into respective words | excel|vba|excel-formula | -3 | 79 | 1 | 72,229,281 | 72,229,281 | 6 | true | 2022-05-13T11:34:04.870Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Excel convert digits into respective words<p><img src="https://i.stack.imgur.com/RlnDI.png" alt="Click to view Image" /></p>
<p>I would like to convert the n... |
72,220,308 | KMM: Compilation failed: Unexpected IrType kind: KIND_NOT_SET<p>I'm trying to run tests in the shared library.</p>
<p><strong>Setup</strong> (versions should be the same for both machines - all are up to date as of today):</p>
<pre><code>Kotlin 1.6.21 (tried 1.6.20 and 1.6.10)
OpenJDK 11.0.15 (via Homebrew)
IntelliJ
... | <p>We encounter the same problem when running on Xcode, it was caused by upgrading the third party libraries, and one of the library need Kotlin 1.7 beta.</p>
<p>You can check what you have done before encounter the problem, if you manage you code with codebase, you can compare the codes between different commits and t... | KMM: Compilation failed: Unexpected IrType kind: KIND_NOT_SET | kotlin|kotlin-multiplatform|kotlin-multiplatform-mobile | 15 | 412 | 2 | 72,236,423 | 72,236,423 | 7 | true | 2022-05-12T18:08:42.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
KMM: Compilation failed: Unexpected IrType kind: KIND_NOT_SET<p>I'm trying to run tests in the shared library.</p>
<p><strong>Setup</strong> (versions should... |
72,155,476 | Is this "greedy" += behavior of lists guaranteed?<p>I occasionally use the "trick" to extend a list by a mapped version of itself, for example to efficiently compute powers of 2:</p>
<pre><code>from operator import mul
powers = [1]
powers += map(mul, [2] * 10, powers)
print(powers) # prints [1, 2, 4, 8, 1... | <p>I don't see any tests or docs that the greedy behavior is guaranteed; however, I do think it is the expected behavior and that code in the wild relies on it.</p>
<p>FWIW, <code>+=</code> with lists is equivalent to <code>list.extend()</code>, so your "trick" boils down to:</p>
<pre><code>>>> power... | Is this "greedy" += behavior of lists guaranteed? | python|list|language-lawyer | 15 | 454 | 1 | 72,155,954 | 72,155,954 | 7 | true | 2022-05-07T18:43:49.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is this "greedy" += behavior of lists guaranteed?<p>I occasionally use the "trick" to extend a list by a mapped version of itself, for example to e... |
72,232,062 | Flutter Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null<p>Whenever I try to run my Flutter app I get this error,
it was running and I don't know why now it's not. I've even reset to previous commit and it still won't run.</p>
<pre><code>../../../development/fl... | <p>Some changes happened in null-safety properties at the last upgrade of Flutter 3.0.0. There are a few approaches to a solution.</p>
<p>1-) If you upgraded the latest Flutter version and if your error is in the Flutter Core codes you must try;</p>
<pre><code>- dart fix --apply
</code></pre>
<p>(Ref: <a href="https://... | Flutter Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null | flutter|dart | 7 | 11,207 | 7 | 72,247,146 | 72,247,146 | 7 | true | 2022-05-13T15:31:31.223Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null<p>Whenever I try to run my Flutter app I ... |
72,227,064 | Dynamic `case_when` that allows for different number of conditions and conditions itself<p>I'm looking for a dynamic way to specify some "condition parameters" and then feed that to a <code>case_when</code> operation or something else if better suited for that problem.</p>
<p>My goal is to separate the specif... | <p>A possible solution, base on <code>rlang</code>, is below.</p>
<p><strong>EXPLANATION</strong></p>
<ul>
<li><p>First, we need to create a string with the whole code for <code>case_when</code>, using the list <code>all_conditions</code> — that is what my <code>imap</code> does.</p>
</li>
<li><p>Second, using <code>rl... | Dynamic `case_when` that allows for different number of conditions and conditions itself | r|tidyverse | 7 | 529 | 1 | 72,228,273 | 72,228,273 | 7 | true | 2022-05-13T09:06:41.613Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dynamic `case_when` that allows for different number of conditions and conditions itself<p>I'm looking for a dynamic way to specify some "condition para... |
72,205,801 | Return column header if row values are above a certain threshold<p>I have a dataframe called <code>tt</code>. I want to create a new column called Ethnicity where I want to have a column header for every row value that is more than 80%. If no row has one value that is greater than 80%, then I want to have string 'MIX' ... | <p>We can use <code>max.col</code> to return the <code>first</code> column index (for each row) that shows value greater than 0.8, then assign <code>MIX</code> for those cases where there are none to <code>"MIX"</code></p>
<pre><code>tt$Ethnicity <- names(tt)[-1][max.col(tt[-1] > 0.8, "first")... | Return column header if row values are above a certain threshold | r | 8 | 113 | 5 | 72,205,890 | 72,205,890 | 8 | true | 2022-05-11T18:15:41.913Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Return column header if row values are above a certain threshold<p>I have a dataframe called <code>tt</code>. I want to create a new column called Ethnicity ... |
72,139,268 | Why does an optional argument in a template constructor for enable_if help the compiler to deduce the template parameter?<p>The minimal example is rather short:</p>
<pre><code>#include <iostream>
#include <array>
#include <type_traits>
struct Foo{
//template <class C>
//Foo(C col, typen... | <p>Template argument deduction does not work this way.</p>
<p>Suppose you have a template and a function using a type alias of that template:</p>
<pre><code>template <typename T>
struct foo;
template <typename S>
void bar(foo<S>::type x) {}
</code></pre>
<p>When you call the function, eg <code>foo(1)... | Why does an optional argument in a template constructor for enable_if help the compiler to deduce the template parameter? | c++|templates|enable-if | 8 | 175 | 3 | 72,139,527 | 72,139,527 | 8 | true | 2022-05-06T09:34:27.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does an optional argument in a template constructor for enable_if help the compiler to deduce the template parameter?<p>The minimal example is rather sho... |
72,188,613 | k8s how to exec to distroless container<p>I want to delete a specific file from a cronJob to the following container, the problem is that when I run exec I got error, how can I exec to distroless container (k8s v1.22.5) and delte the file from a cronJob, which option do we have?</p>
<p>this is the deployment</p>
<pre><... | <p>The point of using <code>distro-less</code> is to have a minimal amount of tools/software packaged in the image. This means the removal of unnecessary tools like <code>shell</code> from the image.</p>
<p>You may work around using, however it may depend on your objective:</p>
<pre><code>kubectl debug -it <POD_TO_D... | k8s how to exec to distroless container | docker|kubernetes|containers | 7 | 902 | 2 | 72,188,761 | 72,188,761 | 8 | true | 2022-05-10T14:55:13.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
k8s how to exec to distroless container<p>I want to delete a specific file from a cronJob to the following container, the problem is that when I run exec I g... |
72,224,263 | MutableStateflow Value Vs Update vs Emit<p>Let say I have a <a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-mutable-state-flow/index.html" rel="noreferrer">MutableStateFlow</a> variable. What is the main differences and usage of the three cases</p>
<pre><code>mutabl... | <p><code>emit()</code> is nothing but a <code>suspend</code> function which internally uses the <code>mutable.value = newValue</code>.</p>
<p>The <code>update {} </code> is used for atomic updates i.e. for managing/handling concurrent operations which internally uses <code>compareAndSet</code> to (obviously) compare th... | MutableStateflow Value Vs Update vs Emit | android|kotlin|setter|kotlin-stateflow | 9 | 976 | 1 | 72,225,241 | 72,225,241 | 9 | true | 2022-05-13T03:54:06.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MutableStateflow Value Vs Update vs Emit<p>Let say I have a <a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.f... |
72,173,127 | SFINAE doesn't work in recursive function<p>Let's create <a href="https://en.wikipedia.org/wiki/Currying" rel="noreferrer">currying</a> function.</p>
<pre><code>template <typename TFunc, typename TArg>
class CurryT
{
public:
CurryT(const TFunc &func, const TArg &arg)
: func(func), arg(arg )
... | <p>Your <code>operator()</code> overload is completely unconstrained and therefore claims to be callable with any set of arguments. Only declarations, not definitions, are inspected to determine which function to call in overload resolution. If substitution into the definition then fails, SFINAE does not apply.</p>
<p>... | SFINAE doesn't work in recursive function | c++|templates|recursion|sfinae|overload-resolution | 7 | 359 | 2 | 72,173,754 | 72,173,754 | 9 | true | 2022-05-09T13:53:42.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SFINAE doesn't work in recursive function<p>Let's create <a href="https://en.wikipedia.org/wiki/Currying" rel="noreferrer">currying</a> function.</p>
<pre><c... |
72,218,980 | GCC v12.1 warning about serial compilation<p>I have upgraded my whole <a href="https://archlinux.org/packages/core/x86_64/gcc/" rel="nofollow noreferrer"><em>arch linux</em></a> system today (12<sup>th</sup> May, 2022). <code>gcc</code> was also upgraded from <code>v11.2</code> to <strong><code>v12.1</code></strong>. I... | <p>Apparently that is a recent change in the <code>-flto</code> option. With a little bit of variation in the google search I was able to find <a href="https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg258441.html" rel="noreferrer">this mail conversation</a>:</p>
<blockquote>
<p>Likewise if people just use -flto ... | GCC v12.1 warning about serial compilation | c++|gcc|g++|gcc-warning | 9 | 1,225 | 1 | 72,222,512 | 72,222,512 | 9 | true | 2022-05-12T16:15:19.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GCC v12.1 warning about serial compilation<p>I have upgraded my whole <a href="https://archlinux.org/packages/core/x86_64/gcc/" rel="nofollow noreferrer"><em... |
72,210,211 | Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null<p>when i made flutter upgrade then run my app this error occurs.</p>
<p>../../../development/tools/flutter/.pub-cache/hosted/pub.dartlang.org/responsive_sizer-3.0.6+1/lib/src/helper.dart:56:33: Warning: Operand of null-aware oper... | <p>This is a warning not an error. In Flutter 3 the <code>instance</code> property on bindings such as <code>WidgetsBinding</code> and <code>SchedulerBinding</code> is now non-nullable, hence using the null-aware operator <code>?</code> or the null assertion operation <code>!</code> will lead to this warning.</p>
<p>If... | Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null | flutter | 12 | 8,563 | 2 | 72,239,902 | 72,239,902 | 10 | true | 2022-05-12T04:41:31.963Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null<p>when i made flutter upgrade then run my app this error occurs.</... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.