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,355,045 | How to make a StringVar update its value when changing in tkinter?<pre><code>import tkinter as tk
from tkinter import *
from math import *
from turtle import delay
from pylab import *
import time
my_w = tk.Tk()
my_w.geometry("200x500") # Size of the window
my_w.title("Puls") # Adding a title
sv... | <p>You can use <code>sv.trace_add(...)</code> to execute a function whenever the value of <code>sv</code> is changed:</p>
<pre class="lang-py prettyprint-override"><code>...
# used to show the result of f(x)
label = tk.Label(height=5)
label.grid(row=3, column=1, padx=50)
# used textvariable=sv to show the 'x' value
l... | How to make a StringVar update its value when changing in tkinter? | python|variables|tkinter | 0 | 79 | 2 | 72,356,142 | 72,356,142 | 1 | true | 2022-05-23T21:38:09.037Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make a StringVar update its value when changing in tkinter?<pre><code>import tkinter as tk
from tkinter import *
from math import *
from turtle import... |
72,356,473 | Why Justify-content not working in nav-bar in html css<p>I am creating a project in HTML,CSS & Flask. Whenever I check my nav bar in the live server 'justify content' is not working, I try to figure out via fixing the sizing of <code>ul</code> & <code>li</code> elements and I give main container 100% width but ... | <p>Because you add <code><hr></code> tag inside <code><nav class="navbar"></code>. so move it outside <code><nav class="navbar"></code> then it works.</p> | Why Justify-content not working in nav-bar in html css | html|css | 0 | 79 | 3 | 72,357,155 | 72,357,155 | 1 | true | 2022-05-24T02:03:18.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why Justify-content not working in nav-bar in html css<p>I am creating a project in HTML,CSS & Flask. Whenever I check my nav bar in the live server 'jus... |
72,363,582 | Why is %Z giving me the numeric offset instead of the abbreviated time zone name in Ruby?<p>I'm trying to parse a timestamp from a string, and then subsequently display it with its abbreviated time zone, but what's coming back is the numeric offset from UTC despite what I believe is the correct usage. Here's the consol... | <p>From the <a href="https://apidock.com/ruby/DateTime/strftime" rel="nofollow noreferrer">strftime</a> docs for rails, says it's working as intended.</p>
<pre><code>Time zone:
%z - Time zone as hour and minute offset from UTC (e.g. +0900)
%:z - hour and minute offset from UTC with a colon (e.g. +09:00)
... | Why is %Z giving me the numeric offset instead of the abbreviated time zone name in Ruby? | ruby-on-rails|ruby | 0 | 79 | 2 | 72,365,977 | 72,365,977 | 1 | true | 2022-05-24T13:16:26.383Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is %Z giving me the numeric offset instead of the abbreviated time zone name in Ruby?<p>I'm trying to parse a timestamp from a string, and then subsequen... |
72,366,668 | R: if statement inside function (lapply)<p>I have a large list of dataframes with environmental variables from different localities. For each of the dataframes in the list, I want to summarize the values across locality (= group measurements of the same locality into one), using the name of the dataframes as a conditio... | <p>Several things going on here, including</p>
<ol>
<li><p>as akrun said, <code>if</code> statements must have a condition with a length of 1. Yours are not.</p>
<pre class="lang-r prettyprint-override"><code>grepl("locality", names(df1))
# [1] TRUE FALSE FALSE
</code></pre>
<p>That must be reduced so that i... | R: if statement inside function (lapply) | r|function|if-statement|apply | 0 | 79 | 1 | 72,368,896 | 72,368,896 | 1 | true | 2022-05-24T16:52:52.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R: if statement inside function (lapply)<p>I have a large list of dataframes with environmental variables from different localities. For each of the datafram... |
72,366,092 | Return empty collection when this collection is lazy intitialized<p>I have this object:</p>
<p><strong>Entity</strong></p>
<pre><code>@Entity
public class someClass{
private String name;
private String labelKey;
@ManyToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE}, fetch = FetchType.LAZY)
priv... | <p>As you can see in this tutorial <a href="https://www.baeldung.com/dozer#Mapping" rel="nofollow noreferrer">here</a> you can instruct <code>dozer</code> to exclude some field from the mapping.</p>
<p>If you do so, then the dozer will not invoke the method of <code>getProducts</code> of your entity class and therefore... | Return empty collection when this collection is lazy intitialized | java|spring-boot|hibernate|jpa|lazy-loading | 3 | 79 | 4 | 72,376,884 | 72,376,884 | 1 | true | 2022-05-24T16:07:02.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Return empty collection when this collection is lazy intitialized<p>I have this object:</p>
<p><strong>Entity</strong></p>
<pre><code>@Entity
public class so... |
72,380,674 | Keep backward compatibility for a function when we need to return more values than before<p>I have a function that that currently returns two values, an int and a string, for example:</p>
<pre><code>def myfunc():
return 0, 'stringA'
</code></pre>
<p>This function is already in use in a lot of code, but I'd need to ... | <p>First up, answering a question you didn't ask, but which may help in the future or for other folks:</p>
<p>When I find that I'm returning multiple items from a single function, and especially when the list of items returned starts to grow, I often find it useful to return either a dict or an object rather than a tup... | Keep backward compatibility for a function when we need to return more values than before | python|function|return-value | 2 | 79 | 2 | 72,380,910 | 72,380,910 | 1 | true | 2022-05-25T15:45:57.230Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Keep backward compatibility for a function when we need to return more values than before<p>I have a function that that currently returns two values, an int ... |
72,385,240 | Display text value from Github Gist in Hugo site<p>I know I might be asking something quite simple but for the life of me I can't seem to get my head around this and I'm definitely overseeing something simple but I don't know what. Any help would be very appreciated.</p>
<p>I'm generating a static site using Hugo. On o... | <p>You could fetch this data and store it in Hugo as a data file but I don't recommend it.</p>
<p>Since Hugo is a static site generator, you would need to not only modify the data files in your repo every time the value changes, but re-build your site as well. Then you have to worry about running the script on a schedu... | Display text value from Github Gist in Hugo site | javascript|html|hugo|gist | 0 | 79 | 2 | 72,385,730 | 72,385,730 | 1 | true | 2022-05-25T23:49:48.640Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Display text value from Github Gist in Hugo site<p>I know I might be asking something quite simple but for the life of me I can't seem to get my head around ... |
72,797,152 | Flutter pass TextEditingController as argument to class<p>I try to pass a TextEditingController from a parent Class to a child Class.
I don't know, how to do so.</p>
<p>This is my class, where I want to use the TextEditingController which I want to give as an argument.</p>
<pre><code>class AutocompleteField extends Sta... | <p>I think to the real challange here is how to use the controller, rather than simply passing it between the parent and the child. That is a very interesting question. You basically need to lift the controller up from the child to it's parent rather than the other way arround. That is, the <code>fieldViewBuilder</code... | Flutter pass TextEditingController as argument to class | flutter|class|parameters|arguments | 0 | 79 | 4 | 72,802,617 | 72,802,617 | 1 | true | 2022-06-29T07:07:41.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter pass TextEditingController as argument to class<p>I try to pass a TextEditingController from a parent Class to a child Class.
I don't know, how to do... |
72,804,588 | Why SafeAreaView Background Not Working in React Native?<p>In my app SafeareaView Not Working. And I can to change Background Color
Check This Image
<a href="https://i.stack.imgur.com/dlasQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dlasQ.jpg" alt="enter image description here" /></a></p> | <p>Solved</p>
<p>Just Add <code><StatusBar backgroundColor="red" /></code></p> | Why SafeAreaView Background Not Working in React Native? | react-native|safeareaview | 1 | 79 | 2 | 72,804,715 | 72,804,715 | 1 | true | 2022-06-29T16:05:59.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why SafeAreaView Background Not Working in React Native?<p>In my app SafeareaView Not Working. And I can to change Background Color
Check This Image
<a href=... |
72,807,273 | Tailwind css apply order<p>I want to know tailwind css apply order. Or it can be issue of general css order.</p>
<p>However, when I put 2 classes, <code>bg-gray-50</code> and <code>bg-gray-500</code>, <code>bg-gray-50</code> class is applied only. It doesn't matter for order of two classes.
So, <code>bg-gray-50 bg-gray... | <p>Because in file css core of tailwind which they defind all class of tailwind, they place class <code>bg-gray-50</code> before <code>bg-gray-500</code>.So it compile the first class and ignore later class. You can imagine their order:</p>
<pre><code>// tailwind.css
.bg-gray-50 { background-color: #E9E6E6 }
.bg-gray-5... | Tailwind css apply order | css|tailwind-css | 1 | 79 | 1 | 72,812,688 | 72,812,688 | 1 | true | 2022-06-29T20:10:24.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Tailwind css apply order<p>I want to know tailwind css apply order. Or it can be issue of general css order.</p>
<p>However, when I put 2 classes, <code>bg-g... |
72,815,098 | Dimension 2 in both shapes must be equal, but are 3 and 1<p>I am getting a value error while trying to make a GAN work on RGB photos in Tensorflow.</p>
<p>in the video that I'm following it works in black and white(59:50): <a href="https://www.youtube.com/watch?v=LZov6445YAY&list=WL&index=4&t=3426s&ab_c... | <p>Let us start by inspecting your error alongside the code you have provided.</p>
<pre><code> x = tf.concat([data, fake], axis=0)
ValueError: Dimension 2 in both shapes must be equal, but are 3 and 1. Shapes are [28,28,3] and [28,28,1]. for '{{node concat_1}} = ConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32](data... | Dimension 2 in both shapes must be equal, but are 3 and 1 | python|tensorflow|keras|neural-network|keras-layer | 0 | 79 | 1 | 72,815,245 | 72,815,245 | 1 | true | 2022-06-30T11:37:09.827Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dimension 2 in both shapes must be equal, but are 3 and 1<p>I am getting a value error while trying to make a GAN work on RGB photos in Tensorflow.</p>
<p>in... |
72,815,072 | How to get arguments for on_message event in discord.py<p>I'm currently new to coding, And I'm planning to make a utility bot. So basically, what I am trying to do here is getting the second argument for my on_message event. But how can I do that?
I'm making an auto math module for my bot, without using the prefix. For... | <p>Using <code>message.content.startswith()</code> means you already know that <code>message.content</code> is a string. It is self explanatory that it contains the content of the message that triggered this <code>on_message()</code> event, and you can find the doc <a href="https://discordpy.readthedocs.io/en/stable/ap... | How to get arguments for on_message event in discord.py | python|discord.py | 0 | 79 | 1 | 72,815,373 | 72,815,373 | 1 | true | 2022-06-30T11:35:14.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get arguments for on_message event in discord.py<p>I'm currently new to coding, And I'm planning to make a utility bot. So basically, what I am trying... |
72,818,856 | How to .appendChild() to all elements with the same class<p>The blue <strong>F</strong> turns into an actual amount of weight when you enter a number into the input field above.</p>
<p>The Two Functions <code>Kg()</code> and <code>Lbs()</code> are changing the class <code>.dynamic</code> which is where Kg or Lbs is bei... | <h2>Minor Problems</h2>
<ul>
<li>There's no such HTML element <code><navbar></code>, there's <code><nav></code>.</li>
<li>There's a block code hard-coded 8 times with the only difference between them is a number. Whenever code needs to repeat itself, we use some sort of iteration such as a <code>for</code> ... | How to .appendChild() to all elements with the same class | javascript|html|jquery|css | 1 | 79 | 4 | 72,821,217 | 72,821,217 | 1 | true | 2022-06-30T16:03:45.393Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to .appendChild() to all elements with the same class<p>The blue <strong>F</strong> turns into an actual amount of weight when you enter a number into th... |
72,823,485 | PySpark Map to Columns, rename key columns<p>I am converting the Map column to multiple columns dynamically based on the values in the column. I am using the following code (taken mostly from <a href="https://stackoverflow.com/questions/36869134/pyspark-converting-a-column-of-type-map-to-multiple-columns-in-a-dataframe... | <p>Add the following line just before the code which converts map to columns:</p>
<pre class="lang-py prettyprint-override"><code>df = df.withColumn('map_col', F.expr("transform_keys(map_col, (k, v) -> concat(k, '_2'))"))
</code></pre>
<p>This uses <a href="https://spark.apache.org/docs/latest/api/sql/inde... | PySpark Map to Columns, rename key columns | apache-spark|dictionary|pyspark|key|multiple-columns | 1 | 79 | 1 | 72,824,150 | 72,824,150 | 1 | true | 2022-07-01T01:13:40.403Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PySpark Map to Columns, rename key columns<p>I am converting the Map column to multiple columns dynamically based on the values in the column. I am using the... |
72,818,526 | Azure Function App Service Bus Topic trigger random error while settings some PrefetchCount limit and lock error as well<p>Below code I have for one of the Azure Function Service Bus topic trigger, where I am receiving the service bus messages in batch and each message I am putting into one Task.</p>
<p>I have below se... | <ul>
<li><p>you can set <code>PrefetchCount</code> to 0 it is and optional parameter. It is
available if you want high speed and want message to be ready after
the maximum number of messages are already fetch.</p>
</li>
<li><p>That is why you are getting the warning because it seems that the
number of messages availabl... | Azure Function App Service Bus Topic trigger random error while settings some PrefetchCount limit and lock error as well | c#|azure-functions|azure-servicebus-topics | 0 | 79 | 1 | 72,824,250 | 72,824,250 | 1 | true | 2022-06-30T15:38:13.867Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Azure Function App Service Bus Topic trigger random error while settings some PrefetchCount limit and lock error as well<p>Below code I have for one of the A... |
72,822,783 | Doctest not working in Sphinx, cannot import python files Python<p>I have a problem trying to run <code>doctest</code> from the <a href="https://www.sphinx-doc.org/en/master/tutorial/describing-code.html" rel="nofollow noreferrer">Sphinx Tutorial</a>. I have the directory tree below but I cannot run a <code>doctest</co... | <p>Move <code>lumache.py</code> to your project folder (i.e. same folder as where <code>docs/</code> currently is).</p> | Doctest not working in Sphinx, cannot import python files Python | python|python-sphinx|sys|pathlib|doctest | 3 | 79 | 1 | 72,828,884 | 72,828,884 | 1 | true | 2022-06-30T22:51:47.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Doctest not working in Sphinx, cannot import python files Python<p>I have a problem trying to run <code>doctest</code> from the <a href="https://www.sphinx-d... |
72,836,647 | Angular - Nested API Calls<p>I'm getting data from APIs like this:</p>
<pre class="lang-js prettyprint-override"><code>this.myService.getFirstData(slug).pipe(takeUntil(this.unsubscribe))
.subscribe(firstData => {
this.data = firstData;
for (const column of this.data.columns) {
if(colu... | <p>If I understand the problem right, this is the way I would implement this requirement. The comments try to explain the code.</p>
<pre><code>this.myService.getFirstData(slug).pipe(
// after getFirstData returns you can concatenate another series of http
// calls using the concatMap operator
concatMap(firstData... | Angular - Nested API Calls | angular|typescript|rxjs | 0 | 79 | 1 | 72,837,901 | 72,837,901 | 1 | true | 2022-07-02T05:17:40.593Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular - Nested API Calls<p>I'm getting data from APIs like this:</p>
<pre class="lang-js prettyprint-override"><code>this.myService.getFirstData(slug).pipe... |
72,847,056 | Busy/wait or spinning pattern in multithreaded environment<p><a href="https://www.linkedin.com/pulse/how-do-i-design-high-frequency-trading-systems-its-part-silahian-2/" rel="nofollow noreferrer">https://www.linkedin.com/pulse/how-do-i-design-high-frequency-trading-systems-its-part-silahian-2/</a></p>
<blockquote>
<p>a... | <blockquote>
<p>how does busy/wait and spinning pattern avoids context switches if it runs two threads in one core ?</p>
</blockquote>
<p>When a thread perform a lock and the lock is taken by another thread, it make s system call so the OS can know that the thread is waiting for a lock and this should be worthless to l... | Busy/wait or spinning pattern in multithreaded environment | c++|multithreading | 0 | 79 | 1 | 72,847,508 | 72,847,508 | 1 | true | 2022-07-03T13:54:56.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Busy/wait or spinning pattern in multithreaded environment<p><a href="https://www.linkedin.com/pulse/how-do-i-design-high-frequency-trading-systems-its-part-... |
72,850,728 | How to map function over numpy with condition on each variable?<p>I get this error when trying to do map this function over the numpy array:</p>
<pre class="lang-py prettyprint-override"><code>>>> a = np.array([1, 2, 3, 4, 5])
>>> g = lambda x: 0 if x % 2 == 0 else 1
>>> g(a)
Traceback (most ... | <p>This has problems:</p>
<pre><code>a = np.array([1, 2, 3, 4, 5])
g = lambda x: 0 if x % 2 == 0 else 1
g(a)
</code></pre>
<p>A lambda is essentially just an unnamed function, which you happen to be naming here, so you might as well:</p>
<pre><code>def g(x):
return 0 if x % 2 == 0 else 1
</code></pre>
<p>But that's... | How to map function over numpy with condition on each variable? | python|numpy | 0 | 79 | 3 | 72,850,784 | 72,850,784 | 1 | true | 2022-07-04T00:16:04.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to map function over numpy with condition on each variable?<p>I get this error when trying to do map this function over the numpy array:</p>
<pre class="... |
72,867,397 | Select values of rows across dataframes using python<p>I have two dataframes, one is populated with barcodes and their product's prices across several supermarkets during the COVID pandemic, and the other one contains the actual product names and their barcodes along with a few category_id's etc, which are known (so I ... | <p>just convert BARCODE column to string. example:</p>
<pre><code> df_bar['BARCODE'] = df_bar['BARCODE'].apply(lambda x: str(x)[:-2])
</code></pre> | Select values of rows across dataframes using python | python|pandas | 1 | 79 | 4 | 72,870,399 | 72,870,399 | 1 | true | 2022-07-05T09:54:32.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Select values of rows across dataframes using python<p>I have two dataframes, one is populated with barcodes and their product's prices across several superm... |
72,870,589 | Do you know how to visualize a DXF files in React js?<p>I want to display DXF files (2D mechanical drawings) in my react app. I cant find the way to do it. Thank You!</p> | <p>Here is the package i used once for this <a href="https://www.npmjs.com/package/dxf-viewer" rel="nofollow noreferrer">https://www.npmjs.com/package/dxf-viewer</a></p> | Do you know how to visualize a DXF files in React js? | javascript|reactjs|react-hooks|dxf | 0 | 79 | 1 | 72,870,842 | 72,870,842 | 1 | true | 2022-07-05T13:50:26.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Do you know how to visualize a DXF files in React js?<p>I want to display DXF files (2D mechanical drawings) in my react app. I cant find the way to do it. T... |
72,884,740 | How to customize WooCommerce shop page without plugins<p>I'm trying to customise the <code>shop</code> page in WooCommerce completely, but cannot see a way to do so without the use of plugins.</p>
<p>I imagine that if I do not set a <code>shop</code> page in WooCommerce (and it's just a page with a template for example... | <p>In your child theme folder create a folder calle <strong>WooCommerce</strong> anmd inside a file called <strong>archive-product.php</strong> which is the shop page template file, customize it as desired.</p>
<p>example:</p>
<pre><code>do_action('woocommerce_before_shop_loop');
echo '<h1>MOST POPULAR PRODUCTS&l... | How to customize WooCommerce shop page without plugins | php|wordpress|woocommerce | 0 | 79 | 1 | 72,884,916 | 72,884,916 | 1 | true | 2022-07-06T13:48:52.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to customize WooCommerce shop page without plugins<p>I'm trying to customise the <code>shop</code> page in WooCommerce completely, but cannot see a way t... |
72,878,253 | How to update the cherry picked commit on gerrit?<p>I made a commit <code>A</code> to a branch. It's not merged yet. My friend cherry picked my commit and made a new commit <code>B</code>. Now they form a relation chain right? So, If I amend my commit <code>A</code>, What is the best way to get my new changes in my fri... | <p>It's not a good practice cherry-picking a commit from a open change, but if this was needed, now it's necessary to cherry-pick the new commit, amend the original commit and push to Gerrit, creating a new patch-set.</p> | How to update the cherry picked commit on gerrit? | git|gerrit|git-rebase|git-pull|git-cherry-pick | 0 | 79 | 1 | 72,885,059 | 72,885,059 | 1 | true | 2022-07-06T05:18:41.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to update the cherry picked commit on gerrit?<p>I made a commit <code>A</code> to a branch. It's not merged yet. My friend cherry picked my commit and ma... |
72,905,664 | AttributeError: 'NoneType' object has no attribute 'drivername' URI config implementation wrong<p>I see a lot of people with this error but nothing fixes it for me. I'm using a config.py file to hold my config classes. This seems to be where the issue lies. I'm also using the application factory pattern. I call the obj... | <p>I think you might need to put load_env() in your Config class. I understand that flask has it's own way to reading .env files but maybe try it.</p> | AttributeError: 'NoneType' object has no attribute 'drivername' URI config implementation wrong | python|mysql|flask|sqlalchemy|flask-sqlalchemy | 0 | 79 | 1 | 72,905,828 | 72,905,828 | 1 | true | 2022-07-08T01:02:08.073Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AttributeError: 'NoneType' object has no attribute 'drivername' URI config implementation wrong<p>I see a lot of people with this error but nothing fixes it ... |
72,875,829 | Athena: Convert column to different values<p>I would like to convert a column to another value, kind of like having a map. I am currently doing something like</p>
<pre class="lang-sql prettyprint-override"><code>SELECT col1,
col2,
CASE
data = 'data1' THEN 'd1'
WHEN data = 'data2' THEN 'd2' ELSE... | <p>There really is not a way to use a case statement without writing each condition to do what you are trying to accomplish.</p>
<p>If your end goal is a mapping to change the value of a column to something else and that could change or is a large number of items; for easy maintenance you would want to use another tabl... | Athena: Convert column to different values | sql|amazon-athena|presto | 1 | 79 | 1 | 72,913,864 | 72,913,864 | 1 | true | 2022-07-05T21:38:10.603Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Athena: Convert column to different values<p>I would like to convert a column to another value, kind of like having a map. I am currently doing something li... |
72,931,226 | How do I detect the transparent part of a sprite in unity<p>I have a sprite that is partly transparent.</p>
<p><a href="https://i.stack.imgur.com/vb0Hh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vb0Hh.png" alt="enter image description here" /></a></p>
<p>My aim is to fill the image with some squ... | <p>Beforehand little disclaimer: This won't be cheap ^^</p>
<p>You will want to get the according pixels at the rect where you are going to spawn a tile and need to check them all if <strong>any</strong> of them is <strong>not</strong> fully transparent.</p>
<p>As you didn't provide much information about your setup I ... | How do I detect the transparent part of a sprite in unity | c#|unity3d | 0 | 79 | 1 | 72,935,797 | 72,935,797 | 1 | true | 2022-07-10T19:17:02.637Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I detect the transparent part of a sprite in unity<p>I have a sprite that is partly transparent.</p>
<p><a href="https://i.stack.imgur.com/vb0Hh.png" ... |
72,938,116 | Bad enforcement of clippy rule?<p>I have disallowed unrelated shadowing in variable declarations.</p>
<p>But now this rule gives me an error on these two lines</p>
<pre class="lang-rust prettyprint-override"><code>let overflow: bool;
(self.standing, overflow) = self.standing.overflowing_add(reason.to_severity());
</cod... | <p>This is a reported bug - <a href="https://github.com/rust-lang/rust-clippy/issues/6141#issuecomment-758330154" rel="nofollow noreferrer">rust-clippy#6141</a>.</p>
<p>I think the problem is that the destructuring assignment is desugared into a <code>let</code> declaration that reuses the same span, and this causes cl... | Bad enforcement of clippy rule? | rust|shadowing|rust-clippy | 0 | 79 | 1 | 72,938,254 | 72,938,254 | 1 | true | 2022-07-11T11:48:52.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bad enforcement of clippy rule?<p>I have disallowed unrelated shadowing in variable declarations.</p>
<p>But now this rule gives me an error on these two lin... |
72,940,521 | ggplot2 custom scale color labels<p>I have</p>
<pre><code>norm.values<-data.frame(x=rnorm(100), y=rnorm(100), col=rnorm(100), size=sample(c(1,2,3), 100, replace = T))
ggplot(norm.values , aes(x=x, color=col, y=y)) +
geom_point(aes(shape=factor(size)), size=3 ) +
scale_color_gradient2(low="blue",mid=... | <p>Just add the <code>breaks</code> and <code>labels</code> argument of <code>scale_color_gradient2</code>:</p>
<pre><code>ggplot(norm.values , aes(x=x, color=col, y=y)) +
geom_point(aes(shape=factor(size)), size=3 ) +
scale_color_gradient2(low="blue",mid="blue", high="red",
... | ggplot2 custom scale color labels | r|ggplot2|label | 0 | 79 | 2 | 72,940,766 | 72,940,766 | 1 | true | 2022-07-11T14:55:26.663Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ggplot2 custom scale color labels<p>I have</p>
<pre><code>norm.values<-data.frame(x=rnorm(100), y=rnorm(100), col=rnorm(100), size=sample(c(1,2,3), 100, r... |
72,941,113 | Why the error "Generic type 'Record' requires 2 type argument(s). ts(2314)" using this form of typing?<p>I'm trying to use this type but I can't:</p>
<pre><code>type ROLES = "one" | "two"
type Users = {
name: Record<[key in ROLES]?, User[]>;
};
</code></pre>
<p>because it throws with:</p>... | <p>The error message says it all. you have to define two generics, so if you want the key to be a key of <code>ROLES</code> then you need to remove the <code>?</code> and use <code>Record<ROLES, User[]></code>. if you want optional entries you can use <code>Partial<Record<ROLES, User[]>></code>.</p> | Why the error "Generic type 'Record' requires 2 type argument(s). ts(2314)" using this form of typing? | typescript | 0 | 79 | 1 | 72,941,302 | 72,941,302 | 1 | true | 2022-07-11T15:36:44.250Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why the error "Generic type 'Record' requires 2 type argument(s). ts(2314)" using this form of typing?<p>I'm trying to use this type but I can't:</p>
<pre><c... |
72,960,763 | Header based routing with Chi<p>I'm trying to implement two routes using the Chi router. One should be invoked only if the "host" header is set to example.com. But only the lastly added route is invoked.</p>
<pre><code>r := chi.NewRouter()
r.Use(middleware.Logger)
middlewareHeader := middleware.RouteHeaders(... | <p>As mentioned on comment: you cannot assign multiple handlers to one route.</p>
<blockquote>
<p>RouteHeaders is a neat little header-based router that allows you to direct the flow of a request through a middleware stack based on a request header.</p>
</blockquote>
<p><code>RouteHeaders</code> is used to put your req... | Header based routing with Chi | go|go-chi | 1 | 79 | 1 | 72,971,402 | 72,971,402 | 1 | true | 2022-07-13T03:56:22.947Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Header based routing with Chi<p>I'm trying to implement two routes using the Chi router. One should be invoked only if the "host" header is set to ... |
72,953,059 | Caching best practice using .net core and APIM<p>I am new to APIM caching. I am building a .net core webapi project (micro Service) which has GET endpoint for example "GetProduct(QueryPara parameters) (see below)". I would like to implement caching.</p>
<p>Note: My web api (service) is called via APIM.</p>
<p... | <p><em>As suggested by @Markus Meyer, Here is the complete policies of Cached APIM and the <a href="https://rfqapiservicey27itmeb4cf7q.developer.azure-api.net/api-details#api=evaluation&operation=62ce45471cb8cbe3725b55ed" rel="nofollow noreferrer">documentation</a> with the example of Cached APIM.</em></p>
<pre><co... | Caching best practice using .net core and APIM | c#|asp.net-core-webapi|azure-api-management | -1 | 79 | 1 | 72,980,327 | 72,980,327 | 1 | true | 2022-07-12T13:23:42.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Caching best practice using .net core and APIM<p>I am new to APIM caching. I am building a .net core webapi project (micro Service) which has GET endpoint fo... |
72,946,449 | Change The Azure App Service To Display A Different Timezone From a Users Settings Stored Value?<p>I am aware of changing an Azure Web App timezone in the configuration using 'WEBSITE_TIME_ZONE' and the 'Time Zone You Want'.</p>
<p>It works great.</p>
<p>However, in my user setting page/table I'd like to store a value ... | <p>You should not use <code>WEBSITE_TIME_ZONE</code> if you are wanting to change the time zone per-user. Instead, you should avoid relying on the concept of the "local time zone" in your application code. That means, don't call <code>TimeZoneInfo.Local</code>, <code>DateTime.Now</code>, <code>DateTime.Toda... | Change The Azure App Service To Display A Different Timezone From a Users Settings Stored Value? | c#|azure|web-applications|timezone|blazor | 1 | 79 | 1 | 72,984,431 | 72,984,431 | 1 | true | 2022-07-12T02:31:23.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change The Azure App Service To Display A Different Timezone From a Users Settings Stored Value?<p>I am aware of changing an Azure Web App timezone in the co... |
72,992,650 | How to select subset of a range in Google Spreadsheet?<p>I want to extract subset of a range from another range by selecting starting columns and length.</p>
<p>For example, how can I extract <code>B1:C1</code> from another range <code>A1:D1</code> by indicating starting columns <code>2</code> as in the image attached?... | <p>This is easily achievable with the OFFSET function:</p>
<pre><code>=sum(offset(Range,,StartCol-1,,Width))
</code></pre>
<p>So for your specific example, the expression would be:</p>
<pre><code>=sum(offset(A1:D1,,2-1,,2))
</code></pre> | How to select subset of a range in Google Spreadsheet? | google-sheets | 1 | 79 | 2 | 72,994,400 | 72,994,400 | 1 | true | 2022-07-15T10:32:25.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to select subset of a range in Google Spreadsheet?<p>I want to extract subset of a range from another range by selecting starting columns and length.</p>... |
72,956,840 | setting up event pattern in cloud watch event rule<p>I am having a problem with my terraform. my lambda is expecting a specific format of message from CloudWatch event rule</p>
<pre><code>resource "aws_cloudwatch_event_rule" "send_hello" {
name = "say-hi"
schedule_expression = &quo... | <p>Your <code>send_hello</code> works on schedule, thus <code>event_pattern</code> does not apply. If you want to pass something to your lambda on schedule, you have to specify <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target#input_template" rel="nofollow nore... | setting up event pattern in cloud watch event rule | terraform|terraform-provider-aws | 1 | 79 | 1 | 73,000,288 | 73,000,288 | 1 | true | 2022-07-12T18:25:33.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
setting up event pattern in cloud watch event rule<p>I am having a problem with my terraform. my lambda is expecting a specific format of message from CloudW... |
73,004,828 | How to find the greatest number of negative integers in array in java?<p>How to find the most significant number of negative integers in java? I have the following code and work well with positive integers. This is the code:</p>
<pre><code>int max = 0; // not initialsing it also makes it 0
int[] n = {-1,-2,-3,-4};
for(... | <ol>
<li>The return type of your methode has to be the int wrapper class Integer, because you accept any values in the int array so the only way to show the user that the array doesn't have an max, which only could happen if the array is empty, is to return null.</li>
<li>Now because your secure the case that the array... | How to find the greatest number of negative integers in array in java? | java|arrays | -3 | 79 | 2 | 73,005,522 | 73,005,522 | 1 | true | 2022-07-16T14:02:56.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to find the greatest number of negative integers in array in java?<p>How to find the most significant number of negative integers in java? I have the fol... |
72,972,044 | Create XML with XMLBUILDER2 in Nodejs<p>I'm creating an XML file using a foreach to add the data.</p>
<p>Problem:</p>
<p>I need to create an ELEMENT < Listings > and inside it I need to put the children that will be Listing given .... < /Listing > and after that FOR I need to close the < /Listings ></... | <p>Here is a working example:</p>
<pre><code>var {create} = require("xmlbuilder2");
const R = [{name: 'foo1', sku: 'bar1'}, {name:'foo2', sku: 'bar2'}];
let xml = create({ version: '1.0', encoding: "UTF-8"})
.ele('ListingDataFeed')
.ele('Listings');
for(let i = 0; i<R.length;i++){
xml.el... | Create XML with XMLBUILDER2 in Nodejs | node.js | 0 | 79 | 1 | 73,026,890 | 73,026,890 | 1 | true | 2022-07-13T20:07:26.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create XML with XMLBUILDER2 in Nodejs<p>I'm creating an XML file using a foreach to add the data.</p>
<p>Problem:</p>
<p>I need to create an ELEMENT < Lis... |
73,024,445 | Polly.Contrib.WaitAndRetry to "funnel" all requests when hitting rate limit<p>We're using the Dropbox API wrapped in Polly to handle retries.<br />
We have it set up as an exponential back-off, like explained <a href="https://github.com/Polly-Contrib/Polly.Contrib.WaitAndRetry#wait-and-retry-with-exponential-back-off" ... | <p>According to my understanding you want to have the following:</p>
<ol>
<li>The downstream system can throttle incoming requests<br />
1.1 The system is smart enough to provide a <code>RetryAfter</code> time span</li>
<li>You want to avoid flooding the downstream system if you already know that you are throttled</li>... | Polly.Contrib.WaitAndRetry to "funnel" all requests when hitting rate limit | c#|dropbox-api|polly|retry-logic | 1 | 79 | 1 | 73,055,228 | 73,055,228 | 1 | true | 2022-07-18T15:00:48.517Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Polly.Contrib.WaitAndRetry to "funnel" all requests when hitting rate limit<p>We're using the Dropbox API wrapped in Polly to handle retries.<br />
We have i... |
72,307,773 | Radio button value not resetting<p>I have a list of questions. And on click of next or previous I'm changing the question. I have 4 or 5 answers as radio buttons. I' using this package <a href="https://npm.io/package/radio-buttons-react-native" rel="nofollow noreferrer">Radio button npm</a>. And now I'm trying to chang... | <p>I solved it using below code:-</p>
<pre><code>import React, { useState } from "react";
import { View, StyleSheet, Button, Alert } from "react-native";
import RadioButtonRN from 'radio-buttons-react-native';
const App = () => {
const [show,setShow] = React.useState(true);
const data = [
... | Radio button value not resetting | reactjs|react-native | 2 | 79 | 2 | 73,109,058 | 73,109,058 | 1 | true | 2022-05-19T16:06:29.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Radio button value not resetting<p>I have a list of questions. And on click of next or previous I'm changing the question. I have 4 or 5 answers as radio but... |
72,811,196 | Creating a date column using pandas<p>I have a dataframe like below.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: center;">Id</th>
<th style="text-align: right;">d_of_arr</th>
<th style="text-align: center;">d_of_sty</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-ali... | <p>If performance or large DataFrame use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.repeat.html" rel="nofollow noreferrer"><code>Index.repeat</code></a> by difference by days for duplicate rows, add timedeltas by counter <a href="http://pandas.pydata.org/pandas-docs/stable/reference... | Creating a date column using pandas | python|pandas | 2 | 79 | 1 | 72,811,255 | 72,811,255 | 1 | true | 2022-06-30T06:31:12.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating a date column using pandas<p>I have a dataframe like below.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text... |
72,836,799 | How can we add Two auto-generated field in one model in Django<p>I am in need to create two auto generated field:
1st field is ID and another i am taking position that is equivalent to id or we can say it is also auto generated field in the model.</p>
<p>here is the code in which i am integrating:</p>
<pre><code>class ... | <p>You can override the <code>save</code> method to set the initial value of <code>position</code>:</p>
<pre class="lang-py prettyprint-override"><code>class DeviceControlPolicy(models.Model):
vendor_id = models.ForeignKey(Vendor, on_delete=models.CASCADE)
id = models.AutoField(primary_key=True)
name = mode... | How can we add Two auto-generated field in one model in Django | python|django|django-models|django-rest-framework | 1 | 79 | 1 | 72,836,939 | 72,836,939 | 1 | true | 2022-07-02T05:54:37.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can we add Two auto-generated field in one model in Django<p>I am in need to create two auto generated field:
1st field is ID and another i am taking pos... |
72,832,489 | How to unnest an integer array represented as a BLOB?<p>SQLite doesn’t have native support for arrays. I would think that my method (thinking outlined below) of making a custom BLOB encoding would be a fairly common workaround (yes, I need an array rather than normalizing the table). The benefit of representing an inte... | <p>SQLite's <a href="https://www.sqlite.org/lang_corefunc.html#hex" rel="nofollow noreferrer"><code>HEX()</code></a> function</p>
<blockquote>
<p>interprets its argument as a BLOB and returns a string which is the
upper-case hexadecimal rendering of the content of that blob.</p>
</blockquote>
<p>After you get the blob ... | How to unnest an integer array represented as a BLOB? | sqlite|blob | 2 | 79 | 1 | 72,833,821 | 72,833,821 | 1 | true | 2022-07-01T16:56:10.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to unnest an integer array represented as a BLOB?<p>SQLite doesn’t have native support for arrays. I would think that my method (thinking outlined below)... |
73,008,140 | Type declaration of a generic `map` function in TypeScript<p>In <a href="https://typescript-exercises.github.io/#exercise=14" rel="nofollow noreferrer">exercise #14 of typescript-exercises</a> you get to annotate the following function:</p>
<pre class="lang-ts prettyprint-override"><code>export function map(mapper, inp... | <p>I think the issue is with the use of the <code>declare</code> keyword. I'm not sure exactly where the problem comes in, but the keyword isn't being used correctly here. It should be used to <a href="https://stackoverflow.com/a/57352788/8271628">inform the compiler that a function named <code>subFunction</code> exist... | Type declaration of a generic `map` function in TypeScript | typescript|generics|functional-programming|closures|typing | 1 | 79 | 1 | 73,008,660 | 73,008,660 | 1 | true | 2022-07-16T22:49:53.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Type declaration of a generic `map` function in TypeScript<p>In <a href="https://typescript-exercises.github.io/#exercise=14" rel="nofollow noreferrer">exerc... |
72,881,145 | Detect multiple keypresses and trigger an action once in p5.js<p>I want the user to be able to press <kbd>a</kbd>+<kbd>d</kbd> <strong>once</strong> and my game should increase the score, not hold it to increase score, similar to when pressing <kbd>a</kbd>+<kbd>d</kbd> causes a special effect to occur in a game.</p>
<p... | <p>There are a few approaches. The event-driven approach is using p5's <a href="https://p5js.org/reference/#/p5/keyPressed" rel="nofollow noreferrer"><code>keyPressed</code></a> and <a href="https://p5js.org/reference/#/p5/keyReleased" rel="nofollow noreferrer"><code>keyReleased</code></a> callbacks, pulling the key's ... | Detect multiple keypresses and trigger an action once in p5.js | javascript|boolean|p5.js|keypress|game-development | 3 | 79 | 2 | 72,885,871 | 72,885,871 | 1 | true | 2022-07-06T09:35:41.693Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Detect multiple keypresses and trigger an action once in p5.js<p>I want the user to be able to press <kbd>a</kbd>+<kbd>d</kbd> <strong>once</strong> and my g... |
72,866,145 | Flutter - Dropdown list on click display Textfield<p>I'm quite new in Flutter, so how do I show a textfield widget below right after an user click one of the dropdown list value?</p>
<p>Here is the codes for my Dropdown button</p>
<pre><code>final items = ['Healthy', 'Unhealthy'];
...
DropdownMenuItem<String&g... | <p>You can use a visibility widget to show/hide a textfield. This will be controlled by a state variable, which we will call isVisible. So we have</p>
<pre><code>bool isVisible = false;
.....
Visibility(
visible: isVisible,
child: TextField(),
);
</code></pre>
<p>By default, the textfield won't be shown, bu... | Flutter - Dropdown list on click display Textfield | java|android|flutter|android-emulator | 0 | 79 | 1 | 72,875,911 | 72,875,911 | 1 | true | 2022-07-05T08:17:46.457Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter - Dropdown list on click display Textfield<p>I'm quite new in Flutter, so how do I show a textfield widget below right after an user click one of the... |
72,966,828 | reversing a hash to it's string in solidity<p>hello I am trying to save the physical address of somewhere in my contract but I found out
that large strings will cost more gas, so I am trying to save the string as a hash, and whenever I want, reverse that hash and get the string which I hashed.
Q1: is it possible?
Q2: i... | <ul>
<li>1</li>
</ul>
<p>No, it's not possible, hash functions are one way, and there's also a chance that 2 different inputs may conclude the same hash output. Hashes are meant to check if the integrity of a message, for example, if a string was modified during a process, by comparing their hashes ( the original strin... | reversing a hash to it's string in solidity | hash|solidity | 0 | 79 | 1 | 72,967,261 | 72,967,261 | 1 | true | 2022-07-13T13:04:15.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
reversing a hash to it's string in solidity<p>hello I am trying to save the physical address of somewhere in my contract but I found out
that large strings w... |
72,793,014 | R to calculate the unique count for Overlap Categories<p>I have been so frustrated to count the number of clients who made conversion or not in the 3 single categories (app, desktop, web) scenarios and the rest of the overlapping categories (app & Web, app & desktop, web & desktop, app & web & deskt... | <p>You can prepare a list of device combinations (i.e. all 7 possibilities), and then use <code>setequal()</code> and <code>unique()</code> in a helper function, like this</p>
<ol>
<li>list of device combinations, using <code>combn()</code></li>
</ol>
<pre><code>device_combinations = unlist(
sapply(1:3, \(i) combn(c(... | R to calculate the unique count for Overlap Categories | r|categories|overlapping | 1 | 79 | 2 | 72,793,324 | 72,793,324 | 1 | true | 2022-06-28T20:50:33.150Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R to calculate the unique count for Overlap Categories<p>I have been so frustrated to count the number of clients who made conversion or not in the 3 single ... |
72,775,116 | Using SwiftUI ForEach to iterate over [any Protocol] where said protocol is Identifiable<p>In a ViewModel I have:</p>
<pre><code>public var models: [any Tabbable]
</code></pre>
<p>And Tabbable starts with</p>
<pre><code>public protocol Tabbable: Identifiable {
associatedtype Id
var id: Id { get }
/// ...
}
</c... | <p>Consider this example in the form of a Playground:</p>
<pre><code>import UIKit
import SwiftUI
public protocol Tabbable: Identifiable {
associatedtype Id
var id: Id { get }
var name : String { get }
}
struct TabbableA : Tabbable{
typealias Id = Int
var id : Id = 3
var name = "... | Using SwiftUI ForEach to iterate over [any Protocol] where said protocol is Identifiable | swift|swiftui | 0 | 79 | 2 | 72,775,626 | 72,775,626 | 1 | true | 2022-06-27T16:02:53.097Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using SwiftUI ForEach to iterate over [any Protocol] where said protocol is Identifiable<p>In a ViewModel I have:</p>
<pre><code>public var models: [any Tabb... |
72,951,605 | Assert that an element contains a set of specific child elements in Cypress<p>I need to assert that a <code><table></code> element contains both a nested <code><thead></code> and a <code><tbody></code> element.</p>
<p>Sure, an obvious solution would be sth. like this:</p>
<pre class="lang-js prettypri... | <p>Try jQuery <code>.has()</code></p>
<pre class="lang-js prettyprint-override"><code>cy.get('table')
.should($table => {
expect($table.has('thead')).to.eq(true)
expect($table.has('tbody')).to.eq(true)
})
</code></pre>
<hr />
<p>Or same thing in one line</p>
<pre class="lang-js prettyprint-override"><cod... | Assert that an element contains a set of specific child elements in Cypress | javascript|cypress | 2 | 79 | 3 | 72,951,821 | 72,951,821 | 1 | true | 2022-07-12T11:30:53.317Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Assert that an element contains a set of specific child elements in Cypress<p>I need to assert that a <code><table></code> element contains both a nest... |
72,987,983 | Separating Multiple Lines in Cell while Keeping Same Row Title<p>I'm using Google Sheets to dynamically import election results from a RSS/XML file, but I'm having trouble separating information in the same cell.</p>
<p>Basically, the candidates and their results are all listed on separate lines in the same cell in a r... | <h2>You can use Google Apps Script</h2>
<p>To address the issue in this post, I recommend using a script through Google Apps Script since the process is quite complex. For my setup, I used a Google Sheet file with two tabs, <code>Data</code> and <code>Output</code>.</p>
<p>For the <code>Data</code> tab, I used the same... | Separating Multiple Lines in Cell while Keeping Same Row Title | google-sheets | 0 | 79 | 1 | 72,989,287 | 72,989,287 | 1 | true | 2022-07-15T00:49:02.870Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Separating Multiple Lines in Cell while Keeping Same Row Title<p>I'm using Google Sheets to dynamically import election results from a RSS/XML file, but I'm ... |
72,926,138 | Convert from django orm to sql query<p>How to convert from django orm to sql query?</p>
<pre><code>Publisher.objects.annotate(num_books=Count('book')).order_by('-num_books')[:5]
</code></pre>
<p>in sql query?</p>
<pre><code>class Publisher(models.Model):
name = models.CharField(max_length=300)
class Book(models.M... | <p>try this:</p>
<pre><code>queryset = Publisher.objects.annotate(num_books=Count('book')).order_by('-num_books')[:5]
print(str(queryset.query))
</code></pre> | Convert from django orm to sql query | sql|database|orm|django-orm|converters | 2 | 79 | 1 | 73,103,180 | 73,103,180 | 1 | true | 2022-07-10T04:26:15.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert from django orm to sql query<p>How to convert from django orm to sql query?</p>
<pre><code>Publisher.objects.annotate(num_books=Count('book')).order_... |
72,997,380 | How do you drop an Azure SQL scoped credential left behind by Microsoft Purview that says it is in use?<p>After scanning a SQL Azure database with Microsoft Purview and then deleting Microsoft Purview later in the day, it left behind a scoped credential and a user that I cannot drop from my database.</p>
<p>I created t... | <p>Check the extended event sessions active on the database. Purview creates a session to track events, and it is bind with the credential.</p>
<p><img src="https://i.stack.imgur.com/9s6ZL.png" alt="Purview extended event session" /></p>
<p>It is not needed to remove it, just stop it and then try to remove the credenti... | How do you drop an Azure SQL scoped credential left behind by Microsoft Purview that says it is in use? | azure|azure-sql-database|azure-purview | 0 | 79 | 1 | 73,081,692 | 73,081,692 | 1 | true | 2022-07-15T16:56:40.337Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do you drop an Azure SQL scoped credential left behind by Microsoft Purview that says it is in use?<p>After scanning a SQL Azure database with Microsoft ... |
72,824,444 | Chart.js With a mixed chart (step and bar chart), how do I get each step to start at the beginning of the bar instead of the middle the stacked bar?<p>I tried to remove the offset for the bar chart (offset: false), but the result has the first bar shifted to the left such that only half of the first bar is shown. Here... | <p>You can define the <code>'line'</code> <code>data</code> as an array of points (individual objects having an <code>x</code> and <code>y</code> property each). Then tie the <code>dataset</code> to a second non-displayed x-axis.</p>
<pre><code>{
type: 'line',
label: 'Dataset 1',
data: [{x: 0, y: 18}, {x: 1, y: 1... | Chart.js With a mixed chart (step and bar chart), how do I get each step to start at the beginning of the bar instead of the middle the stacked bar? | javascript|chart.js | 2 | 79 | 1 | 72,825,055 | 72,825,055 | 1 | true | 2022-07-01T04:39:16.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Chart.js With a mixed chart (step and bar chart), how do I get each step to start at the beginning of the bar instead of the middle the stacked bar?<p>I trie... |
72,842,948 | Using Regex to replace a value in a string from a list of items in array<p>I'm not sure I'm asking what is possible. I have a situation</p>
<pre><code>Dim animalList as string = "Dog|Cat|Bird|Mouse"
Dim animal_story_string as string = "One day I was walking down the street and I saw a dog"
Dim hasA... | <blockquote>
<p><em>Is there a way to do it using a Regex function?</em></p>
</blockquote>
<p>Yes, call <a href="https://docs.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regex.replace?view=netframework-4.8&f1url=%3FappId%3DDev16IDEF1%26l%3DEN-US%26k%3Dk(System.Text.RegularExpressions.Regex.Replace... | Using Regex to replace a value in a string from a list of items in array | regex|vb.net | 1 | 79 | 2 | 72,843,385 | 72,843,385 | 1 | true | 2022-07-02T23:02:17.400Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using Regex to replace a value in a string from a list of items in array<p>I'm not sure I'm asking what is possible. I have a situation</p>
<pre><code>Dim a... |
72,826,281 | Multiple IF-statements in JSON AdditionalRowClass<p>After studying <a href="https://stackoverflow.com/questions/62944890/multiple-formating-conditions-in-json">this</a> question and answer, I still can not make my JOSN formula work correctly.</p>
<p>I too moved away from nested JSON, however I'm not opposed of revertin... | <p>You could use below rules in the JSON formatting.</p>
<p><a href="https://i.stack.imgur.com/cgx3I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cgx3I.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/hcJ6u.png" rel="nofollow noreferrer"><img src="https://i.... | Multiple IF-statements in JSON AdditionalRowClass | json|sharepoint|logic | 0 | 79 | 1 | 72,868,558 | 72,868,558 | 1 | true | 2022-07-01T08:13:06.473Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple IF-statements in JSON AdditionalRowClass<p>After studying <a href="https://stackoverflow.com/questions/62944890/multiple-formating-conditions-in-jso... |
72,827,153 | how to extract specific key and value from a dataframe python<p><a href="https://i.stack.imgur.com/iuCjj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iuCjj.png" alt="[enter image description here][1][" /></a></p>
<p>I want to extract name(a) and respective scores(90) from a data frame
As you can s... | <p>Set the index of the dataframe to the <code>Name</code> column</p>
<pre><code>df.set_index('Name', inplace=True)
</code></pre>
<p>Then you can fetch the score as</p>
<pre><code>df.loc['a', 'Score']
</code></pre> | how to extract specific key and value from a dataframe python | python|pandas | 1 | 79 | 1 | 72,827,273 | 72,827,273 | 1 | true | 2022-07-01T09:25:32.067Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to extract specific key and value from a dataframe python<p><a href="https://i.stack.imgur.com/iuCjj.png" rel="nofollow noreferrer"><img src="https://i.s... |
72,834,806 | C# DirectoryEntry find all users with a specific attribute (wWWHomePage)<p>What would be the best way in C# to use directory entry to find all users with the attribute wWWHomePage filled in.</p>
<p>I am able to see if a specific user has it but I have not used Directory Entry to search all users for something like this... | <p>use <code>DirectoryEntry</code> with <code>DirectorySearcher</code> and specify the search <code>Filter</code> to get what you want.</p>
<p>the <code>Filter</code> template you want is :</p>
<pre><code>(&(objectClass=user)(objectCategory=person)(PROPERTY_NAME=SEARCH_TERM))
</code></pre>
<p>where <code>PROPERTY_N... | C# DirectoryEntry find all users with a specific attribute (wWWHomePage) | c#|.net|active-directory|directoryentry|directorysearcher | 1 | 79 | 1 | 72,835,202 | 72,835,202 | 1 | true | 2022-07-01T21:33:52.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# DirectoryEntry find all users with a specific attribute (wWWHomePage)<p>What would be the best way in C# to use directory entry to find all users with the... |
72,904,408 | Ajax success function not working with json answer<p>If I set dataType to 'json' and inside my PHP file I print whatever I want (event a letter), success function works, but if I don't print anything else besides the JSON I need, stops working. I can't handle my data with something else printed, because it turns the an... | <p>If you're returning JSON, you can only echo the JSON once, not each time through the loop.</p>
<p>If there can only be one row, you don't need the <code>while</code> loop. Just fetch the row and create the JSON.</p>
<p>You also can't echo anything else, so the <code>echo "true";</code> lines are breaking i... | Ajax success function not working with json answer | php|ajax|post | 0 | 79 | 2 | 72,904,474 | 72,904,474 | 1 | true | 2022-07-07T21:26:09.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ajax success function not working with json answer<p>If I set dataType to 'json' and inside my PHP file I print whatever I want (event a letter), success fun... |
72,784,250 | Python class call a method from a class object<p>How can I fix attribute error in this situation? I have a pandas dataframe where I make some data slicing and transformation and I want to plot the results of the persistence_model function like below.</p>
<p>Edit:
I want to customize a function with specific title of th... | <p>You need to be more aware of what methods return. The first step creates a <code>ResidualErrors</code> object:</p>
<pre><code>res = ResidualErrors(data)
</code></pre>
<p>The second step creates a <code>DataFrame</code> or <code>Series</code>:</p>
<pre><code>obj = res.persistence_model(test_rows=10)
</code></pre>
<p>... | Python class call a method from a class object | python|pandas|class|oop | 1 | 79 | 1 | 72,790,838 | 72,790,838 | 1 | true | 2022-06-28T09:48:16.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python class call a method from a class object<p>How can I fix attribute error in this situation? I have a pandas dataframe where I make some data slicing an... |
72,398,539 | If a pull request is still pending, how do I continue working (Gitflow)?<p>So we are using GitFlow working schema.</p>
<p>I have a branch named <code>feature/foo</code>, I just finished my ticket there and I created a Pull Request, that branch (<code>feature/foo</code>) is going to be merged with our head branch <code>... | <blockquote>
<p>What is the best way to approach this?</p>
</blockquote>
<p>If it were me, I'd just leave it and move on. As soon as the first PR is completed and <code>feature/foo</code> gets merged into <code>develop</code>, your second PR should be able to be updated such that the changes from the previous PR will d... | If a pull request is still pending, how do I continue working (Gitflow)? | git|git-flow | -1 | 79 | 2 | 72,398,865 | 72,398,865 | 1 | true | 2022-05-26T22:14:37.917Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
If a pull request is still pending, how do I continue working (Gitflow)?<p>So we are using GitFlow working schema.</p>
<p>I have a branch named <code>feature... |
72,387,008 | Which one is better way in terms of performance to use IPC listener in electron?<p>I have a lot of IPC listeners (<strong>more than 30</strong>) on my electron application, but I wonder which one is better in terms of performance.</p>
<p><strong>The first solution (Implement IPC listener as many as it needed):</strong>... | <p>As Electron uses Node.js underneath and Electron's IPC is based on Node events, any limits would be imposed by Node and
not Electron (unless otherwise defined by electron, which I don't believe it is).</p>
<p>As per the latest Node.js Event documentation, once you have more than 10 listeners per event a warning will... | Which one is better way in terms of performance to use IPC listener in electron? | javascript|electron|ipc|event-listener | 0 | 79 | 1 | 72,444,694 | 72,444,694 | 1 | true | 2022-05-26T05:17:16.803Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Which one is better way in terms of performance to use IPC listener in electron?<p>I have a lot of IPC listeners (<strong>more than 30</strong>) on my electr... |
72,400,172 | Is it okay to rely on idp guid when linking accounts in a multi-tenant configuration?<p>I've successfully implemented the following sample/custom policy in our B2C configuration:</p>
<p><a href="https://github.com/azure-ad-b2c/samples/tree/master/policies/link-local-account-with-federated-account" rel="nofollow norefer... | <p>• <code>The ‘issuer’ and ‘issuerUserId’ input claims values represent the ‘socialaccountprovider’ or the ‘identityprovider’ and the ‘value’ of the key claim in base64 encoded format respectively</code>. Thus, the issuer value represents the <strong>social identity provider</strong> which provides the <strong>ident... | Is it okay to rely on idp guid when linking accounts in a multi-tenant configuration? | azure-ad-b2c|azure-ad-b2c-custom-policy | 0 | 79 | 1 | 72,444,993 | 72,444,993 | 1 | true | 2022-05-27T03:31:50.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it okay to rely on idp guid when linking accounts in a multi-tenant configuration?<p>I've successfully implemented the following sample/custom policy in o... |
72,331,773 | Declaration of template specialization on a template function<p>I'm getting <code>undefined reference to ´long long fromBigEndin<long long>(unsigned char*)´</code> for a template specialization.</p>
<p>See code here: <a href="https://onlinegdb.com/AagKTQJ2B" rel="nofollow noreferrer">https://onlinegdb.com/AagKTQJ... | <h4>Method 1</h4>
<p>You need to put the implementation of the function template into the header file itself. So it would look something like:</p>
<p><strong>util.h</strong></p>
<pre><code>#pragma once //include guard added
template <class T>
T fromBigEndin(uint8_t *buf);
//definition
template <> int64_t ... | Declaration of template specialization on a template function | c++|arduino-c++ | 0 | 79 | 1 | 72,331,819 | 72,331,819 | 1 | true | 2022-05-21T17:21:09.683Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Declaration of template specialization on a template function<p>I'm getting <code>undefined reference to ´long long fromBigEndin<long long>(unsigned ch... |
72,289,305 | Swift MapKit annotations not loading until map tapped<p>I'm adding a bunch of annotations to a map and as the user moves and pans around to different countries I remove the annotations and add in some more. The problem I'm facing is the new annotations don't show until I've interacted with the map, either tap, pinch, p... | <p>The key issue is that the code is initializing the <code>[[MKAnnotation]]</code> with the current view model results, then starting the <code>load</code> of the view models models for a new <code>country</code>, and then adding the old view model annotations to the map view.</p>
<p>Instead, grab the <code>[[MKAnnota... | Swift MapKit annotations not loading until map tapped | swift|annotations|mapkit | 1 | 79 | 1 | 72,294,644 | 72,294,644 | 1 | true | 2022-05-18T12:36:03.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift MapKit annotations not loading until map tapped<p>I'm adding a bunch of annotations to a map and as the user moves and pans around to different countri... |
72,356,525 | Print Django model data as JavaScript Array<p>I have printed a for loop as below in my HTML Template:</p>
<pre><code> <td>
{% for athlete in booking.athlete.all %}
{{athletes.id}}
{% endfor %}
</td>
</code></pre>
<p>The Output i... | <p>The easiest way is probably to use a custom template tag to get the list of <code>athlete.ids</code>, and then the built-in <a href="https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#json-script" rel="nofollow noreferrer"><code>json_script</code></a> filter to render those ids as json.</p>
<p>Let's assum... | Print Django model data as JavaScript Array | javascript|html|django|django-views|django-templates | 0 | 79 | 1 | 72,356,746 | 72,356,746 | 1 | true | 2022-05-24T02:15:12.607Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Print Django model data as JavaScript Array<p>I have printed a for loop as below in my HTML Template:</p>
<pre><code> <td>
... |
72,401,352 | How to draw grid line only in a circle using QGraphicsItem<p>Please forgive the poor English in advance.</p>
<p>hello! I am currently implementing view widget using QGraphicsView & QGraphicsItem.</p>
<p>Is there any way to draw gridlines only inside a circle?</p>
<p>Rectangles are fine, but trying to draw them insi... | <p>It's just a matter of tigronometry calculation. From the position on the X or Y axis you can calculate the angle to go to the point on the circle using arc sin and arc cosine. The code below should work</p>
<pre><code>#include <math.h>
class Point
{
public:
double X = 0.0;
double Y = 0.0;
};
int main... | How to draw grid line only in a circle using QGraphicsItem | c++|qt|qt5|qgraphicsview|qgraphicsitem | 0 | 79 | 1 | 72,401,620 | 72,401,620 | 1 | true | 2022-05-27T06:32:41.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to draw grid line only in a circle using QGraphicsItem<p>Please forgive the poor English in advance.</p>
<p>hello! I am currently implementing view widge... |
72,360,372 | Including a C++ library into another?<p>I'm trying to build a c++ library, which will be using itself another library.
I would like to output at the end a single .so file, so it is easily copied and used in any other project.</p>
<p>In this library I am using another library, GLFW.</p>
<p>Now, I can create my library f... | <p>From what I can deduce from your <code>CMakeLists.txt</code>, you should do something like this (I don't like vendoring, not an expert of this approach, so maybe there is something more elegant):</p>
<pre><code>cmake_minimum_required(VERSION 3.20)
project(MyLib)
# glfw static PIC
set(CMAKE_POSITION_INDEPENDENT_CODE... | Including a C++ library into another? | c++|cmake|shared-libraries | 1 | 79 | 1 | 72,365,328 | 72,365,328 | 1 | true | 2022-05-24T09:23:00.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Including a C++ library into another?<p>I'm trying to build a c++ library, which will be using itself another library.
I would like to output at the end a si... |
72,328,840 | How to get nested relationship entities with nested subqueries SQL?<p>I have these 4 tables: Scorecard, Section, Topic, Answer.</p>
<p>Each scorecard can have many sections. Each Section can have many topics and each Topic can have many answers.</p>
<p>I am looking to retrieve the data in the following form. Get all se... | <p>You can join all four tables to get your result.</p>
<pre><code>SELECT sec."id",
sec."name" AS "sectionName",
tp."name" AS topics, ans."name" AS answers
FROM "scorecard" sc
LEFT JOIN "section" sec ON sc."id" = sec."sc... | How to get nested relationship entities with nested subqueries SQL? | sql|postgresql | 1 | 79 | 2 | 72,328,994 | 72,328,994 | 1 | true | 2022-05-21T10:47:45.213Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get nested relationship entities with nested subqueries SQL?<p>I have these 4 tables: Scorecard, Section, Topic, Answer.</p>
<p>Each scorecard can hav... |
72,289,999 | How to delete sheets except for certain sheets in the VBA<p>I have this code, but excel always crashes when I run it. I don't receive an error code or anything. Excel just closes out.</p>
<pre><code>Sub DeleteSheets()
Dim xWs As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
... | <p>It appears your code is deleting all sheets causing the error, even if one is labeled "Overview". I cleaned this up using <code>Select</code>, which now does not delete the appropriate named sheets:</p>
<pre><code>Sub DeleteSheets()
Dim xWs As Worksheet
Application.EnableEvents = False
Applica... | How to delete sheets except for certain sheets in the VBA | excel|vba | 0 | 79 | 1 | 72,290,247 | 72,290,247 | 1 | true | 2022-05-18T13:20:58.887Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to delete sheets except for certain sheets in the VBA<p>I have this code, but excel always crashes when I run it. I don't receive an error code or anythi... |
72,256,144 | Grouped ggplot for adding p-values<p>I'm trying to print the bonferroni p values on top of every grouped bar plot.</p>
<p>The code that I'm using is:</p>
<pre><code>stat1 <- stack[1:170,] %>%
rstatix::group_by(modules) %>%
rstatix::t_test(values ~ phenotypes) %>%
rstatix::adjust_pvalue(p.col = "p"... | <p>You need to specify <code>x = 'phenotypes'</code> in <code>add_xy_position</code> rather than <code>x = 'values'</code>:</p>
<pre class="lang-r prettyprint-override"><code>stat1 <- stack[1:170,] %>%
rstatix::group_by(modules) %>%
rstatix::t_test(values ~ phenotypes) %>%
rstatix::adjust_pvalue(p.col... | Grouped ggplot for adding p-values | r|ggplot2|stat|p-value|bonferroni | 1 | 79 | 1 | 72,256,989 | 72,256,989 | 1 | true | 2022-05-16T08:22:18.200Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Grouped ggplot for adding p-values<p>I'm trying to print the bonferroni p values on top of every grouped bar plot.</p>
<p>The code that I'm using is:</p>
<pr... |
72,322,437 | How to Run Multiple Dynamic Queries in a PostgreSQL Function<p>I am having some issues figuring out how to run multiple dynamic queries in a single function.</p>
<pre><code> CREATE OR REPLACE FUNCTION cnms_fy22q2.test_function(
fyq text)
RETURNS void
LANGUAGE 'plpgsql'
COST 100
VOLATILE
AS $BODY$
B... | <p>You can't simply concatenate strings to make a dynamic sql statement. Take a look at <a href="https://www.postgresql.org/docs/current/sql-execute.html" rel="nofollow noreferrer">EXECUTE</a> and <a href="https://www.postgresql.org/docs/current/ecpg-sql-execute-immediate.html" rel="nofollow noreferrer">EXECUTE IMMEDIA... | How to Run Multiple Dynamic Queries in a PostgreSQL Function | postgresql|function|dynamic-sql | 0 | 79 | 3 | 72,322,497 | 72,322,497 | 1 | true | 2022-05-20T17:00:38.533Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to Run Multiple Dynamic Queries in a PostgreSQL Function<p>I am having some issues figuring out how to run multiple dynamic queries in a single function.... |
72,396,238 | Why does the website 404 when I add a "/" at the end of the url (Flask)?<p>When I go to my (imaginary website), it works:</p>
<blockquote>
<p>mywebsite.com/flowers</p>
</blockquote>
<p>But if I add a "/" at the end, I get a "Not Found" error:</p>
<blockquote>
<p>mywebsite.com/flowers/</p>
</blockquo... | <p>In Flask, the URL redirection with and without trailing <code>/</code> works differently.</p>
<pre><code>@app.route('/works/')
def works():
return 'This works'
@app.route('/sorry')
def sorry():
return 'sorry'
</code></pre>
<p>The URL for the <code>works</code> endpoint has a trailing slash. It’s similar to ... | Why does the website 404 when I add a "/" at the end of the url (Flask)? | python|flask|routes | 1 | 79 | 1 | 72,396,494 | 72,396,494 | 1 | true | 2022-05-26T18:09:33.023Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does the website 404 when I add a "/" at the end of the url (Flask)?<p>When I go to my (imaginary website), it works:</p>
<blockquote>
<p>mywebsite.com/f... |
72,396,945 | How to display items in a list with a description of what that list item is in c# console<p>I am trying to display a list sorted in descending order with each item being displayed with a description of what the value of the item is in VS console app. I’m just not sure how to display the description with each item</p>
<... | <p>I cannot see where you are getting the description values from. A better way to do this would be to use Dictionary instead of a List.</p>
<pre class="lang-cs prettyprint-override"><code>double cost = textbox1.Text; // cost of item
string des = textbox2.Text; //description of item
//below code goes into a event to a... | How to display items in a list with a description of what that list item is in c# console | c#|visual-studio|console-application|generic-list | 0 | 79 | 2 | 72,398,736 | 72,398,736 | 1 | true | 2022-05-26T19:19:13.033Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to display items in a list with a description of what that list item is in c# console<p>I am trying to display a list sorted in descending order with eac... |
72,251,958 | Reading Matrix from file<p>I have a txt file consisting some numbers with space and I want to make it as three 4*4 matrixes in python. Each matrix is also divided with two symbols in the text file. The format of the txt file is like this:</p>
<pre><code>1 1
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
1 1
0 0 0 0
0 0 0 0
0 0 0 0
... | <p>A good old pure python algorithm (assuming matrices can hold string values, otherwise, convert as required):</p>
<pre><code>file = open("inputs.txt",'r')
matrices=[]
m=[]
for line in file:
if line=="1 1\n":
if len(m)>0: matrices.append(m)
m=[]
else:
m.append(line.strip... | Reading Matrix from file | python|numpy|file|matrix|spyder | 0 | 79 | 3 | 72,252,026 | 72,252,026 | 1 | true | 2022-05-15T20:29:39.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reading Matrix from file<p>I have a txt file consisting some numbers with space and I want to make it as three 4*4 matrixes in python. Each matrix is also di... |
72,240,205 | CSS Grid and Flex - Content going beyond the specified columns<p>I'm trying to create a page using css grid and flex. I have defined the grid areas and positioned them.</p>
<p>When I'm adding content to <code>blog-post-list</code> section contents goes beyond <code><section></code> the specified area.</p>
<p>I'm ... | <p>You should change this part with flex-wrap. If you want to have all in same row then you should give smaller percentage for child elements</p>
<pre><code>.blog-post-list{
display: flex;
flex-wrap: wrap;
}
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false... | CSS Grid and Flex - Content going beyond the specified columns | css|flexbox|css-grid | 1 | 79 | 1 | 72,240,287 | 72,240,287 | 2 | true | 2022-05-14T12:29:35.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CSS Grid and Flex - Content going beyond the specified columns<p>I'm trying to create a page using css grid and flex. I have defined the grid areas and posit... |
72,256,749 | javascript - unzip tar.gz archive in google script<p>I am trying to unzip the file: [https://wwwinfo.mfcr.cz/ares/ares_vreo_all.tar.gz][1] into google drive folder.</p>
<p>So, I have downloaded the file using google script, but can not properly unzip it. Could you, please, help me with it?</p>
<p>Thank you in advance!<... | <p>You can use the <code>Utilities</code> Class to unzip your File.</p>
<p>To unzip the gzip you have to call the <code>ungzip()</code> method:</p>
<pre><code>var textBlob = Utilities.newBlob("Some text to compress using gzip compression");
// Create the compressed blob.
var gzipBlob = Utilities.gzip(textBlo... | javascript - unzip tar.gz archive in google script | javascript|google-apps-script | 0 | 79 | 1 | 72,257,089 | 72,257,089 | 2 | true | 2022-05-16T09:11:32.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
javascript - unzip tar.gz archive in google script<p>I am trying to unzip the file: [https://wwwinfo.mfcr.cz/ares/ares_vreo_all.tar.gz][1] into google drive ... |
72,246,318 | TCL pass variable to proc<p>Pass argument to proc, expected result is <code>puts $cust_id</code> in <code>proc</code> will print the <code>123</code> instead of <code>$cust_id</code></p>
<pre><code>proc hello {cust_id} {
puts $cust_id
}
set cust_id 123
puts $cust_id
hello {$cust_id}
</code></pre>
<p>Output is</p>
<p... | <p>When you call <code>hello</code>, you give it a <em>value</em> and it prints that value that it was given (because you pass it to <code>puts</code> inside the body). When you call:</p>
<pre><code>puts $cust_id
</code></pre>
<p>You are telling Tcl to read the <code>cust_id</code> variable and use that as the argument... | TCL pass variable to proc | tcl | 1 | 79 | 1 | 72,257,798 | 72,257,798 | 2 | true | 2022-05-15T07:27:40.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TCL pass variable to proc<p>Pass argument to proc, expected result is <code>puts $cust_id</code> in <code>proc</code> will print the <code>123</code> instead... |
72,284,958 | C++ Vector content is being deleted?<p>I've been trying to create a directed graph following <a href="https://www.youtube.com/watch?v=V_TulH374hw" rel="nofollow noreferrer">https://www.youtube.com/watch?v=V_TulH374hw</a></p>
<pre><code>class Digraph {
public:
Digraph();
void addNode(Node);
void addEdge(Edg... | <p>Your <code>auto</code> in the for loop needs to be a reference (<code>auto&</code>), and after the code I'll tell you why.</p>
<pre class="lang-cpp prettyprint-override"><code>void Digraph::addEdge(Edge e){
Node src = e.getSrc();
Node dest = e.getDest();
// use references here
for(auto& node : no... | C++ Vector content is being deleted? | c++|vector | 2 | 79 | 1 | 72,285,121 | 72,285,121 | 2 | true | 2022-05-18T07:37:21.560Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ Vector content is being deleted?<p>I've been trying to create a directed graph following <a href="https://www.youtube.com/watch?v=V_TulH374hw" rel="nofol... |
72,291,579 | overflow instead of saturation on 16bit add AVX2<p>I want to add 2 unsigned vectors using AVX2</p>
<pre><code>__m256i i1 = _mm256_loadu_si256((__m256i *) si1);
__m256i i2 = _mm256_loadu_si256((__m256i *) si2);
__m256i result = _mm256_adds_epu16(i2, i1);
</code></pre>
<p>however I need to have overflow instead of satur... | <p>Use normal binary wrapping <code>_mm256_add_epi16</code> instead of saturating <code>adds</code>.</p>
<p>Two's complement and unsigned addition/subtraction are the same binary operation, that's one of the reasons modern computers use two's complement. As the <a href="https://www.felixcloutier.com/x86/paddb:paddw:p... | overflow instead of saturation on 16bit add AVX2 | c++|unsigned|intrinsics|integer-overflow|avx2 | 0 | 79 | 1 | 72,292,335 | 72,292,335 | 2 | true | 2022-05-18T15:01:07.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
overflow instead of saturation on 16bit add AVX2<p>I want to add 2 unsigned vectors using AVX2</p>
<pre><code>__m256i i1 = _mm256_loadu_si256((__m256i *) si1... |
72,307,220 | RichTextFx VirtualizedScrollPane flickers when text wraps as you type<p><a href="https://i.stack.imgur.com/q84BH.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q84BH.gif" alt="enter image description here" /></a></p>
<p>I have a flickering issue with RichTextFx <code>StyleClassedTextArea</code> and ... | <p>Found out how to fix the text flickering, although the scrollbars still flicker which is way more acceptable:</p>
<pre><code>textArea.requestFollowCaret();
</code></pre> | RichTextFx VirtualizedScrollPane flickers when text wraps as you type | java|javafx|richtextfx | 1 | 79 | 1 | 72,307,592 | 72,307,592 | 2 | true | 2022-05-19T15:25:50.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
RichTextFx VirtualizedScrollPane flickers when text wraps as you type<p><a href="https://i.stack.imgur.com/q84BH.gif" rel="nofollow noreferrer"><img src="htt... |
72,335,246 | c++ missing construction and destruction of an object<p>The following code:</p>
<pre><code>#include <iostream>
#include <string>
using namespace std;
void print(string a) { cout << a << endl; }
void print(string a, string b) { cout << a << b << endl; }
class A {
public:
... | <blockquote>
<p>Where is the construction/destruction of the whereDidThisGo variable defined in main?</p>
</blockquote>
<p>You do not see the ouptut for this due to named return value optimization(aka NRVO).</p>
<blockquote>
<p>it's not a good optimization for people like me who are trying to learn constructors</p>
</b... | c++ missing construction and destruction of an object | c++|constructor|destructor|copy-constructor | 1 | 79 | 2 | 72,335,488 | 72,335,488 | 2 | true | 2022-05-22T06:20:00.037Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
c++ missing construction and destruction of an object<p>The following code:</p>
<pre><code>#include <iostream>
#include <string>
using namespace... |
72,373,200 | C# : how to convert char array into float<p>I have a byte array of four bytes which contains the byts of a FLOAT values.
For example</p>
<p>array[0]=0x1F</p>
<p>array[1]=0x05</p>
<p>array[2]=0x01</p>
<p>array[3]=0x42</p>
<p>this should be 0x4201051f, which means 32.255 value.</p>
<p>Do you have any suggestion on how to... | <p>As suggested by <a href="https://stackoverflow.com/users/6196568/shingo">shingo</a>, the <a href="https://stackoverflow.com/questions/4301623/problem-converting-4-bytes-array-to-float-in-c-sharp">linked question</a> provides the answer:</p>
<pre><code>var input = new byte[] { 0x1F, 0x05, 0x01, 0x42 };
Console.WriteL... | C# : how to convert char array into float | c#|arrays|char|data-conversion | 0 | 79 | 1 | 72,374,374 | 72,374,374 | 2 | true | 2022-05-25T07:03:15.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# : how to convert char array into float<p>I have a byte array of four bytes which contains the byts of a FLOAT values.
For example</p>
<p>array[0]=0x1F</p>... |
72,373,827 | Why can I remove the code navArgument without problem when I use Navigating with arguments in JetPack Compose?<p>I'm learning Jetpack Compose Navigation.</p>
<p>The Code A is from the <a href="https://developer.android.com/codelabs/jetpack-compose-navigation#3" rel="nofollow noreferrer">article</a>. It works well.</p>
... | <p>As per <a href="https://developer.android.com/jetpack/compose/navigation#nav-with-args" rel="nofollow noreferrer">documentation</a>:</p>
<blockquote>
<p>By default, all arguments are parsed as strings. You can specify another type by using the arguments parameter to set a type</p>
</blockquote>
<p>So the second opti... | Why can I remove the code navArgument without problem when I use Navigating with arguments in JetPack Compose? | android|android-jetpack-compose | 0 | 79 | 1 | 72,413,283 | 72,413,283 | 2 | true | 2022-05-25T07:52:51.217Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can I remove the code navArgument without problem when I use Navigating with arguments in JetPack Compose?<p>I'm learning Jetpack Compose Navigation.</p>... |
72,372,393 | Netty: TCP file transfer doesn't work correctly<p>I am working on my online file storage and today I have encountered some issues with my Netty TCP file tranfer. So the problem is that only 8192 bytes of data is actually written in the file on the client-side.
I want to know what the problem is, and how I can fix it.</... | <p>The problem is indeed most likely to be in your FileChunkHandler.</p>
<p>You only read a single buffer (likely containing 8192 bytes - 8kB), and then remove the handler. The remaining chunks either get "handled" by some other handler in the pipeline, or reach the end of the pipeline and get dropped. As men... | Netty: TCP file transfer doesn't work correctly | java|file|netty|file-transfer | -1 | 79 | 1 | 72,372,905 | 72,372,905 | 2 | true | 2022-05-25T05:31:50.463Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Netty: TCP file transfer doesn't work correctly<p>I am working on my online file storage and today I have encountered some issues with my Netty TCP file tran... |
72,364,427 | Replace smartcodes with gsub<p>I work on ruby > 3.0 and i need to replace a text content (in-line html text with smartcode).
this text can be long and for example it's like this : "Hello, {{viewer_name}} ! How are you ?"</p>
<p>I have a method to replace theses smartcodes :</p>
<pre class="lang-rb prettypr... | <p>Here you're running a new gsub inside an existing gsub block, which isn't necessary, since the gsub block will substitute each match with the return value of the block anyway. The same result could be achieved simply with 2 lines of code:</p>
<pre><code>content.gsub!(/{{viewer_name}}/, viewer.name)
content.gsub!(/{{... | Replace smartcodes with gsub | ruby|string|gsub | 1 | 79 | 2 | 72,365,699 | 72,365,699 | 2 | true | 2022-05-24T14:08:22.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace smartcodes with gsub<p>I work on ruby > 3.0 and i need to replace a text content (in-line html text with smartcode).
this text can be long and for... |
72,337,760 | What is the range of improved Perlin noise?<p>I'm trying to find the theoretical output range of improved Perlin noise for 1, 2 and 3 dimensions. I'm aware of existing answers to this question, but they don't seem to accord with my practical findings.</p>
<p>If <em>n</em> is the number of dimensions then according to <... | <p>Ken’s not using unit vectors. As [1] says, with my emphasis:</p>
<blockquote>
<p>Third, there are many different ways to select the random vectors at the grid cell corners. In Improved Perlin noise, instead of selecting any random vector, one of 12 vectors pointing to the edges of a cube are used instead. Here, I wi... | What is the range of improved Perlin noise? | java|algorithm|perlin-noise|noise-generator | 3 | 79 | 1 | 72,348,250 | 72,348,250 | 2 | true | 2022-05-22T12:55:13.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the range of improved Perlin noise?<p>I'm trying to find the theoretical output range of improved Perlin noise for 1, 2 and 3 dimensions. I'm aware o... |
72,287,104 | T-SQL iterative calculation without loop<p>I have below financial data, I need to show balance as on date.
I have used below logic using loop, but I want to achieve same thing without loop or cursor, using single query. Any idea on this will be helpful.</p>
<pre><code> DROP TABLE IF EXISTS #Transact;
CREATE TABLE #... | <p>I think it's a running total, so you need a windowed <code>SUM()</code> and a <code>CASE</code> expression:</p>
<pre><code>SELECT
dt, Transact, Amount,
SUM(
CASE
WHEN Transact = 'C' THEN Amount
WHEN Transact = 'D' THEN -Amount
ELSE 0
END) OVER (ORDER BY dt) AS Balance... | T-SQL iterative calculation without loop | sql-server|loops|tsql|iteration | -1 | 79 | 2 | 72,287,180 | 72,287,180 | 2 | true | 2022-05-18T10:05:26.473Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
T-SQL iterative calculation without loop<p>I have below financial data, I need to show balance as on date.
I have used below logic using loop, but I want to ... |
72,341,564 | Why does an undefined operand not return false?<p>Given the following:</p>
<pre><code>let a;
let b = false;
let c = a && b === undefined;
</code></pre>
<p>In my understanding, <code>undefined</code> is a falsy value, so why is it that <code>c</code> has value <code>undefined</code> instead of <code>false</code>... | <p>Given your example, <code>a</code> is undefined. Therefore, <code>a && ...</code> is <code>undefined && ...</code>, and since undefined is falsy, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_AND#short-circuit_evaluation" rel="nofollow noreferrer">the le... | Why does an undefined operand not return false? | javascript | 0 | 79 | 2 | 72,341,612 | 72,341,612 | 2 | true | 2022-05-22T22:00:58.523Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does an undefined operand not return false?<p>Given the following:</p>
<pre><code>let a;
let b = false;
let c = a && b === undefined;
</code></pr... |
72,283,323 | scatter plotting with multiple subplots of each month's mean throughout the years<p>Hey people of the web,</p>
<p>I have a function i'm creating '<em>show_monthly_temp</em>', in which i'm attempting to plot a figure with 12 scatter sub plots, where each subplot's purpose mentioned in the next lines.</p>
<p>the function... | <p>If I understood correctly, you could do it like this:</p>
<pre><code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import calendar
# Fake data - generating 'tmax_grouped_avg'.
df = pd.DataFrame({'Date': pd.date_range('1990-10-01', '2023-05-01')})
df['TMAX'] = np.random.random((len(df)))*30
... | scatter plotting with multiple subplots of each month's mean throughout the years | python|pandas|dataframe|matplotlib | 1 | 79 | 1 | 72,283,588 | 72,283,588 | 2 | true | 2022-05-18T04:44:59.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
scatter plotting with multiple subplots of each month's mean throughout the years<p>Hey people of the web,</p>
<p>I have a function i'm creating '<em>show_mo... |
72,273,362 | How to Generates a random pair of unique images in VBA Powerpoint<p>If I want to create a random order to select another pair from my image. , not repeating the random pair i've previously picked, i.e. so that once i've gone through 56 random unique images i.e. 26 random pairs, the game is over, and reset to my origina... | <p>Please, try the next function. It uses an array built from 1 to maximum necessary/existing number. It returns the <code>RND</code> array element and then <strong>eliminate it from the array</strong>, next time returning from the remained elements:</p>
<ol>
<li>Please, copy the next variables on top of the module kee... | How to Generates a random pair of unique images in VBA Powerpoint | vba|powerpoint | 1 | 79 | 1 | 72,275,052 | 72,275,052 | 2 | true | 2022-05-17T11:36:52.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to Generates a random pair of unique images in VBA Powerpoint<p>If I want to create a random order to select another pair from my image. , not repeating ... |
72,372,014 | How to merge two object arrays of differing length, based on two object key<p>I have 2 arrays, I'd like to combine them if they have the same two object keys.</p>
<p>If no match is found, still keep the object, but have the value as 0.</p>
<p><strong>Example of Input</strong></p>
<pre><code>withdrawal: [
{
... | <p>You can achieve the result you want by processing the list of withdrawals and deposits using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce" rel="nofollow noreferrer"><code>Array.reduce</code></a> to an object with the <code>id</code> values as keys and <code>d... | How to merge two object arrays of differing length, based on two object key | javascript|arrays|typescript|object | 0 | 79 | 5 | 72,372,048 | 72,372,048 | 2 | true | 2022-05-25T04:38:33.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to merge two object arrays of differing length, based on two object key<p>I have 2 arrays, I'd like to combine them if they have the same two object keys... |
72,399,995 | JavaFx TableView shows long string representation of columns<p>I just start JavaFx and am a bit stuck with TableView, it shows very long string representation of each column like:</p>
<pre><code>StringProperty [bean: com.plcsim2.PlcSimModel$ErpSheet@2c1ffe7b, name:name, value: big]
IntegerProperty [bean: com.plcsim2.Pl... | <h1>JavaFX Properties</h1>
<p>When a class exposes a JavaFX property, it should adhere to the following pattern:</p>
<pre class="lang-java prettyprint-override"><code>import javafx.beans.property.SimpleStringProperty
import javafx.beans.property.StringProperty
public class Foo {
// a field holding the property
pr... | JavaFx TableView shows long string representation of columns | kotlin|javafx | 0 | 79 | 2 | 72,406,789 | 72,406,789 | 2 | true | 2022-05-27T03:00:20.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaFx TableView shows long string representation of columns<p>I just start JavaFx and am a bit stuck with TableView, it shows very long string representatio... |
72,388,150 | Is there a way to make a destructor for RXJS Observables?<p>In my Angular app I would like to get SSE events from a server, and then do something with the results. For this, I found a solution where I wrap the SSE EventSource into an Observable. The code is the following:</p>
<hr />
<pre><code>import { Injectable, NgZo... | <p>You can optionally return a teardown function form the "subscribe function" passed to the constructor:</p>
<pre><code>return new Observable((observer) => {
const eventSource = this.getEventSource(url);
...
return () => eventSource.close();
})
</code></pre>
<p>There're also operators such as <co... | Is there a way to make a destructor for RXJS Observables? | javascript|angular|rxjs|observable|server-sent-events | 1 | 79 | 2 | 72,388,226 | 72,388,226 | 3 | true | 2022-05-26T07:15:56.703Z | 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 make a destructor for RXJS Observables?<p>In my Angular app I would like to get SSE events from a server, and then do something with the re... |
72,358,022 | Should an Instance of a Swift Class be assigned to `nil` to see the deinitializer in action?<p>Swift can have Deinitializers (Like C++ Destructors) for Classes. When I am using a Non-Optional Instance of a Class (That is, <code>var obj: Class</code> not <code>var obj: Class?</code>), I am unable to see the message prin... | <p>The deinitialization is managed via the <a href="https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html" rel="nofollow noreferrer"><strong>swift ARC</strong></a>. To simplify: it is triggered for an object (not a variable) when there is no longer a valid reference to the object. This happen... | Should an Instance of a Swift Class be assigned to `nil` to see the deinitializer in action? | swift|class|option-type|swift5|deinit | 2 | 79 | 1 | 72,638,768 | 72,638,768 | 3 | true | 2022-05-24T06:18:39.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Should an Instance of a Swift Class be assigned to `nil` to see the deinitializer in action?<p>Swift can have Deinitializers (Like C++ Destructors) for Class... |
72,245,304 | Remove list in lists that satisfied the condition<p>I'm trying to make a quick OCR for specific use, I know should've just write a preprocessor for normal OCR and that would been faster but this idea came up to me first and I figure I should just try it anyway haha. This program would take a picture on a region of scre... | <p>You can try this.</p>
<pre><code>if len(Firstlist) > 2:
elems = [f[0] for f in Firstlist] # create a list of just first index
i = 0
while i < len(elems) - 1: # iterate through the list with i
j = i + 1
while j < len(elems): # iterate through the rest of the list with j
... | Remove list in lists that satisfied the condition | python|ocr|pyautogui | 2 | 79 | 2 | 72,245,384 | 72,245,384 | 3 | true | 2022-05-15T03:16:46.877Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove list in lists that satisfied the condition<p>I'm trying to make a quick OCR for specific use, I know should've just write a preprocessor for normal OC... |
72,310,246 | Numpy fastest way to create mask array around indexes<p>I have a 1D array:</p>
<pre><code>arr = np.array([0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 2, 0, 0, 0, 0, 0, 2, 3, 0, 0, 1, ...], dtype='uint16')
</code></pre>
<p>I want to create a <code>mask</code> array that is <code>True</code> anywhere that is +/- <cod... | <p>Find the elements larger than <code>2</code> then set the elements around them to <code>True</code>:</p>
<pre><code>a = np.array([0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 2, 0])
N = 3
mask = a > 2
center = np.where(mask)[0]
mask[np.maximum(np.ravel(center - np.arange(1, 1 + N).reshape(-1, 1)), 0)] = True
... | Numpy fastest way to create mask array around indexes | python|arrays|algorithm|numpy | 2 | 79 | 2 | 72,310,398 | 72,310,398 | 3 | true | 2022-05-19T19:38:43.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Numpy fastest way to create mask array around indexes<p>I have a 1D array:</p>
<pre><code>arr = np.array([0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 2, ... |
72,383,007 | Speed of native R function vs C++ equivalent<p>When I compare the speed of the native Gamma function <code>gamma</code> in R to the C++ equivalent <code>std::tgamma</code> I find that the latter is about 10-15x slower. Why? I expect some differences, but this is huge, isn't it?</p>
<p>My implementation:</p>
<pre><code>... | <p>Look at the code of <code>gamma()</code> (for example by typing <code>gamma<Return></code>): it just calls a primitive.</p>
<p>Your <code>Rcpp</code> function is set up to be <em>convenient</em>. All it took was a two-liner. But it has <em>some</em> overhead is saving the state of the random-number generator... | Speed of native R function vs C++ equivalent | c++|r|rcpp | -1 | 79 | 1 | 72,383,327 | 72,383,327 | 3 | true | 2022-05-25T19:10:35.397Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Speed of native R function vs C++ equivalent<p>When I compare the speed of the native Gamma function <code>gamma</code> in R to the C++ equivalent <code>std:... |
72,340,590 | thread function doesn't terminate until Enter is pressed<p>The following code (in the end) represents thread function which takes in ls command from remote client and send current working directory to that client.</p>
<p>It successfully sends but there is one issue:
When it stops sending completely, I want it to start ... | <p>There are <em>many</em> bugs:</p>
<ol>
<li>In <code>terminal_thread</code>, <code>input_command</code> is allocated on each loop iteration -- a memory leak</li>
<li>Code to strip newline is broken</li>
<li>With <code>.l</code>, <em>not</em> specifying an IP address causes a segfault because <code>token</code> is <co... | thread function doesn't terminate until Enter is pressed | c|sockets|pthreads | 1 | 79 | 1 | 72,341,219 | 72,341,219 | 3 | true | 2022-05-22T19:12:11.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
thread function doesn't terminate until Enter is pressed<p>The following code (in the end) represents thread function which takes in ls command from remote c... |
72,244,017 | What value should I return in catch?<p>I just implemented a <code>Try</code> <code>catch</code> in my code, the error is because I have to return something in the <code>catch</code>,
I can't understand is "what should I return?"</p>
<blockquote>
<p>'CompanyController.Create(DtoCompany)': not all code paths re... | <p>You should return an error telling your client what went wrong.
A good way to to this is to return <code>Problem()</code>.</p>
<p><a href="https://docs.microsoft.com/en-us/aspnet/core/web-api/handle-errors?view=aspnetcore-6.0" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/web-api/handle-erro... | What value should I return in catch? | c#|asp.net-core|asp.net-web-api | -1 | 79 | 3 | 72,244,070 | 72,244,070 | 4 | true | 2022-05-14T21:34:23.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What value should I return in catch?<p>I just implemented a <code>Try</code> <code>catch</code> in my code, the error is because I have to return something i... |
72,390,788 | warning: excess elements in array initializer<p>I'm trying to create 2D array.</p>
<pre><code>int main() {
int stalagmite[10][6] = { { 1, 0, 0, 1, 1, 0, 1, 0, 0, 1 },
{ 1, 0, 0, 1, 1, 0, 1, 0, 0, 1 },
{ 1, 0, 0, 1, 0, 0, 0, 0, 0, 1 },
... | <p><code>int stalagmite[10][6]</code> defines an array of 10 arrays of 6 <code>int</code>, whereas your initializer specifies 6 arrays of 10 integers.</p>
<p>The definition should probably be changed to <code>int stalagmite[6][10] = {...}</code> or possibly <code>int stalagmite[][10] = {...}</code>.</p> | warning: excess elements in array initializer | arrays|c|2d|compiler-warnings | 0 | 79 | 1 | 72,390,869 | 72,390,869 | 4 | true | 2022-05-26T11:03:34.433Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
warning: excess elements in array initializer<p>I'm trying to create 2D array.</p>
<pre><code>int main() {
int stalagmite[10][6] = { { 1, 0, 0, 1, 1, 0, ... |
72,394,550 | Java Stream: Parsing Strings inside the reduce() operation<p>I have a stream of strings:</p>
<pre><code>Stream<String> st = Arrays.stream(new String[]{"10", "20", "30", "40", "50"});
</code></pre>
<p>I want to convert them to integer and sum them up using the <co... | <p>You need to provide a <em>combiner</em> function as the third argument to make it work:</p>
<pre><code>int sum = Arrays.stream(new String[]{"10", "20", "30", "40", "50"})
.reduce(0, (a, b)-> a + Integer.parseInt(b), Integer::sum);
</code></pre>
<p>Oth... | Java Stream: Parsing Strings inside the reduce() operation | java|string|java-stream | 1 | 79 | 3 | 72,394,622 | 72,394,622 | 4 | true | 2022-05-26T15:47:09.887Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java Stream: Parsing Strings inside the reduce() operation<p>I have a stream of strings:</p>
<pre><code>Stream<String> st = Arrays.stream(new String[]{... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.