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,797,234 | How to summarize with R without losing additional column information?<p>I have a tibble with info about users (<strong>ID</strong>) that use different workstations (<strong>WS</strong>) to create documents in a certain domain (<strong>DM</strong>), documents have a certain error rate (<strong>ER</strong>), and then the... | <p>You just need to change the grouping to do this:</p>
<pre class="lang-r prettyprint-override"><code>df %>%
group_by(ID, WS) %>%
mutate(
numDocs_ID_WS = n(),
avg = mean(ER)) %>%
group_by(ID) %>%
mutate(
numWS = n_distinct(WS)
)
# A tibble: 12 x 8
# Groups: ID ... | How to summarize with R without losing additional column information? | r | 2 | 40 | 2 | 72,797,325 | 72,797,325 | 2 | true | 2022-06-29T07:14:48.273Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to summarize with R without losing additional column information?<p>I have a tibble with info about users (<strong>ID</strong>) that use different workst... |
72,808,443 | TextInput gets unfocused after typing each character<p>I'm using React to build a form and I'm trying to filter a <code>list</code> with the <code>SearchInput</code> (which works the same as TextInput) located in the child component <code>Header</code>. But everytime I type a character the SearchInput gets unfocused</p... | <p>Oh, I think I can see the problem now - it's the way you're rendering the <code><SearchInput /></code> component. You're inadvertantly creating a new functional component on every render. Either inline the <code>Header</code> directly into the <code>Parent</code> control's <code>headerContent</code> property, ... | TextInput gets unfocused after typing each character | javascript|reactjs|react-native|rendering|parent-child | 0 | 40 | 1 | 72,808,884 | 72,808,884 | 2 | true | 2022-06-29T22:19:12.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TextInput gets unfocused after typing each character<p>I'm using React to build a form and I'm trying to filter a <code>list</code> with the <code>SearchInpu... |
72,809,126 | what does the ":8" part mean in a Python f-string?<pre><code> address_book = [{'name':'N.X.', 'addr':'15 Jones St', 'bonus': 70},
{'name':'J.P.', 'addr':'1005 5th St', 'bonus': 400},
{'name':'A.A.', 'addr':'200001 Bdwy', 'bonus': 5},]
for person in address_book:
print(f'{person["name"]:8} || {perso... | <p>It indicates that the value being printed should take at least 8 spaces (if the length of <code>person["name"]</code> is less than 8, it will be padded with spaces... the same applies to the <code>:20</code> and <code>:>5</code> on the <code>print</code> call... you can read more about f-strings here: <... | what does the ":8" part mean in a Python f-string? | python|python-3.x | 0 | 40 | 1 | 72,809,145 | 72,809,145 | 2 | true | 2022-06-30T00:20:12.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
what does the ":8" part mean in a Python f-string?<pre><code> address_book = [{'name':'N.X.', 'addr':'15 Jones St', 'bonus': 70},
{'name':'J.P.', 'addr':'... |
72,816,793 | How to transform SVG coordinate system (resize) just like a canvas?<p>On canvas, I can render stuff according to one coordinate system and make the CSS render it differently:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snipp... | <p>Use a viewBox to set the SVG's co-ordinate system. Then you can size the SVG to whatever you want.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>#svg {
height: 100px... | How to transform SVG coordinate system (resize) just like a canvas? | javascript|html|css|svg | 0 | 40 | 2 | 72,817,099 | 72,817,099 | 2 | true | 2022-06-30T13:33:38.440Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to transform SVG coordinate system (resize) just like a canvas?<p>On canvas, I can render stuff according to one coordinate system and make the CSS rende... |
72,817,706 | Call a method after assigning multiple property values in Angular<p>I have an Angular component with two input properties. I would like to call a method when both properties are set, is there any event I can use?</p>
<pre><code>export class ProductComponent implements OnInit {
_product: Product;
@Input() set produ... | <p>You can implement <code>OnChanges</code> interface in order to check changes on input attributes, and add some logic depending on that.</p>
<pre class="lang-js prettyprint-override"><code>export class ProductComponent implements OnInit, OnChanges {
@Input() set product(value: Product) {
_product = value;
... | Call a method after assigning multiple property values in Angular | angular|typescript | -1 | 40 | 2 | 72,817,874 | 72,817,874 | 2 | true | 2022-06-30T14:38:25.077Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Call a method after assigning multiple property values in Angular<p>I have an Angular component with two input properties. I would like to call a method when... |
72,820,107 | Is it possible to move the for loop counter in lua?<p>I am trying to move my i location forward and backward if a certain string arrives kind of like assembly code, is this possible using lua?</p>
<p>something like this:</p>
<pre class="lang-lua prettyprint-override"><code>local array = {"Hi", "Goodbye&q... | <p>You cannot use a numeric for loop or a generic for loop with the standard iterator functions to do this. You cannot properly control their state from inside. Just use a while loop.</p>
<pre><code>while notDoneCondition do
-- do stuff that may trigger the jumpCondition
if jumpCondition then
pos = jumpTarget
... | Is it possible to move the for loop counter in lua? | memory|lua | 1 | 40 | 1 | 72,820,571 | 72,820,571 | 2 | true | 2022-06-30T17:54:21.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to move the for loop counter in lua?<p>I am trying to move my i location forward and backward if a certain string arrives kind of like assembl... |
72,823,305 | wagtail search_fields on snippet with foreign key<p>I have a snippet which is a proxy of one of my standard django models.
search_fields works fine when filtering on standard fields, the problem is I can't seem to get foreign keys to work.
This page has an example on the bottom that shows how to create searchable snipp... | <p>You can't use complex lookups with double-underscores inside <code>SearchField</code> - search queries work by populating a central table (the search index) in advance with the data you're going to be searching on, which means you can't do arbitrary lookups and transformations on it like you would with a standard da... | wagtail search_fields on snippet with foreign key | django|wagtail | 0 | 40 | 1 | 72,830,661 | 72,830,661 | 2 | true | 2022-07-01T00:34:41.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
wagtail search_fields on snippet with foreign key<p>I have a snippet which is a proxy of one of my standard django models.
search_fields works fine when filt... |
72,831,220 | Custom Jpa Repository erroring with Fragment implementation error<p>I am currently writing an application in spring boot and am building my own custom repository.</p>
<p>First things first, here the code in question:</p>
<pre class="lang-java prettyprint-override"><code>@Repository
public interface ServiceRepository<... | <p>The JPA repository scan by default looks for implementations with post fix string for class, which is <code>Impl</code> (it could be changed if you need).</p>
<p>When you want to add custom behaviour to a JPA repository by an 'extension', you need to follow:
ExtensionName (interface) -> EntensionNameImpl (class).... | Custom Jpa Repository erroring with Fragment implementation error | java|spring|spring-boot|spring-data-jpa | 0 | 40 | 1 | 72,831,424 | 72,831,424 | 2 | true | 2022-07-01T15:04:40.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Custom Jpa Repository erroring with Fragment implementation error<p>I am currently writing an application in spring boot and am building my own custom reposi... |
72,833,762 | Is there a way to replace the last N letters of words longer than X digits?<p>Does anyone know how can I replace the last N letters of words longer than X digits?
I'm using this code</p>
<pre><code>text = re.sub("[A-ZÀ-ÖØ-Ýà-öø-ÿa-z][A-ZÀ-ÖØ-Ýà-öø-ÿa-z]{7,}", "[\g<0>]", text)
</code></pre>
<p>... | <p>You may use this regex for search:</p>
<pre><code>(\b\w{6,})(\w)
</code></pre>
<p>And use: <code>\1[\2]</code> for replacement.</p>
<p><a href="https://regex101.com/r/r9jyl5/1" rel="nofollow noreferrer">RegEx Demo</a></p>
<p><strong>Code:</strong></p>
<pre class="lang-py prettyprint-override"><code>import re
text = ... | Is there a way to replace the last N letters of words longer than X digits? | python|python-3.x|regex | 2 | 40 | 1 | 72,833,792 | 72,833,792 | 2 | true | 2022-07-01T19:18:05.030Z | 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 replace the last N letters of words longer than X digits?<p>Does anyone know how can I replace the last N letters of words longer than X di... |
72,833,412 | Creating a dynamodb table using Lambda function (python) - error<p>I have defined 3 attributes in that table definition. agentId, agentName, agentRole. I want to create KeySchema on agentId (partitionkey) , agentRole (range key).</p>
<p>In my understanding the table can have 10 attributes. All those 10 attributes don't... | <p>Remove <code>agentName</code> from the Attribute definitions.</p>
<p>See <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeDefinition.html" rel="nofollow noreferrer">the documentation for Attribute Definitions</a>:</p>
<blockquote>
<p>Represents an attribute for describing the key ... | Creating a dynamodb table using Lambda function (python) - error | aws-lambda|amazon-dynamodb | 1 | 40 | 1 | 72,834,119 | 72,834,119 | 2 | true | 2022-07-01T18:37:35.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating a dynamodb table using Lambda function (python) - error<p>I have defined 3 attributes in that table definition. agentId, agentName, agentRole. I wan... |
72,836,006 | Golang Regex not matching the optional part even when it is present in the string<p>I am trying to parse some output from a command, I want to check if the command had an error in it, so I look for the string <code>**Apply Error**</code>. If there is no error present the previously mentioned string is absent. My regex ... | <p>You can use</p>
<pre><code>(?s)Ran Apply\b(?:.+?(\*\*Apply Error\*\*)|.*)
</code></pre>
<p><strong>Explanation</strong></p>
<ul>
<li><code>(?s)</code> Inline modifier to have the dot match a newline</li>
<li><code>Ran Apply\b</code> Match literally followed by a word boundary</li>
<li><code>(?:</code> Non capture gr... | Golang Regex not matching the optional part even when it is present in the string | go|regex-group | 1 | 40 | 1 | 72,837,475 | 72,837,475 | 2 | true | 2022-07-02T02:10:28.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Golang Regex not matching the optional part even when it is present in the string<p>I am trying to parse some output from a command, I want to check if the c... |
72,848,553 | Python Selenium scrape the price which is contained in a custom attribute<p>After hours of trying I manage to scrape data from a marketplace with selenium.
With this code here I took the titles</p>
<pre><code>website = 'https://www.skroutz.gr/c/40/kinhta-thlefwna.html?from=families'
title_list=[]
price_list=[]
driver =... | <p>You can use <code>'find_elements_by_xpath'</code> to print the <code>prices</code>.</p>
<pre><code>from selenium.webdriver.common.by import By
priceLink = driver.find_elements(by=By.XPATH, value = '//a[@data-e2e-testid="sku-price-link"]')
for price in priceLink:
print(price.text)
</code></pre> | Python Selenium scrape the price which is contained in a custom attribute | python|selenium | 0 | 40 | 1 | 72,848,751 | 72,848,751 | 2 | true | 2022-07-03T17:24:07.790Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Selenium scrape the price which is contained in a custom attribute<p>After hours of trying I manage to scrape data from a marketplace with selenium.
W... |
72,865,421 | How to get the name of input filed in jquery<p>I have a multiple-input field and an onchange function. When we change the input field from the event it triggered, I want to get the name or id of the input field (to distinguish it from other input fields). Many thanks.</p> | <pre><code>$('input[type="text"]').on('change', function(){
// name is a unique attribute
$(this).attr("name"));
});
<input type="text" name="text1" />
<input type="text" name="text2" />
<input type="text" name="text3... | How to get the name of input filed in jquery | javascript|jquery|events|input|event-handling | 0 | 40 | 1 | 72,865,671 | 72,865,671 | 2 | true | 2022-07-05T07:20:00.947Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get the name of input filed in jquery<p>I have a multiple-input field and an onchange function. When we change the input field from the event it trigg... |
72,877,005 | What does this Typescript interface syntax from the official docs mean?<p>I came across this code snippet on the <a href="https://www.typescriptlang.org/docs/handbook/namespaces.html" rel="nofollow noreferrer">Typescript namespaces page</a>.</p>
<p>[snippet1]</p>
<pre><code>export interface Selectors {
select: {
... | <blockquote>
<p>is it an overloaded method with 2 possible signatures?</p>
</blockquote>
<p>Yes</p>
<blockquote>
<p>If I wrote it as shown below, would it mean the same?</p>
</blockquote>
<p>Yes, but your method has 2 drawbacks:</p>
<ul>
<li>When using intellisense, the argument is now less precise. <code>selector: str... | What does this Typescript interface syntax from the official docs mean? | typescript|oop|interface | 0 | 40 | 1 | 72,877,039 | 72,877,039 | 2 | true | 2022-07-06T01:18:21.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What does this Typescript interface syntax from the official docs mean?<p>I came across this code snippet on the <a href="https://www.typescriptlang.org/docs... |
72,880,202 | Is it possible to distribute unit test modules in diffrent source files if I use Boost.Test?<p>I have many testing source files in which I use Boost.Test and I'm trying to run them, but get <code> multiple definition of boost::unit_test::runtime_config::argument_store()</code> error and the same for many modules of thi... | <pre><code>%.o: Fast/**/%.cpp $(FAST_HEADERS)
g++ $@ -o $<
</code></pre>
<p>This never applies due to <code>**</code>. You also reversed <code>$@</code> and <code>$<</code>. You could use</p>
<pre><code>Fast/tests/%.o: Fast/tests/%.cpp | $(FAST_HEADERS)
Fast/src/%.o: Fast/src/%.cpp | $(FAST_HEADERS)
%.o: %... | Is it possible to distribute unit test modules in diffrent source files if I use Boost.Test? | c++|boost|makefile | 1 | 40 | 1 | 72,885,281 | 72,885,281 | 2 | true | 2022-07-06T08:28:55.587Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to distribute unit test modules in diffrent source files if I use Boost.Test?<p>I have many testing source files in which I use Boost.Test and... |
72,890,482 | Flutter/Dart Logic for assigning an API Future's return value to another variable/function<p>I think my lack of in-depth oop or async/wait knowledge may be hurting me here but I could not seem to find a working solution for myself. Please be kind.</p>
<p>Creating a basic countdown app for which I'm avoiding hard-coding... | <p>Hoping this helps you to set up the whole scenario.</p>
<p>Let's assume this is your API call method</p>
<pre><code>Future<String> fetchDDate() async {
await Future.delayed(const Duration(seconds: 2));
return "2012-02-27 13:27:00";
}
</code></pre>
<p>Then wrap it with a meaningful function</p... | Flutter/Dart Logic for assigning an API Future's return value to another variable/function | flutter|dart|future|flask-restful|flutter-futurebuilder | 2 | 40 | 2 | 72,890,669 | 72,890,669 | 2 | true | 2022-07-06T22:24:17.383Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter/Dart Logic for assigning an API Future's return value to another variable/function<p>I think my lack of in-depth oop or async/wait knowledge may be h... |
72,903,862 | TRANSACTIONS to CUSTOMERS Relationship<p>We have the data tables from Netsuite ELT'd into a DW. I'm trying to build a query that relates <code>TRANSACTIONS</code> or <code>TRANSACTION_LINES</code> to the <code>CUSTOMERS</code> table.</p>
<p>What I've tried:</p>
<p>1.) transaction and <code>transaction_lines</code> does... | <p>The joining field is <code>entity_id</code> on transactions</p>
<pre class="lang-sql prettyprint-override"><code>select tl.item_id, tl.item_count
from transaction_lines tl, transactions t, customers c
where
c.customer_id = t.entity_d and tl.transaction_id = t.transaction_id
</code></pre>
<p>Your syntax ma... | TRANSACTIONS to CUSTOMERS Relationship | netsuite | 0 | 40 | 1 | 72,904,883 | 72,904,883 | 2 | true | 2022-07-07T20:27:21.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TRANSACTIONS to CUSTOMERS Relationship<p>We have the data tables from Netsuite ELT'd into a DW. I'm trying to build a query that relates <code>TRANSACTIONS</... |
72,904,702 | Creating new column in a Pandas df, where each row's value depends on the value of a different column in the row immediately above it<p>Assume the following Pandas df:</p>
<pre><code># Import dependency.
import pandas as pd
# Create data for df.
data = {'Value': [1000, 1020, 1011, 1010, 1030, 950, 1001, 1100, 1121, 11... | <p>You can use <a href="https://numpy.org/doc/stable/reference/generated/numpy.where.html" rel="nofollow noreferrer">np.where</a> for this:</p>
<pre><code>import pandas as pd
import numpy as np
data = {'Value': [1000, 1020, 1011, 1010, 1030, 950, 1001, 1100, 1121, 1131],
'Dummy_Variable': [0,0,1,0,0,0,1,0,1,1]... | Creating new column in a Pandas df, where each row's value depends on the value of a different column in the row immediately above it | python|pandas|dataframe | 2 | 40 | 1 | 72,904,942 | 72,904,942 | 2 | true | 2022-07-07T22:03:01.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating new column in a Pandas df, where each row's value depends on the value of a different column in the row immediately above it<p>Assume the following ... |
72,912,312 | Show axis labels of geom_sf in unit metres instead of lat/lon<p><strong>Problem</strong></p>
<p>I have an <code>sf</code> object in a crs that uses <code>metres</code> as units. I want the axis labels on a ggplot <code>geom_sf</code> to be the asme as in the original geometry - that is metres for my crs, not lat/lon. I... | <p>You can do this with a <code>coord_sf</code> term...</p>
<pre><code>ggplot() +
geom_sf(data = meuse_sf, aes(color = cadmium)) +
coord_sf(datum = st_crs(28992))
</code></pre>
<p><a href="https://i.stack.imgur.com/iiPNl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iiPNl.png" alt="enter image ... | Show axis labels of geom_sf in unit metres instead of lat/lon | r|ggplot2|geospatial|sf | 0 | 40 | 1 | 72,912,420 | 72,912,420 | 2 | true | 2022-07-08T13:41:50.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Show axis labels of geom_sf in unit metres instead of lat/lon<p><strong>Problem</strong></p>
<p>I have an <code>sf</code> object in a crs that uses <code>met... |
72,919,861 | Presence of @Environment dismiss causes list to constantly rebuild its content on scrolling<p>I need to build a list of TextFields where each field is associated with focus id, so that I can auto scroll to such a text field when it receives focus. In reality the real app is a bit more complex which also includes TextEd... | <ol>
<li><p>I could make an assumption, but that would be really rather a guess (based on experience, observations, etc). In a fact, all <strong>WHYs</strong> like "why this sh... (bug) happens" should be asked on <a href="https://developer.apple.com/forums/" rel="nofollow noreferrer">https://developer.apple.... | Presence of @Environment dismiss causes list to constantly rebuild its content on scrolling | ios|swiftui | 3 | 40 | 1 | 72,919,938 | 72,919,938 | 2 | true | 2022-07-09T07:57:32.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Presence of @Environment dismiss causes list to constantly rebuild its content on scrolling<p>I need to build a list of TextFields where each field is associ... |
72,920,114 | Adding truncated line to ggplot<p>I am trying to plot decision boundaries of a decision tree in <code>ggplot</code>. Unfortunately, when I run this code, I partition <code>data_plot</code> into four (rather than three regions). Note that below data is just a placeholder (doesn't make sense to partition this way).</p>
<... | <p>If I understand you correctly, you could use <code>geom_segment</code> like this:</p>
<pre class="lang-r prettyprint-override"><code>data_plot <- data.frame(x=runif(100,0,1), y=runif(100,0,1))
cut1 <- 0.5
cut2 <- 0.5
library(ggplot2)
ggplot(data_plot, aes(x=x, y=y)) +
geom_point() +
geom_vline(xinterce... | Adding truncated line to ggplot | r|ggplot2 | 0 | 40 | 1 | 72,920,185 | 72,920,185 | 2 | true | 2022-07-09T08:56:10.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding truncated line to ggplot<p>I am trying to plot decision boundaries of a decision tree in <code>ggplot</code>. Unfortunately, when I run this code, I p... |
72,922,242 | Is there a vector 2-norm function in Pydrake?<p>I have defined the following function to compute the pairwise distances between positions of different agents:</p>
<pre><code>def compute_pairwise_distance(X, x_dims):
"""Compute the distance between each pair of agents"""
assert len(... | <p>If you do want the 2-norm in symbolic form, then <code>np.sqrt(x.dot(x))</code> will do the trick:</p>
<pre><code>import numpy as np
from pydrake.all import MakeVectorVariable
x = MakeVectorVariable(2, 'x')
print(np.sqrt(x.dot(x)))
</code></pre>
<p>But if your goal is collision avoidance, you might want to take a l... | Is there a vector 2-norm function in Pydrake? | python|drake | 1 | 40 | 1 | 72,925,506 | 72,925,506 | 2 | true | 2022-07-09T14:36:51.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a vector 2-norm function in Pydrake?<p>I have defined the following function to compute the pairwise distances between positions of different agents... |
72,937,604 | How to count percentage within group with categorical values?<p>I have a dataframe:</p>
<pre><code>id value_type
1 b
1 a
1 a
2 a
3 a
3 b
</code></pre>
<p>I want to calculate percent of each value_type with each id group.so desired result is:</p>
<pre><code>id value_type per... | <p>Check below code:</p>
<pre><code>import pandas as pd
df = pd.DataFrame({'col1':[1,1,1,2,3,3],'col2':['b','a','a','a','a','b']})
df['perc'] = df.groupby(['col1','col2'])['col2'].transform('count')/df.groupby('col1')['col2'].transform('count')
df.round(2).drop_duplicates()
</code></pre>
<p>Output:</p>
<p><a href="h... | How to count percentage within group with categorical values? | python|python-3.x|dataframe|group-by | 3 | 40 | 2 | 72,937,722 | 72,937,722 | 2 | true | 2022-07-11T11:10:33.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to count percentage within group with categorical values?<p>I have a dataframe:</p>
<pre><code>id value_type
1 b
1 a
1 a
2 a
3 ... |
72,942,409 | Updating JPanel based on results from slow server (Using threads to not block GUI)<p>So I have been looking to update one of my panels in a my client code with data that comes from a server in Indonesia. The delay is rather long (2-8) sec and Im noticing that my UI is freezing during the time it takes for the response ... | <p>Making your JPanel implement Runnable is not the best solution. There is no reason to expose a <code>run()</code> method to other classes.</p>
<p>Instead, create a private void method that takes no arguments. A method reference that refers to that method can act as a Runnable, since it will have the same arguments... | Updating JPanel based on results from slow server (Using threads to not block GUI) | java|multithreading|swing|runnable | 1 | 40 | 1 | 72,943,488 | 72,943,488 | 2 | true | 2022-07-11T17:24:06.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Updating JPanel based on results from slow server (Using threads to not block GUI)<p>So I have been looking to update one of my panels in a my client code wi... |
72,944,388 | Remove a set of specific characters from a string using Regular Expression<p>How to remove all the occurrences of apostrophe('), hyphen(-) and dot(.) in a given string using Regular Expression?</p>
<p>For example: <strong>John,. Home'Owner-New</strong> should return <strong>John, HomeOwnerNew</strong></p>
<p>I have tri... | <p>the regex you are looking for is likely <code>/[\.'-]/g</code></p>
<p>I have attached a snippet including a test based on the sample you provided.
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-o... | Remove a set of specific characters from a string using Regular Expression | javascript|regex|regex-group|nsregularexpression | 0 | 40 | 1 | 72,944,453 | 72,944,453 | 2 | true | 2022-07-11T20:36:01.110Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove a set of specific characters from a string using Regular Expression<p>How to remove all the occurrences of apostrophe('), hyphen(-) and dot(.) in a gi... |
72,944,723 | Flask sqlalchemy query using marshmallow not returning nested query result<p>I am trying to invoke below mentioned query and not seeing the <strong>department_info</strong> field in the json response .If I use name "Department", the department details are returning.Is there any way to use different name for t... | <p>You also need to have the <code>relationship</code> defined in your <code>model</code>s (and it needs to be the same name as your nested Marshmallow object.</p>
<pre><code>class Employee(db.model):
id = db.column(db.Integer, primary_key=True)
name = db.column(db.String(45))
department_id = db.Column(db.I... | Flask sqlalchemy query using marshmallow not returning nested query result | python|flask|flask-sqlalchemy|marshmallow|flask-marshmallow | 0 | 40 | 1 | 72,945,170 | 72,945,170 | 2 | true | 2022-07-11T21:12:18.650Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flask sqlalchemy query using marshmallow not returning nested query result<p>I am trying to invoke below mentioned query and not seeing the <strong>departmen... |
72,949,386 | Set all empty cells to zero except for certain columns<p>I have a file called "gar_nv", "nbrLines" is the number of lines ,defined in my code. I have given names to my columns. "listCol" is a function returning a list of these names.
I would like to set all empty cells to zero except the c... | <p>Let's say your columns are named ranges like headers in the image:</p>
<p><a href="https://i.stack.imgur.com/q6JNa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q6JNa.png" alt="enter image description here" /></a></p>
<p>You can do:</p>
<pre><code>Sub test()
Application.ScreenUpdating = False
Di... | Set all empty cells to zero except for certain columns | excel|vba | 1 | 40 | 1 | 72,949,846 | 72,949,846 | 2 | true | 2022-07-12T08:42:21.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Set all empty cells to zero except for certain columns<p>I have a file called "gar_nv", "nbrLines" is the number of lines ,defined in my ... |
72,936,382 | GatsbyJS - how to set up gatsby-node.ts with createPages?<p>I was migrating my Gatsby site to typescript and followed the <a href="https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/#gatsby-nodets" rel="nofollow noreferrer">official guide</a> to update gatsby-node.js to .ts file. The js file works fin... | <p>You have to convert <code>exports.createPages = () => {}</code> to <code>export const createPages = () => {}</code>.</p>
<p>Currently you have <code>export const sourceNodes</code> where the <code>createPage</code> action won't be called. It has to happen in the <code>createPages</code> lifecycle.</p> | GatsbyJS - how to set up gatsby-node.ts with createPages? | gatsby | 2 | 40 | 1 | 72,952,164 | 72,952,164 | 2 | true | 2022-07-11T09:31:41.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GatsbyJS - how to set up gatsby-node.ts with createPages?<p>I was migrating my Gatsby site to typescript and followed the <a href="https://www.gatsbyjs.com/d... |
72,953,134 | How to extract numbers at the end of the strings with repeated pattern in a Pandas column in Python?<p>I would like to extract all the numbers at the end of the string in a column of a data frame, and make a new column out of them.</p>
<p>Example:</p>
<pre><code>import pandas as pd
pd.DataFrame({'target': ['w1-d2','w1-... | <p>Use <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.str.extract.html" rel="nofollow noreferrer"><code>str.extract</code></a> and a simple regex (<code>(\d+)$</code>):</p>
<pre><code>df['new_column'] = df['target'].str.extract(r'(\d+)$')
</code></pre>
<p>output:</p>
<pre><code> target new_column
... | How to extract numbers at the end of the strings with repeated pattern in a Pandas column in Python? | python|pandas | 0 | 40 | 3 | 72,953,159 | 72,953,159 | 2 | true | 2022-07-12T13:29:18.867Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to extract numbers at the end of the strings with repeated pattern in a Pandas column in Python?<p>I would like to extract all the numbers at the end of ... |
72,960,942 | Flask & WTForms: Execution Stops improperly on ValidationError<p>I'm using a WTForm with a custom validator the check for properly formatted phone numbers, care of the helpful package phonenumbers (<a href="https://pypi.org/project/phonenumbers/" rel="nofollow noreferrer">https://pypi.org/project/phonenumbers/</a>).</p... | <p>I think the problem arises from the fact that you are calling the custom validator directly.<br />
In the following example, the function for validation is assigned to the associated field using the name. This is called by the <code>validate</code> function of the form, which in turn is called by <code>validate_on_s... | Flask & WTForms: Execution Stops improperly on ValidationError | flask|debugging|testing|wtforms | 0 | 40 | 2 | 72,972,052 | 72,972,052 | 2 | true | 2022-07-13T04:25:29.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flask & WTForms: Execution Stops improperly on ValidationError<p>I'm using a WTForm with a custom validator the check for properly formatted phone numbers, c... |
72,972,953 | Can't subclass UIFont<p>I use custom fonts in my iOS application and have setup the fonts like so:</p>
<pre><code>private enum MalloryProWeight: String {
case book = "MalloryMPCompact-Book"
case medium = "MalloryMPCompact-Medium"
case bold = "MalloryMPCompact-Bold"}
extension UIFont {... | <p>You can't subclass UIFont because it is bridged to CTFont via UICTFont. That's why the <code>init</code> methods are marked "not inherited" in the header. It's not a normal kind of class.</p>
<p>You can easily add a new property to UIFont, but it won't work the way you want it to. It'll be exactly what you... | Can't subclass UIFont | swift|uikit|uifont | 1 | 40 | 1 | 72,973,519 | 72,973,519 | 2 | true | 2022-07-13T21:43:36.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't subclass UIFont<p>I use custom fonts in my iOS application and have setup the fonts like so:</p>
<pre><code>private enum MalloryProWeight: String {
ca... |
72,976,210 | C# IoC configuration: how can I inject an object when one of its parameters it's not an already injected object?<p>I'm using the <code>Microsoft.Extensions.DependencyInjection</code> library and I have this concrete class which implements a generic interface called <code>IInterface</code></p>
<pre><code>using System.Ne... | <p>The lambda function passed to <code>AddScoped</code> takes an <code>IServiceProvider</code> as input. You can use this to resolve an <code>IHttpClientFactory</code> by calling <code>GetService<IHttpClientFactory>()</code>.</p>
<pre><code>services.AddScoped<IInterface, Concrete>(sp
=> new Concrete(... | C# IoC configuration: how can I inject an object when one of its parameters it's not an already injected object? | c#|dependency-injection|inversion-of-control|asp.net-mvc-controller | 0 | 40 | 1 | 72,976,462 | 72,976,462 | 2 | true | 2022-07-14T06:39:38.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# IoC configuration: how can I inject an object when one of its parameters it's not an already injected object?<p>I'm using the <code>Microsoft.Extensions.D... |
72,982,664 | PHP SQL Change style of filtered data while still display all data<p>I hava a page with a list of data displayed from database table and a search bar.</p>
<p>When I filter the data by id, the searched data will be highlighted (background color change) but I need it to remain displaying the rest of data.</p>
<p>I manage... | <p>I have managed to highlight/bold the search data while still display all the other data and will display a message <code>Record not found</code> if the data is not in table.</p>
<pre><code><?php
include("database.php");
$search_keyword = '';
if (isset($_POST['search'])) {
$search_keyword = $_POST['... | PHP SQL Change style of filtered data while still display all data | php|html|mysql | 0 | 40 | 1 | 72,989,033 | 72,989,033 | 2 | true | 2022-07-14T15:01:31.423Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PHP SQL Change style of filtered data while still display all data<p>I hava a page with a list of data displayed from database table and a search bar.</p>
<p... |
72,990,685 | Is there a way to increase ttl in redis?<p>I know there are several ways to set a specific ttl for a key, but is there a way to add some extra time for a key which has a counting down ttl?</p> | <p>There's no built-in way to <em>extend</em> TTL. You need to get the current TTL, and then add some more TTL to it.</p>
<p>Wrap these two steps into a Lua script:</p>
<pre><code>-- extend 300 seconds
eval 'local ttl = redis.call("TTL", "key") + 300; redis.call("EXPIRE", "key", ... | Is there a way to increase ttl in redis? | redis | 0 | 40 | 2 | 72,990,947 | 72,990,947 | 2 | true | 2022-07-15T07:47:40.143Z | 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 increase ttl in redis?<p>I know there are several ways to set a specific ttl for a key, but is there a way to add some extra time for a key... |
72,993,053 | Change lapply syntax to nested for looping in R<p>I would like to ask for help in rephrasing syntax in my R function.</p>
<p>I have a following nested list:</p>
<pre><code>x <- list(one = list(one_1 = list(seq = c(rep(1,5), rep(2,4)), start = -1, end = 5),
one_2 = list(seq = c(rep(2,5), rep(1,5), rep(3,4), rep(... | <p>Here is <code>second</code> rewritten. The two outputs are <a href="https://stat.ethz.ch/R-manual/R-devel/library/base/html/identical.html" rel="nofollow noreferrer"><code>identical</code></a>.</p>
<pre class="lang-r prettyprint-override"><code>library(parallel)
library(doParallel)
#> Loading required package: fo... | Change lapply syntax to nested for looping in R | r|list|for-loop|lapply | 0 | 40 | 1 | 72,993,351 | 72,993,351 | 2 | true | 2022-07-15T11:07:43.713Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change lapply syntax to nested for looping in R<p>I would like to ask for help in rephrasing syntax in my R function.</p>
<p>I have a following nested list:<... |
73,002,064 | What is the diffrence between these definitions for `async inline methods`?<p>We are able to define an <code>async inline method</code> in different ways, Is there any difference in the result or under the hood?</p>
<pre class="lang-dart prettyprint-override"><code>1.
Future<void> counter() async => await Fut... | <p>Timing, if anything.</p>
<p>The <code>async => await</code> version waits for the delayed future created by <code>Future.delayed</code> to complete before returning, then it completes the returned future.
The <code>async =></code> version should do precisely the same, since the await is implicit in the return.... | What is the diffrence between these definitions for `async inline methods`? | dart|async-await|asynchronous-programming | 3 | 40 | 1 | 73,004,842 | 73,004,842 | 2 | true | 2022-07-16T06:36:43.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the diffrence between these definitions for `async inline methods`?<p>We are able to define an <code>async inline method</code> in different ways, Is... |
73,011,138 | Referencing secrets in Kubernetes<p>What is the difference between <code>env</code> and <code>envFrom</code> fields in kubernetes when referencing secrets? Thank you!</p> | <p>Below is the <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/" rel="nofollow noreferrer">"env:"</a> sample which will load variables into container environment as environment variables which can referenced using "$DEMO_GREETING" then you wil... | Referencing secrets in Kubernetes | kubernetes|kubernetes-secrets | 1 | 40 | 1 | 73,012,511 | 73,012,511 | 2 | true | 2022-07-17T10:49:52.537Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Referencing secrets in Kubernetes<p>What is the difference between <code>env</code> and <code>envFrom</code> fields in kubernetes when referencing secrets? T... |
73,016,019 | How can I find which keys are absent from a Python dict?<p><code>d</code> is a Python <code>dict</code> mapping (some of) the integers in <code>range(x)</code> to values. How can I find which integers in that range are <em>not</em> mapped, and set them to a default value?</p>
<p>I do not want to just the dict's defaul... | <p>Iterate over the range and <code>setdefault</code> each key:</p>
<pre><code>for i in range(x):
d.setdefault(i, 42)
</code></pre>
<p>Note that <code>setdefault</code> sets a default value <em>for that key</em> (not the whole dictionary), if and only if that key isn't already set to something else.</p>
<p>You coul... | How can I find which keys are absent from a Python dict? | python|dictionary | -3 | 40 | 3 | 73,016,035 | 73,016,035 | 2 | true | 2022-07-17T23:21:23.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I find which keys are absent from a Python dict?<p><code>d</code> is a Python <code>dict</code> mapping (some of) the integers in <code>range(x)</cod... |
73,017,609 | How to save path after upload in laravel storage?<p>I want to after uploading an image save it like this</p>
<blockquote>
<p>images/blogs/1650953308.jpg</p>
</blockquote>
<p>But I see this</p>
<blockquote>
<p>1650953308.jpg</p>
</blockquote>
<p>I want to save like this</p>
<blockquote>
<p>images/blogs/1650953308.jpg</p... | <p>Concatenate <strong>folder path</strong> with image name.</p>
<pre><code> Blog::query()->create([
'image' => 'images/blogs/'.$fileNameService,
]);
</code></pre>
<p>It will save as <strong>images/blogs/1650953308.jpg</strong>.</p> | How to save path after upload in laravel storage? | php|laravel | 1 | 40 | 1 | 73,017,719 | 73,017,719 | 2 | true | 2022-07-18T05:18:02.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to save path after upload in laravel storage?<p>I want to after uploading an image save it like this</p>
<blockquote>
<p>images/blogs/1650953308.jpg</p>
... |
73,029,055 | How to resize HTML navbar icon<p>I have an image that I'm using as the home button for a navbar on a website. I want the image height to exceed the height of the navbar (so that it hangs over the bottom of the navbar). I tried setting the max-height for the navbar to half of the height for the image/home button, but it... | <p>Your code uses the w3schools design system and for the .w3-bar class it uses overflow hidden, so you'll never be able to move the logo out of there unless you override it.</p>
<p>That's what I've done in the code example is override the overflow hidden then use relative position on the containing div then I was able... | How to resize HTML navbar icon | html|css | 1 | 40 | 1 | 73,029,670 | 73,029,670 | 2 | true | 2022-07-18T21:59:20.683Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to resize HTML navbar icon<p>I have an image that I'm using as the home button for a navbar on a website. I want the image height to exceed the height of... |
73,030,481 | Big Query -- Reorder elements within a delimited string by another delimiter<h2>Summary</h2>
<p>I'd like to reorder elements in a string, the elements are delimited by new lines.</p>
<p>The elements I'd like to sort should be ordered by a string that can have numbers or letters within it. This sorting string is not at ... | <p>Consider below approach</p>
<pre><code>select student, (
select string_agg(line, '\n' order by split(line, '|')[safe_offset(1)])
from unnest(split(favorite_characters_and_shows, '\n')) line
where trim(line) != ''
) as favorite_characters_and_shows
from example_data
</code></pre>
<p>if applied to... | Big Query -- Reorder elements within a delimited string by another delimiter | sql|google-cloud-platform|google-bigquery | 1 | 40 | 1 | 73,030,566 | 73,030,566 | 2 | true | 2022-07-19T02:30:29.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Big Query -- Reorder elements within a delimited string by another delimiter<h2>Summary</h2>
<p>I'd like to reorder elements in a string, the elements are de... |
73,031,031 | How does MySQL handle the SUM function?<pre><code>SELECT
COUNT(id) as t,
IF(pageId is NULL, 1, 0) as tD
FROM table_name;
</code></pre>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>t</th>
<th>td</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>1</td>
</tr>
</tbody>
</table>
</div>
<pre>... | <p>The first query is not legal SQL. You're using an aggregate function (count) but have a non aggregated column (pageId). MySQL will allow this if only_full_group_by is off. You should turn it on to avoid bad habits. See <a href="https://dev.mysql.com/doc/refman/8.0/en/group-by-handling.html" rel="nofollow noreferrer"... | How does MySQL handle the SUM function? | mysql|sql | 1 | 40 | 1 | 73,031,157 | 73,031,157 | 2 | true | 2022-07-19T04:12:54.177Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does MySQL handle the SUM function?<pre><code>SELECT
COUNT(id) as t,
IF(pageId is NULL, 1, 0) as tD
FROM table_name;
</code></pre>
<div class="s-t... |
72,923,107 | Dart: How do I extract text from string?<p>I have the following string from which I wish to get the text in the src tag.What would be the Regular Expression or Function I would have to use.</p>
<pre><code>var string ='<img src=\"https://d3btgtzu3ctdwx.cloudfront.net/nf1?t=8e67f6f9-efba-4c3b-b718-517512044736\&q... | <p>I don't have much experience with Dart, but with Python I quickly solved this in:</p>
<pre class="lang-py prettyprint-override"><code>import re
data = "<img src=\"https://d3btgtzu3ctdwx.cloudfront.net/nf1?t=8e67f6f9-efba-4c3b-b718-517512044736\" height=\"1\" width=\"1\" border=... | Dart: How do I extract text from string? | dart | -1 | 40 | 1 | 72,923,186 | 72,923,186 | 2 | true | 2022-07-09T16:40:22.780Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dart: How do I extract text from string?<p>I have the following string from which I wish to get the text in the src tag.What would be the Regular Expression ... |
72,873,509 | Omit parameter in lookup<p>How could I omit parameter in lookup when it isn't defined?</p>
<p>I have tried with something like <code>default(omit)</code>, but it doesn't work:</p>
<pre class="lang-yaml prettyprint-override"><code>- set_fact:
myvar: >-
{{ query(
'awx.awx.schedule_rrule',
... | <p>This one is indeed a tricky one, it seems like the omit happens too late even if you use the trick <a href="https://stackoverflow.com/a/334666/2123530">to pass a dictionary in the named parameters</a> of the lookup.</p>
<p>So, to cover it, you could trim down the <code>item</code> dictionary to the <code>start_date<... | Omit parameter in lookup | ansible | 2 | 40 | 1 | 72,874,591 | 72,874,591 | 2 | true | 2022-07-05T17:38:35.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Omit parameter in lookup<p>How could I omit parameter in lookup when it isn't defined?</p>
<p>I have tried with something like <code>default(omit)</code>, bu... |
72,880,608 | How to set a date for future in mysql<p>I am creating a table that has 3 columns one primary key <code>id</code> the other one <code>reg_date</code> to hold the date that the user has registered and the last one <code>exp_date</code> which is 4 years ahead of <code>reg_date</code> to hold the expiry date of the account... | <p>Try this way,</p>
<pre><code>CREATE TABLE Accounts (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
exp_date TIMESTAMP generated always as (reg_date + interval 4 year)
)
</code></pre> | How to set a date for future in mysql | mysql|sql|phpmyadmin|sql-timestamp | 1 | 40 | 1 | 72,880,802 | 72,880,802 | 2 | true | 2022-07-06T08:59:01.073Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to set a date for future in mysql<p>I am creating a table that has 3 columns one primary key <code>id</code> the other one <code>reg_date</code> to hold ... |
72,846,871 | How to add program to users program menu in VS2022 Installer projects?<p>How do I add a program to my target user's program menu using Visual Studio 2022 setup project? Any way to do it would be great.</p> | <p>Assuming you want a shortcut to a program that is part of the installer package (most likely in the "Application Folder"), then you can use the following steps:</p>
<ol>
<li><p>Open the "File System" view for your installer project (right-click on the project in Solution Explorer and select the &... | How to add program to users program menu in VS2022 Installer projects? | visual-studio|setup-project|visual-studio-2022 | 2 | 40 | 1 | 72,846,958 | 72,846,958 | 2 | true | 2022-07-03T13:25:12.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add program to users program menu in VS2022 Installer projects?<p>How do I add a program to my target user's program menu using Visual Studio 2022 set... |
72,870,259 | fill column of dataframes within a list with substring of dataframes names in R<p>I have a list of dataframes that look like this></p>
<pre><code>
crops_1990.tempor <- data.frame(study_unit=c("unit1", "unit2", "unit3"),
cropp=c("crop1", "... | <p>Using <code>tidyverse</code> (<code>lst</code> names the list automatically*) you could do:</p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
lst(crops_1990.tempor, crops_1991.tempor, crops_1992.tempor) |>
imap(~ .x |> mutate(year = .y |> str_extract("\\d+")))
</code></pre>
... | fill column of dataframes within a list with substring of dataframes names in R | r|list|dataframe | 0 | 40 | 2 | 72,870,548 | 72,870,548 | 2 | true | 2022-07-05T13:26:16.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
fill column of dataframes within a list with substring of dataframes names in R<p>I have a list of dataframes that look like this></p>
<pre><code>
crops_1... |
72,912,724 | Null Reference Exception on List of Strings<p>I've been <a href="https://stackoverflow.com/questions/45851277/smart-way-to-concatenate-strings">looking at this thread</a> as a way to create a "smart" method for concatenating strings. I have a set of properties where some of them might be null, in which case, ... | <p>Calling the ToString() method on a null object will result in a NullReferenceException.</p>
<p>Instead, you will need to:</p>
<ol>
<li>Filter to return just the values that are not null</li>
<li>Select the value of ToString on the filtered set</li>
<li>Then join</li>
</ol>
<p>Also, there really is no need to convert... | Null Reference Exception on List of Strings | vb.net | 0 | 40 | 1 | 72,912,922 | 72,912,922 | 2 | true | 2022-07-08T14:14:14.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Null Reference Exception on List of Strings<p>I've been <a href="https://stackoverflow.com/questions/45851277/smart-way-to-concatenate-strings">looking at th... |
72,965,381 | Google script sending email containing information from wrong sheet<p>I have a Google Sheet containing three sheets. Sheet 1 is an information page and doesn't get updated. Sheets 2 and 3 are similar, there's just a few differences in the data the columns contain and Sheet 3 has one extra column.</p>
<p>There's separat... | <p>In your logic <code>if(event.range.getA1Notation().indexOf("J")</code> doesn't limit it to column J of <code>PASS Profile</code> but any sheet. If you do want to limit it you should add a check.</p>
<p>In Script 2 add:</p>
<pre><code>if( event.range.getSheet().getName() !== "PASS Profile" ) retu... | Google script sending email containing information from wrong sheet | google-apps-script|google-sheets | -1 | 40 | 1 | 72,980,870 | 72,980,870 | 2 | true | 2022-07-13T11:18:00.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google script sending email containing information from wrong sheet<p>I have a Google Sheet containing three sheets. Sheet 1 is an information page and doesn... |
73,002,218 | Pygame Animated background freezing<p>I was working on making a animated background for my game. So I have the frames for it there are 174 ans store them in a list in a class. when I run the animate function in the class it only displays one image then dosnt do anything. I figured it is because of the for loop that is ... | <p>Never implement a loop that tires to animate something in the application loop. This stops the application loop and the game becomes unresponsive. You need to load all the image int the constructor and loop through the images while the application loop is running.<br />
Beside that, <code>pygame.image.load</code> is... | Pygame Animated background freezing | python|loops|animation|pygame|freeze | 1 | 40 | 2 | 73,002,298 | 73,002,298 | 2 | true | 2022-07-16T07:03:31.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pygame Animated background freezing<p>I was working on making a animated background for my game. So I have the frames for it there are 174 ans store them in ... |
73,023,192 | Creating a randomly even distribution of two lists in google sheets<p>let's asume I have two lists:</p>
<p>(1)</p>
<ul>
<li>plays baseball</li>
<li>plays cricket</li>
<li>plays tennis</li>
<li>plays golf</li>
<li>plays rugby</li>
</ul>
<p>(2)</p>
<ul>
<li>Tim</li>
<li>Steve</li>
<li>Max</li>
</ul>
<p>Now I would like t... | <p>Say your noun phrases are in column A and verb phrases are in column B. Empty cells are allowed.</p>
<p>In column C, every new sentence can be generated by</p>
<pre><code>= join(" ",
index(filter(A:A,A:A<>""),randbetween(1,counta(A:A)),1),
index(filter(B:B,B:B<>"&qu... | Creating a randomly even distribution of two lists in google sheets | google-sheets|google-sheets-formula | 0 | 40 | 1 | 73,023,559 | 73,023,559 | 2 | true | 2022-07-18T13:34:00.020Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating a randomly even distribution of two lists in google sheets<p>let's asume I have two lists:</p>
<p>(1)</p>
<ul>
<li>plays baseball</li>
<li>plays cri... |
72,986,650 | Why does one of my ways of passing retval (void *) to pthread_exit() give unexpected results?<p>Today is my first day working with threads. I am struggling to understand why I am unable to pass the retval (type: void *) in <strong>both</strong> of the following ways below (i.e., only one way will give expected results ... | <p>This code:</p>
<pre><code>pthread_exit( exitStatus_ptr ); /** denote as Line 17 **/
</code></pre>
<p>passes a pointer to a local variable to pthread_exit. When you want to retreive that value in <code>main()</code>, that pointer is invalid as it points to something on the stack in <code>threadFunction</code> - which... | Why does one of my ways of passing retval (void *) to pthread_exit() give unexpected results? | c|linux|pthreads|void-pointers|pthread-exit | 0 | 40 | 1 | 72,986,737 | 72,986,737 | 2 | true | 2022-07-14T21:05:36.343Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does one of my ways of passing retval (void *) to pthread_exit() give unexpected results?<p>Today is my first day working with threads. I am struggling t... |
72,790,221 | How does loom screen record without asking for permission to capture the screen?<p>Loom's chrome extension can record your screen with "one click record".</p>
<p>Normally, to capture someone's screen, the browser will display a "do you want to share your screen" modal.</p>
<p>How does Loom achieve t... | <p>It's an <em>extension</em>, not just a web page. When you installed it, Chrome showed you the things it would have access to, and you accepted that by continuing with the installation:</p>
<p><a href="https://i.stack.imgur.com/GrpJc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GrpJc.png" alt="e... | How does loom screen record without asking for permission to capture the screen? | webrtc | 0 | 40 | 1 | 72,790,277 | 72,790,277 | 2 | true | 2022-06-28T16:35:44.943Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does loom screen record without asking for permission to capture the screen?<p>Loom's chrome extension can record your screen with "one click record... |
72,994,649 | Count Rows If Column A OR Column B meet criteria<p>I am stuck trying to count the number of rows that meet a certain criteria. I have a large database in excel. Now on column A and B, I have a lot of text in cell, but I want to count every row if cell A or B meets my criteria.</p>
<p>Let's say column A has some notes f... | <p>Since your two columns are contiguous, you could use:</p>
<p><code>=SUMPRODUCT(N(MMULT(N(ISNUMBER(SEARCH("shopping",A1:B100))),{1;1})>0))</code></p>
<p>though I would be tempted by:</p>
<p><code>=SUM(COUNTIFS(A:A,{"=";"<>";"="}&"*shopping*",B:B,{"&l... | Count Rows If Column A OR Column B meet criteria | excel|excel-formula | 0 | 40 | 1 | 72,994,823 | 72,994,823 | 2 | true | 2022-07-15T13:19:15.790Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Count Rows If Column A OR Column B meet criteria<p>I am stuck trying to count the number of rows that meet a certain criteria. I have a large database in exc... |
72,986,227 | Create a new value output if the values of another column do not match<p>I am working with some complicated patient health data and would like to simplify categorizing the types of insurance patients use. However, some patients use multiple insurance types to pay for a medical visit (ie Medicare and supplemental insura... | <p>You can group by the patient id, select the public_private column from the groups, and then apply a transformation, which you can populate back to the original rows of the groups in a new column.</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
data = {
'patient_ID': [1, 1, 2, 2, 3, 3],
... | Create a new value output if the values of another column do not match | python|duplicates|categories|simplify|hit | 0 | 40 | 1 | 72,998,924 | 72,998,924 | 2 | true | 2022-07-14T20:19:03.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create a new value output if the values of another column do not match<p>I am working with some complicated patient health data and would like to simplify ca... |
73,026,817 | Combine conditional with static class NextJS<p>In NextJS I'm trying to apply both a static CSS-class and a conditional class to an element. Separated from each other I can make both work, but when combining them it will result in an unexpected error.</p>
<pre><code># This will work
<span className="font-medium&... | <p>You need a space after font-medium, because it will be interpreted as a single class otherwise</p>
<pre><code><span className={"font-medium " + status ? "bg-green-600":"bg-orange-600"}>{message}</span>
</code></pre>
<p>And with template literals :</p>
<pre><code><span cla... | Combine conditional with static class NextJS | javascript|html|next.js|jsx|tailwind-css | 0 | 40 | 2 | 73,026,835 | 73,026,835 | 2 | true | 2022-07-18T18:14:21.067Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combine conditional with static class NextJS<p>In NextJS I'm trying to apply both a static CSS-class and a conditional class to an element. Separated from ea... |
72,917,176 | How to deal with month grouping and sum of hours of these months in Google Sheets?<p>I'm having trouble filtering a column by month/year and counting the unique values. I started trying with ARRAYFORMULA, then with QUERY, but without success.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>... | <p>try:</p>
<pre><code>=ARRAYFORMULA(QUERY({TEXT(A3:A; "mm/e")\
IF(COUNTIFS(A3:A; A3:A; ROW(A3:A); "<="&ROW(A3:A))=1; 1; 0)\ C3:C-B3:B};
"select Col1,sum(Col2),sum(Col3) where Col3>0
group by Col1 label sum(Col2)'',sum(Col3)''
format sum(Col3)'[h]\hmm\min'"))
</code></p... | How to deal with month grouping and sum of hours of these months in Google Sheets? | google-sheets|sum|formatting|string-formatting|google-query-language | 1 | 40 | 1 | 72,917,649 | 72,917,649 | 2 | true | 2022-07-08T21:29:26.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to deal with month grouping and sum of hours of these months in Google Sheets?<p>I'm having trouble filtering a column by month/year and counting the uni... |
72,827,151 | Reshape 3-d array to 2-d<p>I want to change my array type as <code>pd.DataFrame</code> but its shape is:</p>
<pre><code>array_.shape
(1, 181, 12)
</code></pre>
<p>I've tried to reshape by the following code, but it didn't work:</p>
<pre><code>new_arr = np.reshape(array_, (-1, 181, 12))
</code></pre>
<p>How can I change... | <p>NumPy array dimensions can be reduced using various ways; some are:<br />
using <a href="https://stackoverflow.com/questions/18691084/what-does-1-mean-in-numpy-reshape"><code>np.squeeze</code></a>:</p>
<pre><code>array_.squeeze(0)
</code></pre>
<p>using <code>np.reshape</code>:</p>
<pre><code>array_.reshape(array_.s... | Reshape 3-d array to 2-d | python|numpy | 0 | 40 | 2 | 72,827,950 | 72,827,950 | 2 | true | 2022-07-01T09:25:31.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reshape 3-d array to 2-d<p>I want to change my array type as <code>pd.DataFrame</code> but its shape is:</p>
<pre><code>array_.shape
(1, 181, 12)
</code></pr... |
72,833,444 | How to Return struct in a class when gthe struct is declared outside the class?<p>I am trying to get the structure of strings "Johna" "Smith" to return by calling a class. I am very new and confused on OOP and pointers and I wanted to know if Im on the right track and what I can do to get rid of the... | <p>Your code is totally fine, you're just confused about the <code>printf</code> function of C++.
<br>
Maybe you have experience with python, javascript, or other scripting languages that the print function accepts anything and prints it out nicely. That is not the case with a strong typed language like C++.</p>
<p>You... | How to Return struct in a class when gthe struct is declared outside the class? | c++|oop|pointers|getter-setter | 0 | 40 | 3 | 72,833,523 | 72,833,523 | 2 | true | 2022-07-01T18:41:08.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to Return struct in a class when gthe struct is declared outside the class?<p>I am trying to get the structure of strings "Johna" "Smith&q... |
72,775,469 | can you catch the rxjs filter like catching an either left<p>I would like to know if it's possible to catch when the condition of the rxjs filter condition isn't true.</p>
<p>this is what I have:</p>
<pre><code> of(1)
.pipe(
map((d) => d + 1),
filter((d) => d === 0),
map((d) => d + 1),... | <p>You need to throw an error to be able to catch it !</p>
<pre><code>of(1)
.pipe(
map((d) => d + 1),
switchMap((d) => {
if (d === 0) {
return of(d + 1);
}
throwError(() => new Error('Erroooooor'));
})
)
.toPromise()
.then((d) => console.log(d)) // display indef... | can you catch the rxjs filter like catching an either left | javascript|typescript|rxjs|observable|fp-ts | 0 | 40 | 1 | 72,775,664 | 72,775,664 | 2 | true | 2022-06-27T16:31:06.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
can you catch the rxjs filter like catching an either left<p>I would like to know if it's possible to catch when the condition of the rxjs filter condition i... |
72,778,438 | Intersection types with arrays and array methods cannot find all fields<p>I've got two types that are both an array of objects, with their fields, in an intersection type in Typescript.</p>
<p>If I take an element from the array I can access the second field, but if I use an array method (forEach, map, filter etc) the ... | <p><a href="https://github.com/microsoft/TypeScript/issues/11961" rel="nofollow noreferrer">Per Ryan Cavanaugh</a> (active member fo the TypeScript team), it is a bad idea to have an intersection of 2 array types.</p>
<blockquote>
<p>This happens because we just merge the signatures of forEach in order,
whereas element... | Intersection types with arrays and array methods cannot find all fields | arrays|typescript|union-types | 1 | 40 | 2 | 72,778,535 | 72,778,535 | 2 | true | 2022-06-27T21:22:17.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Intersection types with arrays and array methods cannot find all fields<p>I've got two types that are both an array of objects, with their fields, in an inte... |
72,798,762 | Value_counts() for each of the columns in one dataframe<p>Let's suppose I have a dataset like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">ID</th>
<th style="text-align: left;">Department</th>
<th style="text-align: left;">Level</th>
</tr>
</thead>
<tbody>... | <p>You can do this by creating 2 groupby dataframes, one for each of the counts, and merging them together.</p>
<p>Department counts:</p>
<pre><code>dept = df.groupby('Department', as_index=False).count()[['Department', 'ID']]
dept = dept.rename(columns = {'ID':'Department_Count'})
Department ID
0 Design 2
1 ... | Value_counts() for each of the columns in one dataframe | python|pandas|dataframe | 1 | 40 | 1 | 72,798,955 | 72,798,955 | 2 | true | 2022-06-29T09:11:01.597Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Value_counts() for each of the columns in one dataframe<p>Let's suppose I have a dataset like this:</p>
<div class="s-table-container">
<table class="s-table... |
73,008,032 | Object.freeze not working on URL searchParams.set()<p>Is there a way to force an object to be recreated/cloned in order for it to be used specifically on the <code>URL</code> object?</p>
<p>I have tried using <code>Object.freeze(new URL('http://example.com))</code>, however, I can still add and remove searchParams to t... | <p>There are two potential things tripping you up here:</p>
<p>Firstly, freezing an object doesn't freeze its sub-objects. It is not recursive. There are many implementations of a 'deep freeze' function that does work recursively, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects... | Object.freeze not working on URL searchParams.set() | javascript | 0 | 40 | 1 | 73,008,064 | 73,008,064 | 2 | true | 2022-07-16T22:27:15.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Object.freeze not working on URL searchParams.set()<p>Is there a way to force an object to be recreated/cloned in order for it to be used specifically on the... |
73,002,402 | get id of Selected Tag<p>how can i give Id of my selected tag in c#
this is my code:</p>
<pre><code>Options = new SelectList(_db.CityUserTable, nameof(CityUserTable.CityID), nameof(CityUserTable.CityName));
Options.First(x => x.Value == user.CityID.ToString()).Selected = true;
</code></pre> | <p>You have it backwards. You're setting the property <code>Selected</code> true where <code>CityId</code> matches. Instead you need to get the <code>Value</code> (Assuming value contains the CityId) where <code>Selected</code> is true.</p>
<pre><code>Options.FirstOrDefault(x => x.Selected)?.Value
</code></pre>
<p>U... | get id of Selected Tag | c#|asp.net-core|combobox|selectlist | 0 | 40 | 1 | 73,002,566 | 73,002,566 | 2 | true | 2022-07-16T07:34:45.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
get id of Selected Tag<p>how can i give Id of my selected tag in c#
this is my code:</p>
<pre><code>Options = new SelectList(_db.CityUserTable, nameof(CityUs... |
72,798,726 | Change class attribute type from string to int<p>I have this class that should be initialized with all parameter <code>int</code> but sometimes it gets <code>string</code> instead of <code>int</code></p>
<pre><code>@dataclass
class Meth:
one: Optional[int] = None
two: Optional[int] = None
three: Optional[in... | <p>The error is caused when converting None to int, not because of specified types. You can add a check:</p>
<pre><code>new_class = Meth(
one=int(my_class.one),
two=int(my_class.two),
three=my_class.three if my_class.three is None else int(my_class.three)
)
</code></pre>
<hr />
<p>A better way would be to do i... | Change class attribute type from string to int | python|python-3.x | 0 | 40 | 1 | 72,798,838 | 72,798,838 | 2 | true | 2022-06-29T09:09:15.430Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change class attribute type from string to int<p>I have this class that should be initialized with all parameter <code>int</code> but sometimes it gets <code... |
72,907,963 | Override navigation icons in bulma carousel<p>I am looking at the following example for bulma carousel: <a href="https://codesandbox.io/s/bold-tree-p3dyf4?file=/index.html" rel="nofollow noreferrer">https://codesandbox.io/s/bold-tree-p3dyf4?file=/index.html</a> and I am looking for a way to override the icons for the ... | <p>Sure, you can use the icon parameter to adjust the text/images of the buttons</p>
<pre><code>bulmaCarousel.attach("#slider", {
slidesToScroll: 1,
slidesToShow: 3,
infinite: true,
icons: { previous: "L", next: "<span style='color:green;font-weight:800'>R</span>"}
});
... | Override navigation icons in bulma carousel | javascript|html|bulma | 0 | 40 | 1 | 72,908,534 | 72,908,534 | 2 | true | 2022-07-08T07:17:00.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Override navigation icons in bulma carousel<p>I am looking at the following example for bulma carousel: <a href="https://codesandbox.io/s/bold-tree-p3dyf4?f... |
72,908,200 | condition to save workbook only when open<p>Hi all I have this code to autosave a workbook</p>
<pre><code>Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:01:00"), "Save1"
End Sub
Sub Save1()
Application.DisplayAlerts = False
ThisWorkbook.Save
Application.DisplayAlerts = Tru... | <p>Your problem is that you never stop the timer - it stays active even if you close the workbook. When the minute is over, VBA want to call a Sub (<code>Save1</code>) that is currently not available (as the workbook is closed), so VBA asks Excel to open the file so that it can execute the routine.</p>
<p>It will not h... | condition to save workbook only when open | excel|vba | 1 | 40 | 2 | 72,909,122 | 72,909,122 | 2 | true | 2022-07-08T07:39:54.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
condition to save workbook only when open<p>Hi all I have this code to autosave a workbook</p>
<pre><code>Private Sub Workbook_Open()
Application.OnTime N... |
72,935,165 | Django custom tags validation<p>I'm getting this error -> Invalid filter: 'cutter'
while this is my custom tags.py:</p>
<pre><code>from django import template
from random import randint
register = template.Library()
def cutter(list, args):
return list[args]
register.filter('cutter', cutter)
</code></pre>
<p>... | <p>I tried it with following:</p>
<p>custom_tags.py (list is a bad name for a variable - because it shadows built in list function)</p>
<pre><code>from django import template
register = template.Library()
def cutter(entry_list, args):
return entry_list[args]
register.filter('cutter', cutter)
</code></pre>
<p>ind... | Django custom tags validation | django|django-templates|django-settings|django-apps|django-custom-tags | 0 | 40 | 1 | 72,937,484 | 72,937,484 | 2 | true | 2022-07-11T07:39:46.383Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django custom tags validation<p>I'm getting this error -> Invalid filter: 'cutter'
while this is my custom tags.py:</p>
<pre><code>from django import temp... |
72,881,664 | How to declare type in typescript properly<p>I am getting below the error in my code.</p>
<pre><code>let getVal: string
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'AppComponent'.
No index signature with a parameter of type 'string' was found on type 'AppCompon... | <p>You could try to use <code>(this as any)[getVal] = ...</code>.</p>
<p>However, I would recommend doing something like this:</p>
<p><strong>app.component.ts</strong></p>
<pre><code>export class AppComponent {
readonly groups: { [key: string]: boolean } = {};
seasons = ['Group 1', 'Group 2', 'Group 3'];
... | How to declare type in typescript properly | typescript|angular13 | 2 | 40 | 1 | 72,882,118 | 72,882,118 | 2 | true | 2022-07-06T10:11:35.327Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to declare type in typescript properly<p>I am getting below the error in my code.</p>
<pre><code>let getVal: string
Element implicitly has an 'any' type ... |
72,928,625 | Why do sed a and sed s commands behave differently with respect to escape characters under single quotes and double quotes?<p>I know there are differences between single quotes and double quotes in a <code>sed</code> expression, but I didn't know there are differences between <code>sed a</code> and <code>sed s</code> e... | <p><code>sed</code> has no idea which quotes you use. The shell parses and removes the quotes. Inside single quotes, text is preserved completely verbatim; inside double quotes, the shell performs variable substitution, command substitution, and backslash processing. The rules are simple, but sometimes surprising: in b... | Why do sed a and sed s commands behave differently with respect to escape characters under single quotes and double quotes? | linux|bash|ubuntu|sed | 0 | 40 | 1 | 72,928,800 | 72,928,800 | 2 | true | 2022-07-10T12:55:52.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why do sed a and sed s commands behave differently with respect to escape characters under single quotes and double quotes?<p>I know there are differences be... |
72,993,238 | how to use and in the properties section of the html element in react?<p>I had a situation like if 1st name exists in the obj , I need to do some more styling to that div so I am thinking like using and operator in react like this , if name exists add id to the div , but it is showing error</p>
<pre><code><div {obj[... | <pre><code><div {obj["name"][0] && id="feature-border"} className="rectangle"> </div>
</code></pre>
<p>Change this line of code to,</p>
<pre><code><div id={obj["name"][0] ? "feature-border" : ""} className="rectangle"> </... | how to use and in the properties section of the html element in react? | javascript|reactjs|element | 0 | 40 | 1 | 72,993,261 | 72,993,261 | 2 | true | 2022-07-15T11:24:21.193Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to use and in the properties section of the html element in react?<p>I had a situation like if 1st name exists in the obj , I need to do some more stylin... |
72,860,361 | How to do the sum of the values in an object<p>//What I'm trying to do is count the sum of the data in this array.</p>
<pre><code>const storage = [
{ data: '1', status: '0' },
{ data: '2', status: '0' },
{ data: '3', status: '0' },
{ data: '4', status: '0' },
{ data: '5', status: '0' },
{ data: '6', status:... | <p>You can use the <code>reduce</code> here, see more info about <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce" rel="nofollow noreferrer">reduce</a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="s... | How to do the sum of the values in an object | javascript|arrays|function | 0 | 40 | 3 | 72,860,442 | 72,860,442 | 2 | true | 2022-07-04T17:41:46.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do the sum of the values in an object<p>//What I'm trying to do is count the sum of the data in this array.</p>
<pre><code>const storage = [
{ data:... |
72,964,018 | Data imputation by linear interpolation according to date in R<p>I have a large dataset of mineral nitrogen values from different plots which includes some missing data were on some dates we could not take samples. it is known that mineral N values in soil change <strong>linearly</strong> between samplings.</p>
<p>for ... | <p>Using <code>approx</code>.</p>
<pre><code>df <- transform(df, flag=ifelse(is.na(Nmin), 1, 0)) ## set flag for sake of identification
res <- by(df, df$plot, transform, Nmin=approx(date, Nmin, date)$y) |> unsplit(df$plot)
res
# plot date Nmin flag
# 1 1 2020-10-01 100 0
# 2 2 2020-10-01... | Data imputation by linear interpolation according to date in R | r|date|interpolation|imputation | 2 | 40 | 1 | 72,964,146 | 72,964,146 | 2 | true | 2022-07-13T09:35:27.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Data imputation by linear interpolation according to date in R<p>I have a large dataset of mineral nitrogen values from different plots which includes some m... |
72,968,524 | Must delete massive inadvertent checkin from remote git repo<p>My situation is that a massive, 2GB file has been inadvertently pushed to our remote git repo on Azure DevOps. I noticed this when reviewing the pull request.</p>
<p>I cannot have a file that big in my repo and need to delete it. From the history as well.... | <blockquote>
<p>I'm told that a git revert will not delete the file from the history and that I need a git reset. Is this my path to a fix?</p>
</blockquote>
<p>Mostly, yes. The user should rewrite their branch such that the large file no longer exists in any commit on that branch. There are a few different ways to do ... | Must delete massive inadvertent checkin from remote git repo | git|visual-studio|azure-devops | 1 | 40 | 1 | 72,968,985 | 72,968,985 | 2 | true | 2022-07-13T15:06:14.617Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Must delete massive inadvertent checkin from remote git repo<p>My situation is that a massive, 2GB file has been inadvertently pushed to our remote git repo ... |
72,922,794 | Generating repeating structures in graphs<p>How can I generate repeating structures like below? As can be seen, there is a 2d grid with with two diagonals (vertices <code>1,3,6,4</code> to name one) connected that is repeating.</p>
<p><a href="https://i.stack.imgur.com/9oG0o.png" rel="nofollow noreferrer"><img src="htt... | <p>This is a possible solution. You just need to set the <code>N</code> parameter to whatever you want. In your first example you need <code>N = 2</code>, in the second example you need <code>N = 3</code>.</p>
<pre><code>import networkx as nx
N = 3
G = nx.Graph()
for u in range(2 * N * (N + 1)):
if u % (2 * N + 1... | Generating repeating structures in graphs | python|networkx | 0 | 40 | 1 | 72,923,166 | 72,923,166 | 2 | true | 2022-07-09T15:52:34.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Generating repeating structures in graphs<p>How can I generate repeating structures like below? As can be seen, there is a 2d grid with with two diagonals (v... |
72,861,659 | Server doesn't accept double quotes in the query<p>I'm trying to make the same request as <a href="https://v4.subgraph.polygon.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql?query=%7B%0ApoolSnapshots(where%3A%7Bpool%3A%220x800d0c1e4fb219a2d9bd2f292aa91abdcd862915%22%7D)%7B%0A%20%0A%20%20%20%20id%... | <p>The API expects a stringified JSON that you wrapped into the triple quotes. The right way is to use <a href="https://docs.python.org/3/library/json.html#json.dumps" rel="nofollow noreferrer"><code>json.dumps</code></a> to stringify the query payload (<code>dict</code>). It will convert the payload data types to corr... | Server doesn't accept double quotes in the query | post|python-requests|graphql | 1 | 40 | 1 | 72,870,029 | 72,870,029 | 2 | true | 2022-07-04T20:17:00.040Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Server doesn't accept double quotes in the query<p>I'm trying to make the same request as <a href="https://v4.subgraph.polygon.oceanprotocol.com/subgraphs/na... |
72,889,711 | Save a date when a condition is met<p>I would like to know how to get the first Date when the futures_price is higher that prices_df. In this case I want 2022-05-05 because 2100 > 1082.77. Once the condition is met I don't need to save more dates, so even though 2000 is also higher than 1074.52 I don't want to get... | <p>You could do it like this:</p>
<pre><code>future_prices.loc[future_prices['High'] > prices_df].index[0]
</code></pre>
<p><strong>Result</strong></p>
<pre><code>'2022-05-05'
</code></pre>
<p>You would need to add additional error checking to handle the situation where the condition was not met.</p>
<p><strong>Hand... | Save a date when a condition is met | python|pandas|if-statement|conditional-statements | 0 | 40 | 1 | 72,890,253 | 72,890,253 | 2 | true | 2022-07-06T20:51:53.530Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Save a date when a condition is met<p>I would like to know how to get the first Date when the futures_price is higher that prices_df. In this case I want 20... |
72,791,514 | Data in the List gets modified after changing the object in another List<p>After adding the object into my list I am changing the data in the list it is getting modified I have the code like</p>
<pre><code>List<Data> oldList = // initializing the list
List<Data> newList = // initializing the list
for (Data... | <p>If you don't want the objects in the <code>newList</code> get affected while changing the object from the <code>oldList</code>, then need to create a copy of each object that should be added to the <code>newList</code>.</p>
<p>For that, you can implement a <a href="https://www.baeldung.com/java-copy-constructor" rel... | Data in the List gets modified after changing the object in another List | java|list|arraylist | 0 | 40 | 1 | 72,791,644 | 72,791,644 | 2 | true | 2022-06-28T18:29:55.913Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Data in the List gets modified after changing the object in another List<p>After adding the object into my list I am changing the data in the list it is gett... |
72,769,232 | Python exclude special characters and non-English alphabet<p>I am working on a scraping script for python.
I don't want to scrape non-English letters and special characters.</p>
<p>I am using this code to get rid of most symbols/characters/flags that I don't need:</p>
<pre><code> emoji_pattern = re.compile("["... | <p>Does it filter enough?</p>
<pre><code>import re
string = '''English text? vɒs səˈvɑːnt
\U0001F600 \U0001F64F
meɪhər ʃælæl ˈhæʃ bɑːz
מַהֵר שָׁלָל חָשׁ בַּז
Mahēr šālāl ḥāš baz'''
print(re.sub('[^\sA-Za-z0-9.!?\\-]+','', string))
</code></pre>
<p>Output:</p>
<pre><code>English text? vs svnt
mehr ll h bz
Ma... | Python exclude special characters and non-English alphabet | python|scrape | 0 | 40 | 1 | 72,769,398 | 72,769,398 | 3 | true | 2022-06-27T08:40:02.860Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python exclude special characters and non-English alphabet<p>I am working on a scraping script for python.
I don't want to scrape non-English letters and spe... |
72,791,590 | Summarize and count the number of unique values in grouped df with dplyr<p>I have this df:</p>
<pre><code>structure(list(CN = c("BR", "BR", "BR", "PL", "PL", "PL",
"BR", "BR", "BR", "BR", "PL", "PL",... | <p>We may create the 'n_squad_distinct' column grouped by 'CN" by applying <code>n_distinct</code> on the 'Squad', then add the 'Year' and 'n_squad_distinct' also as grouping variables and do the <code>summarise</code></p>
<pre><code>library(dplyr)
df %>%
group_by(CN) %>%
mutate(n_squad_distinct = n_di... | Summarize and count the number of unique values in grouped df with dplyr | r|dplyr|tidyverse|summarize | 2 | 40 | 1 | 72,791,615 | 72,791,615 | 3 | true | 2022-06-28T18:37:08.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Summarize and count the number of unique values in grouped df with dplyr<p>I have this df:</p>
<pre><code>structure(list(CN = c("BR", "BR"... |
72,799,743 | Regular expression with condition on inner expressions<p>I would like to build a regular expression for replacing a sentence with "per" when it should be (a readable version of a sentence with quantities).</p>
<p>That is:</p>
<ul>
<li>"3/unit" must match</li>
<li>"unit/3" must match</li>
<... | <p>You can use</p>
<pre class="lang-none prettyprint-override"><code>^(?![0-9]+/[0-9]+$)[^/]+/[^/]+$
</code></pre>
<p>See the <a href="https://regex101.com/r/MDaab7/1" rel="nofollow noreferrer">regex demo</a>. <em>Details</em>:</p>
<ul>
<li><code>^</code> - start of string</li>
<li><code>(?![0-9]+/[0-9]+$)</code> - a n... | Regular expression with condition on inner expressions | swift|regex | 2 | 40 | 1 | 72,799,884 | 72,799,884 | 3 | true | 2022-06-29T10:21:40.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regular expression with condition on inner expressions<p>I would like to build a regular expression for replacing a sentence with "per" when it sho... |
72,817,303 | What is the purpose of default arguments for forced keyword arguments in Python?<p>I've come across a package which consistently has functions of the form:</p>
<pre class="lang-py prettyprint-override"><code>def function(
arg1,
arg2,
*,
arg3=None,
arg4=None,
...
argN=None
)
</code></pre>
<p>I'm trying to ... | <p>It doesn't force you to provide the arguments, but it forces you to explicitly provide the keyword argument name when passing it. So <code>function(1, 2, 3)</code> won't work because you have to specify <code>arg3</code> explicitly, i.e. <code>function(1, 2, arg3=3)</code>. Apart from that, the behavior stays the sa... | What is the purpose of default arguments for forced keyword arguments in Python? | python|python-3.x | 2 | 40 | 1 | 72,817,372 | 72,817,372 | 3 | true | 2022-06-30T14:09:51.643Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the purpose of default arguments for forced keyword arguments in Python?<p>I've come across a package which consistently has functions of the form:</... |
72,828,838 | Getting values between quotes from String - Java<p>How can I get the value between quotes from below string:</p>
<p>Actually at end of each string below thing will attached with different parameter in Quotes:</p>
<pre><code>Connect to Database to get data of student severity "low" priority "minor"
... | <p>You can use regular expressions, like this:</p>
<pre class="lang-java prettyprint-override"><code>String string = "Connect to Database to get data of student severity \"low\" priority \"minor\"";
Pattern pattern = Pattern.compile("severity \"(.*)\" priority \"(.*)\&q... | Getting values between quotes from String - Java | java | -2 | 40 | 3 | 72,828,971 | 72,828,971 | 3 | true | 2022-07-01T11:49:59.023Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting values between quotes from String - Java<p>How can I get the value between quotes from below string:</p>
<p>Actually at end of each string below thi... |
72,837,698 | ggplot2, Ordering y axis descendent<p>I have a data frame called <code>tb</code> like this one</p>
<pre><code> country station taxa scientific_name var1
1 USA GA01 A a 23.42532
2 USA GA02 A b 23.10565
3 USA GA03 A c 23.88142
4 USA ... | <p>Use <code>scale_x_discrete(limits=rev) +</code></p>
<pre><code>library(tidyverse)
df %>%
group_by(country) %>%
arrange(country,taxa,scientific_name) %>%
ggplot(aes(fill = country,
x = taxa)) +
geom_point(aes(y=var1),
size = 3,
shape = 21)+
scale_x_discrete(l... | ggplot2, Ordering y axis descendent | r|ggplot2 | 0 | 40 | 3 | 72,837,785 | 72,837,785 | 3 | true | 2022-07-02T08:42:45.770Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ggplot2, Ordering y axis descendent<p>I have a data frame called <code>tb</code> like this one</p>
<pre><code> country station taxa scientific_name var... |
72,879,507 | Remove Duplicates from Datatable with LINQ without keeping a duplicated entry at all<p>I have a <code>Datatable</code> with several Columns which I want to remove all duplicates from like that</p>
<pre><code>Dt1 = Dt1 .AsEnumerable().GroupBy(r => new { filename = r.Field<string>("filename1"), filesiz... | <pre class="lang-cs prettyprint-override"><code>Dt1 = Dt1.AsEnumerable()
.GroupBy(r => new { filename = r.Field<string>("filename1"), filesize = r.Field<string>("filesizeinkb") })
.Where(g => g.Count() == 1)
.Select(g => g.First())
.CopyToData... | Remove Duplicates from Datatable with LINQ without keeping a duplicated entry at all | c#|linq|datatable | 0 | 40 | 2 | 72,879,661 | 72,879,661 | 3 | true | 2022-07-06T07:33:20.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove Duplicates from Datatable with LINQ without keeping a duplicated entry at all<p>I have a <code>Datatable</code> with several Columns which I want to r... |
72,883,028 | How can I loop through only .cpp files in the list obtained from "git status"<p>I have a tool to analyse every .cpp file. I am implementing a pre-commit hook to analyse only edited and staged .cpp files in the local git repository before committing the changes. I have a shell script that gets called from the pre-commit... | <p>Add spaces and use <code>[[</code>:</p>
<pre><code>if [[ $file == *.cpp ]]; then
</code></pre>
<p>See <a href="https://linux.die.net/man/1/bash" rel="nofollow noreferrer"><code>man bash</code></a> for the difference between <code>[</code> and <code>[[</code>.</p>
<p>Also you can use</p>
<pre><code>git ls-files -m &q... | How can I loop through only .cpp files in the list obtained from "git status" | bash|git|shell|pre-commit-hook | 1 | 40 | 1 | 72,883,202 | 72,883,202 | 3 | true | 2022-07-06T11:43:54.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I loop through only .cpp files in the list obtained from "git status"<p>I have a tool to analyse every .cpp file. I am implementing a pre-commit hook... |
72,886,690 | Dynamic cell spacing in HTML table<p>Okay so I don't even know if this is possible, but I'm trying to accomplish the following design with the use of a <code><table></code>:</p>
<p><a href="https://i.stack.imgur.com/BJnIK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BJnIK.png" alt="enter ima... | <p>You could just set a <code>display:flex</code> on <code>tr</code> and it would do the job. Like so:
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>tr {
display:flex;
}</code><... | Dynamic cell spacing in HTML table | html|css | 1 | 40 | 2 | 72,886,756 | 72,886,756 | 3 | true | 2022-07-06T16:02:40.827Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dynamic cell spacing in HTML table<p>Okay so I don't even know if this is possible, but I'm trying to accomplish the following design with the use of a <code... |
72,891,542 | How create and view different information for each registered user in Firebase?<p>Hello guys I've created an authentication page for my website using Firebase, till now everything works fine, I'm able to login, signup and logout.</p>
<p>I'm using firestore as database, my page also has the option that only registered u... | <blockquote>
<p>What I would like to know is how every registered user can add their personal information in their profile and only they should be allowed to delete or change it and other users can only see that information.</p>
</blockquote>
<p>What you need is <a href="https://firebase.google.com/docs/firestore/secur... | How create and view different information for each registered user in Firebase? | javascript|html|firebase|google-cloud-firestore|firebase-authentication | 1 | 40 | 1 | 72,891,723 | 72,891,723 | 3 | true | 2022-07-07T02:02:32.780Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How create and view different information for each registered user in Firebase?<p>Hello guys I've created an authentication page for my website using Firebas... |
72,897,331 | How to create Namespace and Set<p>I'm new to Aerospike..
How to create a New Namespace and new set..
I have gone thru some docs and videos but I didn't find any useful thing.
i have read somewhere which is 5 years old blog, i.e. thru config file only we can create namespace and set.
is that true or any other commands a... | <p>In order to create a <code>namespace</code> you'll need to modify the <code>aerospike.conf</code> file since <code>namespaces</code> cannot be created dynamically.
By default the "test" <code>namespace</code> is included in the <code>aerospike.conf</code> file (located in <code>/etc/aerospike/aerospike.con... | How to create Namespace and Set | database|aerospike|aerospike-ce|aerospike-loader | 1 | 40 | 1 | 72,927,100 | 72,927,100 | 3 | true | 2022-07-07T11:51:29.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create Namespace and Set<p>I'm new to Aerospike..
How to create a New Namespace and new set..
I have gone thru some docs and videos but I didn't find ... |
72,933,398 | Background image not loading correctly in html<p>I'm using the same code for a background image for my site and it's not supposed to have any repeats - and I added the <code>background-repeat: no-repeat;</code> line in the style section of my pages (I only have 3).</p>
<p>The code for the background image is the same f... | <p>Maybe you need to check which version of the opera browser you are using is it supported for css. Here I attach a link to find out the versions of some supported browsers : <a href="https://css-tricks.com/almanac/properties/b/background-repeat/#aa-multiple-backgrounds-support" rel="nofollow noreferrer">background-re... | Background image not loading correctly in html | html|css|browser | 1 | 40 | 1 | 72,933,433 | 72,933,433 | 3 | true | 2022-07-11T03:25:58.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Background image not loading correctly in html<p>I'm using the same code for a background image for my site and it's not supposed to have any repeats - and I... |
72,934,313 | Function not updating internal state of mt19937<p>I have a function that generates and writes random integers:</p>
<pre><code>void randint(int min, int max, int times,std::mt19937 rng){
std::uniform_int_distribution<int> dist(min, max);
for (int i=0;i<times;i++){
std::cout<<dist(rng)<... | <p>You are passing the object by value (i.e. you are copying the object when you call the function). Use a reference</p>
<pre><code>void randint(int min, int max, int times,std::mt19937& rng){
</code></pre> | Function not updating internal state of mt19937 | c++|random|mt19937 | 1 | 40 | 1 | 72,934,331 | 72,934,331 | 3 | true | 2022-07-11T06:05:24.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Function not updating internal state of mt19937<p>I have a function that generates and writes random integers:</p>
<pre><code>void randint(int min, int max, ... |
72,949,220 | Difference between window.requestAnimationframe and setInterval<p>I want to know the difference between window.requestAnimationFrame() and setInterval( , ) methods, I have used both and they work fine to me.</p> | <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame" rel="nofollow noreferrer">From MDN</a>:</p>
<blockquote>
<p>The window.requestAnimationFrame() method tells the browser that you wish to perform an animation and requests that the browser calls a specified function to update an a... | Difference between window.requestAnimationframe and setInterval | javascript | -3 | 40 | 1 | 72,949,252 | 72,949,252 | 3 | true | 2022-07-12T08:27:14.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Difference between window.requestAnimationframe and setInterval<p>I want to know the difference between window.requestAnimationFrame() and setInterval( , ) m... |
72,957,246 | Cross Class Subclass use<p>I am experimenting with python object orientated programming. Of course I learned about inheritence and so on, but this question is very specific and I couldn't find the answer anywhere yet.</p>
<p>Let's say we have a class <code>class mainClass:</code>. In this class there is a function <cod... | <p>what about passing it via the constructor of the first class?</p>
<pre><code>class custom1:
def func1(self):
#do something
class custom2:
def __init__(self, obj1):
self._obj1 = obj1
def func2(self):
self._obj1.func1()
class mainClass:
def func(self):
obj1 = custom1... | Cross Class Subclass use | python|class | 2 | 40 | 1 | 72,957,335 | 72,957,335 | 3 | true | 2022-07-12T19:07:06.723Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cross Class Subclass use<p>I am experimenting with python object orientated programming. Of course I learned about inheritence and so on, but this question i... |
72,967,605 | How can I pass RESULT from javascript to laravel function as amount?<p>I want to save this result as amount, when I do console.log(result); I see that know what number I put in input, but how to save it in Laravel function?</p>
<pre><code> function makeOffer(nftid) {
swal({
t... | <p>Axios' <code>.post()</code> method takes 2 arguments; the URL and the data you want to send to the backend, so adjust it to:</p>
<pre><code>axios.post("/myaccount/makeoffer/" + nftid, {'amount': result})
.then(response => {
window.location.reload();
});
</code></pre>
<p>Then, in your backend, you can ... | How can I pass RESULT from javascript to laravel function as amount? | javascript|php|mysql|laravel | 1 | 40 | 1 | 72,967,770 | 72,967,770 | 3 | true | 2022-07-13T14:00:14.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I pass RESULT from javascript to laravel function as amount?<p>I want to save this result as amount, when I do console.log(result); I see that know w... |
72,976,320 | index.html.haml Ruby on Rails<p>index.html.haml where line #3 raised:
undefined method `each' for nil:NilClass</p>
<pre><code>Projects #Index
**= @projects.each do |project|**
= project.name
%br
</code></pre> | <p>I think because @projects in nil try to add some data after that use that page or you can add condition like if @projects.present? than you can show</p> | index.html.haml Ruby on Rails | ruby-on-rails|ruby|z-index | 0 | 40 | 2 | 72,976,407 | 72,976,407 | 3 | true | 2022-07-14T06:49:11.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
index.html.haml Ruby on Rails<p>index.html.haml where line #3 raised:
undefined method `each' for nil:NilClass</p>
<pre><code>Projects #Index
**= @projects.... |
72,977,551 | DataFrame: Setting all the values to a particular columns as NaN<p>I have a DF like</p>
<pre><code>A B C D E F G H I
=====================================
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
</code></pre>
<p>I need to set all the values f... | <p>An easy way could be to slice and reindex:</p>
<pre><code>target = ['A', 'C']
out = df[target].reindex(df.columns, axis=1)
</code></pre>
<p>For in place modification you can take advantage of index difference:</p>
<pre><code>df[df.columns.difference(target)] = float('nan')
</code></pre>
<p>output:</p>
<pre><code> ... | DataFrame: Setting all the values to a particular columns as NaN | python|python-3.x|pandas|dataframe | 1 | 40 | 2 | 72,977,632 | 72,977,632 | 3 | true | 2022-07-14T08:32:15.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
DataFrame: Setting all the values to a particular columns as NaN<p>I have a DF like</p>
<pre><code>A B C D E F G H I
=========================... |
72,986,359 | How to make a generic numeric method in scala 3?<p>I've seen this question answered before, but for scala 2 using <code>implicit</code>. However, scala 3 lacks the <code>implicit</code> keyword, which leaves me at square one.</p>
<p>So, how would I go about making a generic method like this toy example:</p>
<p><code>de... | <p>As <a href="https://docs.scala-lang.org/scala3/new-in-scala3.html" rel="nofollow noreferrer">new in Scala 3</a> doc mentions - implicits (and their syntax) have been <a href="https://docs.scala-lang.org/scala3/reference/contextual/" rel="nofollow noreferrer">heavily revised</a> and now you can achieve this with <a h... | How to make a generic numeric method in scala 3? | scala|generics|scala-3 | 0 | 40 | 1 | 72,987,403 | 72,987,403 | 3 | true | 2022-07-14T20:33:05.527Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make a generic numeric method in scala 3?<p>I've seen this question answered before, but for scala 2 using <code>implicit</code>. However, scala 3 lac... |
73,008,820 | DriveApp makecopy returns an error I can't understand<p><a href="https://i.stack.imgur.com/egX1K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/egX1K.png" alt="driveApp error" /></a></p>
<p><a href="https://i.stack.imgur.com/F6BfS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F6... | <p>Try to change <code>easiminator[i][3]</code> with <code>DriveApp.getFolderById(easiminator[i][3])</code></p> | DriveApp makecopy returns an error I can't understand | google-apps-script | -1 | 40 | 1 | 73,010,550 | 73,010,550 | 3 | true | 2022-07-17T02:11:21.833Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
DriveApp makecopy returns an error I can't understand<p><a href="https://i.stack.imgur.com/egX1K.png" rel="nofollow noreferrer"><img src="https://i.stack.img... |
73,020,214 | Pandas get multiple first occurrences of each group<p>I want to get the multiple first occurrences of each group (ie: every time a group appears after another group), given that some groups may appear more than once in the data frame. For example:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>... | <p>You can use <a href="https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.GroupBy.first.html" rel="nofollow noreferrer"><code>GroupBy.first</code></a> on a custom group:</p>
<pre><code>df.groupby(df['col1'].ne(df['col1'].shift()).cumsum(), as_index=False).first()
</code></pre>
<p>output:</p>
<pre><code> ... | Pandas get multiple first occurrences of each group | python|pandas | 2 | 40 | 3 | 73,020,260 | 73,020,260 | 3 | true | 2022-07-18T09:40:52.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas get multiple first occurrences of each group<p>I want to get the multiple first occurrences of each group (ie: every time a group appears after anothe... |
72,805,782 | How to run nested/subquery in google sheet?<p>SQl : select id,tod,count from new_temp where (id,count) in (select id,min(count) from new_temp group by id);</p>
<p>i want to run this in google sheet. How i can run this ?</p>
<p>[<img src="https://i.stack.imgur.com/UZIHo.png" alt="DatasetResult
" />
<a href="https://i.st... | <p>try:</p>
<pre><code>=SORTN(SORT(A2:C, 1, 1, 3, 1), 9^9, 2, 1, 1)
</code></pre>
<p><a href="https://i.stack.imgur.com/WOE0r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WOE0r.png" alt="enter image description here" /></a></p>
<hr />
<pre><code>=SORTN(QUERY(A2:C7,
"select A,B,min(C)
whe... | How to run nested/subquery in google sheet? | sql|arrays|sorting|google-sheets|google-query-language | 2 | 40 | 1 | 72,806,019 | 72,806,019 | 3 | true | 2022-06-29T17:46:53.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to run nested/subquery in google sheet?<p>SQl : select id,tod,count from new_temp where (id,count) in (select id,min(count) from new_temp group by id);</... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.