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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
71,126,184 | More than one Aggregate per Event Stream in Event Sourcing<p>Assuming that one event stream is a transation boundary and aggregate is a write-model to enforce invariants, can i have two or more aggregates dedicated to one event stream? If one big aggregate is not an option by perfomance or overcomplicated design reason... | <p>In general you can't nest aggregates within other aggregates. They can refer via the root to the other aggregate. You can make all access to a given aggregate be through another aggregate.</p>
<p>For instance the product aggregate might be like:</p>
<pre><code>{
"Id": 1,
"Name": "Call-... | More than one Aggregate per Event Stream in Event Sourcing | domain-driven-design|event-sourcing|event-stream | 0 | 300 | 1 | 71,129,080 | 71,129,080 | 2 | true | 2022-02-15T12:08:16.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
More than one Aggregate per Event Stream in Event Sourcing<p>Assuming that one event stream is a transation boundary and aggregate is a write-model to enforc... |
71,131,026 | Strimzi Apache Kafka operator doesn't respect auto.create.topics.enable<p>I created a kafka cluster with strimzi operator (version 0.28.0) with the following settings:</p>
<pre><code>spec:
kafka:
config:
log.retention.hours: 5
auto.create.topics.enable: false
default.replication.factor: 3
... | <p>I did an Internet search for <code>auto.create.topics.enable</code> and the first result which explained what this configuration does is <a href="https://riferrei.com/why-the-property-auto-create-topics-enable-is-disabled-in-confluent-cloud/" rel="nofollow noreferrer">here</a>. It says:</p>
<blockquote>
<p>... there... | Strimzi Apache Kafka operator doesn't respect auto.create.topics.enable | kubernetes|apache-kafka|strimzi | 0 | 284 | 1 | 71,131,174 | 71,131,174 | 2 | true | 2022-02-15T17:43:48.023Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Strimzi Apache Kafka operator doesn't respect auto.create.topics.enable<p>I created a kafka cluster with strimzi operator (version 0.28.0) with the following... |
71,131,408 | Google sheets query on unique range<p>I have two columns Y and Z of some data:</p>
<pre><code>Y Z
G U
P U
G U
G U
G P
G P
P U
R U
R P
C P
C U
</code></pre>
<p>I have got the unique values based on both columns like below:</p>
<pre><code> =UNIQUE(Y1:Z10)
</code></pre>
<p>I got of course:</p>
<pre... | <p>You can only use column letters (e.g., <code>Z</code>) if the <code>QUERY</code> is acting directly on the actual range. Since you've introduced <code>UNIQUE</code>, you've create a virtual array instead of a direct reference; and you must reference columns of virtual arrays within <code>QUERY</code> in "Col<co... | Google sheets query on unique range | google-sheets|google-sheets-formula | 0 | 285 | 1 | 71,131,888 | 71,131,888 | 2 | true | 2022-02-15T18:13:06.687Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google sheets query on unique range<p>I have two columns Y and Z of some data:</p>
<pre><code>Y Z
G U
P U
G U
G U
G P
G P
P U
R U
R P
C ... |
71,132,212 | Setting titles in Pandas<p>I am using the pivot function from Pandas. My intention is to aggregate values by taking the sum. Below you can see data and code</p>
<pre><code>df = pd.DataFrame({"A": ["foo", "foo", "foo", "foo", "foo",
&qu... | <p>You can concatenate the index name with the column name, then join the multiindex columns together</p>
<pre><code>table.index.name = table.columns.names[-1] + '_' + table.index.name
table.columns = table.columns.map('_'.join)
</code></pre>
<p>Result:</p>
<pre><code>>>> table
D_large D_small E_large ... | Setting titles in Pandas | python|pandas | 0 | 30 | 1 | 71,132,320 | 71,132,320 | 2 | true | 2022-02-15T19:23:27.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Setting titles in Pandas<p>I am using the pivot function from Pandas. My intention is to aggregate values by taking the sum. Below you can see data and code<... |
71,132,409 | Django - Adding up values in an object's many to many field?<p>I have 2 classes</p>
<pre><code>class Service(models.Model):
service_name = models.CharField(max_length=15, blank=False)
service_time = models.IntegerField(blank=False)
class Appointment(models.Model):
name = models.CharField(max_length=15)
... | <p>You can do it as follows:</p>
<pre><code>#in class Appointment
def save(self, *args, **kwargs):
self.total_time += Service.objects.all().aggregate(total_time=Sum('service_time'))['total_time']
# You will have to run a query to get the data and aggregate according to that. You may change the query according to yo... | Django - Adding up values in an object's many to many field? | django | 0 | 25 | 1 | 71,132,527 | 71,132,527 | 2 | true | 2022-02-15T19:40:47.617Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django - Adding up values in an object's many to many field?<p>I have 2 classes</p>
<pre><code>class Service(models.Model):
service_name = models.CharFie... |
71,131,976 | Postgres full text search: Word positioning is results<p>I am trying to figure out how to create TsQuery where when I query "Executive Sales"
I get only results that have "Executive Sales" as the <strong>first and second word</strong>.
For example</p>
<ul>
<li>Executive Sales Manager</li>
<li>Execut... | <p>FTS is the wrong tool for that job.</p>
<pre><code>col1 LIKE 'Executive Sales%'
</code></pre> | Postgres full text search: Word positioning is results | postgresql|full-text-search|string-matching|tsvector | 0 | 24 | 1 | 71,133,370 | 71,133,370 | 2 | true | 2022-02-15T19:03:41.497Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Postgres full text search: Word positioning is results<p>I am trying to figure out how to create TsQuery where when I query "Executive Sales"
I get... |
71,132,811 | Break array_agg column into batches<p>I have a query like the following:</p>
<pre><code>SELECT mt.group_id, array_agg(mt.id) as my_array
FROM myTable mt
GROUP BY mt.group_id;
</code></pre>
<p>In some contexts the array contains too many elements and a max byte limit error is thrown.</p>
<p>Is there any way that I can b... | <p>You can use a window function to add a subgroup column, then group by that column in addition to the existing group_id.</p>
<p>Due to restrictions on where window functions can be used, this requires a nested select to add the subgroup at one level and group by it at a higher level.</p>
<pre><code>with mytable as (s... | Break array_agg column into batches | postgresql | 0 | 33 | 1 | 71,133,571 | 71,133,571 | 2 | true | 2022-02-15T20:15:14.440Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Break array_agg column into batches<p>I have a query like the following:</p>
<pre><code>SELECT mt.group_id, array_agg(mt.id) as my_array
FROM myTable mt
GROU... |
71,133,902 | Insert data from pandas into sql db - keys doesn't fit columns<p>I have a database with around 10 columns. Sometimes I need to insert a row which has only 3 of the required columns, the rest are not in the <code>dic</code>.</p>
<p>The data to be inserted is a dictionary named <code>row</code> :
(this insert is to avoid... | <p>Consider explicitly naming the columns to be inserted in <code>INSERT INTO</code> and <code>SELECT</code> clauses which is best practice for SQL append queries. Doing so, the dynamic query should work for all or subset of columns. Below uses F-string (available Python 3.6+) for all interpolation to larger SQL query:... | Insert data from pandas into sql db - keys doesn't fit columns | python|pandas|postgresql|sqlalchemy | 0 | 21 | 1 | 71,134,219 | 71,134,219 | 2 | true | 2022-02-15T21:58:00.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Insert data from pandas into sql db - keys doesn't fit columns<p>I have a database with around 10 columns. Sometimes I need to insert a row which has only 3 ... |
71,134,661 | how to change the data of the first observable using data from another observable including the condition in angular/rxjs<p>I ran into a problematic one, let me provide the example schematically without any business details, so I'm fetching some data (<em>e.g. cars via getCars()</em>) from an API that returns an Observ... | <pre><code>let cars$ = getCars();
let carsWithFeatures$ = cars$.pipe(
map((cars) =>
cars
.filter((car) => car.model === 'porsche')
.map((car) =>
getFeatures(car.model).pipe(map((features) => ({ ...car, features })))
)
),
mergeMap((cars$) => forkJoin(cars$))
);
</code><... | how to change the data of the first observable using data from another observable including the condition in angular/rxjs | angular|typescript|rxjs | 0 | 44 | 1 | 71,135,775 | 71,135,775 | 2 | true | 2022-02-15T23:27:00.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to change the data of the first observable using data from another observable including the condition in angular/rxjs<p>I ran into a problematic one, let... |
71,135,763 | Removing rows from data frame containing strictly uppercase letters (in a specified column) using R?<p>I have a very large and messy dataset containing both country names and regions in a column named 'country.' I need to eliminate the regions, but leave the countries. Fortunately, the regions are written in all upperc... | <p>Use <code>grepl</code> and take a subset:</p>
<pre class="lang-r prettyprint-override"><code>data <- data[!grepl("^[A-Z]+(?:[ -][A-Z]+)*$", data$country), ]
</code></pre> | Removing rows from data frame containing strictly uppercase letters (in a specified column) using R? | r | 0 | 24 | 1 | 71,135,787 | 71,135,787 | 2 | true | 2022-02-16T02:40:49.177Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Removing rows from data frame containing strictly uppercase letters (in a specified column) using R?<p>I have a very large and messy dataset containing both ... |
71,136,295 | Vue.js: Conditional Rendering Array Using Computed Property<p>I'm new to Vue and have spent the past several hours looking into how to use conditional logic within methods and computed properties for a practice project creating a birthday component. I've seen others use if/else statements in their computed property, bu... | <p>The issue is with the computed property part.</p>
<p>You should not simply assign <code>this.days</code> with the required array inside the <code>displayDays</code> computed method. Instead you have to return the required array from the computed property.</p>
<p>Also, computer properties will be re evaluated when an... | Vue.js: Conditional Rendering Array Using Computed Property | javascript|vue.js|vuejs2|conditional-statements|computed-properties | 0 | 531 | 1 | 71,136,386 | 71,136,386 | 2 | true | 2022-02-16T04:10:46.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vue.js: Conditional Rendering Array Using Computed Property<p>I'm new to Vue and have spent the past several hours looking into how to use conditional logic ... |
71,138,291 | `std::cout << FooStuff::Foo();` chooses completely unrelated overload instead of exactly matching one<p>I have this code:</p>
<pre class="lang-cpp prettyprint-override"><code>#include <iostream>
namespace FooStuff
{
struct Foo { };
}
decltype(std::cout)& operator << (decltype(std::cout)& left,... | <p>When you write <code>std::cout << FooStuff::Foo();</code> name lookup is done to determine the candidates for <code><<</code> to use in overload resolution.</p>
<p>For overload resolution of operators there are two parts to this lookup: unqualified name lookup of <code>operator<<</code> and argumen... | `std::cout << FooStuff::Foo();` chooses completely unrelated overload instead of exactly matching one | c++|operator-overloading | 0 | 25 | 1 | 71,138,732 | 71,138,732 | 2 | true | 2022-02-16T08:17:43.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
`std::cout << FooStuff::Foo();` chooses completely unrelated overload instead of exactly matching one<p>I have this code:</p>
<pre class="lang-cpp prettyprin... |
71,140,609 | autoincrement number function-postgres<p>i have a table like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>person</th>
</tr>
</thead>
<tbody>
<tr>
<td>20</td>
<td>adams</td>
</tr>
<tr>
<td>20</td>
<td>george</td>
</tr>
<tr>
<td>40</td>
<td>jina</td>
</tr>
<tr>
<td>46</td... | <p>use dense_rank()</p>
<pre><code>select dense_rank()over(order by id) as newid,id,persion
from table_name
</code></pre>
<p><a href="https://dbfiddle.uk/?rdbms=postgres_14&fiddle=a5eca2a3829bf1a32f31631bd403e716" rel="nofollow noreferrer">demo link</a></p> | autoincrement number function-postgres | sql|postgresql|function|auto-increment | 0 | 30 | 1 | 71,140,770 | 71,140,770 | 2 | true | 2022-02-16T11:02:46.360Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
autoincrement number function-postgres<p>i have a table like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>p... |
71,143,362 | Best practices for parametrized Coq libraries<p>I'm writing a library in Coq that depends on user-supplied type parameters. One central part is a construction along the lines of</p>
<pre><code>Require Import Ascii.
Require Import String.
Parameter UserType : Set. (* <<- placeholder for this example *)
Parameter ... | <blockquote>
<p>then I have to manually splice them in everywhere when using the library's functions from outside.</p>
</blockquote>
<p>This is typically addressed by a mix of implicit parameters and type classes.</p>
<p>Declare a class for user-provided parameters.</p>
<pre><code>Class UserParams : Type :=
{ UserTyp... | Best practices for parametrized Coq libraries | coq | 0 | 41 | 1 | 71,143,976 | 71,143,976 | 2 | true | 2022-02-16T14:06:37.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Best practices for parametrized Coq libraries<p>I'm writing a library in Coq that depends on user-supplied type parameters. One central part is a constructi... |
71,144,001 | R convert long to wide but only for select rows<p>I have two data frames similar to these:</p>
<pre><code>df<-structure(list(study_id = c(1, 2, 3, 5, 8, 10), mrn = c(123456,
654321, 121212, 212121, 232323, 323232
), gender = c(1, 0, 0, 1, 1, 0), surg_date = structure(c(17003,
17519, 17610, 16800, 18083, 18003), cl... | <p>Not sure how this output is more informative, but you can try</p>
<pre><code>library(tidyverse)
df2 %>%
group_by(mrn) %>%
mutate(n=1:n()) %>%
pivot_wider(
names_from = n,
names_glue = "{n}_{.value}",
values_from = c(Procedures, surg_date,`Patient Age`)
) %>%
mutate(mrn=... | R convert long to wide but only for select rows | r|dataframe|pivot-table|data-manipulation|data-wrangling | 0 | 39 | 2 | 71,144,170 | 71,144,170 | 2 | true | 2022-02-16T14:48:00.097Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R convert long to wide but only for select rows<p>I have two data frames similar to these:</p>
<pre><code>df<-structure(list(study_id = c(1, 2, 3, 5, 8, 1... |
71,146,313 | Compute stats from a dictionary and populate a new column in a DataFrame<p>Below is a data frame that contains some summary information related to a few records along with a that dictionary contains more detailed information for a subset of those records. In reality the DataFrame and the dictionary contain thousands o... | <p>You could use a dict comprehension as well. Traverse <code>dct</code> and compare values, wrap it in a Series and <code>assign</code> it to <code>df</code>:</p>
<pre><code>df = df.assign(ratio=pd.Series({k: v['count'].gt(df.loc[k, 'count']).sum() / v['count'].ge(df.loc[k, 'count']).sum()
... | Compute stats from a dictionary and populate a new column in a DataFrame | python|python-3.x|pandas|dataframe|dictionary | 0 | 42 | 1 | 71,147,659 | 71,147,659 | 2 | true | 2022-02-16T17:11:27.003Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Compute stats from a dictionary and populate a new column in a DataFrame<p>Below is a data frame that contains some summary information related to a few reco... |
71,148,330 | Change the object preview into one of its own attributes<p>How to change object printing preview into desirable name ?</p>
<pre><code>class Person:
def __init___(self):
self.name = name
self.age = age
man1 = Person("Jhon",32)
print(man1)
>>> <__main__.Person object at 0x7f97805... | <p>Override the <code>__repr__</code> method of your class:</p>
<pre><code># PEP8: Class names should normally use the CapWords convention.
class Pokemon():
def __init__(self, name):
self.name = name
def __repr__(self):
return f"Pokemon(name='{self.name}')"
</code></pre>
<p>Usage... | Change the object preview into one of its own attributes | python | 0 | 19 | 1 | 71,148,373 | 71,148,373 | 2 | true | 2022-02-16T19:43:48.617Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change the object preview into one of its own attributes<p>How to change object printing preview into desirable name ?</p>
<pre><code>class Person:
def _... |
71,149,093 | Need help to convert Associative Array to key=>value pair<h4>My Code:</h4>
<pre><code>
global $wpdb;
$row = $wpdb->get_results( "SELECT * FROM `wp_employee`", ARRAY_A );
print_r ($row);
</code></pre>
<h4>Output:</h4>
<pre>
Array(
[0] => Array(
[job_id] => 1
[job_positi... | <pre><code>$array = [
[ 'job_id' => 1, 'job_position' => 'Architect' ],
[ 'job_id' => 2, 'job_position' => 'Civil Engineer' ],
[ 'job_id' => 3, 'job_position' => 'Electrical Engineer' ],
[ 'job_id' => 4, 'job_position' => 'Plumbing Engineer' ],
[ 'job_id' => 5, 'job_positi... | Need help to convert Associative Array to key=>value pair | php|arrays|object|associative-array|key-value | 0 | 38 | 1 | 71,149,132 | 71,149,132 | 2 | true | 2022-02-16T20:49:17.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need help to convert Associative Array to key=>value pair<h4>My Code:</h4>
<pre><code>
global $wpdb;
$row = $wpdb->get_results( "SELECT * FRO... |
71,150,637 | Pandas elapsed time between 2 date order by user<p>I have a fake bank dataset who look like this :</p>
<pre><code>Card Number Date Amount
536518******2108 2015-05-01 00:01:54 55.0
536518******2191 2015-05-01 00:01:14 37.5
536518******2108 2015-05-0... | <p>You can convert "Date" to pandas datetime object; then <code>groupby</code> "Card Number" and find <code>diff</code>; use the <code>.dt</code> accessor to get elapsed time in the seconds:</p>
<pre><code>df['Date'] = pd.to_datetime(df['Date'])
df['elapsed'] = df.groupby('Card Number')['Date'].diff... | Pandas elapsed time between 2 date order by user | python|pandas|dataframe|datetime | 0 | 44 | 1 | 71,150,779 | 71,150,779 | 2 | true | 2022-02-16T23:35:37.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas elapsed time between 2 date order by user<p>I have a fake bank dataset who look like this :</p>
<pre><code>Card Number Date ... |
71,150,580 | Custom Floating Action Button with TextView on top of Image<p>I'm trying to create something similar to the picture. I am using <code>CoordinatorLayout</code>, <code>BottomAppBar</code> and <code>BottomNavigation</code>, but the bottom app bar needs a floating action button to create the cradle around the button.
I nee... | <p>You can have a transparent FAB, and draw on top of it a layout with your custom Image & <code>TextView</code>;</p>
<p>Similar to FAB, <code>app:layout_anchor</code> & <code>app:layout_anchorGravity</code> can be used on the layout to lay it on top of the FAB.</p>
<p>Here is an implementation:</p>
<pre><code>... | Custom Floating Action Button with TextView on top of Image | android|kotlin|android-layout|user-interface|floating-action-button | 0 | 280 | 1 | 71,150,944 | 71,150,944 | 2 | true | 2022-02-16T23:27:51.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Custom Floating Action Button with TextView on top of Image<p>I'm trying to create something similar to the picture. I am using <code>CoordinatorLayout</code... |
71,153,617 | How to specify using generics/type hints one specific subtype of a type union?<p>How can I create a function type <code>Creator<X></code> that will only allow creating A or Bs while keeping the quality that you know which type you get?</p>
<p>This is not what I want:</p>
<pre><code>type C = A|B
type Creator = () ... | <p>You just need a type constraint on <code>X</code>:</p>
<pre><code>type Creator<X extends C> = () => X;
</code></pre>
<p><a href="https://www.typescriptlang.org/play?#code/C4TwDgpgBA8mwEsD2A7AzlAvFArig1ikgO4oBQokUAgllAN5lTNQBmSSAXFCjgLYAjCACcA3ExYCAhsID83NMGEIUAc3EsoYYUgDGENGm4AKJPCOx4ydAEosAPh78hwsgF8yFcNAB... | How to specify using generics/type hints one specific subtype of a type union? | typescript|typescript-generics | 0 | 17 | 1 | 71,153,723 | 71,153,723 | 2 | true | 2022-02-17T06:49:54.877Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to specify using generics/type hints one specific subtype of a type union?<p>How can I create a function type <code>Creator<X></code> that will onl... |
71,154,886 | Set an Pseude/autogenerated :key for v-for element vue.js<p>i need to set a pseude/autogenerated :key for v-for elements because the ids of the items could be duplicate.</p>
<p>i tried this:</p>
<pre><code><my-component v-for="items in item" v-bind:key="getPseudoIds()">
...
props:{
'id' : {
... | <p>is the key relevant?
You could use the index as key</p>
<p><code><my-component v-for="(item, index) in items" :key="index"></code></p> | Set an Pseude/autogenerated :key for v-for element vue.js | vue.js | 0 | 36 | 1 | 71,154,973 | 71,154,973 | 2 | true | 2022-02-17T08:45:19.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Set an Pseude/autogenerated :key for v-for element vue.js<p>i need to set a pseude/autogenerated :key for v-for elements because the ids of the items could b... |
71,156,643 | Define a method in one line accesing parent class in Python<p>Could I call <code>Spyder.paws</code> or <code>Fish.fins</code> just this way? I've seen <a href="https://stackoverflow.com/a/805081/13151511">this</a> post in which they do it by just <strong>defining a function</strong>, but I wonder if it could just be do... | <p>You can use the parent class explicitly instead of calling <code>super</code>. <code>paws</code> will be just an alias to <code>extremities</code> in this case:</p>
<pre><code>class Spyder(LivinBeing):
def __init__(self):
super().__init__()
self._extremities = 8
paws = LivinBeing.ext... | Define a method in one line accesing parent class in Python | python|oop|super | 0 | 26 | 1 | 71,156,981 | 71,156,981 | 2 | true | 2022-02-17T10:45:55.257Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Define a method in one line accesing parent class in Python<p>Could I call <code>Spyder.paws</code> or <code>Fish.fins</code> just this way? I've seen <a hre... |
71,157,137 | Modifying deeply nested object inside of a BehaviorSubject array<p>I am building an app in angular. My service <code>DocumentService</code> contains a <code>BehaviorSubject</code> of an array of Documents.</p>
<pre><code>documents: BehaviorSubject<Document[]>
</code></pre>
<p>Here are the defintions of the classe... | <p>If you wish to keep your current deep structure, you'd need to drill down:</p>
<pre class="lang-js prettyprint-override"><code>const newDocs = oldDocs.map(doc => {
if (doc !== docToChange) {
return doc;
} else {
return {
...doc,
files: doc.files.map(file => ({
...file,
p... | Modifying deeply nested object inside of a BehaviorSubject array | javascript|angular|typescript|rxjs | 0 | 33 | 1 | 71,157,356 | 71,157,356 | 2 | true | 2022-02-17T11:17:27.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Modifying deeply nested object inside of a BehaviorSubject array<p>I am building an app in angular. My service <code>DocumentService</code> contains a <code>... |
71,155,530 | How can i retrieve query params from get request<p>I'm kind of new to <code>Ruby</code> and I stuck with a fairly simple task.
I would like to pass GET parameters to Faraday's request.
Here is my request function</p>
<pre><code>def request
@request ||= Faraday.new do |conn|
conn.url_prefix = BASE_URL
conn.headers... | <p>When you want to use <code>params</code> in the <code>request</code> method then you have to apss it to the method like this:</p>
<pre><code>def request(params)
@request ||= Faraday.new do |conn|
conn.url_prefix = BASE_URL
conn.headers = @@headers
conn.params = params
conn.request :json
conn.re... | How can i retrieve query params from get request | ruby|faraday | 0 | 44 | 1 | 71,157,662 | 71,157,662 | 2 | true | 2022-02-17T09:33:02.500Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can i retrieve query params from get request<p>I'm kind of new to <code>Ruby</code> and I stuck with a fairly simple task.
I would like to pass GET param... |
71,160,018 | How to Filter SQL data in Python Program?<p>I have this code, which takes data from MSSQL database and shows it in a table in my program.
My question is: How could I make a filter button so I could only show items containing "this persons name" or "this date" or "this order nr" etc if I wi... | <p>I would suggest to define a potential SQL query as an f string:</p>
<pre><code>sql_query = f"SELECT {criterion1} FROM PROD_MachiningEvents WHERE {criterion2};"
</code></pre>
<p>You can then design buttons that will, when clicked, assign values to the variables <code>criterion1</code> and <code>criterion2</... | How to Filter SQL data in Python Program? | python|sql-server|tkinter | 0 | 294 | 1 | 71,160,172 | 71,160,172 | 2 | true | 2022-02-17T14:29:30.023Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to Filter SQL data in Python Program?<p>I have this code, which takes data from MSSQL database and shows it in a table in my program.
My question is: How... |
71,160,894 | Date based IF formula<p>I have a sheet with dates in column A and a formula in B that populates a date on the 15th of the following month as follows A1 = 01/01/2022 , B2 = 15/02/2022</p>
<p>=DATE(YEAR(A1),MONTH(A1)+1,15)</p>
<p>what I am struggling with is the IF formula I need so that if the date in A1 is between the... | <p>Use:</p>
<pre><code>=DATE(YEAR(A1),MONTH(A1)+(DAY(A1)>=15),15)
</code></pre>
<p>The <code>(DAY(A1)>=15)</code> when true will add <code>1</code> if not it will add <code>0</code></p>
<p><a href="https://i.stack.imgur.com/Mittw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mittw.png" alt="e... | Date based IF formula | excel|excel-formula|formula | 0 | 42 | 1 | 71,160,931 | 71,160,931 | 2 | true | 2022-02-17T15:27:16.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Date based IF formula<p>I have a sheet with dates in column A and a formula in B that populates a date on the 15th of the following month as follows A1 = 01/... |
71,162,150 | Ruby Rails Screen Scrape different results in Rails Console<p>I'm confused about a difference I'm seeing in Nokogiri commands run from Rails Console and what I get from the same commands run in a Rails Helper.</p>
<p>In Rails Console, I am able to capture the data I want with these commands:</p>
<pre><code>endpoint = &... | <p>Your first thought of comparing the Gem versions is a great idea, but I am noticing a difference between the two code solutions:</p>
<p><strong>In the Rails Console</strong></p>
<p>the code parses the HTML with URI.open: <code>Nokogiri::HTML.parse(URI.open("some html"))</code></p>
<p><strong>In the Scraper... | Ruby Rails Screen Scrape different results in Rails Console | ruby-on-rails|ruby|nokogiri | 0 | 34 | 1 | 71,163,258 | 71,163,258 | 2 | true | 2022-02-17T16:44:10.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ruby Rails Screen Scrape different results in Rails Console<p>I'm confused about a difference I'm seeing in Nokogiri commands run from Rails Console and what... |
71,164,223 | how to remove values from a column based on the specific name within the group?<p>I would like to remove values (<11) in column y based on group name "genetic" within column B.</p>
<p>For example below:</p>
<pre><code>dfa
ID B Y
1 genetic 10
2 life 20
3 life 10
4... | <p>You can use <code>dplyr::filter()</code> for this:</p>
<pre><code>dfa %>%
dplyr::filter(!(Y < 11 & B == 'genetic'))
</code></pre> | how to remove values from a column based on the specific name within the group? | r | 0 | 18 | 1 | 71,164,363 | 71,164,363 | 2 | true | 2022-02-17T19:21:47.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to remove values from a column based on the specific name within the group?<p>I would like to remove values (<11) in column y based on group name &qu... |
71,165,032 | Replacing only certain values of a column based on condition of another column<p>I have df below as:</p>
<pre><code>name flag
company night night
company day day
dark night night
night day both night
night day both night
</code></pre>
<p>How can I change the flag column to ... | <p>You can use <code>str.contains</code> to create a boolean Series and use it as a condition in <code>np.where</code> to assign values to "flag" column:</p>
<pre><code>import numpy as np
df['flag'] = np.where(df['name'].str.contains('both'), 'both', df['flag'])
</code></pre>
<p>Another option is to <code>loc... | Replacing only certain values of a column based on condition of another column | python|python-3.x|pandas|dataframe | 0 | 28 | 2 | 71,165,073 | 71,165,073 | 2 | true | 2022-02-17T20:34:43.730Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replacing only certain values of a column based on condition of another column<p>I have df below as:</p>
<pre><code>name flag
company night ... |
71,164,580 | Cleanest way to put a border on one side of SVG polygon?<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><svg fill="blue" viewBox="0 0 100 100" preserveAspectRatio="none">... | <p>Use an appropriate stroke-dasharray</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-html lang-html prettyprint-override"><code><svg width="600px" height="600px" fill="blue" viewBox="0 0 101 100" preserveAspect... | Cleanest way to put a border on one side of SVG polygon? | svg|polygon | 0 | 40 | 2 | 71,165,399 | 71,165,399 | 2 | true | 2022-02-17T19:53:25.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cleanest way to put a border on one side of SVG polygon?<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div... |
71,165,987 | keep checkbox disabled and unchecked if any other two checkboxes are checked<p>I am trying to keep <code>#b0</code> disabled and unchecked if <code>#b1</code> and/or <code>#b2</code> is/are checked. The snippet below re-enables <code>#b0</code> if uncheck <code>#b1</code> or <code>#b2</code></p>
<pre><code>let boxes = ... | <p>You can enable the checkbox in an <code>else</code> block, like this:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>let used_for_contact = $('#b1, #b2');
used_for_contact.... | keep checkbox disabled and unchecked if any other two checkboxes are checked | html|jquery | 0 | 38 | 1 | 71,166,085 | 71,166,085 | 2 | true | 2022-02-17T22:08:09.733Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
keep checkbox disabled and unchecked if any other two checkboxes are checked<p>I am trying to keep <code>#b0</code> disabled and unchecked if <code>#b1</code... |
71,164,966 | NetSuite Saved Search: REGEXP_SUBSTR Pattern troubles<p>I am trying to break down a string that looks like this:</p>
<pre><code>|5~13~3.750~159.75~66.563~P20~~~~Bundle A~~|
</code></pre>
<p>Here is a second example for reference:</p>
<pre><code>|106~10~0~120~1060.000~~~~~~~|
</code></pre>
<p>Here is a third example of ... | <pre><code>TRIM(REGEXP_SUBSTR({custbody_msm_cut_list}, '^\|(([^~]*)~){1}',1,1,'i',2))
</code></pre>
<p><em>From the start of the string, match the pipe character <code>|</code>, then match anything except a tilde <code>~</code>, then match the tilde. Repeat N times <code>{1}</code>. Return the last of these repeats.<... | NetSuite Saved Search: REGEXP_SUBSTR Pattern troubles | mysql|sql|netsuite|suitescript|saved-searches | 0 | 291 | 1 | 71,166,359 | 71,166,359 | 2 | true | 2022-02-17T20:28:57.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NetSuite Saved Search: REGEXP_SUBSTR Pattern troubles<p>I am trying to break down a string that looks like this:</p>
<pre><code>|5~13~3.750~159.75~66.563~P20... |
71,167,593 | How to stop modal from scrolling up when closing it?<p>I'm trying to make a modal using pure CSS and HTML. So far I have this</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>... | <p>Instead of <code>href = "#"</code> use <code>href = "#!"</code>. Your example is below:</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>[id^=modal] {
... | How to stop modal from scrolling up when closing it? | javascript|html|css | 0 | 45 | 1 | 71,167,612 | 71,167,612 | 2 | true | 2022-02-18T02:03:34.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to stop modal from scrolling up when closing it?<p>I'm trying to make a modal using pure CSS and HTML. So far I have this</p>
<p><div class="snippet" dat... |
71,141,292 | cordova gradle build SUCCESSFUL turns into FAILED<p>cordova gradle build SUCCESSFUL and then turns into FAILED. Maybe something is wrong with the versions? It seems to download a lower gradle version in the middle... why?</p>
<p>Starting with versions: Gradle 7.3.3, Cordova 10.0.0, Java/JDK 17.0.2 - Here is the transcr... | <p>After struggling for hours to find the correct versions, it appears that the following combination seems to build successfully:</p>
<p>cordova 10.0.0<br />
jdk 11.0.13<br />
Gradle 7.1.1<br />
Android Gradle Plugin 4.2.2</p>
<p>There were <strong>many other problems</strong>, overcome with the help of other discussi... | cordova gradle build SUCCESSFUL turns into FAILED | java|android-studio|cordova|gradle | 0 | 798 | 2 | 71,169,343 | 71,169,343 | 2 | true | 2022-02-16T11:47:18.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cordova gradle build SUCCESSFUL turns into FAILED<p>cordova gradle build SUCCESSFUL and then turns into FAILED. Maybe something is wrong with the versions? I... |
71,168,303 | Wpf Grid with 2 Rows width sizing<p>I am trying to work on this WPF design and not having any luck</p>
<p>This is the xaml</p>
<pre><code><UserControl x:Class="namespace.myuserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas... | <p>The <code>button</code> is not visible because you set <code>row</code> height to 50 but also <code>button</code> height to 100. I would set <code>row</code> height to <code>Auto</code> in this case.</p>
<p>White space on the right side in the second column is due to you've set main <code>grid</code> <code>Horizonta... | Wpf Grid with 2 Rows width sizing | wpf|user-interface | 0 | 33 | 1 | 71,169,566 | 71,169,566 | 2 | true | 2022-02-18T04:13:47.427Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wpf Grid with 2 Rows width sizing<p>I am trying to work on this WPF design and not having any luck</p>
<p>This is the xaml</p>
<pre><code><UserControl x:C... |
71,170,515 | Create running count or cumsum of rows between values<p>Seems simple but I can't make it work -</p>
<p>I have:</p>
<pre><code>dtIhave = data.table(col1 = c(1,0,0,0,0,0,1,0,0,0,0,0,0,1))
</code></pre>
<p>I want:</p>
<pre><code>dtIwant = data.table(col1 = c(1,0,0,0,0,0,1,0,0,0,0,0,0,1),
col2 = c(1,2,... | <p>You can do it one step without grouping the data:</p>
<pre><code>library(data.table)
dtIhave[, col2 := with(rle(cumsum(col1)), sequence(lengths))]
</code></pre>
<p>or</p>
<pre><code>dtIhave[, col2 := sequence(diff(which(c(col1, 1) == 1)))]
</code></pre>
<p>Which gives:</p>
<pre><code> col1 col2
1: 1 1
2:... | Create running count or cumsum of rows between values | r | 0 | 33 | 3 | 71,171,107 | 71,171,107 | 2 | true | 2022-02-18T08:36:06.113Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create running count or cumsum of rows between values<p>Seems simple but I can't make it work -</p>
<p>I have:</p>
<pre><code>dtIhave = data.table(col1 = c(1... |
71,172,119 | Show Linear Fits for all colors individually in Plotly<p>I'm asking the exact reverse of <a href="https://stackoverflow.com/questions/58545285/how-to-have-just-one-trendline-for-multiple-colors-in-plotly-express-scatter">this question</a>. I want to display the trendline for each color individually instead of an overal... | <p>It's a simple case of making <strong>MONTH</strong> column a string so that a trace is created for each month.</p>
<pre><code>fig = px.scatter(
df.assign(MONTH=df["MONTH"].astype(str)),
x='YEAR',
y='SD',
color='MONTH',
trendline_scope='trace', # same as default
trendline='ols',
)
fi... | Show Linear Fits for all colors individually in Plotly | python|plotly | 0 | 35 | 1 | 71,173,055 | 71,173,055 | 2 | true | 2022-02-18T10:43:03.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Show Linear Fits for all colors individually in Plotly<p>I'm asking the exact reverse of <a href="https://stackoverflow.com/questions/58545285/how-to-have-ju... |
71,173,654 | quiz.map is not iterable - React<p>Im making a self-project - a quiz app.</p>
<p>It gets random strings from an api which generates a random object of 5 questions, including correct answers and wrong answers and the like .</p>
<pre><code>function App() {
const [quiz, setQuiz] = React.useState({});
const [resetGame,... | <p><code>.map()</code> is for arrays. But <code>quiz</code> is not an array, it's an empty object:</p>
<pre><code>const [quiz, setQuiz] = React.useState({});
</code></pre>
<p>You may <em>later</em> set it to an array after fetching data. But its initial state is an object. If you instead want that state to be an arr... | quiz.map is not iterable - React | reactjs | 0 | 25 | 2 | 71,173,688 | 71,173,688 | 2 | true | 2022-02-18T12:40:55.357Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
quiz.map is not iterable - React<p>Im making a self-project - a quiz app.</p>
<p>It gets random strings from an api which generates a random object of 5 ques... |
71,173,396 | A function to automate the classification of value ranges<p>How could I classify this data according to <a href="https://i.stack.imgur.com/sNkkb.png" rel="nofollow noreferrer">these criteria</a>?</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th></th>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbo... | <p>The criteria can be simplified:</p>
<pre><code>if 42 <= Af < 55:
Class 3
else if 21 <= Af < 68:
Class 2
else:
Class 1
</code></pre>
<p>This can be expressed in a formula, formatted to match the layout of the pseudocode:</p>
<pre><code>=IF(AND(42 <= @A:A, @A:A < 55),
"Class 3&qu... | A function to automate the classification of value ranges | excel|excel-formula | 0 | 29 | 1 | 71,173,695 | 71,173,695 | 2 | true | 2022-02-18T12:20:11.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
A function to automate the classification of value ranges<p>How could I classify this data according to <a href="https://i.stack.imgur.com/sNkkb.png" rel="no... |
71,173,720 | Using for loop to get sum of digits<p>How can you write the output as of a sum formula as 1+2+3=6 as opposed to just getting the sum i.e 6. I have using the sum(str(num)) to get sum_of_digits.But the output is just 6 not 1+2+3=6</p> | <p>You need to do two things with the inputs - represent them with a <code>+</code> sign in between and also compute the <code>sum</code> -</p>
<pre><code>def mysum(*args):
return f'{"+".join(str(_) for _ in args)} = {sum(args)}'
mysum(1, 2, 3)
# '1+2+3 = 6'
</code></pre> | Using for loop to get sum of digits | python-3.x | 0 | 29 | 1 | 71,173,795 | 71,173,795 | 2 | true | 2022-02-18T12:45:15.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using for loop to get sum of digits<p>How can you write the output as of a sum formula as 1+2+3=6 as opposed to just getting the sum i.e 6. I have using the ... |
71,174,992 | Need help using pandas to covert a url into a dataframe for college basketball data<p>I am trying to get barttorvik.com data into a dataframe. I can scrape with the following code, but I get an error when trying to export the dataframe into excel.</p>
<p>I am assuming the error has to do with the header row on the sit... | <p>See <a href="https://pandas.pydata.org/docs/reference/api/pandas.read_html.html" rel="nofollow noreferrer">https://pandas.pydata.org/docs/reference/api/pandas.read_html.html</a>. It returns a list of Dataframes.</p>
<pre><code>df[0].to_excel('./outputdestination', index=False)
</code></pre> | Need help using pandas to covert a url into a dataframe for college basketball data | python|pandas | 0 | 35 | 1 | 71,175,127 | 71,175,127 | 2 | true | 2022-02-18T14:20:02.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need help using pandas to covert a url into a dataframe for college basketball data<p>I am trying to get barttorvik.com data into a dataframe. I can scrape ... |
71,174,037 | sympy preorder_traversal: i want to choice ...tGreaterThan element<p>2way?</p>
<p>① i want to choice ...tGreaterThan element ----> n > 6.1875</p>
<p>②I can convert it to a string and use a regular expression.</p>
<p>preorder_traversal < Walking the Tree
<a href="https://docs.sympy.org/latest/tutorial/manipulat... | <p>I'm not really sure what you are asking for but if you declare <code>n</code> to be real (and therefore <em>finite</em>) then this will simplify automatically:</p>
<pre><code>In [5]: n = symbols('n', real=True)
In [6]: f=(99/16 < n) & (n < oo)
In [7]: f
Out[7]: n > 6.1875
</code></pre> | sympy preorder_traversal: i want to choice ...tGreaterThan element | sympy | 0 | 23 | 1 | 71,176,230 | 71,176,230 | 2 | true | 2022-02-18T13:11:11.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
sympy preorder_traversal: i want to choice ...tGreaterThan element<p>2way?</p>
<p>① i want to choice ...tGreaterThan element ----> n > 6.1875</p>
<p>②I... |
71,180,520 | Compare percentage variations between variables<p>I have accounting DataFrame and want to check some facts but the main problem is that they are not "playing" on the same league.</p>
<p>The DF is something like this:</p>
<pre><code> A B C D E
x 1 1.5 1.1 0.8 1
y 100 ... | <p>You can convert "A" to a numpy column vector and use broadcasting:</p>
<pre><code>df = (df / df["A"].to_numpy()[:, None] - 1) * 100
</code></pre>
<p>Output:</p>
<pre><code> A B C D E
x 0.0 50.0 10.0 -20.0 0.0
y 0.0 20.0 -10.0 15.0 2.0
z 0.0 10.0 80.0 -10.0 0.0
</cod... | Compare percentage variations between variables | python|pandas|dataframe|matplotlib | 0 | 24 | 1 | 71,180,637 | 71,180,637 | 2 | true | 2022-02-18T22:22:08.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Compare percentage variations between variables<p>I have accounting DataFrame and want to check some facts but the main problem is that they are not "pl... |
71,185,486 | How to not repeat this same function in ReactJS<pre><code> const postDate = (fullDate) => {
return `${fullDate.split(" ").splice(1, 2).join(" ")},
${fullDate.split(" ").splice(3, 1).join(" ")}`;
};
</code></pre>
<p>I have repeated the above function on three diff... | <p>Create a new file, say, <code>postDate.js</code></p>
<pre class="lang-js prettyprint-override"><code>const postDate = (fullDate) => {
return `${fullDate.split(" ").splice(1, 2).join(" ")},
${fullDate.split(" ").splice(3, 1).join(" ")}`;
};
export default postDat... | How to not repeat this same function in ReactJS | reactjs | 0 | 25 | 1 | 71,185,525 | 71,185,525 | 2 | true | 2022-02-19T13:33:58.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to not repeat this same function in ReactJS<pre><code> const postDate = (fullDate) => {
return `${fullDate.split(" ").splice(1, 2).join... |
71,183,582 | Is there a way to automatically scale vertically azure cloud services (classic)?<p>I have services that are still using the classic Azure cloud services.
Is there a way to vertical scale the cloud services automatically?</p> | <p>It is not possible to vertically scale a Classic Cloud Service automatically.</p>
<p>This is because the instance size is defined in <code>csdef</code> file that gets included in the package file (<code>cspkg</code>). Instance count is stored in configuration file (<code>cscfg</code>) and you can achieve horizontal ... | Is there a way to automatically scale vertically azure cloud services (classic)? | azure|cloud | 0 | 35 | 1 | 71,185,683 | 71,185,683 | 2 | true | 2022-02-19T09:11:09.050Z | 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 automatically scale vertically azure cloud services (classic)?<p>I have services that are still using the classic Azure cloud services.
Is ... |
71,187,226 | Python: How to print an ndarray in scientific notation (rounded) as part of a print statement<p>I have an ndarray that I want to print in scientific notation with rounding as part of a sentence, this is what I currently have</p>
<pre><code>data_arr = np.array([12345, 12345])
print('This is the data ', *data_arr)
</code... | <p>String formating seems to be the way to go. Example:</p>
<pre><code>data_arr = np.array([12345, 12345])
print('This is the data {:.1e} {:.1e}'.format(*data_arr))
</code></pre>
<p>prints what you're looking for. To adjust the number of figures after the dot to, for example, three, just change <code>1e</code> to <code... | Python: How to print an ndarray in scientific notation (rounded) as part of a print statement | python|printing|numpy-ndarray|scientific-notation | 0 | 32 | 1 | 71,187,299 | 71,187,299 | 2 | true | 2022-02-19T17:07:50.870Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: How to print an ndarray in scientific notation (rounded) as part of a print statement<p>I have an ndarray that I want to print in scientific notation... |
71,188,788 | How to "return" two values in prolog<p>I have two functions, first one calculates how many negative elements are in list, the second one forms list with indexes of negatives elements. I need to write a function called goal_negative_positions, that will "return" two values. My version don't work, it always ret... | <p>Problem in last definition of <code>goal_negative_positions</code>. <code>count</code> argument should starts with capital letter:</p>
<pre><code>goal_negative_positions(Start, Result, Count):-
negative_count(Start, Count),
negative_positions(Start, -1, Result).
</code></pre>
<p>In prolog arguments which starts ... | How to "return" two values in prolog | prolog | 0 | 23 | 1 | 71,188,992 | 71,188,992 | 2 | true | 2022-02-19T20:09:17.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to "return" two values in prolog<p>I have two functions, first one calculates how many negative elements are in list, the second one forms list with inde... |
71,189,371 | How do I make a text clipping mask with video on non-black/white background<p>I'm looking to have text act as a clipping mask for a background video, like shown here: <a href="https://codepen.io/corvus-007/pen/vYEXLmg" rel="nofollow noreferrer">https://codepen.io/corvus-007/pen/vYEXLmg</a>, which uses the <code>mix-ble... | <p>You might use another <code>h2</code> element to put over with <code>color:#fff</code> and <code>mix-blend-mode:multiply</code>:</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">... | How do I make a text clipping mask with video on non-black/white background | css|html5-video | 0 | 286 | 1 | 71,189,999 | 71,189,999 | 2 | true | 2022-02-19T21:31:33.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I make a text clipping mask with video on non-black/white background<p>I'm looking to have text act as a clipping mask for a background video, like sh... |
71,191,508 | How can I tell if I value already exists in Firebase Firestore?<p><a href="https://i.stack.imgur.com/NzxJc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NzxJc.png" alt="Database entry" /></a></p>
<p>I would like to receive a <code>bool</code> letting me know if my document has a <code>Wasiyyah</cod... | <p>There isn't any function to check if a field exists in a document. You'll have to fetch the document and check for it's existence:</p>
<pre><code>let docRef = Firestore.firestore().collection(user!.uid).document(docID)
docRef.getDocument { (document, error) in
if let document = document, document.exists {
... | How can I tell if I value already exists in Firebase Firestore? | swift|firebase|google-cloud-firestore | 0 | 274 | 1 | 71,191,660 | 71,191,660 | 2 | true | 2022-02-20T05:04:05.607Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I tell if I value already exists in Firebase Firestore?<p><a href="https://i.stack.imgur.com/NzxJc.png" rel="nofollow noreferrer"><img src="https://i... |
71,195,084 | Adding characters to the end of a line<p>Based on the following code and description here:</p>
<p><a href="https://stackoverflow.com/questions/57042145/add-bullets-to-each-new-line-within-a-textarea">Add Bullets to Each New Line within a textarea</a></p>
<pre><code>const bullet = "\u002a";
const bulletWithSpa... | <p>I Changed your code and you can see the working example at <a href="https://nexuscode.online/editor/R0iIh4wDkO" rel="nofollow noreferrer">https://nexuscode.online/editor/R0iIh4wDkO</a></p> | Adding characters to the end of a line | javascript|html | 0 | 41 | 1 | 71,195,248 | 71,195,248 | 2 | true | 2022-02-20T13:53:32.500Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding characters to the end of a line<p>Based on the following code and description here:</p>
<p><a href="https://stackoverflow.com/questions/57042145/add-b... |
71,195,370 | When to use a Component Instance instead of a Component?<p>Is there any difference, apart from the function (that makes the component) being called again, between rendering a Component and a <em>Component Instance</em>?</p>
<p>Consider this snippet:</p>
<pre><code>// component.jsx
function Foo() { return <div/> }... | <p>First of all, what you're calling a component instance is usually called a <a href="https://reactjs.org/docs/rendering-elements.html" rel="nofollow noreferrer">React Element</a>.</p>
<p>The only downside of using Elements instead of Components is that you won't be able to update its props.</p>
<p>The performance gai... | When to use a Component Instance instead of a Component? | reactjs | 0 | 19 | 1 | 71,195,454 | 71,195,454 | 2 | true | 2022-02-20T14:24:49.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When to use a Component Instance instead of a Component?<p>Is there any difference, apart from the function (that makes the component) being called again, be... |
71,198,425 | Trouble when parsing JSON string<p>I'm dumping JSON in Django view and then parsing JSON in JS to get the data.</p>
<p>My view.py (Django)</p>
<pre><code>ibms = []
for i in range(2, 5):
ibm = Mapa(i, wsMapa)
ibms.append(ibm.__dict__)
ibms = json.dumps(ibms)
return render(request, 'mapas/index.html', {'ibms': i... | <p>You should not dump it in the view, so:</p>
<pre><code>ibms = [Mapa(i, wsMapa).__dict__ for i in range(2, 5)]
return render(request, 'mapas/index.html', {'ibms': ibms})</code></pre>
<p>and thus parse it as:</p>
<pre><code>{{ ibms|json_script:"ibms" }}
<script>
const mydata = JSON.parse(document.... | Trouble when parsing JSON string | javascript|json|django | 0 | 35 | 1 | 71,198,435 | 71,198,435 | 2 | true | 2022-02-20T20:22:52.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trouble when parsing JSON string<p>I'm dumping JSON in Django view and then parsing JSON in JS to get the data.</p>
<p>My view.py (Django)</p>
<pre><code>ibm... |
71,193,495 | Is it possible to include other Python packages when packaging a Spacy model?<p>I'm trying to package a Spacy model that contains some custom language components and factories.</p>
<p>One of the components comes from the spacy_syllables python package (it also requires pyphen).</p>
<p>Is it possible to include packaged... | <p>Provide a partial <code>meta.json</code> with the additional <code>"requirements"</code> with <code>spacy package -m meta.json</code>: <a href="https://spacy.io/api/data-formats#meta" rel="nofollow noreferrer">https://spacy.io/api/data-formats#meta</a></p> | Is it possible to include other Python packages when packaging a Spacy model? | model|package|components|spacy | 0 | 24 | 1 | 71,198,481 | 71,198,481 | 2 | true | 2022-02-20T10:29:27.773Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to include other Python packages when packaging a Spacy model?<p>I'm trying to package a Spacy model that contains some custom language compon... |
71,198,488 | can different-time-zones/wrong-date-times mess up git merges and cause old bugs to show up again? (remote & teamwork)<p>we have an app in production , which has a remote repository on Gitlab,</p>
<p>sometimes when we locally git merge , old changes overwrites new changes(without git saying anything or warn us) , and wh... | <p>No. Git commit timestamps are not used by the merge logic. Whatever is causing your issue, it's not due to the timestamps on the commits.</p> | can different-time-zones/wrong-date-times mess up git merges and cause old bugs to show up again? (remote & teamwork) | git|gitlab|git-merge | 0 | 23 | 1 | 71,198,577 | 71,198,577 | 2 | true | 2022-02-20T20:30:39.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
can different-time-zones/wrong-date-times mess up git merges and cause old bugs to show up again? (remote & teamwork)<p>we have an app in production , which ... |
71,178,158 | Azure API management redirect http requests to https<p>New to Azure API management. I have deployed an API with a custom domain. The https requests are working but how can I redirect http requests to https?</p> | <p>We can use combination of Control flow and Return response policies to achieve http to https redirection.</p>
<pre><code>
<inbound>
...
<choose>
<when condition="@(context.Request.OriginalUrl.Scheme.Equals("http"))">
<return-response>
<set-status code="302" re... | Azure API management redirect http requests to https | azure|azure-api-management | 0 | 282 | 1 | 71,200,365 | 71,200,365 | 2 | true | 2022-02-18T18:19:12.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Azure API management redirect http requests to https<p>New to Azure API management. I have deployed an API with a custom domain. The https requests are worki... |
71,204,363 | Get average per partition and keep all results<p>I have a table like this:</p>
<pre><code>company date_num profit
A EPOCH 12
B EPOCH 17
A EPOCH 7
C EPOCH 9
</code></pre>
<p>I would like to calculate average per company and keep the profit column:</p>
<pre><code>company date_num profi... | <p>Use <code>AVG</code> as an analytic function:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT company, AVG(profit) OVER (PARTITION BY company) AS avg
FROM history
WHERE date_num >= 1617235200 AND date_num <= 1619913600 AND company IN ('A', 'B');
</code></pre> | Get average per partition and keep all results | sql|postgresql | 0 | 24 | 1 | 71,204,395 | 71,204,395 | 2 | true | 2022-02-21T10:04:27.197Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get average per partition and keep all results<p>I have a table like this:</p>
<pre><code>company date_num profit
A EPOCH 12
B EPOCH 17
A ... |
71,206,595 | How to animate the appearance and disappearance of a composable function in Android?<p>I'm making a custom <code>Radio Button</code> that wraps an animation when I go from selected to deselected and/or vice versa. I am using the <code>AnimatedVisibility</code> function of jetpack compose, however I am not getting the e... | <p><code>AnimatedVisibility</code> works when <code>visible</code> is different between previous and current recompositions. In your code it's always <code>true</code>, so no animation should happen.</p>
<p>In your case <code>AnimatedContent</code> can be used. Note that using lambda parameter is critical with animatio... | How to animate the appearance and disappearance of a composable function in Android? | android|android-jetpack-compose|jetpack-compose-animation | 0 | 273 | 1 | 71,206,842 | 71,206,842 | 2 | true | 2022-02-21T12:48:05.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to animate the appearance and disappearance of a composable function in Android?<p>I'm making a custom <code>Radio Button</code> that wraps an animation ... |
71,209,344 | Different behaviour of dataframe and series when editing whole row of Pandas Dataframe by boolean indexing<p>I wanted to change the whole row of a dataframe by indexing with a boolean array. I got unexpected behaviour:</p>
<pre><code>df = pd.DataFrame([[1,1],[2,2],[3,3],[4,4]])
boolean_list = pd.DataFrame([False,True,F... | <p>When you create a DataFrame containing your boolean list (mask), that DataFrame has its own columns, e.g. <code>0</code>. When you write <code>df[boolean_list] = 5</code> where <code>boolean_list</code> is a dataframe, it applies the mask(s) in <code>boolean_list</code> column-by-column, so <code>boolean_list</code>... | Different behaviour of dataframe and series when editing whole row of Pandas Dataframe by boolean indexing | python|pandas|dataframe | 0 | 27 | 1 | 71,209,400 | 71,209,400 | 2 | true | 2022-02-21T15:56:15.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Different behaviour of dataframe and series when editing whole row of Pandas Dataframe by boolean indexing<p>I wanted to change the whole row of a dataframe ... |
71,209,280 | How to remove zig-zag pattern in marginal distribution plot of integer values in R?<p>I am including marginal distribution plots on a scatterplot of a continuous and integer variable. However, in the integer variable maringal distribution plot (y-axis) there is this zig-zag pattern that shows up because the y-values ar... | <p>From <code>?geom_density</code>:</p>
<blockquote>
<p>adjust: A multiplicate [sic] bandwidth adjustment. This makes it possible
to adjust the bandwidth while still using the a bandwidth
estimator. For example, ‘adjust = 1/2’ means use half of the
default bandwidth.</p>
</blockquote>
<p>So as a start try e.g. <code>ge... | How to remove zig-zag pattern in marginal distribution plot of integer values in R? | r|ggplot2 | 0 | 34 | 1 | 71,209,536 | 71,209,536 | 2 | true | 2022-02-21T15:52:03.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove zig-zag pattern in marginal distribution plot of integer values in R?<p>I am including marginal distribution plots on a scatterplot of a contin... |
71,199,179 | CMake project builds but shows include error in LSP<p>I'm working on a C++ project using <code>ccls</code> (the LSP language server) and <code>lsp-mode</code> in Emacs. I also have a CMake project definition for my project. My project builds correctly with <code>make</code> using the <code>Makefile</code> generated by ... | <p><code>ccls</code> tries to find <code>SomeClass.hpp</code> in the root of your project.
It should be fine when you change the first line of your <code>main.cpp</code> to this (At least for me it resolved the error):</p>
<pre><code>#include "src/SomeClass.hpp"
</code></pre> | CMake project builds but shows include error in LSP | c++|cmake|language-server-protocol | 0 | 290 | 2 | 71,209,937 | 71,209,937 | 2 | true | 2022-02-20T21:58:25.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CMake project builds but shows include error in LSP<p>I'm working on a C++ project using <code>ccls</code> (the LSP language server) and <code>lsp-mode</code... |
71,209,668 | How to compute number of friends of friends in a BigQuery table with repeated records?<p>I have a BigQuery table with the following format:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>person</th>
<th>friends.name</th>
<th>friends.year</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>M... | <p>Consider below approach</p>
<pre><code>with friends_count as (
select person, ifnull(num_friends, 0) num_friends from (
select distinct name as person
from your_table, unnest(friends)
) left join (
select person, array_length(friends) num_friends
from your_table
) using(person)
)
select person, arr... | How to compute number of friends of friends in a BigQuery table with repeated records? | sql|google-bigquery | 0 | 26 | 1 | 71,210,278 | 71,210,278 | 2 | true | 2022-02-21T16:20:45.793Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to compute number of friends of friends in a BigQuery table with repeated records?<p>I have a BigQuery table with the following format:</p>
<div class="s... |
71,212,096 | Can you create a substring from numpy function call? (i.e Extract "median" from `np.median`?)<p>This is kind of a strange question, but I have created a function that leverages <code>pivot_table</code> and some filtering and renaming to apply to a bunch of pivot/aggregation use cases I need.</p>
<p>One of the parameter... | <p>How about using <code>.__name__</code>?</p>
<pre><code>...
col1, col2 = [col for col in reshaped_df.columns if aggs[0].__name__ in col]
...
</code></pre>
<p>Because...</p>
<pre><code>>>> np.median
<function numpy.median(a, axis=None, out=None, overwrite_input=False, keepdims=False)>
>>> np... | Can you create a substring from numpy function call? (i.e Extract "median" from `np.median`?) | python|pandas|numpy | 0 | 24 | 1 | 71,212,242 | 71,212,242 | 2 | true | 2022-02-21T19:38:37.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can you create a substring from numpy function call? (i.e Extract "median" from `np.median`?)<p>This is kind of a strange question, but I have created a func... |
71,210,453 | VueJS 3, Webpack trying to read external CSSStyleSheet that it does not have access to<blockquote>
<p>DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules</p>
</blockquote>
<p><em>I know what this is and why this happens, this is not a "what is this error" question an... | <p><code>reactive</code> is doing deep reactive conversion. <code>shallowReactive</code> is not enough because it <a href="https://vuejs.org/api/reactivity-advanced.html#shallowreactive" rel="nofollow noreferrer">still does reactive conversion</a> of the top level object and it's properties.</p>
<p>What you want is <a ... | VueJS 3, Webpack trying to read external CSSStyleSheet that it does not have access to | webpack|google-maps-api-3|vuejs3 | 0 | 39 | 2 | 71,212,762 | 71,212,762 | 2 | true | 2022-02-21T17:19:17.457Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
VueJS 3, Webpack trying to read external CSSStyleSheet that it does not have access to<blockquote>
<p>DOMException: Failed to read the 'cssRules' property fr... |
71,212,708 | How to add value in one dataframe to a new column in another dataframe<p>I have two DataFrames of different sizes.</p>
<pre><code>df1 = pd.DataFrame()
df2 = pd.DataFrame()
df1["id"] = ["A", "A", "B", "B", "C", "C"]
df1["revenue"] = [1, 2, 1... | <p>You could also <code>merge</code> on "id":</p>
<pre><code>df1 = df1.merge(df2, on='id', suffixes=('','_year_1'))
</code></pre>
<p>Output:</p>
<pre><code> id revenue revenue_year_1
0 A 1 12
1 A 2 12
2 B 10 1
3 B 9 1
4 C... | How to add value in one dataframe to a new column in another dataframe | python|pandas|dataframe|numpy | 0 | 37 | 2 | 71,212,801 | 71,212,801 | 2 | true | 2022-02-21T20:35:27.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add value in one dataframe to a new column in another dataframe<p>I have two DataFrames of different sizes.</p>
<pre><code>df1 = pd.DataFrame()
df2 = ... |
71,215,438 | Extracting String from another string in shell<p>I have string this:</p>
<pre><code>release/3.0.2.344
</code></pre>
<p>And I want to extract this:</p>
<pre><code>release/3.0.2
</code></pre>
<p>pattern is like:</p>
<pre><code>release/<number>.<number>.<number>.<number>
</code></pre> | <p>Use <a href="https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html" rel="nofollow noreferrer">parameter expansion</a> in bash:</p>
<pre class="lang-sh prettyprint-override"><code>$ v="release/3.0.2.344"
$ echo "${v%.*}"
release/3.0.2
</code></pre>
<p><code>%</code> c... | Extracting String from another string in shell | bash|shell | 0 | 32 | 1 | 71,215,459 | 71,215,459 | 2 | true | 2022-02-22T03:06:10.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Extracting String from another string in shell<p>I have string this:</p>
<pre><code>release/3.0.2.344
</code></pre>
<p>And I want to extract this:</p>
<pre><... |
71,217,348 | How to search in filtered list of nested objects only<p>this seems to be a complex one - not sure if it's possible to manage without scripting + I would like to be able to boost <code>name</code> or <code>value</code> fields.</p>
<p>Let's imagine the following documents:</p>
<pre class="lang-json prettyprint-override">... | <h1>TLDR;</h1>
<p><code>Elastic</code> flatten objects. Such that</p>
<pre class="lang-json prettyprint-override"><code>{
"group" : "fans",
"user" : [
{
"first" : "John",
"last" : "Smith"
},
{
"first" : &... | How to search in filtered list of nested objects only | elasticsearch | 0 | 35 | 1 | 71,218,339 | 71,218,339 | 2 | true | 2022-02-22T07:24:26.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to search in filtered list of nested objects only<p>this seems to be a complex one - not sure if it's possible to manage without scripting + I would like... |
71,218,472 | Postgres - how to enforce NUMERIC value between 1 & 10<p>In PostgreSQL I have a column <code>city_rate</code> value <code>NUMERIC DEFAULT 1.00</code>.</p>
<p>Is there a way from postgres to enforce that value to be between two values: 1.00 & 10.00.</p>
<p>Like if user INSERT or UPDATE <code>city_rate</code> with a ... | <p>You could use a check constraint:</p>
<pre class="lang-sql prettyprint-override"><code>ALTER TABLE yourTable
ADD CONSTRAINT rate_check CHECK (city_rate >= 1.0 AND city_rate <= 10.00);
</code></pre> | Postgres - how to enforce NUMERIC value between 1 & 10 | postgresql | 0 | 33 | 1 | 71,218,531 | 71,218,531 | 2 | true | 2022-02-22T09:02:23.307Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Postgres - how to enforce NUMERIC value between 1 & 10<p>In PostgreSQL I have a column <code>city_rate</code> value <code>NUMERIC DEFAULT 1.00</code>.</p>
<p... |
71,219,942 | How to exclude certain styling in page2 in pagination<p>I have followed Jeffery Way in Laravel 8 from scratch amazing series but I'm having a trouble in pagination. In the index page we're making our latest post to have a specific styling and then first 2 posts comes after with a different styling and then rest of post... | <p>You can use <code>currentPage()</code> method on paginator and check if it's on first page. May not be fanciest way but here is an example:</p>
<pre><code><x-bloglayout>
@include('posts.__header')
@if ($posts->count())
<x-featuredCard :post="$posts[0]" />
@if ($posts->c... | How to exclude certain styling in page2 in pagination | php|arrays|laravel|pagination | 0 | 44 | 1 | 71,220,080 | 71,220,080 | 2 | true | 2022-02-22T10:51:30.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to exclude certain styling in page2 in pagination<p>I have followed Jeffery Way in Laravel 8 from scratch amazing series but I'm having a trouble in pagi... |
71,220,037 | ggplot letters in x axis replacing a continuos numerical sequence<p>I would like to replace the numbers on the X-axis with a string.</p>
<pre><code>df <- data.frame(Start = c(1, 3, 8, 10),
End = c(5, 10, 12, 15),
Height = c(10, 4, 5, 6))
p <- ggplot(df)+
geom_segment(aes(x =... | <pre><code>library(ggplot2)
df <- data.frame(Start = c(1, 3, 8, 10),
End = c(5, 10, 12, 15),
Height = c(10, 4, 5, 6))
xAxis <- unlist(strsplit(lettersString, split = "+"))
p <- ggplot(df)+
geom_segment(aes(x = Start,
xend = End,... | ggplot letters in x axis replacing a continuos numerical sequence | r|ggplot2 | 0 | 22 | 1 | 71,220,231 | 71,220,231 | 2 | true | 2022-02-22T10:57:19.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ggplot letters in x axis replacing a continuos numerical sequence<p>I would like to replace the numbers on the X-axis with a string.</p>
<pre><code>df <- ... |
71,221,101 | how can I change props of component that pass from higher component . reactjs<p>this is my upper component.</p>
<pre><code>const Add_singlepage = () => {
const [feed,setFeed] = useState(null);//getFeddd.php
const [show,setShow] = useState({sh_categorytitle:true,sh_category:false});
return (
<di... | <p>pass <code>setShow</code> too, as props, and this is what we call it <code>callback</code> works,</p>
<pre><code><CategoryTitle show={show} setShow={setShow} getFeed={feed} />
</code></pre>
<p>this is how call it in child,</p>
<pre><code>const CategoryTitle = (props) => {
const {show, setShow} = props;... | how can I change props of component that pass from higher component . reactjs | reactjs | 0 | 19 | 2 | 71,221,296 | 71,221,296 | 2 | true | 2022-02-22T12:14:43.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how can I change props of component that pass from higher component . reactjs<p>this is my upper component.</p>
<pre><code>const Add_singlepage = () => {
... |
71,221,944 | add text to end of array items depending on the item number<p>I've got a dropdown list of numbers which I intend to use to track my miles. I want to add the text 'miles' after the number but if the number is 1, I want to add 'mile'.</p>
<p>unit = miles |
arrayOfArrays = [0, 1, 2, 3, 4, 5, 6, 7, 8]</p>
<p>Here is my scr... | <p>Why don't you pass the value for unit to the function as singular and append an 's' if the value is not 1? Like this:</p>
<pre><code> if(r!=1){ option.text = r + unit +"s"; }else{ option.text = r + unit; }
</code></pre> | add text to end of array items depending on the item number | javascript | 0 | 24 | 1 | 71,222,069 | 71,222,069 | 2 | true | 2022-02-22T13:11:09.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
add text to end of array items depending on the item number<p>I've got a dropdown list of numbers which I intend to use to track my miles. I want to add the ... |
71,222,002 | SQL join showing all combinaisons<p>I want a "join" that gives me every category (cat) and every site (cat_sites) knowing if they are associated to each other or not</p>
<pre><code>CREATE TABLE cat (
cat varchar(34) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE cat_s... | <p>You would normally cross join two sets to find all possible combinations, then use a left join to find matching/missing values:</p>
<pre><code>select cat.cat, sites.site, cat_sites.*
from cat
cross join (select distinct site from cat_sites) as sites
left join cat_sites on cat.cat = cat_sites.cat and sites.site = cat... | SQL join showing all combinaisons | mysql|sql|join|outer-join | 0 | 28 | 1 | 71,222,181 | 71,222,181 | 2 | true | 2022-02-22T13:14:48.877Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL join showing all combinaisons<p>I want a "join" that gives me every category (cat) and every site (cat_sites) knowing if they are associated to... |
71,224,606 | Using DOM to manipulate css visibility<p>guys. I'm pretty new to JS and i'm stuck with a problem for quite sometime now. My code is a simple dice game. When you press a button, you call a JS function that randomize 12 dice images and display certain images and a title with the winner depending on the dice value.</p>
<p... | <p>You cant be sure the lengths of your arrays will always be 11. Try the following code below;</p>
<pre><code>//Remove visibility class from titles
var arrayTitleClasses = Array.from(document.querySelectorAll("[class*='-title']"));
for ( j = 0; j <= arrayTitleClasses.length; j++ ) {
arrayTitleClas... | Using DOM to manipulate css visibility | javascript|html|css|dom | 0 | 40 | 2 | 71,224,887 | 71,224,887 | 2 | true | 2022-02-22T16:11:49.873Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using DOM to manipulate css visibility<p>guys. I'm pretty new to JS and i'm stuck with a problem for quite sometime now. My code is a simple dice game. When ... |
71,226,414 | Change CSS value of other elements if one element is being hovered<p>I have a few social-media links displayed by <code>.card</code> box-elements. Now I want to make that if no <code>.card</code> is hovered, the opacity will just stay at <code>1</code> but if one <code>.card</code> is hovered, every card except for the... | <p>You're almost there:</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>div {
display: inline-block;
width: 100px;
height: 100px;
margin 1em;
background: navy;
}
s... | Change CSS value of other elements if one element is being hovered | html|css|hover | 0 | 34 | 1 | 71,226,500 | 71,226,500 | 2 | true | 2022-02-22T18:18:11.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change CSS value of other elements if one element is being hovered<p>I have a few social-media links displayed by <code>.card</code> box-elements. Now I want... |
71,227,630 | Adding column name to user function<p>I am using a 'user function' to generate the frequencies for each type of 'apply-all' type question.</p>
<p><strong>This is my user function:</strong></p>
<pre><code># adapted from: https://stackoverflow.com/questions/9265003/analysis-of-multiple-response
multfreqtable = function(d... | <p>In your function you could add another column containing the variable names:</p>
<pre class="lang-r prettyprint-override"><code>multfreqtable = function(data, question.prefix) {
z = length(question.prefix)
temp = vector("list", z)
for (i in 1:z) {
a = grep(question.prefix[i], names(data)) # ... | Adding column name to user function | r|dplyr | 0 | 27 | 1 | 71,227,753 | 71,227,753 | 2 | true | 2022-02-22T20:03:05.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding column name to user function<p>I am using a 'user function' to generate the frequencies for each type of 'apply-all' type question.</p>
<p><strong>Thi... |
71,228,309 | How can I lookup the values in a df column against multiple lists and return the list name in a new column?<p>I have a DataFrame with a column called <code>'color'</code>, containing a list of colors.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>color</th>
</tr>
</thead>
<tbody>
<tr>
<td... | <p>You could use <code>numpy.select</code> (since the words in <code>df</code> are capitalized but those in the lists aren't, we could align them with the <code>str.lower</code> method):</p>
<pre><code>colors = df['color'].str.lower()
df['category'] = np.select([colors.isin(primary), colors.isin(secondary)], ['primary'... | How can I lookup the values in a df column against multiple lists and return the list name in a new column? | python|pandas|dataframe | 0 | 34 | 3 | 71,228,355 | 71,228,355 | 2 | true | 2022-02-22T21:07:16.220Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I lookup the values in a df column against multiple lists and return the list name in a new column?<p>I have a DataFrame with a column called <code>'... |
71,227,002 | Two Wikipedia pages have the same Page ID<p>The Page ID definition in <a href="https://en.wikipedia.org/wiki/Help:Page_information" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Help:Page_information</a>
says Page ID is a <strong>"Uniquely identifying primary key"</strong></p>
<p>Why then do these t... | <p>It is unique for a given database. <code>en.wikipedia.org</code> and <code>da.wikipedia.org</code> are two separate databases.</p> | Two Wikipedia pages have the same Page ID | wikipedia|wikipedia-api | 0 | 39 | 1 | 71,230,064 | 71,230,064 | 2 | true | 2022-02-22T19:07:43.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Two Wikipedia pages have the same Page ID<p>The Page ID definition in <a href="https://en.wikipedia.org/wiki/Help:Page_information" rel="nofollow noreferrer"... |
71,230,991 | Formatting output of series in python pandas<p>Here is my DataFrame. This is a representation of an 8-hour day, and the many different combinations of schedules. The time is in 24hr time.
Input:</p>
<pre><code>solutions = problem.getSolutions()
pd.options.display.max_columns = None
df = pd.DataFrame(solutions)
</code><... | <p>You can reverse it by passing its index as data and data as index to a Series constructor:</p>
<pre><code>out = pd.Series(s.index, index=s).sort_index()
</code></pre>
<p>Output:</p>
<pre><code>9 FreeHour
10 Lunch
11 WorkOut
12 Cleaning
13 WorkHr1
14 WorkHr2
15 WorkHr3
16 WorkHr4
dtyp... | Formatting output of series in python pandas | python|pandas | 0 | 44 | 1 | 71,231,009 | 71,231,009 | 2 | true | 2022-02-23T03:17:22.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Formatting output of series in python pandas<p>Here is my DataFrame. This is a representation of an 8-hour day, and the many different combinations of schedu... |
71,231,433 | Joining arrays on internal(nested ) row ids<p>how can I join/sum up array values row by row (i.e. rows representing offset in the array) when joining two tables</p>
<p>i.e. given below two tables
the output for <code>row_id = 1</code> should be <code>STRUCT("A",ARRAY[41,43,45])</code> i.e. array of sum of <co... | <p>You were very close - see below correction</p>
<pre><code>WITH table1 AS (
SELECT 1 AS row_id, STRUCT("A" AS internal_id, ARRAY[1,2,3] as val1) AS col1
),
table2 AS (
SELECT 1 AS row_id, STRUCT("A" AS internal_id, ARRAY[40,41,42] as val2) AS col2
),
table1_unnested as(
select row_id... | Joining arrays on internal(nested ) row ids | google-bigquery | 0 | 16 | 1 | 71,231,784 | 71,231,784 | 2 | true | 2022-02-23T04:36:45.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Joining arrays on internal(nested ) row ids<p>how can I join/sum up array values row by row (i.e. rows representing offset in the array) when joining two tab... |
71,233,072 | Get array sting numbers from array (PHP)<p>I have an 'animals' array stored in the database like this:</p>
<pre><code>array(5) {
[0]=>
string(4) "Bird"
[1]=>
string(3) "Cat"
[2]=>
string(5) "Zebra"
[3]=>
string(4) "Fish"
[4]=>
... | <p>You could iterate the array using key value syntax.</p>
<pre class="lang-php prettyprint-override"><code><ul>
<?php
foreach($array as $key=>$value) { ?>
<li><?php echo $value . " (" . $key . ")"; ?></li>
<?php
}
?>... | Get array sting numbers from array (PHP) | php|arrays | 0 | 26 | 1 | 71,233,118 | 71,233,118 | 2 | true | 2022-02-23T07:49:56.170Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get array sting numbers from array (PHP)<p>I have an 'animals' array stored in the database like this:</p>
<pre><code>array(5) {
[0]=>
string(4) &... |
71,234,617 | Swift code question - what this code actually do? (? : meaning in this code sample)<p>I have below code in my XCode project and I'm not sure how to read it apart from the fact it's a function which does not return and which seems to be calling other functions from the viewModel (correct me if I'm wrong). But what condi... | <p>This is <a href="https://docs.swift.org/swift-book/LanguageGuide/BasicOperators.html#ID71" rel="nofollow noreferrer">Ternary Conditional Operator</a>, also called <em>ternary expression</em>, usually used as:</p>
<pre><code>let myValue = condition ? valueIfConditionTrue : valueIfConditionFalse
</code></pre>
<p>Here ... | Swift code question - what this code actually do? (? : meaning in this code sample) | swift | 0 | 42 | 1 | 71,234,711 | 71,234,711 | 2 | true | 2022-02-23T09:45:48.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift code question - what this code actually do? (? : meaning in this code sample)<p>I have below code in my XCode project and I'm not sure how to read it a... |
71,235,875 | Selecting the ID of a row based on the max date in a group<p>If I have the following, say Table1 with columns ID, Plan and PlanDate
How do I select the ID for the row with the max PlanDate for each Plan?</p>
<p>Thanks in advance</p>
<pre><code>1 plan1 2021-10-07 18:18:28.723
2 plan2 2021-10-07 19:20:17.513
3 plan2 2021... | <pre><code>with cte as (
select ID, Plan, ROW_NUMBER() OVER(partition by plan order by planDate desc) as RNUM
from Table1
)
select Id from cte
where RNUM = 1
</code></pre> | Selecting the ID of a row based on the max date in a group | sql|sql-server | 0 | 24 | 1 | 71,235,955 | 71,235,955 | 2 | true | 2022-02-23T11:13:57.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Selecting the ID of a row based on the max date in a group<p>If I have the following, say Table1 with columns ID, Plan and PlanDate
How do I select the ID fo... |
71,238,607 | Error message when making QQ plots of residuals (lmer)<p>Does anyone know how to fix this error when trying to make QQ plots of residuals, data and code below;</p>
<pre><code>head(final_data)
Country Continent Life_Expectancy
1 Afghanistan Eastern Mediterranean 62.68935 ... | <p><code>merMod</code> objects (the results of an <code>lmer</code> fit) aren't lists (they're S4 objects) and don't have a <code>$residuals</code> element. Try <code>residuals(mod6)</code> instead; it's always better practice to use accessor methods (which don't depend on the internal structure of model objects) anyw... | Error message when making QQ plots of residuals (lmer) | r|modeling | 0 | 39 | 1 | 71,238,710 | 71,238,710 | 2 | true | 2022-02-23T14:19:10.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error message when making QQ plots of residuals (lmer)<p>Does anyone know how to fix this error when trying to make QQ plots of residuals, data and code belo... |
71,238,915 | How do I make a get method return a decreasing/increasing value for every time it is called?<p>I have a unit(soldier) class which contains a getAttackBonus() method and a getResistBonus() method. These must return different values for every time a soldier either attacks or is attacked.
To be specific, getResistBonus() ... | <p>You need to change a bit your code.
First you need to define resist at instance level, not method level.
Second it is better to use an if instead of a while because you are not making a loop, but only checking a single condition.</p>
<p>So the code can be something similar to that:</p>
<pre><code>public class YourCl... | How do I make a get method return a decreasing/increasing value for every time it is called? | java|oop|testing | 0 | 21 | 1 | 71,239,076 | 71,239,076 | 2 | true | 2022-02-23T14:37:26.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I make a get method return a decreasing/increasing value for every time it is called?<p>I have a unit(soldier) class which contains a getAttackBonus()... |
71,240,211 | How to get the decorator handle arbitrary arguments<p>I am trying to understand decorators. I want to define a decorator that can handle any arbitrary argument. I am trying the following:</p>
<pre><code>def a_decorator_passing_arbitrary_arguments(function_to_decorate):
def a_wrapper_accepting_arbitrary_arguments(*a... | <p>You are currently only passing on the positional arguments, not the keyword arguments as well, to the wrapped function.</p>
<pre><code>def a_decorator_passing_arbitrary_arguments(function_to_decorate):
def a_wrapper_accepting_arbitrary_arguments(*args,**kwargs):
print('The positional arguments are', args... | How to get the decorator handle arbitrary arguments | python|python-3.x|arguments|decorator|keyword-argument | 0 | 17 | 1 | 71,240,272 | 71,240,272 | 2 | true | 2022-02-23T15:56:18.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get the decorator handle arbitrary arguments<p>I am trying to understand decorators. I want to define a decorator that can handle any arbitrary argume... |
71,243,431 | MongoDB - Update all documents in a collection, adding a new field using value from another field that is already present in the document<p>I have a MongoDB collection consisting of such documents:</p>
<pre><code>{
title: "Foo",
subtitle: "Bar"
}
</code></pre>
<p>Due to development necessities, I ... | <p>You can run query in mongodb compass shell (_MONGOSH)</p>
<pre><code>db.<CollectionName>.updateMany({ }, [{$set: {"title_lower": { $toLower: "$title" }}}], {upsert: false})
</code></pre>
<p>I tried and it works fine on my end, but I would suggest to try it on a test collection before updati... | MongoDB - Update all documents in a collection, adding a new field using value from another field that is already present in the document | node.js|mongodb|mongodb-atlas|mongo-shell|mongodb-compass | 0 | 809 | 1 | 71,243,765 | 71,243,765 | 2 | true | 2022-02-23T20:09:44.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MongoDB - Update all documents in a collection, adding a new field using value from another field that is already present in the document<p>I have a MongoDB ... |
71,241,446 | Timed behaviors in Akka classic?<p>I am working with Akka classic, and have to setup timed behaviors - in Akka typed, I could do this using <code>Behaviors.withTimers</code> how do I accomplish this in Akka classic? It seems like we can create an actor in Akka using</p>
<pre class="lang-java prettyprint-override"><code... | <p>See the docs on Timers: <a href="https://doc.akka.io/docs/akka/current/actors.html#timers-scheduled-messages" rel="nofollow noreferrer">https://doc.akka.io/docs/akka/current/actors.html#timers-scheduled-messages</a></p>
<p>In short, mixin the Timers trait. Then you can use <code>timers</code> to access the API. You'... | Timed behaviors in Akka classic? | java|akka | 0 | 30 | 1 | 71,244,305 | 71,244,305 | 2 | true | 2022-02-23T17:20:18.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Timed behaviors in Akka classic?<p>I am working with Akka classic, and have to setup timed behaviors - in Akka typed, I could do this using <code>Behaviors.w... |
71,244,323 | IAM role to allow command execution on AWS ECS containers<p>I am new to both terraform, and AWS. I am trying to set <code>enable_execute_command=true</code> on an existing fargate service, with the role and cluster/service/task defined liked this:</p>
<pre><code>data "aws_iam_policy_document" "ecs_task_e... | <p>In your <code>resource "aws_ecs_task_definition" "app"</code> you have specified an <code>execution_role_arn</code>, but you have not specified a <code>task_role_arn</code>. That's really what the error is saying, that you need to provide a task role ARN.</p>
<p>The execution role gives the ECS s... | IAM role to allow command execution on AWS ECS containers | amazon-web-services|terraform|terraform-provider-aws | 0 | 770 | 1 | 71,244,556 | 71,244,556 | 2 | true | 2022-02-23T21:36:13.777Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
IAM role to allow command execution on AWS ECS containers<p>I am new to both terraform, and AWS. I am trying to set <code>enable_execute_command=true</code> ... |
71,247,998 | How to rearrange table in Pandas<p>I have a table look like this in DataFrame:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>couriers</th>
<th>delivery</th>
<th>price_list</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alfred Locker</td>
<td>2 day(s)</td>
<td>HKD $20</td>
</tr>
<tr>
<td>Hongkong Po... | <p>I think you could <code>unstack</code> + convert MultiIndex to a plain index + <code>transpose</code>:</p>
<pre><code>s = df.unstack().sort_index(level=1)
s.index = [f'{x}_{y+1}' for x,y in s.index]
out = s.to_frame().T
</code></pre>
<p>Output:</p>
<pre><code> couriers_1 delivery_1 price_list_1 couriers_2 d... | How to rearrange table in Pandas | python|pandas|dataframe | 0 | 43 | 2 | 71,248,294 | 71,248,294 | 2 | true | 2022-02-24T06:31:55.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to rearrange table in Pandas<p>I have a table look like this in DataFrame:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>c... |
71,248,184 | How ellipsis only middle text in Android Compose?<p>I am developing an android app using the jetpack compose.</p>
<p>I want to make a UI like:</p>
<p><a href="https://i.stack.imgur.com/Vg0re.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vg0re.png" alt="enter image description here" /></a></p>
<pre ... | <p>In such cases <a href="https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/RowScope#(androidx.compose.ui.Modifier).weight(kotlin.Float,kotlin.Boolean)" rel="nofollow noreferrer"><code>Modifier.weight</code></a> should be used on the view, in this case it'll be measured after other sibli... | How ellipsis only middle text in Android Compose? | android|android-jetpack-compose | 0 | 271 | 1 | 71,248,836 | 71,248,836 | 2 | true | 2022-02-24T06:57:22.663Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How ellipsis only middle text in Android Compose?<p>I am developing an android app using the jetpack compose.</p>
<p>I want to make a UI like:</p>
<p><a href... |
71,248,826 | Prolog: Trying to determine if a person is a citizen of a certain country<p>I am writing a Prolog program in which given a set of facts about the citizenship(s) of a person in the following format (meaning [name] is a citizen of a [list of countries]):</p>
<pre><code>citizen(name, [list of countries])
</code></pre>
<p>... | <p>You've done a few things wrong. For starters, in Prolog, variables start with Capital letters, and you need to quote atoms that start with capital letters.</p>
<p>So:</p>
<pre><code>citizen('JaneDone', ['Germany', 'United States']).
</code></pre>
<p>And in Prolog, there aren't any functions; you need to spell things... | Prolog: Trying to determine if a person is a citizen of a certain country | prolog | 0 | 36 | 2 | 71,249,152 | 71,249,152 | 2 | true | 2022-02-24T08:03:35.177Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Prolog: Trying to determine if a person is a citizen of a certain country<p>I am writing a Prolog program in which given a set of facts about the citizenship... |
71,249,144 | Flutter Textfield capture dollar amount and apply a fee<p>We have a flutter text field whereby a user can enter an amount as an int, and what we want to do is that int calculated an amount less a fee. Probably is I cannot work out here what I am doing wrong</p>
<pre><code>TextFormField(
contro... | <p>Try this:</p>
<pre><code>setState(() {
_offer = sum.toInt();
});
</code></pre> | Flutter Textfield capture dollar amount and apply a fee | flutter|onchange|calculation | 0 | 45 | 2 | 71,249,406 | 71,249,406 | 2 | true | 2022-02-24T08:34:19.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter Textfield capture dollar amount and apply a fee<p>We have a flutter text field whereby a user can enter an amount as an int, and what we want to do i... |
71,249,327 | Why does FaunaDB output differ from Graphqli?<p>I have created a simple <em>user.gql</em> file</p>
<pre><code>type Query {
users: [user]
userById(id:ID!):user
}
type user {
id: ID!
chat_data: String
}
</code></pre>
<p>My data is</p>
<pre><code> [
{
"id": "0815960b-9725-48d5-b326-7718c4749cf5... | <p>This is very unintuitive, but Fauna seems to be returning a paginated result. Read more about it <a href="https://docs.fauna.com/fauna/current/tutorials/graphql/pagination" rel="nofollow noreferrer">here</a>.</p>
<p>The best thing would be to GraphiQL to have a look at the schema of the Fauna GraphQL endpoint. Autoc... | Why does FaunaDB output differ from Graphqli? | graphql|faunadb | 0 | 36 | 1 | 71,249,807 | 71,249,807 | 2 | true | 2022-02-24T08:49:54.520Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does FaunaDB output differ from Graphqli?<p>I have created a simple <em>user.gql</em> file</p>
<pre><code>type Query {
users: [user]
userById(id:ID!):use... |
71,250,127 | Roll condition ifelse in R data frame<p>I have a data frame with two columns in R and I want to create a third column that will roll by 2 in both columns and check if a condition is satisfied or not as described in the table below.
The condition is a rolling ifelse and goes like this :</p>
<p>IF -A1<B3<A1 TRUE EL... | <p>Since R is vectorized, you can do that with one command, using for instance <code>dplyr::lag</code>:</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
df %>%
mutate(CHECK = -lag(A, n=2) < B & lag(A, n=2) > B)
A B CHECK
1 1 4 NA
2 2 5 NA
3 3 6 FALSE
4 4 1 TRUE
5 5 -4 FAL... | Roll condition ifelse in R data frame | r|dataframe|if-statement|rollapply | 0 | 32 | 1 | 71,250,216 | 71,250,216 | 2 | true | 2022-02-24T09:55:15.493Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Roll condition ifelse in R data frame<p>I have a data frame with two columns in R and I want to create a third column that will roll by 2 in both columns and... |
71,251,012 | Mutate in dplyr the proportions of TRUE or FALSE in 2 new columns<p>I have the following table in R:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">CAT</th>
<th style="text-align: center;">CONDITION</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">A<... | <p>You could also simply use <code>mean</code> with <code>logical</code> variables:</p>
<pre><code>library(dplyr)
data3 %>%
as_tibble() %>% # this converts your matrix into a tibble
mutate(cond = as.logical(cond)) %>% # convert character to logical
group_by(cat) %>%
summari... | Mutate in dplyr the proportions of TRUE or FALSE in 2 new columns | r|dplyr|percentage | 0 | 282 | 4 | 71,251,161 | 71,251,161 | 2 | true | 2022-02-24T11:07:48.423Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mutate in dplyr the proportions of TRUE or FALSE in 2 new columns<p>I have the following table in R:</p>
<div class="s-table-container">
<table class="s-tabl... |
71,249,896 | Make type validator give back right type<p>This is my code:</p>
<pre><code>function isArray(value) {
return Array.isArray(value)
}
function someFunction(value: Array<any> | boolean) {
if (isArray(value)) {
console.log(value.length)
} else {
console.log(value)
}
}
</code></pre>
<p>And I got this ... | <pre><code>function isArray(value: any): value is any[] {
return Array.isArray(value)
}
</code></pre>
<p>You need to add a return type to <code>isArray</code>, making it a type predicate.</p>
<p>More info here: <a href="https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates" rel="nofollow... | Make type validator give back right type | typescript | 0 | 33 | 1 | 71,251,644 | 71,251,644 | 2 | true | 2022-02-24T09:37:42.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Make type validator give back right type<p>This is my code:</p>
<pre><code>function isArray(value) {
return Array.isArray(value)
}
function someFunction(v... |
71,250,678 | Is it possible to cross-compile an already compiled file? ARM Cortex M4<p>I'm working on a project where I have to port a compiled file for x86 architecture to a STM32F401RE, which has an ARM Cortex M4 processor. <br>
Is it possible to cross-compile the already compiled file? I don't have access to the c code, since th... | <p>I'm going to say it's not possible. Even if you somehow managed to translate all x86 instructions to ARM instructions. An executable compiled for x86 from a higher level language most definitely relies on an operating system for loading, memory access, IO etc. You will not have such an OS on a Cortex M4.</p> | Is it possible to cross-compile an already compiled file? ARM Cortex M4 | arm|cross-compiling|stm32 | 0 | 35 | 1 | 71,251,706 | 71,251,706 | 2 | true | 2022-02-24T10:41:17.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to cross-compile an already compiled file? ARM Cortex M4<p>I'm working on a project where I have to port a compiled file for x86 architecture ... |
71,249,219 | Loading JSON Array Into BigQuery<p>I am trying to load a json array into a bigquery table. The structure of the data is as stated below :</p>
<pre><code>[{"image":"testimage1","component":"component1"},{"image":"testimage2","component":"componen... | <p>No, only a valid JSON can be ingested by BigQuery and a valid JSON doesn't start by an array.</p>
<p>You have to transform it slightly:</p>
<ul>
<li>Either transform it in a valid JSON (add a <code>{"object":</code> at the beginning and finish the line by a <code>}</code>). Ingest that JSON in a temporary ... | Loading JSON Array Into BigQuery | google-cloud-platform|google-bigquery | 0 | 1,048 | 2 | 71,252,333 | 71,252,333 | 2 | true | 2022-02-24T08:40:36.603Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Loading JSON Array Into BigQuery<p>I am trying to load a json array into a bigquery table. The structure of the data is as stated below :</p>
<pre><code>[{&q... |
71,251,726 | What do these turbofan memory zones mean?<p>I was playing around with the V8 engine and stumbled upon the <a href="https://v8.github.io/tools/head/zone-stats/index.html" rel="nofollow noreferrer">zone stats tool</a>. I understand the zone memory concept, but what are these different zones in zone stats memory?</p>
<p>W... | <p>(V8 developer here.) Since Turbofan is a compiler, all the zones it uses are used for compiling.</p>
<p>It uses more than one zone so that temporary data that's only needed for a short time can be freed afterwards, whereas the main zone sticks around until the entire compilation job is completed. This is most obviou... | What do these turbofan memory zones mean? | performance|google-chrome|chromium|v8 | 0 | 30 | 1 | 71,254,072 | 71,254,072 | 2 | true | 2022-02-24T12:07:23.837Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What do these turbofan memory zones mean?<p>I was playing around with the V8 engine and stumbled upon the <a href="https://v8.github.io/tools/head/zone-stats... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.