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,886,901 | The best way to call a function automatically, each time a class is used?<p>I'm creating a class to hold functions that all have a similar goal and as I'm typing this out I realize that all of the functions will need to use the same 80% of their code, which involves connecting to the networking devices first.</p>
<p>Wh... | <p>You're using your class as a "pure class". You need to create instances instead.</p>
<pre class="lang-py prettyprint-override"><code>class NetDevice(object):
def __init__(self, address, username, password, device_type = "cisco_ios"):
self.address = address
self.username = use... | The best way to call a function automatically, each time a class is used? | python|python-3.x | 1 | 48 | 1 | 72,887,260 | 72,887,260 | 2 | true | 2022-07-06T16:20:13.037Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The best way to call a function automatically, each time a class is used?<p>I'm creating a class to hold functions that all have a similar goal and as I'm ty... |
72,891,394 | How to do selected one hot encoding on pyspark?<p>Here's my dataset</p>
<pre><code>+-------+-------+
| id|apps_id|
+-------+-------+
|7445640| 146|
|5592981| 929|
|5103715| 929|
| 386222| 114|
|7674331| 146|
+-------+-------+
</code></pre>
<p>Here's what I want</p>
<p>I have list like this (editable)... | <p>You can use the <code>pivot</code> function.</p>
<pre><code>df = df.groupBy('id', 'apps_id').pivot('apps_id').count().select('id', *list_selected_apps_id).fillna(0)
df.show(truncate=False)
# +-------+---+---+
# |id |146|929|
# +-------+---+---+
# |7445640|1 |0 |
# |7674331|1 |0 |
# |5592981|0 |1 |
# |5103... | How to do selected one hot encoding on pyspark? | python|pandas|pyspark | 0 | 48 | 1 | 72,891,549 | 72,891,549 | 2 | true | 2022-07-07T01:32:20.437Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do selected one hot encoding on pyspark?<p>Here's my dataset</p>
<pre><code>+-------+-------+
| id|apps_id|
+-------+-------+
|7445640| 146|
|5... |
72,893,286 | Is there a way to pay by amount on stripe using JS?<p>Is there a way to initiate a stripe payment from the front end using stripe and js (I'm currently using Vue) without specifying products on the stripe dashboard. I would like something where I just the total amount and a payment page of that total amount gets charge... | <p>If you're using Checkout Session (hosted payment page by Stripe), you can:</p>
<ol>
<li>Ask user for the donation amount at client/frontend</li>
<li>Send the donation amount to backend to create a Checkout Session with ad-hoc <code>price_data</code> instead of <code>price</code> under <code>line_items</code>: <a hre... | Is there a way to pay by amount on stripe using JS? | javascript|vue.js|frontend|stripe-payments | 0 | 48 | 1 | 72,894,425 | 72,894,425 | 2 | true | 2022-07-07T06:39:04.317Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to pay by amount on stripe using JS?<p>Is there a way to initiate a stripe payment from the front end using stripe and js (I'm currently using... |
72,899,737 | Error in true false output in Array Problem<p>Here's the question:</p>
<blockquote>
<p>A Narcissistic Number is a positive number which is the sum of its own digits, each raised to the power of the number of digits in a given base. In this Kata, we will restrict ourselves to decimal (base 10).</p>
<p>For example, take ... | <ol>
<li><a href="https://stackoverflow.com/questions/14879691/get-number-of-digits-with-javascript">Numbers don't have</a> <code>.length</code>, convert to string first</li>
<li><code>vLen[i]</code>, you cant treat a number as array, again, <a href="https://stackoverflow.com/questions/13955738/javascript-get-the-secon... | Error in true false output in Array Problem | javascript|arrays|math|pow | -2 | 48 | 3 | 72,899,878 | 72,899,878 | 2 | true | 2022-07-07T14:36:51.960Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error in true false output in Array Problem<p>Here's the question:</p>
<blockquote>
<p>A Narcissistic Number is a positive number which is the sum of its own... |
72,896,326 | When to use nested routes in react?<p>Hi guys I hope you are doing well
I've been learning react lately, now I'm learning React Router 6 from their documentation and I came across nested routes. I perfectely understood how to implement them but what I didnt grasp is:
When to use nested routes in a react app?
please can... | <p>I suppose you are asking why one would use nested routes versus a flat list of routes with each path explicitly fully "quantified". Nesting routes mostly serves to make laying out the routes and UI a bit more intuitive.</p>
<p>Flat list of fully "quantified" routes:</p>
<pre><code><Routes>
... | When to use nested routes in react? | reactjs|react-router | 1 | 48 | 1 | 72,901,092 | 72,901,092 | 2 | true | 2022-07-07T10:38:54.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When to use nested routes in react?<p>Hi guys I hope you are doing well
I've been learning react lately, now I'm learning React Router 6 from their documenta... |
72,902,948 | SwiftUI - Toggle keyboard type (default/numeric) using Toggle switch?<p>I am creating an application setup screen in iOS using SwiftUI, where a user will enter a password and then confirm it. I have created a <code>ToolbarItemGroup</code> for my keyboard that will let the user toggle between a numeric password and a c... | <p>The keyboard once created can be cached, so try like the following (everywhere needed):</p>
<pre><code> SecureField("Confirm Password", text: $viewModel.confirmPassword)
.modifier(NoAutocapitalizationViewModifier())
.padding()
.overlay(RoundedRectangle(cornerRadius: 10.0).strokeB... | SwiftUI - Toggle keyboard type (default/numeric) using Toggle switch? | ios|swift|swiftui|uikeyboard|uikeyboardtype | 2 | 48 | 1 | 72,903,132 | 72,903,132 | 2 | true | 2022-07-07T18:58:54.707Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SwiftUI - Toggle keyboard type (default/numeric) using Toggle switch?<p>I am creating an application setup screen in iOS using SwiftUI, where a user will ent... |
72,903,585 | WPF DataGrid VerticalScrollbar not working<p>I have a DataGrid that is populated from my MySQL Database in the code behind like this.</p>
<pre><code> public void FillGrid()
{
string sql = "SELECT * FROM employees ORDER BY firstname";
using (MySqlConnection cnn = DatabaseInterface.OpenC... | <p>The reason for that behavior is the DataGrid-Property <code>IsHitTestVisible="False"</code></p> | WPF DataGrid VerticalScrollbar not working | c#|mysql|wpf|datagrid | -1 | 48 | 1 | 72,907,137 | 72,907,137 | 2 | true | 2022-07-07T20:00:09.527Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WPF DataGrid VerticalScrollbar not working<p>I have a DataGrid that is populated from my MySQL Database in the code behind like this.</p>
<pre><code> publ... |
72,915,814 | How can I combine multiple lists of separated bit values into strings?<p>I have a list of lists containing 32 individual bits. I want to separate these values into 4 strings of binary digits, each representing a byte.</p>
<p>My data looks like:</p>
<pre><code>array = [[1, 0, 0, 0, 1, 0, 1, 0],
[0, 1, 1, 0, 0, ... | <p>Use a list comprehension to iterate the items, and join each item by converting it to a string:</p>
<pre><code>>>> array = [[1, 0, 0, 0, 1, 0, 1, 0],
... [0, 1, 1, 0, 0, 0, 0, 0],
... [0, 0, 0, 0, 1, 0, 0, 0],
... [0, 0, 1, 1, 1, 0, 1, 1]]
>>> array = [''.join(str(n) for ... | How can I combine multiple lists of separated bit values into strings? | python|arrays|string | -1 | 48 | 2 | 72,915,936 | 72,915,936 | 2 | true | 2022-07-08T18:50:36Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I combine multiple lists of separated bit values into strings?<p>I have a list of lists containing 32 individual bits. I want to separate these value... |
72,916,663 | Fetch data is shown in console.log, but not in HTML TAG<p>I'm trying to fetch a JSON data from our server and then inserting it in a <code><script></code> TAG in <strong>client-side</strong>. See below:</p>
<pre><code><script>
const bodyTag = document.getElementsByTagName("body")[0];
cons... | <p>Anything you assign to <code>innerHTML</code> will be implicitly converted to a string. Hence, the <code>[object Object]</code> you're seeing. In order to see the actual JSON value, you can explicitly convert this object to a JSON-string:</p>
<pre class="lang-js prettyprint-override"><code>importmap.innerHTML = JSON... | Fetch data is shown in console.log, but not in HTML TAG | javascript|html|fetch-api|innerhtml | 1 | 48 | 2 | 72,916,716 | 72,916,716 | 2 | true | 2022-07-08T20:26:28.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fetch data is shown in console.log, but not in HTML TAG<p>I'm trying to fetch a JSON data from our server and then inserting it in a <code><script></co... |
72,921,995 | Vue.js 2.6.11. How to hide all li elements except one on click during loop?<p>For a general understanding of the essence of the issue, I will attach screenshots from the layout.</p>
<p><a href="https://i.stack.imgur.com/1vQV8.png" rel="nofollow noreferrer">static layout</a></p>
<p><a href="https://i.stack.imgur.com/Tup... | <p>you can add new data property called: <code>activeQuestion</code>.</p>
<ul>
<li><p>When a question is clicked => assign it to <code>activeQuestion</code></p>
</li>
<li><p>When cancel is clicked => assign <code>null</code> to <code>activeQuestion</code></p>
</li>
</ul>
<p>Then in template, make an if condition ... | Vue.js 2.6.11. How to hide all li elements except one on click during loop? | javascript|html|vue.js|vuejs2|bootstrap-5 | 0 | 48 | 1 | 72,922,246 | 72,922,246 | 2 | true | 2022-07-09T14:03:47.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vue.js 2.6.11. How to hide all li elements except one on click during loop?<p>For a general understanding of the essence of the issue, I will attach screensh... |
72,925,751 | I can't find the location to select for the target device in VS Code. (Flutter)<p>I usually use Android studio for application development with Flutter.
I'm trying to use VSCode, but as the title says, I can't find the selection of the target device I want to run.</p>
<p>For the time being, I selected [Run and Debug] f... | <p>At the very bottom of your editor, there is a bar, in this bar you should see the name of the currently selected platform, if you click on the platform, you will bring up a menu where you can select the device.</p>
<p><a href="https://i.stack.imgur.com/nJMF4.png" rel="nofollow noreferrer"><img src="https://i.stack.i... | I can't find the location to select for the target device in VS Code. (Flutter) | flutter|visual-studio-code | 1 | 48 | 1 | 72,925,784 | 72,925,784 | 2 | true | 2022-07-10T02:16:38.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I can't find the location to select for the target device in VS Code. (Flutter)<p>I usually use Android studio for application development with Flutter.
I'm ... |
72,926,123 | How to detect owned products with in_app_purchases in Flutter<p>I've been following the <code>in_app_purchases</code> package <a href="https://pub.dev/packages/in_app_purchase/example" rel="nofollow noreferrer">example</a></p>
<p>I have implemented the in app purchase. A user can buy a product and the listener works to... | <p>You should keep track of what users purchased yourself. For example on the phone or on a server.</p>
<p>There is plenty of documentation about payment. Apple for example:</p>
<p><a href="https://developer.apple.com/documentation/storekit/in-app_purchase/original_api_for_in-app_purchase/restoring_purchased_products" ... | How to detect owned products with in_app_purchases in Flutter | android|flutter|google-play|flutter-in-app-purchase | 2 | 48 | 1 | 72,927,427 | 72,927,427 | 2 | true | 2022-07-10T04:21:48.653Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to detect owned products with in_app_purchases in Flutter<p>I've been following the <code>in_app_purchases</code> package <a href="https://pub.dev/packag... |
72,926,041 | Is there any replacement for tf.random_gamma in pytorch?<p>I'm converting a TensorFlow repository to PyTorch code. I came across this line of code:</p>
<pre><code>tf.squeeze(tf.random_gamma(shape =(self.n_sample,),alpha=self.alpha+tf.to_float(self.B)))
</code></pre>
<p>I would like to know the equivalent of <strong>tf.... | <p>It looks like <code>torch.distributions.gamma.Gamma</code> can be used in this case. Here is an example:</p>
<pre><code>import torch
from torch.distributions.gamma import Gamma
def random_gamma(shape, alpha, beta=1.0):
alpha = torch.ones(shape) * torch.tensor(alpha)
beta = torch.ones(shape) * torch.tensor(beta... | Is there any replacement for tf.random_gamma in pytorch? | python|tensorflow|pytorch | -1 | 48 | 1 | 72,929,612 | 72,929,612 | 2 | true | 2022-07-10T03:53:45.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there any replacement for tf.random_gamma in pytorch?<p>I'm converting a TensorFlow repository to PyTorch code. I came across this line of code:</p>
<pre>... |
72,934,954 | How two sum multiple objects in a list matching a certain condition<p>I'm struggling to understand how to sum <strong>multiple</strong> objects in a list together <strong>matching certain conditions</strong></p>
<p>I have :</p>
<pre><code>List<TruckFruit> = truckFruits;
</code></pre>
<pre><code>class TruckFruit e... | <p>This could do it:</p>
<pre><code>final List<TruckFruit> newTruckFruitsList = truckFruits.fold(<TruckFruit>[], (previousValue, element) {
TruckFruit? match = previousValue.firstWhereOrNull(
(e) => e.shape == element.shape && e.fruitType == element.fruitType);
if (match != null) {
... | How two sum multiple objects in a list matching a certain condition | flutter|dart | 1 | 48 | 2 | 72,935,381 | 72,935,381 | 2 | true | 2022-07-11T07:18:12.520Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How two sum multiple objects in a list matching a certain condition<p>I'm struggling to understand how to sum <strong>multiple</strong> objects in a list tog... |
72,941,283 | How to run a while loop in python using a Lambda<p>I am trying to learn Python and currently studying while loops and I am embarrassed to even ask this question cause I feel I should be able to do this, but I am very confused.</p>
<pre><code>def summation(n, term):
"""Return the sum of numbers 1 thro... | <p>This is how you can do it with a while loop:</p>
<pre><code>def summation_while(n, term):
assert n >= 1
counter = 1
total = 0
while counter <= n:
total += term(counter)
counter += 1
return total
</code></pre>
<p>Test:</p>
<pre><code>summation_while(5, lambda x: x**3)
</code>... | How to run a while loop in python using a Lambda | python|while-loop | -2 | 48 | 1 | 72,941,510 | 72,941,510 | 2 | true | 2022-07-11T15:51:18.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to run a while loop in python using a Lambda<p>I am trying to learn Python and currently studying while loops and I am embarrassed to even ask this quest... |
72,944,758 | How to change default background colour in tkinter<p>I want to have all my labels and buttons to have a white background.
I know I can use <code>bg="white"</code> in each one but I was thinking if there was a way I could change the default colour to white or make it so that all widgets have a white background... | <p>thanks to @acw1668 's comment, can do
<code>window.option_add("*Label*Background", "white")</code>
and
<code>window.option_add("*Button*Background", "white")</code>
to solve it. Just thought id put it as an answer in case people don't see the comment and what not.</p> | How to change default background colour in tkinter | python|tkinter | 1 | 48 | 1 | 72,946,058 | 72,946,058 | 2 | true | 2022-07-11T21:16:34.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to change default background colour in tkinter<p>I want to have all my labels and buttons to have a white background.
I know I can use <code>bg="whi... |
72,951,235 | How to add an ID to every div element created inside a .forEach loop?<p>I want to create an ID for every booksDisplay div because I want bookOne, bookTwo, bookThree and bookFour to have their own containers. Right now, textNode runs through every div and I want for every div to be seperate. I could have created divs in... | <p>You mean you want the id on the html tag? Why not use the loop you already have and use the index as the id?<br>
Also, no need to create a variable for each book, just put them directly in an array:</p>
<pre class="lang-js prettyprint-override"><code>const booksContainer = document.getElementById('booksContainer');
... | How to add an ID to every div element created inside a .forEach loop? | javascript|html | -1 | 48 | 2 | 72,951,508 | 72,951,508 | 2 | true | 2022-07-12T11:00:11.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add an ID to every div element created inside a .forEach loop?<p>I want to create an ID for every booksDisplay div because I want bookOne, bookTwo, bo... |
72,953,221 | get the next value returned by a for loop's generator expression<p>I am working on a program where I need to test each value in a list against a large number of conditions for which I am using a standard <code>for item in list</code> loop. However, in some rare circumstances I need to read in three items to check the c... | <p>I think this is a clean solution:</p>
<pre><code>def gen_tuples(xs):
ixs = iter(xs)
for x in ixs:
if x == 5:
yield (x, next(ixs), next(ixs))
else:
yield (x,)
for t in gen_tuples([1, 2, 3, 4, 5, 6, 7, 8, 9]):
print(t)
</code></pre>
<p>Output:</p>
<pre class="lang-... | get the next value returned by a for loop's generator expression | python|python-3.9 | 0 | 48 | 3 | 72,953,473 | 72,953,473 | 2 | true | 2022-07-12T13:36:00.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
get the next value returned by a for loop's generator expression<p>I am working on a program where I need to test each value in a list against a large number... |
72,954,233 | React. How to show data loading message on API call<p>Trying to render an API call which returns an array of products.</p>
<p>How to show loading message on products render. (Currently the "loading" message is not being displayed)</p>
<p>useGetProducts.js</p>
<pre><code>import { useEffect, useState } from &qu... | <p>What is happening here is that you're calling <code>fetchData</code> without waiting for it, which is immediately setting <code>loaded</code> to true.</p>
<p>I don't think there is a need for the <code>fetchData</code> function here, so either remove it or await it:</p>
<pre><code>const [products, setProducts] = use... | React. How to show data loading message on API call | reactjs | 2 | 48 | 2 | 72,954,299 | 72,954,299 | 2 | true | 2022-07-12T14:46:21.917Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React. How to show data loading message on API call<p>Trying to render an API call which returns an array of products.</p>
<p>How to show loading message on ... |
72,954,520 | Bootstrap: Horizontal Align H1 and dropdown button<p>I put a dropdown button beside an H1 tag and I want the dropdown button moved up just a bit because they don't look aligned right now.</p>
<p>I'm using Bootstrap 5.1.3</p>
<p><a href="https://i.stack.imgur.com/muIwB.png" rel="nofollow noreferrer"><img src="https://i.... | <p>You can use Bootstrap's flexbox class and attributes to align items</p>
<p><a href="https://getbootstrap.com/docs/5.0/utilities/flex/" rel="nofollow noreferrer">https://getbootstrap.com/docs/5.0/utilities/flex/</a></p>
<p>In this case, I just did center but you can use whatever attribute that gives you the positioni... | Bootstrap: Horizontal Align H1 and dropdown button | html|css|twitter-bootstrap|bootstrap-5 | 1 | 48 | 1 | 72,954,657 | 72,954,657 | 2 | true | 2022-07-12T15:06:56.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bootstrap: Horizontal Align H1 and dropdown button<p>I put a dropdown button beside an H1 tag and I want the dropdown button moved up just a bit because they... |
72,962,203 | JS creating new object array using another object<p>I have below object array</p>
<pre><code>var testdata = [{
TYPE: 'type 1', Category: 'Booking', Count : 5
},
{
TYPE: 'type 2', Category: 'Booking', Count : 15
},
{
... | <p>You could try something like this:</p>
<pre><code>$.each(testdata, function(key, value) {
if (!bookingarray[value.Category]) {
bookingarray[value.Category] = {} // if example "Booking" does not exist in resultData, then create it
}
bookingarray[value.Category][value.TYPE] = value.Count
})
</code>... | JS creating new object array using another object | javascript|jquery|arrays | 1 | 48 | 2 | 72,962,297 | 72,962,297 | 2 | true | 2022-07-13T07:08:22.983Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JS creating new object array using another object<p>I have below object array</p>
<pre><code>var testdata = [{
TYPE: 'type 1', Category: 'Bo... |
72,986,305 | Obtaining Friends Count And Favorites Count From User Object<p>I am having trouble obtaining <code>friends_count</code> and <code>favorites_count</code> using the <code>search_all_tweets</code> Tweepy V2 API call.</p>
<p>GeeksForGeeks lists <code>friends_count</code> and <code>favorites_count</code> as attributes ( <a ... | <p>The fields listed by GeeksForGeeks are the User's fields in the Twitter V1 API.</p>
<p>There is unfortunately no way to get the number of likes of an User with the Twitter V2 API. You can try to get all his likes and count the total number of returned tweets, but that will work only if the User has only a few likes ... | Obtaining Friends Count And Favorites Count From User Object | python|twitter|tweepy|twitterapi-python|twitter-api-v2 | 1 | 48 | 1 | 72,990,600 | 72,990,600 | 2 | true | 2022-07-14T20:26:51.683Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Obtaining Friends Count And Favorites Count From User Object<p>I am having trouble obtaining <code>friends_count</code> and <code>favorites_count</code> usin... |
72,993,291 | How to remove hyphens from all the xml document with xslt 1.0<p>Im really new with XSLT and I want to remove all the hyphens in my XML, whether it is in the attribute value or in text, I have this XML:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<SECTION name="-001">
... | <p>The correct answer is:</p>
<p><strong>XSLT 1.0</strong></p>
<pre><code><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space el... | How to remove hyphens from all the xml document with xslt 1.0 | xml|xslt | 1 | 48 | 2 | 72,995,290 | 72,995,290 | 2 | true | 2022-07-15T11:29:42.793Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove hyphens from all the xml document with xslt 1.0<p>Im really new with XSLT and I want to remove all the hyphens in my XML, whether it is in the ... |
73,000,580 | How to reopen a running .sh script in a new terminal in ubuntu<p>I'm running a headless linux server which I've ssh'd into. Now that only gives me 1 terminal to work with, and I can startup a minecraft server with a .sh script. But if I close that ssh terminal, how would I get access to the same .sh script that is stil... | <p>You could use <a href="https://github.com/tmux/tmux/wiki" rel="nofollow noreferrer">tmux</a>.</p>
<p>When you ssh to the server for the first time, you could start a tmux session:</p>
<pre class="lang-bash prettyprint-override"><code>tmux
</code></pre>
<p>And then run your <code>a.sh</code>.</p>
<p>When you close th... | How to reopen a running .sh script in a new terminal in ubuntu | linux|sh | 0 | 48 | 1 | 73,000,623 | 73,000,623 | 2 | true | 2022-07-15T23:57:18.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to reopen a running .sh script in a new terminal in ubuntu<p>I'm running a headless linux server which I've ssh'd into. Now that only gives me 1 terminal... |
73,008,346 | Efficient way of creating this component?<p><em><strong>Description:</strong></em>
I'm a novice at reactJS and Javascript in general.
I'm creating a component whereby I'm grabbing 5 social media icons (Facebook, Instagram, LinkedIn, Twitter, Github) and creating a simple component whereby they become clickable buttons ... | <p>This looks good as is, but if you have a lot of these icons, you can clean it up by dynamically lazy loading them. Bear in mind this increases the complexity. Additionally, you'll still need to have a map of the icon names and the path to the exported module (since they can be from different modules)</p>
<p>codesand... | Efficient way of creating this component? | reactjs | 0 | 48 | 2 | 73,008,547 | 73,008,547 | 2 | true | 2022-07-16T23:43:48.097Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Efficient way of creating this component?<p><em><strong>Description:</strong></em>
I'm a novice at reactJS and Javascript in general.
I'm creating a componen... |
73,008,782 | What am I missing for my input validation to execute properly?<p>I am trying to use input validation with a while loop to ensure user cannot enter anything for a direction that is not north, south, east, or west. I am able to compile without error but currently I cannot enter anything in direction that doesn't yield my... | <pre><code> string north;
string south;
string east;
string west;
</code></pre>
<p>These lines of code declare four <code>std::string</code> objects. By default, all four of them are completely empty. Nothing in the code that follows changes them, so they'll remain empty.</p>
<pre><code> while (di... | What am I missing for my input validation to execute properly? | c++|validation | 1 | 48 | 2 | 73,008,802 | 73,008,802 | 2 | true | 2022-07-17T01:58:27.663Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What am I missing for my input validation to execute properly?<p>I am trying to use input validation with a while loop to ensure user cannot enter anything f... |
73,008,413 | Is it possible to pass the google api client object to a function?<p>I have got the following authentication function:</p>
<pre><code>course_id = "Classexample"
def connect():
creds = None
if os.path.exists('token.json'):
creds = Credentials.from_authorized_user_file('token.json', SCOPES)
... | <p>You're correct in your assumption and your code appears to be fine (and you should try to not mash everything into a single function).</p>
<p>Given your statement, that it works as a single function, I suspect (!?) that what you're presenting as the code in your question is incorrect.</p>
<p>When you say "Runni... | Is it possible to pass the google api client object to a function? | python|python-3.x|api|google-api|google-classroom | 0 | 48 | 1 | 73,013,249 | 73,013,249 | 2 | true | 2022-07-17T00:01:17.833Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to pass the google api client object to a function?<p>I have got the following authentication function:</p>
<pre><code>course_id = "Class... |
72,997,152 | pushReplacementNamed doesn't replace it just pushes on top if coming from an AlertDialog<p>Here's the code:</p>
<p>3 FILES home, main, and screen1</p>
<p>MAIN:</p>
<pre><code>import 'package:flutter/material.dart';
import 'home.dart';
import 'screen1.dart';
void main() {
runApp(MaterialApp(
home: Home(),
rou... | <p>This happens because <code>showDialog(AlertDialog(...))</code> is itself going to be pushed as a new route. So, when doing <a href="https://api.flutter.dev/flutter/widgets/Navigator/pushReplacementNamed.html" rel="nofollow noreferrer"><code>Navigator.pushReplacementNamed</code></a> inside the alert it is going to re... | pushReplacementNamed doesn't replace it just pushes on top if coming from an AlertDialog | flutter | 2 | 48 | 1 | 73,013,771 | 73,013,771 | 2 | true | 2022-07-15T16:35:48.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pushReplacementNamed doesn't replace it just pushes on top if coming from an AlertDialog<p>Here's the code:</p>
<p>3 FILES home, main, and screen1</p>
<p>MAI... |
73,017,007 | How can I return two different strings based on try/finally blocks using setTimeout<p>I am trying to return two different states based on the timer set on setTimeout in try/finally blocks but once I return the state in the try block, the finally block does not return anything. Is there a way to get around this? I am tr... | <p>Because <code>setTimeout</code> is async, the <code>return state</code> actually gets run before the setTimeout callback runs.<br />
So your state gets returned first, then when the callback runs, it will do nothing.
I don't think the <code>try...finally</code> will make any difference here.<br />
You would have to ... | How can I return two different strings based on try/finally blocks using setTimeout | javascript|redux | 0 | 48 | 2 | 73,018,074 | 73,018,074 | 2 | true | 2022-07-18T03:25:51Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I return two different strings based on try/finally blocks using setTimeout<p>I am trying to return two different states based on the timer set on se... |
73,015,643 | autocmd does not detect *.ott files<p>I'd like to have syntax highlighting on files with the <code>.ott</code> extension (using <a href="https://github.com/psosera/ott-vim" rel="nofollow noreferrer">ott-vim</a>), but I am not getting any colors when opening a file, even though <code>filetype=ott</code> is set. Re-setti... | <p>This is a conflict with the <code>zipPlugin</code> that is distributed with vim (<code>/usr/share/vim/current/plugin/zipPlugin.vim</code>), and which recognizes a <code>.ott</code> file as a zip archive. Hacky fix to remove that extension from those recognized by <code>zipPlugin</code>:</p>
<pre><code>" ~/.vimr... | autocmd does not detect *.ott files | vim|file-type|autocmd | 1 | 48 | 1 | 73,055,339 | 73,055,339 | 2 | true | 2022-07-17T22:00:49.770Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
autocmd does not detect *.ott files<p>I'd like to have syntax highlighting on files with the <code>.ott</code> extension (using <a href="https://github.com/p... |
72,876,389 | How does Chromium implement failIfMajorPerformanceCaveat?<p>I'm looking for the general algorithm/checks that Chromium does when you specify <code>failIfMajorPerformanceCaveat</code> to be true when creating a WebGL context on a canvas.</p>
<p>I searched the Chromium source code, but quickly got lost in the sea of resu... | <p>The only two references I could dig up are in <a href="https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/service/gles2_cmd_decoder.cc;l=3572;drc=970e9eac87551b0de2d5e5f263be44c9dd0e4a46" rel="nofollow noreferrer">/gpu/command_buffer/service/gles2_cmd_decoder.cc</a> and in <a href="https://s... | How does Chromium implement failIfMajorPerformanceCaveat? | google-chrome|canvas|webgl|chromium | 1 | 48 | 1 | 72,877,176 | 72,877,176 | 2 | true | 2022-07-05T23:09:09.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does Chromium implement failIfMajorPerformanceCaveat?<p>I'm looking for the general algorithm/checks that Chromium does when you specify <code>failIfMajo... |
72,943,130 | Python & Beautiful Soup - Extract text between a specific tag and class combination<p>I'm new to using Beautiful Soup and web scraping in general; I'm trying to build a dataframe that has the title, content, and publish date from a blog post style website (everything's on one page, there's a title, publish date, and th... | <p>You can use for example <code>tag.find_previous</code> to find to which block the paragraph belongs:</p>
<pre class="lang-py prettyprint-override"><code>from bs4 import BeautifulSoup
html_doc = """\
<h2 class = "thisYear" title = "Click here to display/hide information">
&qu... | Python & Beautiful Soup - Extract text between a specific tag and class combination | python|pandas|web-scraping|beautifulsoup|html-parsing | 0 | 48 | 1 | 72,943,256 | 72,943,256 | 2 | true | 2022-07-11T18:34:01.337Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python & Beautiful Soup - Extract text between a specific tag and class combination<p>I'm new to using Beautiful Soup and web scraping in general; I'm trying... |
72,892,185 | Why does my BlockOperation continue after I add it to an OperationQueue?<p>Apple documentation says that Operations run synchronously. Why then does the code continue to run after an operation is added to a queue?</p>
<p>Here is my code:</p>
<pre><code>let op = BlockOperation(block: { print("Done") })
... | <p>You said:</p>
<blockquote>
<p>Apple documentation says that Operations run synchronously. Why then does the code continue to run after an operation is added to a queue?</p>
</blockquote>
<p>Your debug output is correct. The <code>BlockOperation</code> will run asynchronously with respect to the thread which added it... | Why does my BlockOperation continue after I add it to an OperationQueue? | swift|concurrency|nsoperationqueue|nsoperation | -1 | 48 | 1 | 72,924,007 | 72,924,007 | 2 | true | 2022-07-07T04:09:27.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does my BlockOperation continue after I add it to an OperationQueue?<p>Apple documentation says that Operations run synchronously. Why then does the code... |
72,922,573 | How to make a textbox function in a form?<p>I have an application I am making with multiple text boxes and I am trying to clean it up by making a text box function. However the name parameter itself needs to return a variable name and I am just not quite sure how to do that. I tried giving the parameter the
<code> [psv... | <p>It's unclear why is the <code>$name</code> parameter there in your function to begin with, I don't see any use for it. The other problem is that your function is not returning anything and your function invocation is not capturing anything either.</p>
<pre class="lang-bash prettyprint-override"><code>Add-Type -Assem... | How to make a textbox function in a form? | forms|powershell|winforms|textbox | 2 | 48 | 1 | 72,922,820 | 72,922,820 | 2 | true | 2022-07-09T15:21:28.237Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make a textbox function in a form?<p>I have an application I am making with multiple text boxes and I am trying to clean it up by making a text box fu... |
72,969,977 | Search elements in a list in another list and check each element exist or not<p>I have 2 lists as</p>
<pre><code>x = ["abc", "def", "ghi"]
y = ["ggg", "hhh", "abc", "yyy", "ttt", "uuu", "ooo". "def", "www... | <p><strong>Update</strong> add memory for <code>x</code> to search each <code>x</code> one-time to get better run-time.</p>
<pre><code>mem_x = {i: 'Not Found' for i in set(x)}
set_y = set(y)
for k,v in mem_x.items():
if k in set_y:
mem_x[k] = 'Present'
match = [mem_x[i] for i in x]
print(match)
</c... | Search elements in a list in another list and check each element exist or not | python|list | 0 | 48 | 3 | 72,970,012 | 72,970,012 | 2 | true | 2022-07-13T16:57:29.617Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Search elements in a list in another list and check each element exist or not<p>I have 2 lists as</p>
<pre><code>x = ["abc", "def", "... |
72,909,420 | R Conditionally mutate rows for specific groups<p>I would like to mutate certain rows meeting a condition for specific groups that meet another condition.</p>
<p><strong>The Aim:</strong></p>
<p>For example, I'm trying to extract the mother's name from the below dataset and apply it beside rows labelled with 'children'... | <p>The solution below:</p>
<ul>
<li>Extract the mother's name</li>
<li>Apply it beside rows labelled with 'children'</li>
<li>Deals with the occurrence of more wifes or none</li>
<li>Sort the data within the groups on birth.</li>
</ul>
<p><strong>A solution using <code>role</code>:</strong></p>
<pre class="lang-r prett... | R Conditionally mutate rows for specific groups | r|dplyr | 0 | 48 | 1 | 72,909,713 | 72,909,713 | 2 | true | 2022-07-08T09:32:23.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R Conditionally mutate rows for specific groups<p>I would like to mutate certain rows meeting a condition for specific groups that meet another condition.</p... |
72,863,895 | App Script - Nested ForEach looping on first and second col data<p>I have a set of areas where multiple tests were ran at different locations. If a test doesn't pass, locations are retested on a different date.</p>
<p>Currently, below function that was posted as a solution by @TheWizEd to my question (<a href="https://... | <h3>Modification points:</h3>
<ul>
<li>In your script, the 1st column of the source sheet is checked. In order to achieve your goal, I thought that 1st and 2nd columns are required to be checked.</li>
<li>About the output values in your script, only 2 elements are included in each array of <code>results</code> values. ... | App Script - Nested ForEach looping on first and second col data | google-apps-script | 0 | 48 | 1 | 72,864,058 | 72,864,058 | 2 | true | 2022-07-05T04:07:11.360Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
App Script - Nested ForEach looping on first and second col data<p>I have a set of areas where multiple tests were ran at different locations. If a test does... |
72,921,661 | Is is possible that I use separators other than comma in Rust's MacroMatch?<p>In the <a href="https://doc.rust-lang.org/reference/macros-by-example.html" rel="nofollow noreferrer">rust book</a> I see the definition of MacroMatch is like the following</p>
<pre><code>MacroMatch :
Token except $ and delimiters
| ... | <p>Not sure if you're using a different Rust version, but with your code on the current compiler (1.62) it outputs an error that includes what separators are available:</p>
<pre class="lang-none prettyprint-override"><code>error: `$a:expr` is followed by `>>`, which is not allowed for `expr` fragments
--> src... | Is is possible that I use separators other than comma in Rust's MacroMatch? | rust | 2 | 48 | 1 | 72,923,041 | 72,923,041 | 2 | true | 2022-07-09T13:14:33.257Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is is possible that I use separators other than comma in Rust's MacroMatch?<p>In the <a href="https://doc.rust-lang.org/reference/macros-by-example.html" rel... |
72,891,258 | Lower bound for Postgres integer type out of range?<p>Per Postgres <a href="https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-NUMERIC-TABLE" rel="nofollow noreferrer">documentation</a>, an <code>integer</code> type is defined between <code>-2147483648</code> and <code>+2147483647</code>.<br />
I th... | <p><strong>TLDR</strong>: <a href="https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-PRECEDENCE" rel="nofollow noreferrer"><strong>operator precedence</strong></a>.</p>
<p>This is tricky at first sight. The same cast of the lower bound seemingly fails for <code>smallint</code> and <code>bigint</code>,... | Lower bound for Postgres integer type out of range? | sql|postgresql|syntax|casting|integer | 3 | 48 | 1 | 72,891,880 | 72,891,880 | 2 | true | 2022-07-07T01:01:22.997Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Lower bound for Postgres integer type out of range?<p>Per Postgres <a href="https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-NUMERIC-TA... |
72,842,595 | python - sum values between unique pairs in ledger using hash tables or dictionaries<p>I'm looking at a big list of transactions, and want to simply summarize the total value sent between one account to another</p>
<p>Input:</p>
<pre><code>sources = ['A','A','A','A','A','B','B','B','B']
targets = ['C','C','C','D','D','... | <pre><code>d = dict.fromkeys(zip(sources, targets), 0)
for s, t, v in zip(sources, targets, values): d[(s, t)] += v
d
# {('A', 'C'): 5, ('A', 'D'): 5, ('B', 'C'): 5, ('B', 'D'): 5}
</code></pre> | python - sum values between unique pairs in ledger using hash tables or dictionaries | python | -1 | 48 | 2 | 72,842,657 | 72,842,657 | 2 | true | 2022-07-02T21:40:28.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
python - sum values between unique pairs in ledger using hash tables or dictionaries<p>I'm looking at a big list of transactions, and want to simply summariz... |
72,848,043 | Why does this code not create a heat map in R using ggplot?<p>Suppose we have a data frame <code>df</code> that looks like:</p>
<pre><code> team_1 team_2 team_3
very_effective 3 5 8
effective 5 6 9
ineffective 6 8 20
</code></pre>
<p>I want to... | <p><code>aes()</code> expects vectors for x- and y-values; not a crosstable, and also not undefined variables:</p>
<blockquote>
<p>Usage<br />
aes(x, y, ...)<br></p>
</blockquote>
<p>source: <a href="https://ggplot2.tidyverse.org/reference/aes.html" rel="nofollow noreferrer">https://ggplot2.tidyverse.org/reference/aes.... | Why does this code not create a heat map in R using ggplot? | r|ggplot2 | 0 | 48 | 1 | 72,848,157 | 72,848,157 | 2 | true | 2022-07-03T16:06:05.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does this code not create a heat map in R using ggplot?<p>Suppose we have a data frame <code>df</code> that looks like:</p>
<pre><code> te... |
72,769,959 | Matplotlib: bar/bin style plot of a piecewise constant function<p>I want to make a demonstration for the approximation of an integral of a continuous function with piecewise constant step functions.</p>
<p>The resulting plot should look something like this:</p>
<p><a href="https://i.stack.imgur.com/urLD2.gif" rel="nofo... | <p>You can use <a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.bar.html?highlight=bar#matplotlib.axes.Axes.bar" rel="nofollow noreferrer"><code>bar</code></a> with the <code>align</code> parameter:</p>
<pre><code>import numpy as np
x = np.linspace(0, 1, 11)
y = x**2 + 1
plt.plot(x, y, 'r-')
plt... | Matplotlib: bar/bin style plot of a piecewise constant function | python|matplotlib | 3 | 48 | 1 | 72,770,757 | 72,770,757 | 2 | true | 2022-06-27T09:39:07.947Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Matplotlib: bar/bin style plot of a piecewise constant function<p>I want to make a demonstration for the approximation of an integral of a continuous functio... |
72,805,627 | How does PIL Image save NumPy arrays with non-integer and non-positive values?<p>I have a NumPy array of size 28 x 280, which contains real number values (both positive and negative values). I am using the following code to save this array to file through a PIL Image -</p>
<pre><code>img = Image.fromarray(img)
img.save... | <p>If you want to save negative and floating point data as an image, you should probably use <strong>TIFF</strong> format.</p>
<p><strong>PNG</strong> is only able to store unsigned integer data at up to 16-bit/channel, i.e. in range 0..65535.</p>
<hr />
<p>Here is a demonstration of saving positive and negative floati... | How does PIL Image save NumPy arrays with non-integer and non-positive values? | python|image|numpy|python-imaging-library | 1 | 48 | 1 | 72,808,710 | 72,808,710 | 2 | true | 2022-06-29T17:32:33.493Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does PIL Image save NumPy arrays with non-integer and non-positive values?<p>I have a NumPy array of size 28 x 280, which contains real number values (bo... |
72,969,302 | Rewrite json object list into key value pairs<p>I am trying to format oauth token logs pulled from Google Workspace API using python. The objects returned from the google API call use a mix of formats.</p>
<p>Some sections are formatted like <code>"kind": "admin#reports#activity"</code>, which is pr... | <p>I tried using your sample log like this.</p>
<pre><code>import json
d = {"kind": "admin#reports#activity", "id": {"time": "2022-07-13T11:45:59.181Z", "uniqueQualifier": "<redacted>", "applicationName": "token", "cust... | Rewrite json object list into key value pairs | python|json|google-workspace | 1 | 48 | 2 | 72,971,021 | 72,971,021 | 2 | true | 2022-07-13T16:01:09.770Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rewrite json object list into key value pairs<p>I am trying to format oauth token logs pulled from Google Workspace API using python. The objects returned fr... |
72,831,353 | Getting SQL Column to print in Python<p>I have a code that prints out a specific column from an SQL query table. It prints out fine however I would like it to be put into a file and I cannot think of how to do that.</p>
<p>Here is what I have:</p>
<pre><code>#Connect to the database
testDBCon = sqlalchemy.create_engine... | <p>Depending on what type of file, pandas supports many formats For a simple csv file you can do:</p>
<pre class="lang-py prettyprint-override"><code>df.to_csv('file.csv', columns = ['PartNumber'], index = False)
</code></pre> | Getting SQL Column to print in Python | python|sql | 1 | 48 | 1 | 72,831,384 | 72,831,384 | 2 | true | 2022-07-01T15:16:05.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting SQL Column to print in Python<p>I have a code that prints out a specific column from an SQL query table. It prints out fine however I would like it t... |
72,938,990 | How to highlight differences between rows per key, per column in SQL?<p>Say I have a dataset that I know has a number of rows where the unique keys are the same but data on some other columns is different. I don't know which rows to choose in case of mismatch of data, so I will drop them all anyway, but I want to recor... | <p>Since you'll be using this with an arbitrary number of columns, I'd lean toward dynamic construction in a Snowflake query. There's only one function that does that and preserves the column names, and that's <code>object_construct</code>. You can use object_construct to create objects from the rows (as long as the ov... | How to highlight differences between rows per key, per column in SQL? | sql|snowflake-cloud-data-platform | 1 | 48 | 1 | 72,944,291 | 72,944,291 | 2 | true | 2022-07-11T12:57:34.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to highlight differences between rows per key, per column in SQL?<p>Say I have a dataset that I know has a number of rows where the unique keys are the s... |
72,831,894 | How to store objects being returned from Async methods?<p>So I have two classes:</p>
<pre><code> public class Employee
{
public string status { get; set; }
public EmployeeData[] data { get; set; }
public string message { get; set; }
}
public class EmployeeData
{
publi... | <p>Mark your <code>Main</code> method as <code>async</code> one (available since <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-7.1/async-main" rel="nofollow noreferrer">C# 7.1</a>) and call <code>await</code> on the <code>GetCatFact</code> (or <code>getEmployeeData</code> y... | How to store objects being returned from Async methods? | c#|.net|api|async-await|task | 1 | 48 | 2 | 72,831,930 | 72,831,930 | 2 | true | 2022-07-01T16:00:19.380Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to store objects being returned from Async methods?<p>So I have two classes:</p>
<pre><code> public class Employee
{
public string status ... |
72,940,481 | Capitalize the first character of most words except some exceptions using javascript<p>I have the following JavaScript regex which capitalizes the first character of most words except some exceptions:</p>
<p>There are two issues with this regex that I have not resolved. The very first letter should always be capitalize... | <p>I was able to figure out the solution. This is an explanation of fix:</p>
<ul>
<li>The toLowerCase was added in the beginning to lower all characters</li>
<li>The regex was modified accordingly to handle this:<br>
<a href="https://i.stack.imgur.com/31yUD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur... | Capitalize the first character of most words except some exceptions using javascript | javascript | 0 | 48 | 1 | 72,940,504 | 72,940,504 | 2 | true | 2022-07-11T14:52:09.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Capitalize the first character of most words except some exceptions using javascript<p>I have the following JavaScript regex which capitalizes the first char... |
72,821,850 | Sort thru a file with int and string values in numerical order with python<p>I have a text file which has the following values:</p>
<pre><code>username:password - number of daily visits: 15
username:password - number of daily visits: 482
username:password - number of daily visits: 4823
</code></pre>
<p>I want to filter... | <p>Assuming you always have a number in the end of the line, you could use <code>sorted</code> with a custom key:</p>
<pre><code>with open('file.txt') as f, open('file2.txt', 'w') as f2:
f2.writelines(sorted(f.readlines(),
key=lambda s: int(s.rsplit(' ')[-1].strip()),
... | Sort thru a file with int and string values in numerical order with python | python | -1 | 48 | 1 | 72,822,084 | 72,822,084 | 2 | true | 2022-06-30T20:48:33.040Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sort thru a file with int and string values in numerical order with python<p>I have a text file which has the following values:</p>
<pre><code>username:passw... |
72,830,001 | Pandas read file with no delimiter and with different column widths<p>I want to read a plaintext file using pandas.
I have entries without delimiters and with different widths like this:</p>
<pre><code>59967Y98Doe John 6211100004545SO20140314- 00024278
N0546664SCHMIDT-PETER 7441100008300AW20140314- 0... | <p>As the <strong>s</strong> in <code>widths</code> suggest, you can pass a list of widths:</p>
<pre><code>pd.read_fwf(io.StringIO(txt), widths=[8,20,3,3,7,2,8,1,99], header=None)
</code></pre>
<p>output:</p>
<pre><code> 0 1 2 3 4 5 6 7 8
0 59967Y98 ... | Pandas read file with no delimiter and with different column widths | python|pandas|text | 1 | 48 | 1 | 72,830,087 | 72,830,087 | 2 | true | 2022-07-01T13:25:59.020Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas read file with no delimiter and with different column widths<p>I want to read a plaintext file using pandas.
I have entries without delimiters and wit... |
72,856,209 | str.contain "\" should only be used as an escape character outside of raw strings<p>I have a dataframe with one column and i want to know if the value of the column contain a "+". I made like this:</p>
<pre><code>mask = df['column'].str.contains("\+")
</code></pre>
<p>But when I execute the sonarqub... | <p>There is a difference between escaping the characters in python to be interpreted as a special character (e.g. <code>\n</code> is a newline and has nothing to do with <code>n</code>), and escaping the character not to be interpreted as a special symbol in the regex. Here you need both.</p>
<p>Either use a raw string... | str.contain "\" should only be used as an escape character outside of raw strings | python|pandas|dataframe|contains | 1 | 48 | 1 | 72,856,221 | 72,856,221 | 2 | true | 2022-07-04T11:48:13.037Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
str.contain "\" should only be used as an escape character outside of raw strings<p>I have a dataframe with one column and i want to know if the value of the... |
73,007,247 | Converting inches to CM on series<p>I am trying to turn a series of heights that are in inches and turn them into cm amounts. below is the method I am using but am running into an issue that is also posted below. I have tried using regex but that did not work for me.</p>
<p>Calling the data head of a series</p>
<pre><c... | <p>It looks like you're using the wrong column.</p>
<p>That said, better use a vectorial method for efficiency.</p>
<p>You can extract the ft/in components, convert each to cm and sum:</p>
<pre><code>df['Data_cm'] = (df['Data']
.str.extract(r'(\d+)\'\s*(\d+)"')
.astype(float)
.mul([12*2.54, 2.54])
.sum(axis=1)... | Converting inches to CM on series | python|pandas | 1 | 48 | 2 | 73,007,332 | 73,007,332 | 2 | true | 2022-07-16T19:56:28.053Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting inches to CM on series<p>I am trying to turn a series of heights that are in inches and turn them into cm amounts. below is the method I am using ... |
72,985,176 | Why are the default formats different here? ( Two different implementations of ISO 8601 )<p>When storing timestamps in jsonb I realized the format used when putting current_timestamp and now() into a jsonb was different than when I used them directly. What is going on here? Although both are ISO8601 formats, I would pr... | <p>The format of a timestamp literal (and by extension, default conversion of a timestamp to string), is defined in ISO/IEC 9075-2:2016 (SQL:2016) section 5.3 <literal> to have a space as the separator between date and time:</p>
<pre class="lang-none prettyprint-override"><code><timestamp literal> ::=
TIM... | Why are the default formats different here? ( Two different implementations of ISO 8601 ) | postgresql | 3 | 48 | 2 | 72,994,351 | 72,994,351 | 2 | true | 2022-07-14T18:30:45.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why are the default formats different here? ( Two different implementations of ISO 8601 )<p>When storing timestamps in jsonb I realized the format used when ... |
72,969,180 | List comprehensions with circular dependencies<p>Why is it possible to have a list comprehension that seemingly has a circular dependency?</p>
<p>For example, the following:</p>
<pre><code>nums = [1, 2, 3]
nums = [num*num for num in nums]
</code></pre>
<p>where the list comprehension uses <code>nums</code> and the resu... | <p>The list created by the list comprehension has no "memory" that it was created using values from a list bound to the name <code>nums</code>. As a result, there is no dependency on the name <code>nums</code> nor on the previous value of that name to conflict with the new value of the name <code>nums</code>.... | List comprehensions with circular dependencies | python|list-comprehension | -1 | 48 | 1 | 72,969,273 | 72,969,273 | 2 | true | 2022-07-13T15:51:45.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
List comprehensions with circular dependencies<p>Why is it possible to have a list comprehension that seemingly has a circular dependency?</p>
<p>For example... |
72,899,169 | Python: Create matplotlib subplots using a for loop<p>I would like to know how can I make my code more efficient with a for loop. I'm interested in making multiple subplots. In this example I'm using 4 but in reality I have 14.</p>
<p>So far, I've been copying/pasting the same block of code</p>
<pre><code>df_A = df.loc... | <p>You could store the axes and conditions within lists and iterate over them to create your plots. Something like this would do the job:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from itertools import chain
df = pd.DataFrame(
{
... | Python: Create matplotlib subplots using a for loop | python|pandas|for-loop|matplotlib|subplot | 2 | 48 | 1 | 72,900,423 | 72,900,423 | 2 | true | 2022-07-07T13:58:56.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Create matplotlib subplots using a for loop<p>I would like to know how can I make my code more efficient with a for loop. I'm interested in making mu... |
72,811,476 | Toggle div only when button clicked<p>jQuery newbie here, I'm hoping someone can help.</p>
<p>I have a function when a div with the class <code>.ventures-minorities</code> is clicked, it changes height onclick to show / hide <code>.logos-wrapper</code> - and the button with the class <code>.expander</code> toggles text... | <p>You can simply define the event listener for the buttons <code>.expander</code> instead of the parent container <code>.ventures-minorities</code>.</p>
<p>To get the toggle to work, you need to use the method <code>parent()</code> before you find the <code>.logos-wrapper</code> because <code>$(this)</code> is now the... | Toggle div only when button clicked | javascript|jquery|onclick | 2 | 48 | 1 | 72,814,994 | 72,814,994 | 2 | true | 2022-06-30T06:57:32.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Toggle div only when button clicked<p>jQuery newbie here, I'm hoping someone can help.</p>
<p>I have a function when a div with the class <code>.ventures-min... |
72,841,068 | Hibernate - Why is lazy loading not working here?<p>I am learning Hibernate from an online course, and right now, I am learning Eager vs Lazy loading.</p>
<p>For the example I have three entities and a test program like so:</p>
<pre class="lang-java prettyprint-override"><code>@Entity
@Table(name = "instructor&quo... | <p>You are lazy loading the courses, but because you are referencing them via the line</p>
<pre class="lang-java prettyprint-override"><code>System.out.println("luv2code: Courses: " + tempInstructor.getCourses());
</code></pre>
<p>they are loaded in.</p>
<p>Turn on logging of the queries by adding to your <co... | Hibernate - Why is lazy loading not working here? | java|hibernate|lazy-loading | 1 | 48 | 2 | 72,841,190 | 72,841,190 | 2 | true | 2022-07-02T17:22:30.793Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hibernate - Why is lazy loading not working here?<p>I am learning Hibernate from an online course, and right now, I am learning Eager vs Lazy loading.</p>
<p... |
72,928,318 | Using a flow builder and asFlow error that should call from suspend function<p>I have the following interface to fetch recipes</p>
<pre><code>interface FoodService {
@GET(EndPoint.COMPLEX_SEARCH)
suspend fun fetchComplexSearch(@Query("apiKey") apiKey: String): ResultModel
}
</code></pre>
<p>This works... | <p>It doesn't do the same thing at all, hence the error.</p>
<p>In the first case, <code>complexSearch</code> immediately returns a cold flow without doing any work. No code from the lambda is executed, so no need to suspend anything. The <em>collector</em> of this cold flow will provide a coroutine environment for the... | Using a flow builder and asFlow error that should call from suspend function | kotlin|kotlin-coroutines | 1 | 48 | 1 | 72,928,485 | 72,928,485 | 2 | true | 2022-07-10T11:59:45.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using a flow builder and asFlow error that should call from suspend function<p>I have the following interface to fetch recipes</p>
<pre><code>interface FoodS... |
72,778,645 | Snowflake: most efficient way to join two tables that use the WITH clause instead of sub-queries<p>Here's the code I've written. Just wondering if there's any way to make it more efficient. I've self joining two separate tables to each other and then, I want to join the result of both to eachother:</p>
<pre><code>SELEC... | <p>Well there are many things that are happening the are waste of time:</p>
<p>The two ORDER BY's that should not be present. And if you must self join the DATEADD should be moved into the CTE, to improve that section:</p>
<pre><code> WITH particulate_data (city, timestamp, value) AS (
SELECT
lo... | Snowflake: most efficient way to join two tables that use the WITH clause instead of sub-queries | sql|join|snowflake-cloud-data-platform | -1 | 48 | 1 | 72,779,936 | 72,779,936 | 2 | true | 2022-06-27T21:49:31.170Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Snowflake: most efficient way to join two tables that use the WITH clause instead of sub-queries<p>Here's the code I've written. Just wondering if there's an... |
72,912,782 | Compare DayTime strings in C++<p>If I have a single string storing both Day and Time in the format "mm/dd-hh:mm" how can I create the string of two days ahead?</p> | <p>You can use Howard Hinnant's <a href="https://github.com/HowardHinnant/date" rel="nofollow noreferrer">date</a> library.</p>
<ol>
<li>First of all, fix the input string by adding something that could be parsed as a year, and not a leap year (e.g. <code>"01/"</code>), so that <code>date::from_stream</code> ... | Compare DayTime strings in C++ | c++|string|date|c++11|chrono | 0 | 48 | 1 | 72,914,470 | 72,914,470 | 2 | true | 2022-07-08T14:18:28.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Compare DayTime strings in C++<p>If I have a single string storing both Day and Time in the format "mm/dd-hh:mm" how can I create the string of two... |
72,806,063 | Regex conditional statement or negation<p>I'm trying to detect mobile with the user agent string. According MDN there is always the pattern "mobile" on mobiles user agent strings and not on PC, tablet or whatever; but with one exception the iPad's user agent string :(</p>
<p>Basicly I need this for (in)activa... | <p>The first thing I see is the variable name from hell:<br><code>$notMobile = true</code> that hurts the brain => edit your code in a way to have:<br> <code>$mobile = false</code>.</p>
<p>What is elegant? As suggested by user3783243, that:</p>
<pre><code>$mobile = stripos($ua, 'mobile') && !stripos($ua, 'ip... | Regex conditional statement or negation | php|regex | 0 | 48 | 1 | 72,806,522 | 72,806,522 | 2 | true | 2022-06-29T18:13:33.593Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex conditional statement or negation<p>I'm trying to detect mobile with the user agent string. According MDN there is always the pattern "mobile"... |
72,769,445 | iOS | Can I automatically change version values in all of my files when it's pushed into master branch?<p>I’d like to manage my project’s version information which is all scatterred througout multiple files, for example, <code>.podspec</code>, <code>.xcodeproj</code> and some <code>.h</code> files.</p>
<p><strong>What... | <p>There's probably no one solution that fits all needs, but one that works quite well is to use Xcode custom variables.</p>
<ul>
<li>Go to your project build settings (not just the one for a single target), press the <code>+</code> in the upper-left and select "Add User-Defined Setting".</li>
<li>Name this s... | iOS | Can I automatically change version values in all of my files when it's pushed into master branch? | ios|swift|xcode | 0 | 48 | 1 | 72,769,721 | 72,769,721 | 3 | true | 2022-06-27T08:58:19.497Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
iOS | Can I automatically change version values in all of my files when it's pushed into master branch?<p>I’d like to manage my project’s version information... |
72,775,432 | R Convert datatype of a list of tibbles<p>Similar to this <a href="https://stackoverflow.com/questions/56773354/change-data-types-using-a-list-of-data-type-names">question</a>, I would like to do the same but to a list of <code>tibbles</code>.</p>
<p>How can I do this?</p>
<p>Sample Data & code:</p>
<pre><code>libr... | <p>In the linked post, it is having different column types, so we created a vector of types with length equal to the number of columns in the data. Here, the number of columns in each of the datasets in the <code>list</code> is 2. Thus, the <code>rep</code> with <code>times</code> should be <code>2</code></p>
<pre><c... | R Convert datatype of a list of tibbles | r|dplyr | 2 | 48 | 1 | 72,775,526 | 72,775,526 | 3 | true | 2022-06-27T16:27:39.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R Convert datatype of a list of tibbles<p>Similar to this <a href="https://stackoverflow.com/questions/56773354/change-data-types-using-a-list-of-data-type-n... |
72,784,988 | Show Cancer Specific Survival at exact time (Kaplan Meier in Lifelines)<pre><code>kmf.survival_function_ (LifeLines Package)
</code></pre>
<p>shows me Cancer Specific Survival (CSS) of my cohort at different times (0, 4, 6...128 month). How can CSS be shown at exactly 120 month?</p> | <p>The <code>survival_function_at_times()</code> method will get you that value. Here is an example with a sample dataset:</p>
<pre><code>from lifelines import KaplanMeierFitter
from lifelines.datasets import load_waltons
data = load_waltons()
T = data['T']
E = data['E']
kmf = KaplanMeierFitter().fit(T, E, label='Ka... | Show Cancer Specific Survival at exact time (Kaplan Meier in Lifelines) | python|statistics|survival-analysis|survival|lifelines | 0 | 48 | 1 | 72,791,859 | 72,791,859 | 3 | true | 2022-06-28T10:41:04.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Show Cancer Specific Survival at exact time (Kaplan Meier in Lifelines)<pre><code>kmf.survival_function_ (LifeLines Package)
</code></pre>
<p>shows me Cancer... |
72,797,788 | Three.js: How is using two or more renderers affect the performance? (WebGLRenderer and CSS2DRenderer)<p>Currently, I'm using WebGLRenderer to render the scene. I also need to display some HTML elements on the scene. For that, I wrap HTML elements in CSS2DObjects and render them with CSS2DRenderer.</p>
<p>Question: how... | <blockquote>
<p>how does adding CSS2DRenderer affect the performance?</p>
</blockquote>
<p>I'm afraid it's not possible to answer this question since the performance impact depends on the number of DOM elements in your scene. For a common usage (rendering a few labels), the performance impact should not be noticeable.<... | Three.js: How is using two or more renderers affect the performance? (WebGLRenderer and CSS2DRenderer) | performance|three.js|webgl | 1 | 48 | 1 | 72,797,908 | 72,797,908 | 3 | true | 2022-06-29T08:00:07.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Three.js: How is using two or more renderers affect the performance? (WebGLRenderer and CSS2DRenderer)<p>Currently, I'm using WebGLRenderer to render the sce... |
72,802,869 | Conduct the calculation only when the date value is valid<p>I have a data frame <code>dft</code>:</p>
<pre><code>Date Total Value
02/01/2022 2
03/01/2022 6
N/A 4
03/11/2022 4
03/15/2022 4
05/01/2022 4
</code></pre>
<p>For each date in the data f... | <p>I would convert the whole Date column to be a date time object, using <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html" rel="nofollow noreferrer"><code>pd.to_datetime()</code></a>, with the errors set to coerce, to replace the 'N/A' string to <code>NaT</code> (Not a Timesta... | Conduct the calculation only when the date value is valid | python|pandas | 1 | 48 | 3 | 72,803,445 | 72,803,445 | 3 | true | 2022-06-29T14:12:02.523Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Conduct the calculation only when the date value is valid<p>I have a data frame <code>dft</code>:</p>
<pre><code>Date Total Value
02/01/2022 ... |
72,843,081 | Vue.js: Router is failing<p>So I was trying to implement routers so that, when the sidebar is active, you can click on buttons that take you to different pages, or routes.</p>
<p>However, the routes are not working at all, clicking on the button changes the weblink, but doesn't do anything.</p>
<p>Here is my code for i... | <p>Add <code>router-view</code> component somewhere in the template of <code>App.vue</code>. It will display the component that corresponds to the url.</p> | Vue.js: Router is failing | javascript|vue.js | 0 | 48 | 1 | 72,843,129 | 72,843,129 | 3 | true | 2022-07-02T23:35:52.033Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vue.js: Router is failing<p>So I was trying to implement routers so that, when the sidebar is active, you can click on buttons that take you to different pag... |
72,919,534 | read from the csv file for searchbox in selenium<p>I want to test the e-commerce site. If you run this block of code, find the Search Box on the automation website, then type "novel" and click the button. But I want to do this using csvfiles. Csvfiles contain 1 row/column (novel). And after reading this word,... | <p>You can make use of <code>Scanner class</code> to read the CSV file. You can create a method which reads the csv files and returns the proviced value which you can use within your test method</p>
<p>Your solution would look like</p>
<p><code>Method to read csv</code></p>
<pre><code>public List<String> readCsv(... | read from the csv file for searchbox in selenium | java|selenium|testing|intellij-idea | 0 | 48 | 1 | 72,919,912 | 72,919,912 | 3 | true | 2022-07-09T06:52:52.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
read from the csv file for searchbox in selenium<p>I want to test the e-commerce site. If you run this block of code, find the Search Box on the automation w... |
72,914,861 | Simulating ODE model for different initial conditions in R<p>I have a model, and I want to generate random initial conditions, run the model, and save the output so that each simulation is a replicate. But I have a hard time interpreting and implementing loops (and I also know they are not always the best to use in R),... | <p>Here one of the other approaches, mentioned by @Ben Bolker. Here we use <code>replicate</code> instead of a loop. This has the advantage, that we don't need to create a <code>list()</code> for the results beforehand.</p>
<pre class="lang-r prettyprint-override"><code>N <- 10
res <- replicate(N, ode(y = c(r = r... | Simulating ODE model for different initial conditions in R | r|loops|simulation|ode | 2 | 48 | 2 | 72,922,303 | 72,922,303 | 3 | true | 2022-07-08T17:18:21.503Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Simulating ODE model for different initial conditions in R<p>I have a model, and I want to generate random initial conditions, run the model, and save the ou... |
72,954,465 | Polygone to one polyline in R<p>I have a shape file from: <a href="https://earthworks.stanford.edu/catalog/stanford-yt100my8913" rel="nofollow noreferrer">https://earthworks.stanford.edu/catalog/stanford-yt100my8913</a> about Waters in Mozambique as Polygones.</p>
<p>I would like to have the Zambesze River as an Polyli... | <p>If all you need is Zambezi river as a line (instead of a polygon) and your use case allows such a cavalier approach as you describe I then suggest using other data sources than the Stanford dataset.</p>
<p>Open Street Map may be a good start. Consider this piece of code; it utilizes the {nominatimlite} to access the... | Polygone to one polyline in R | r|sf|polyline | 0 | 48 | 1 | 72,967,085 | 72,967,085 | 3 | true | 2022-07-12T15:03:27.177Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Polygone to one polyline in R<p>I have a shape file from: <a href="https://earthworks.stanford.edu/catalog/stanford-yt100my8913" rel="nofollow noreferrer">ht... |
73,004,733 | Passing a value to a text box in navigation link view<p>I am trying to pass a value from a text box in my first view to a text box in my second view.</p>
<pre><code>struct FirstView: View {
@State private var inputTextValue = ""
var body: some View {
NavigationView{
VStack {
Te... | <p>We can set incoming value to internal in <code>onAppear</code>, like</p>
<pre><code>VStack {
Spacer()
TextField("",text: $textFieldValue)
.frame(width: 200, height: 30, alignment: .center)
.border(.gray)
Spacer()
Text("Incoming value: \(incomingTextFieldvalue)")
... | Passing a value to a text box in navigation link view | ios|swiftui|navigationview | 2 | 48 | 3 | 73,004,872 | 73,004,872 | 3 | true | 2022-07-16T13:48:30.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing a value to a text box in navigation link view<p>I am trying to pass a value from a text box in my first view to a text box in my second view.</p>
<pr... |
72,775,367 | How to assign "null" when received data is undefined?<p>I am currently working on a project that collects product information of several stores.
I have a problem when I'm assigning the scraped product data to an object that I want to store in a final array. Everything is going well except for when a product does not ha... | <p>Does <code>item.images</code> always have an array item at position zero? If not, you're trying to get the <code>url</code> property from an undefined object, which will throw an error.</p>
<p>You could add to this by first checking that <code>item.images[0]</code> exists:</p>
<pre class="lang-js prettyprint-overrid... | How to assign "null" when received data is undefined? | javascript|object|undefined | 1 | 48 | 1 | 72,775,448 | 72,775,448 | 3 | true | 2022-06-27T16:22:39.963Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to assign "null" when received data is undefined?<p>I am currently working on a project that collects product information of several stores.
I have a pro... |
72,971,892 | What is the order of execution of method calls in a statement<p>Just something I've been wondering about, and I wanted to understand how the compiler achieves this task.</p>
<pre class="lang-java prettyprint-override"><code>class HelloWorld {
public static void main(String[] args) {
double d = Double.valueO... | <p>In order to be able to invoke <code>Double.valueOf</code>, we need the value of its argument, i.e. <code>sum(1, plusOne(2))</code>. So we try to invoke <code>sum</code>. But we need the arguments, i.e. <code>1</code> (no problem there) and <code>plusOne(2)</code>.</p>
<p>So what is actually invoked first is <code>pl... | What is the order of execution of method calls in a statement | java | 0 | 48 | 2 | 72,971,970 | 72,971,970 | 3 | true | 2022-07-13T19:52:30.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the order of execution of method calls in a statement<p>Just something I've been wondering about, and I wanted to understand how the compiler achieve... |
72,804,980 | is the time complexity of nested for-loops always of O(n^2)?<pre><code>for (i = 1; i <= n; i++)
{
for (j = n; j >= i; j--)
}
</code></pre>
<p>I'm struggling with this algorithm. I can't even know what time complexity of this algorithm is? I've checked using online software it shows me only o(n).</p> | <p>First of all, the algorithm should be something like this:</p>
<pre><code>for (i = 1; i <= n; i++)
for (j = n; j >= i; j--)
DoSomeWork(i, j); // <- Payload which is O(1)
</code></pre>
<p>To find out the time complexity, let's count how many times <code>DoSomeWork</code> will be executed:</p>
<pre><c... | is the time complexity of nested for-loops always of O(n^2)? | algorithm|time-complexity|big-o | 0 | 48 | 2 | 72,805,090 | 72,805,090 | 3 | true | 2022-06-29T16:36:33.213Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
is the time complexity of nested for-loops always of O(n^2)?<pre><code>for (i = 1; i <= n; i++)
{
for (j = n; j >= i; j--)
}
</code></pre>
<p>I'm s... |
72,872,288 | add vector/list to element of r dataframe<p>I have a dataframe, and I would like to add a new column whose elements are themselves vectors (or lists).
The vectors/lists may might not be expressible in closed form.
I tried the following but received an error</p>
<pre><code>> mydf = data.frame(a=1:3)
> mydf$new <... | <p>If we want to do this in a <code>for</code> loop, wrap the <code>rep</code> output in a <code>list</code></p>
<pre><code>mydf$new <- vector('list', nrow(mydf))
for(i in seq_len(nrow(mydf))) {
mydf$new[i] <- list(rep(i, ceiling(10 * runif(1))))
}
</code></pre>
<p>-output</p>
<pre><code>> mydf
a ... | add vector/list to element of r dataframe | r|dataframe | 1 | 48 | 2 | 72,872,294 | 72,872,294 | 3 | true | 2022-07-05T15:50:38.283Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
add vector/list to element of r dataframe<p>I have a dataframe, and I would like to add a new column whose elements are themselves vectors (or lists).
The ve... |
72,951,461 | How can I infer the type of the method on Java dynamically?<p>I have this two classes, using generics:</p>
<pre><code>public Response version1(Parameters params) {
Supplier<Response> s = () -> getResponse(params);
return unversioned(params, s);
}
public Response2 version2(Parameters params) {
Supplie... | <p>What you could do is add bounds to the generic type of your <code>unversioned</code> method.</p>
<pre class="lang-java prettyprint-override"><code>private <T extends DataProvider> T unversioned(Parameters parameters, Supplier<T> supplier) {
// logic
}
</code></pre>
<p>This, however, requires you to hav... | How can I infer the type of the method on Java dynamically? | java|generics | -1 | 48 | 1 | 72,951,536 | 72,951,536 | 3 | true | 2022-07-12T11:19:08.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I infer the type of the method on Java dynamically?<p>I have this two classes, using generics:</p>
<pre><code>public Response version1(Parameters par... |
72,939,219 | React "magically" updates two states instead of one<p>I have two states defined like so:</p>
<pre><code> const [productProperties, setProductProperties] = useState<
PropertyGroup[] | null
>(null);
const [originalProductProperties, setOriginalProductProperties] = useState<
PropertyGroup[] | null
... | <p>Preface: It sounds like the two arrays are sharing the same objects. That's fine provided you handle updates correctly.</p>
<p>Although you're copying the <em>array</em>, you're modifying the object in the array directly. That's breaking the main rule of state: <a href="https://reactjs.org/docs/state-and-lifecycle.h... | React "magically" updates two states instead of one | javascript|reactjs|ecmascript-6|state | 1 | 48 | 1 | 72,939,266 | 72,939,266 | 3 | true | 2022-07-11T13:17:53.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React "magically" updates two states instead of one<p>I have two states defined like so:</p>
<pre><code> const [productProperties, setProductProperties] = u... |
72,782,299 | How to merge a JSONB array of objects into a single object in PostgreSQL<p>I have a JSONB column where each row contains an array of multiple objects.</p>
<p><code>'[{"a": 1}, {"b": 2}, {"c": 0.5}]'::jsonb</code></p>
<p>I want to merge all of them together into a single object:</p>
<p><cod... | <p>You need to unnest the array and then aggregate the key/values back into a single object:</p>
<pre><code>select (select jsonb_object_agg(e.ky, e.val)
from jsonb_array_elements(t.the_column) as x(element)
cross join jsonb_each(x.element) as e(ky,val))
from the_table t;
</code></pre>
<p>Note, that i... | How to merge a JSONB array of objects into a single object in PostgreSQL | postgresql | 2 | 48 | 2 | 72,782,442 | 72,782,442 | 3 | true | 2022-06-28T07:26:26.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to merge a JSONB array of objects into a single object in PostgreSQL<p>I have a JSONB column where each row contains an array of multiple objects.</p>
<p... |
72,955,916 | Using lapply with an R function that selects a column of data.frame<p>I have a function that takes a column <code>p</code> of a data.frame <code>dat</code> and sums the similar values:</p>
<pre class="lang-r prettyprint-override"><code>response <- function(dat, p){
y = dat[p]
sums = table(y)
sums_df = as... | <p>You should not collect several data frames using <code>c()</code>. You should use <code>list()</code>. So the following fix should work:</p>
<pre><code>plist <- list(SOM_V, SOM_SD, SOM_C, SOM_L, SOM_M, SOM_KD, SOM_MP, SOM_SvD)
output <- lapply(plist, response, p = "f76a")
</code></pre>
<p>Compare th... | Using lapply with an R function that selects a column of data.frame | r|list|dataframe|lapply | 2 | 48 | 1 | 72,955,940 | 72,955,940 | 3 | true | 2022-07-12T16:59:18.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using lapply with an R function that selects a column of data.frame<p>I have a function that takes a column <code>p</code> of a data.frame <code>dat</code> a... |
72,903,295 | Finding any changes between two lists of the same length<p>Given 2 lists of the same length. Is it possible to return a dict containing any changes between the 2 lists. Each key being the value that was changed and the key's value being the value it was changed to. The following returns difference between the 2 lists:<... | <p>Lots of ways to do this, if you'd like an expanded answer this should do it. Just looping through the first <code>list</code> and using <code>total</code> to keep track of the index, and then checking that index on the second <code>list</code>. Then chucking them into a <code>dict</code> when they don't match.</p>... | Finding any changes between two lists of the same length | python|list|algorithm|dictionary | 0 | 48 | 4 | 72,903,387 | 72,903,387 | 3 | true | 2022-07-07T19:31:56.030Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Finding any changes between two lists of the same length<p>Given 2 lists of the same length. Is it possible to return a dict containing any changes between t... |
72,911,564 | Verilog function gives return clock cycle too late<p>I wrote a function in Verilog to flip the order of bits in a word. The function does what it should but not in the clock cycle it gets called but in the next.</p>
<p>This is function:</p>
<pre><code>function [n-1:0] bitreverse;
input [n-1:0] in;
reg [n:0] id... | <p>When you use <code>always @(posedge clock)</code>, you instruct the simulator to treat <code>i</code> like it is sequential logic, like a flip flop. The simulator internally samples the return value of the <code>bitreverse</code> function at the rising edge of the clock, then updates <code>i</code> at the next risi... | Verilog function gives return clock cycle too late | function|for-loop|verilog | 2 | 48 | 1 | 72,911,965 | 72,911,965 | 3 | true | 2022-07-08T12:39:08.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Verilog function gives return clock cycle too late<p>I wrote a function in Verilog to flip the order of bits in a word. The function does what it should but ... |
72,999,788 | React hook setState - setting an array (React Tic Tac Toe tutorial but with hooks)<p>I've been trying to follow the react tic tac toe tutorial, but to use functional components instead of object components. Everything works beautifully until the backtracking part.</p>
<p>I've narrowed the problem down to the fact that ... | <p><strong>States is not updated immediately in react hooks.</strong></p>
<p>ex:</p>
<pre><code>const [counter, setCounter]=useState(0);
handleClick(){
//counter = 0
setCounter(counter + 1);
console.log(counter); //counter is old state so it is still 0
}
</code></pre>
<p>for your question: (<code>history</code... | React hook setState - setting an array (React Tic Tac Toe tutorial but with hooks) | javascript|reactjs|react-hooks | 0 | 48 | 1 | 72,999,909 | 72,999,909 | 3 | true | 2022-07-15T21:32:05.573Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React hook setState - setting an array (React Tic Tac Toe tutorial but with hooks)<p>I've been trying to follow the react tic tac toe tutorial, but to use fu... |
73,004,057 | how to check conditions inside .then in javascript<p>Existing code(Working fine) :</p>
<pre><code>.then((result) => {
this.triggerAction(result.id);
}).catch((error) => {
this.errorMsg(error);
});
</code></pre>
<p>when i try to add condition inside the .the... | <p>To throw an error if <code>result.id</code> is missing, you should do the following:</p>
<pre><code> .then((result) => {
if(!result.id) {
throw new Error("result.id is missing!");
}
this.triggerAction(result.id);
}).catch((error) =&g... | how to check conditions inside .then in javascript | javascript | 0 | 48 | 2 | 73,004,094 | 73,004,094 | 3 | true | 2022-07-16T12:07:02.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to check conditions inside .then in javascript<p>Existing code(Working fine) :</p>
<pre><code>.then((result) => {
this.triggerAction(... |
72,998,709 | ScheduledExecutorService threads set as daemon stops program exiting if you use another ExecutorService<p>I've been using a <code>Executors.newScheduledThreadPool</code> to run a few tasks in the background. I've set them as daemon threads, so that if you exit the program using the X button on the top right of the mai... | <p>For a <a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/Thread.html#setDaemon(boolean)" rel="nofollow noreferrer">daemon thread</a>:</p>
<blockquote>
<p>The Java Virtual Machine exits when the only threads running are all daemon threads.</p>
</blockquote>
<p>The statement:</p>
<pre><cod... | ScheduledExecutorService threads set as daemon stops program exiting if you use another ExecutorService | java|javafx | 1 | 48 | 1 | 72,999,396 | 72,999,396 | 3 | true | 2022-07-15T19:17:35.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ScheduledExecutorService threads set as daemon stops program exiting if you use another ExecutorService<p>I've been using a <code>Executors.newScheduledThrea... |
72,902,499 | Adding ascii-art to command prompt through VBA<p>I have some code that opens up command prompt, and requires a user to sign in through windows command prompt. I've gotten complaints about it being really ugly that they have to log in like that, so I thought I'd add some Ascii-art to the terminal so it gives something t... | <p>You can do:</p>
<pre><code>Dim myArt As String
myArt = _
" ____ " & vbNewLine & _
" / __ \ ___ _ __" & vbNewLine & _
" / / / // _ \| | / /" & vbNewLine & _
" / /_/ // __/| |/ / " & vbNewLine & _... | Adding ascii-art to command prompt through VBA | excel|vba|terminal|ascii|command-prompt | 0 | 48 | 1 | 72,902,583 | 72,902,583 | 3 | true | 2022-07-07T18:14:37.403Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding ascii-art to command prompt through VBA<p>I have some code that opens up command prompt, and requires a user to sign in through windows command prompt... |
72,798,325 | Mean, modus and median per group<p>I have a dataset df with valuations of several names of hospitals (df[Hospital]) like below (just a short part of it, in total 6500 rows):</p>
<p><a href="https://i.stack.imgur.com/rEfkh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rEfkh.png" alt="enter image des... | <p>It can be done using <strong>Group By</strong> & <strong>Agg</strong> as below</p>
<pre><code>df = pd.DataFrame({"Hospital":['A','A','A','B','B','C','C'],
"value":[1,1,2,100,200,20,2]})
df.groupby('Hospital').agg(Mean_value=('value','mean'),
... | Mean, modus and median per group | python | -1 | 48 | 1 | 72,798,564 | 72,798,564 | 3 | true | 2022-06-29T08:39:41.217Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mean, modus and median per group<p>I have a dataset df with valuations of several names of hospitals (df[Hospital]) like below (just a short part of it, in t... |
72,815,173 | NavigationLink issue linking to a website<p>Using <code>NavigationLink</code> i'm attempting to make a button that forwards you to a website on safari, but currently i'm getting the issue <code>Generic struct 'NavigationLink' requires that 'URL' conform to 'View'</code> from the following line of code</p>
<p><code> Nav... | <p>Use <code>Link</code> instead of <code>NavigationLink</code></p>
<p><code>Link</code> is for websites, <code>NavigationLink</code> is for SwiftUI Views.</p> | NavigationLink issue linking to a website | swift|swiftui | 0 | 48 | 2 | 72,815,306 | 72,815,306 | 3 | true | 2022-06-30T11:43:15.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NavigationLink issue linking to a website<p>Using <code>NavigationLink</code> i'm attempting to make a button that forwards you to a website on safari, but c... |
72,999,004 | In Python, how to remove items in a list based on the specific string format?<p>I have a Python list as below:</p>
<pre><code>merged_cells_lst = [
'P19:Q19
'P20:Q20
'P21:Q21
'P22:Q22
'P23:Q23
'P14:Q14
'P15:Q15
'P16:Q16
'P17:Q17
'P18:Q18
'AU9:AV9
'P10:Q10
'P11:Q11
'P12:Q12
'P13:Q13
'A6:P6
'A7:P7
'D9:AJ9
'AK9:AQ9
'AR9:AT... | <p>Modifying a list while looping over it causes troubles. You can use list comprehension instead to create a new list.</p>
<p>Also, you need a different regex expression. The current pattern <code>P*:Q*</code> matches <code>PP:QQQ</code>, <code>:Q</code>, or even <code>:</code>, but <em>not</em> <code>P19:Q19</code>.<... | In Python, how to remove items in a list based on the specific string format? | python|list|string-matching | 0 | 48 | 2 | 72,999,040 | 72,999,040 | 3 | true | 2022-07-15T19:51:45.867Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In Python, how to remove items in a list based on the specific string format?<p>I have a Python list as below:</p>
<pre><code>merged_cells_lst = [
'P19:Q19
'... |
72,970,427 | Is the rounding of floating points random?<p>I have seen many questions and responses on Stack Overflow on the representation of floating point numbers, which target the difference in rounding "different numbers".</p>
<p>I'm testing an engine written in Fortran which solves a nonlinear system iteratively.
I h... | <p>Rounding in floating-point operations is deterministic in IEEE 754 and in common floating-point implementations that do not fully conform to IEEE 754.</p>
<p>The default rounding rule for results within finite bounds of the floating-point format being used is that the floating-point result of an operation is the num... | Is the rounding of floating points random? | floating-point | 1 | 48 | 2 | 72,972,869 | 72,972,869 | 3 | true | 2022-07-13T17:35:21.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is the rounding of floating points random?<p>I have seen many questions and responses on Stack Overflow on the representation of floating point numbers, whic... |
72,784,029 | GTK fprint(%e) float writted with commas instead of dots<p>So, I'm creating a little solar system simulation, with calculus done in C. Once the calculations are done I put them into a json file, which is read by a web page.</p>
<p>I have created a function to save the coordinate of the trajectory into a json file, all ... | <p><code>gtk</code> alters locales settings, switch to default with <code>setlocale</code> just after calling <code>gtk_init</code></p>
<pre><code>#include <locale.h>
int main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
setlocale(LC_NUMERIC, "C");
</code></pre> | GTK fprint(%e) float writted with commas instead of dots | c|floating-point|printf|gtk | 4 | 48 | 2 | 72,784,197 | 72,784,197 | 4 | true | 2022-06-28T09:34:12.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GTK fprint(%e) float writted with commas instead of dots<p>So, I'm creating a little solar system simulation, with calculus done in C. Once the calculations ... |
72,899,828 | R - Modify ggplot columns width by a specific variable and use such variable as a reference on the X-axis<p>I have a dataset where each rows corresponds to a country, while the other variables are:</p>
<ul>
<li><strong>quantity</strong>: average quantity per element in the country</li>
<li><strong>elements</strong>: to... | <p>One option would be to switch to <code>geom_rect</code> which requires some data wrangling to compute the <code>xmin</code> and <code>xmax</code>:</p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
data <- data.frame("country" = c("Argentina", "Peru", "Bolivi... | R - Modify ggplot columns width by a specific variable and use such variable as a reference on the X-axis | r|ggplot2|tidyverse|bar-chart|x-axis | 2 | 48 | 1 | 72,900,022 | 72,900,022 | 4 | true | 2022-07-07T14:42:37.827Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R - Modify ggplot columns width by a specific variable and use such variable as a reference on the X-axis<p>I have a dataset where each rows corresponds to a... |
72,901,145 | Webscraping in Python with Beautifulsoup<p>I would like to scrape a website in Python. The class_ name is too long for Pycharm (>120 characters), so I defined a variable to split it up. However, it still doesn't work. It only returns "None". What am I doing wrong?</p>
<pre><code>html = requests.get("h... | <p>As mentioned by @1extraline you should fix your spaces / typos to get your goal.</p>
<p>I would also recommend avoiding to select your elements by classes, they are more often generated dynamically and it is not necessary to use all of them.</p>
<p>So change your strategy and select by more static attributes like <c... | Webscraping in Python with Beautifulsoup | python|html|web-scraping|beautifulsoup | 0 | 48 | 2 | 72,901,788 | 72,901,788 | 4 | true | 2022-07-07T16:15:00.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Webscraping in Python with Beautifulsoup<p>I would like to scrape a website in Python. The class_ name is too long for Pycharm (>120 characters), so I def... |
72,916,226 | How to perform for loop to apply custom function with grouping<p>I'm trying to perform a forloop to apply a custom summarise function to all the numeric columns in the dataframe. The forloop output seems to ignore the grouping factor- however, if I perform the function alone on a single column (without the for loop), i... | <p>So instead of using for-loops you can do better,</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
library(rlang)
library(purrr)
library(tibble)
dexadf <- data.frame(
stringsAsFactors = FALSE,
participant = c("pt04","pt75","pt21","pt73",
... | How to perform for loop to apply custom function with grouping | r|function|grouping | 1 | 48 | 3 | 72,916,367 | 72,916,367 | 4 | true | 2022-07-08T19:35:57.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to perform for loop to apply custom function with grouping<p>I'm trying to perform a forloop to apply a custom summarise function to all the numeric colu... |
72,928,655 | can not convert const to number<p>I have a code which should give number 1 or 5 or 10 or 50.
rust compiler says "pattern <code>4_u8..=u8::MAX</code> not covered"</p>
<p>the code:</p>
<pre class="lang-rust prettyprint-override"><code>use rand::Rng;
fn main() {
let rand_num: u8 = rand::thread_rng().gen_ran... | <p>Matches in rust need to be exhaustive. In other words they need to cover every possible case.
When you are matching on the enum Coin you are matching every variant in the enum - so it is valid.</p>
<p>But when you are matching on an integer (in this case, a u8) the possible values can be anywhere from 0 to 255. Cons... | can not convert const to number | random|rust | -1 | 48 | 3 | 72,928,722 | 72,928,722 | 4 | true | 2022-07-10T13:00:05.560Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
can not convert const to number<p>I have a code which should give number 1 or 5 or 10 or 50.
rust compiler says "pattern <code>4_u8..=u8::MAX</code> not... |
72,925,865 | How to get a count of record number in the same SQL sentence when we are inserting a data into a file in SQLRPGLE<p>Recently in an interview I was asked , How to get the data count when inserting data into the file using an INSERT statement , I told we can use a Count statement later on to get the count , but he insist... | <p>You have two options.</p>
<ol>
<li><a href="https://www.ibm.com/docs/en/i/7.4?topic=reference-sqlca-sql-communication-area" rel="nofollow noreferrer">SQL Communications area</a></li>
</ol>
<blockquote>
<p>SQLERRD(3)</p>
<p>For a CONNECT for status statement, SQLERRD(3) contains information
about the connection statu... | How to get a count of record number in the same SQL sentence when we are inserting a data into a file in SQLRPGLE | ibm-midrange|rpgle|rpg | 1 | 48 | 1 | 72,939,371 | 72,939,371 | 4 | true | 2022-07-10T02:55:14.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get a count of record number in the same SQL sentence when we are inserting a data into a file in SQLRPGLE<p>Recently in an interview I was asked , Ho... |
72,937,833 | Javascript prompt loads before page displays<p>I added a prompt on my page but it loads before the page has loaded.
How do I only show the message once the whole page is visible?</p>
<p>Here is my prompt:</p>
<pre><code>if (name == null || name == "") {
txt == "No name provided";
} else {
txt = ... | <p>If you wrap the code in an event-listener that listens for the <code>DOMContentLoaded</code> event it'll run only once the document is ready:</p>
<pre><code>window.addEventListener('DOMContentLoaded', (e)=>{
if (name == null || name == "") {
txt == "No name provided";
} else {
txt ... | Javascript prompt loads before page displays | javascript|html|prompt|script | 2 | 48 | 3 | 72,937,851 | 72,937,851 | 4 | true | 2022-07-11T11:27:23.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript prompt loads before page displays<p>I added a prompt on my page but it loads before the page has loaded.
How do I only show the message once the w... |
73,007,407 | Cracking my head over the usage of tilde in Pandas<p>I read numerous similar posts about the subject here but still cannot make anything out of this.</p>
<p>I have this simple list:</p>
<pre><code>mask =[False, False, False, False, True, True, False]
</code></pre>
<p>And am attempting to negate this list via the ~ ope... | <p>To work with the <code>~</code> operator you first need to generate a <em>DataFrame</em> like for example:</p>
<pre><code>import pandas as pd
mask = [False, False, False, False, True, True, False]
mask = pd.DataFrame(mask, columns=['mask'])
mask = ~mask
print(mask)
</code></pre>
<p>Output:</p>
<pre><code> mask
0... | Cracking my head over the usage of tilde in Pandas | python|pandas|list|negation | 0 | 48 | 3 | 73,007,465 | 73,007,465 | 4 | true | 2022-07-16T20:19:57.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cracking my head over the usage of tilde in Pandas<p>I read numerous similar posts about the subject here but still cannot make anything out of this.</p>
<p... |
72,913,490 | Getting an error that I cannot resolve symbol scalafx<p>Beginner at scala here, been trying to import scalafx into my scala file but I just can't seem to do so.</p>
<pre><code>import scalafx.application.JFXApp
object Main extends JFXApp{
}
</code></pre>
<p>And the sbt file that I have is</p>
<pre><code>ThisBuild / ve... | <blockquote>
<p>To use <code>ScalaFX</code> you need to add a dependency on the <code>ScalaFX</code> library
and also corresponding version of the <code>JavaFX</code>. <code>JavaFX</code> binaries are
system dependent.</p>
</blockquote>
<p>You need to tell sbt about the OS you are running, using something like:</p>
<pr... | Getting an error that I cannot resolve symbol scalafx | scala | 2 | 48 | 1 | 72,913,693 | 72,913,693 | 4 | true | 2022-07-08T15:12:01.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting an error that I cannot resolve symbol scalafx<p>Beginner at scala here, been trying to import scalafx into my scala file but I just can't seem to do ... |
72,816,087 | Remove leading zeroes in pandas column but only for numeric<p>My pandas dataframe looks as follows:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>col1</th>
<th>col2</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>ABC8392akl</td>
</tr>
<tr>
<td>2</td>
<td>001523</td>
</tr>
<tr>
<td>3</td>
... | <p>You can use a regex with <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.str.replace.html" rel="nofollow noreferrer"><code>str.replace</code></a> for this:</p>
<pre><code>df['col2'] = df['col2'].str.replace(r'^0+(?!.*\D)', '', regex=True)
</code></pre>
<p>output:</p>
<pre><code> col1 col... | Remove leading zeroes in pandas column but only for numeric | python|pandas|dataframe | 2 | 48 | 3 | 72,816,105 | 72,816,105 | 4 | true | 2022-06-30T12:44:14.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove leading zeroes in pandas column but only for numeric<p>My pandas dataframe looks as follows:</p>
<div class="s-table-container">
<table class="s-table... |
72,876,088 | Not to send SIGINT to a child when SIGINT is sent to a parent<p>Is there a way to not sent <code>SIGINT</code> to a child process when <code>SIGINT</code> is sent to a parent? Example:</p>
<p><code>main.c</code>:</p>
<pre><code>#define _GNU_SOURCE
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio... | <p>Note that this is the kernel sending keyboard-generated signals, such as <code>SIGINT</code>, to all processes in the <a href="https://en.wikipedia.org/wiki/Process_group" rel="nofollow noreferrer">process group</a> attached to the terminal.</p>
<p>Block <code>SIGINT</code> in the parent with <a href="https://man7.o... | Not to send SIGINT to a child when SIGINT is sent to a parent | c|linux|signals|sigint|execve | 0 | 48 | 1 | 72,876,605 | 72,876,605 | 4 | true | 2022-07-05T22:14:53.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Not to send SIGINT to a child when SIGINT is sent to a parent<p>Is there a way to not sent <code>SIGINT</code> to a child process when <code>SIGINT</code> is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.