question_id int64 37.6M 73.2M | input_text stringlengths 88 52.4k | output_text stringlengths 37 35.6k | title stringlengths 15 150 | tags stringlengths 1 107 | q_score int64 -19 397 | view_count int64 3 879k | answer_count int64 1 21 | accepted_answer_id int64 37.6M 73.8M | answer_id int64 37.6M 73.8M | a_score int64 -5 1.29k | is_accepted bool 1
class | creation_date stringlengths 20 24 | input_text_instruct stringlengths 251 52.6k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
72,810,427 | How to pass the TS type checking for component props<pre><code>export const Component: React.FC<SpaProps> = function({
a,
b,
c,
d
})
</code></pre>
<p>a, b, c belong to SpaProps. However, d doesn't. How I can add a prop type, which supports a,b,c,d together? BTW I know what the type for d</p>
<pre... | <p>You can extend the type with Typescript like this:</p>
<pre class="lang-js prettyprint-override"><code>export const Component: React.FC<SpaProps & IT> = function({
a,
b,
c,
d
})
</code></pre>
<p>Even if you didn't know the type, you could write it like this:</p>
<pre class="lang-js prettypr... | How to pass the TS type checking for component props | reactjs|typescript|react-props | 0 | 42 | 1 | 72,810,467 | 72,810,467 | 2 | true | 2022-06-30T04:48:55.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to pass the TS type checking for component props<pre><code>export const Component: React.FC<SpaProps> = function({
a,
b,
c,
d
})
</... |
72,810,358 | How do I look up the cache_size of a sequence in Postgresql?<p>I am using PostgreSQL 9.2.</p>
<p>I created a sequence using the syntax below, but I could not find the cache_size value in the information_schema.sequence table.</p>
<pre><code>CREATE SEQUENCE SEQUENCE1
INCREMENT -1
MINVALUE 1
MAXVALUE 3
ST... | <p>You can select from the sequence:</p>
<pre><code>SELECT min_value, max_value, last_value, increment_by, cache_value, is_cycled
FROM sequence1 --<< replace with your sequence name
</code></pre> | How do I look up the cache_size of a sequence in Postgresql? | postgresql|sequence | 0 | 42 | 1 | 72,810,742 | 72,810,742 | 2 | true | 2022-06-30T04:36:55.930Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I look up the cache_size of a sequence in Postgresql?<p>I am using PostgreSQL 9.2.</p>
<p>I created a sequence using the syntax below, but I could not... |
72,803,258 | How to get that list of all the available Terraform Resource types for Google Cloud?<p>I started learning Terraform recently. For <code>google</code> and <code>google-beta</code> providers, I want to check/list all the available resource type, but I am not receiving any valuable informations. Hashicorp page - <a href="... | <p>I think the key thing to note in the documentation is the phrase at the end of the opening sentence (emphasis mine):</p>
<blockquote>
<p>The <code>terraform providers schema</code> command is used to print detailed schemas for <strong>the providers used in the current configuration</strong>.</p>
</blockquote>
<p>The... | How to get that list of all the available Terraform Resource types for Google Cloud? | google-cloud-platform|terraform | -3 | 42 | 1 | 72,818,542 | 72,818,542 | 2 | true | 2022-06-29T14:37:11.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get that list of all the available Terraform Resource types for Google Cloud?<p>I started learning Terraform recently. For <code>google</code> and <co... |
72,822,133 | Adding a condition to desplay a list of values in Oracle Apex<p>I need help with putting a condition on a List Of Values in Oracle apex. So I have 2 tables:</p>
<pre><code>SELECT v.ID_VEZ NUMBER
v.BROJ_VEZ, NUMBER
v.MAX_DULJINA FLOAT
FROM VEZ v
</code></pre>
<p>and</p>
<pre><code>SELECT b.ID... | <p>Presume this is page <code>P1</code>. Duljina brodice is then entered into <code>P1_DULJINA_BRODICE</code> item. Vez LoV would then reference page item as</p>
<pre><code>select v.broj_vez as display_value,
v.id_vez as return_value
from vez v
where v.max_duljina > :P1_DULJINA_BRODICE
</code></pre>
<p>In ... | Adding a condition to desplay a list of values in Oracle Apex | sql|oracle|oracle-apex | 1 | 42 | 1 | 72,824,926 | 72,824,926 | 2 | true | 2022-06-30T21:17:47.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding a condition to desplay a list of values in Oracle Apex<p>I need help with putting a condition on a List Of Values in Oracle apex. So I have 2 tables:<... |
72,825,424 | Identification of special characters in a string using R<p>I have a data field which consists of firm names that may contain special characters such as @,/,-. I need to identify whether the data field contains any special characters. I have tried the suggestions listed on <a href="https://stackoverflow.com/questions/36... | <p>This seems to work,</p>
<pre><code>grepl('[[:punct:]]', df$Firm)
#[1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE FALSE
</code></pre> | Identification of special characters in a string using R | r|regex|string|special-characters | 1 | 42 | 1 | 72,825,559 | 72,825,559 | 2 | true | 2022-07-01T06:57:05.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Identification of special characters in a string using R<p>I have a data field which consists of firm names that may contain special characters such as @,/,-... |
72,835,975 | react-hooks/exhaustive-deps warning with custom IntersectionObserver hook<p>I have this custom react hook copied more of less straight from this dev.to article for use of the <code>IntersecionObserver</code> in React. <a href="https://dev.to/producthackers/intersection-observer-using-react-49ko" rel="nofollow noreferre... | <p>The warning exists because, in some cases, the <code>.current</code> value referenced in the body of an effect will be different from the <code>.current</code> value referenced in the cleanup function. In general, if you do</p>
<pre><code>useEffect(() => {
// code that references someRef.current
return () =&g... | react-hooks/exhaustive-deps warning with custom IntersectionObserver hook | javascript|reactjs|react-hooks | 1 | 42 | 1 | 72,836,085 | 72,836,085 | 2 | true | 2022-07-02T02:03:11.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
react-hooks/exhaustive-deps warning with custom IntersectionObserver hook<p>I have this custom react hook copied more of less straight from this dev.to artic... |
72,836,111 | Equivalent of `std::iter::inspect` for method chains<p>In rust, is it possible to inspect the intermediate values in a chain of method calls? The equivalent method <a href="https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.inspect" rel="nofollow noreferrer">exists for iterators</a> so that the values produc... | <p>You can define a trait for this almost exactly like that:</p>
<pre class="lang-rust prettyprint-override"><code>trait Inspect {
fn inspect(self, f: impl Fn(&Self)) -> Self;
}
impl<T> Inspect for T {
fn inspect(self, f: impl Fn(&Self)) -> Self {
f(&self);
self
}
}
... | Equivalent of `std::iter::inspect` for method chains | debugging|rust|method-chaining | 0 | 42 | 2 | 72,836,288 | 72,836,288 | 2 | true | 2022-07-02T02:42:57.560Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Equivalent of `std::iter::inspect` for method chains<p>In rust, is it possible to inspect the intermediate values in a chain of method calls? The equivalent ... |
72,836,965 | Error in function: get() can't be applied to a string (python)<p>let's suppose that my dataset looks like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">ID</th>
<th style="text-align: left;">School Name</th>
<th style="text-align: left;">School Type</th>
<th... | <p>You can use:</p>
<pre><code>MAPPING = {
'School Type': school_type_key,
'Specialization': specialization_key
}
def sort_by_keys(col):
return (df[col].sort_values(key=lambda x: x.map(MAPPING[col]))
.unique().tolist())
</code></pre>
<p>Output:</p>
<pre><code>>>> sort_by_keys('S... | Error in function: get() can't be applied to a string (python) | python|pandas|function | 1 | 42 | 2 | 72,837,104 | 72,837,104 | 2 | true | 2022-07-02T06:32:17.857Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error in function: get() can't be applied to a string (python)<p>let's suppose that my dataset looks like this:</p>
<div class="s-table-container">
<table cl... |
72,840,804 | Git Fetch not updating tracking branches in 'packed-refs'<p>Here is what I have done.</p>
<ol>
<li>I have made a new commit in GitHub</li>
<li>Did "git fetch" in my local machine</li>
</ol>
<p><strong>Expectation:</strong></p>
<p>Tracking branches would be updated, but local branches would remain as is.</p>
<... | <p>There's no guarantee when or if references are stored unpacked or packed, or if some future version of Git will store them in some third way (e.g., a real database). You should generally not look at the files inside the <code>.git</code> directory (except to satisfy curiosity), but rather use the provided APIs (e.g... | Git Fetch not updating tracking branches in 'packed-refs' | git|github | 0 | 42 | 2 | 72,840,852 | 72,840,852 | 2 | true | 2022-07-02T16:45:08.537Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Git Fetch not updating tracking branches in 'packed-refs'<p>Here is what I have done.</p>
<ol>
<li>I have made a new commit in GitHub</li>
<li>Did "git ... |
72,841,541 | www.google.com returns HTTP 301<p>I'm looking at <a href="https://github.com/EONRaider/blackhat-python3/blob/master/chapter02/tcp-client.py" rel="nofollow noreferrer">this example</a> of making a simple HTTP request in Python using only the built in <code>socket</code> module:</p>
<pre class="lang-py prettyprint-overri... | <blockquote>
<p>I'm confused by this because the "new location" looks identical to the URL I requested</p>
</blockquote>
<p>It doesn't. Your host header says that you are accessing <code>google.com</code>, i.e. without <code>www</code>:</p>
<blockquote>
<pre><code>client.send(b"GET / HTTP/1.1\r\nHost: go... | www.google.com returns HTTP 301 | python|http|tcp|python-sockets | 0 | 42 | 1 | 72,841,615 | 72,841,615 | 2 | true | 2022-07-02T18:33:13Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
www.google.com returns HTTP 301<p>I'm looking at <a href="https://github.com/EONRaider/blackhat-python3/blob/master/chapter02/tcp-client.py" rel="nofollow no... |
72,842,734 | How can I fix my output on this simple name generating python project?<p>I am just trying to figure out what the issue is with my output on this simple name generating project in Python. The program work just fine and accepts all the inputs, but when it prints the result I get duplicates of certain names when I simply ... | <p>In each pass of the <code>for</code> loop, you add an item to <code>ec2list</code>, and then you print the whole cumulative list.</p>
<p>So in your first pass through the loop, you print <code>ec2List[0]</code></p>
<p>In your second pass you print <code>ec2List[0]</code> again, and <code>ec2List[1]</code>.</p>
<p>In... | How can I fix my output on this simple name generating python project? | python|python-3.x | 0 | 42 | 2 | 72,842,761 | 72,842,761 | 2 | true | 2022-07-02T22:10:51.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I fix my output on this simple name generating python project?<p>I am just trying to figure out what the issue is with my output on this simple name ... |
72,844,513 | arranging files based on the names<p>Many text files with .txt extensions are present in a directory (<code>1620_10.asc_rsmp_1.0.txt, 132_10.asc_rsmp_1.0.txt</code>, etc) and the first few digits of the file names are the only changes (for example <code>1620</code> in first file and <code>132</code> in second file). I ... | <p>It's unclear exactly what you want. This does what I think you want:</p>
<pre class="lang-py prettyprint-override"><code>from glob import glob
# Returns a list of all relevant filenames
filenames = glob("*_10.asc_rsmp_1.0.txt")
# All the values will be stored in a dict where the key is the filename, and
... | arranging files based on the names | python|python-3.x|dataframe|numpy|glob | 1 | 42 | 1 | 72,845,604 | 72,845,604 | 2 | true | 2022-07-03T06:59:12.727Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
arranging files based on the names<p>Many text files with .txt extensions are present in a directory (<code>1620_10.asc_rsmp_1.0.txt, 132_10.asc_rsmp_1.0.txt... |
72,846,046 | Scraping returning None<p>I am trying to scrape yellow pages everything working fine except scraping the phone numbers! it's a div class = 'popover-phones' but having an a tag with href = the phone number can anyone assist me please. <a href="https://i.stack.imgur.com/WkaaX.png" rel="nofollow noreferrer">yellow pages i... | <p>The phone numbers you see are loaded from external URL. To get all phone numbers from the page you can use next example:</p>
<pre class="lang-py prettyprint-override"><code>import requests
from bs4 import BeautifulSoup
url = "https://yellowpages.com.eg/en/category/charcoal"
soup = BeautifulSoup(requests.g... | Scraping returning None | python|web-scraping | 1 | 42 | 1 | 72,846,172 | 72,846,172 | 2 | true | 2022-07-03T11:20:27.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scraping returning None<p>I am trying to scrape yellow pages everything working fine except scraping the phone numbers! it's a div class = 'popover-phones' b... |
72,847,909 | Java : Binary tree Root to Leaf path with Minimum sum<p>I'm trying to find Minimum path sum from root to leaf also need to compute the minimum path. My solution works if the solution is in left sub tree, however if the result is in right subtree root node is added twice in the result path, can someone please take a loo... | <p>Every call of <code>currentpath.add</code> should be mirrored by a call of <code>currentpath.remove</code>. Your code does this fine, except in the bock below:</p>
<pre><code> if (node.left == null && node.right == null) {
if (currentSum + node.val < minsum[0]) {
minsum[0... | Java : Binary tree Root to Leaf path with Minimum sum | java|algorithm|data-structures|tree | 1 | 42 | 1 | 72,848,160 | 72,848,160 | 2 | true | 2022-07-03T15:49:29.730Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java : Binary tree Root to Leaf path with Minimum sum<p>I'm trying to find Minimum path sum from root to leaf also need to compute the minimum path. My solut... |
72,849,973 | Disabling derived classes from overriding interface method<pre><code>public interface Interface {
void interfaceMethod();
}
abstract class Base implements Interface {
@Override
public void interfaceMethod() {
baseClassMethod();
abstractMethod();
}
private void baseClassMeth... | <p>Just make it <code>final</code>:</p>
<pre><code> @Override
public final void interfaceMethod() {
baseClassMethod();
abstractMethod();
}
</code></pre>
<p>So you cant override it again from your <code>Derived</code> class.</p> | Disabling derived classes from overriding interface method | java|interface|overriding | 0 | 42 | 1 | 72,850,003 | 72,850,003 | 2 | true | 2022-07-03T21:16:11.687Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Disabling derived classes from overriding interface method<pre><code>public interface Interface {
void interfaceMethod();
}
abstract class Base ... |
72,851,439 | Fast computation for changing the leftmost different bit<p>Given the two number in 8-bit:</p>
<pre><code>x = 0b11110111
y = 0b11001010
</code></pre>
<p>What I want to do is to compare x and y and change x only the first different leftmost bit based on y. For example:</p>
<pre><code>z = 0b11010111 (Because the leftmost ... | <p>The function you're after:</p>
<pre><code>from math import floor, log2
def my_fun(x, y):
return x ^ (2 ** floor(log2(x ^ y)))
z = my_fun(0b11110111, 0b11001010)
print(f'{z:b}')
</code></pre>
<p>Output:</p>
<pre><code>11010111
</code></pre>
<p>The function does the following:</p>
<ul>
<li>compute the XOR resu... | Fast computation for changing the leftmost different bit | python|deep-learning|pytorch | 0 | 42 | 1 | 72,852,111 | 72,852,111 | 2 | true | 2022-07-04T03:18:24.007Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fast computation for changing the leftmost different bit<p>Given the two number in 8-bit:</p>
<pre><code>x = 0b11110111
y = 0b11001010
</code></pre>
<p>What ... |
72,853,908 | R: merge two tables when one table is a special case of the another one<p>I want to merge two table with different row numbers by the specific way.
I have the next:</p>
<pre><code>
df1 <- data.frame(num = c(1,1,1,2,2,2),
lab = c("A", "B", "C", "A", "B&qu... | <p>You can do it with one line:</p>
<pre class="lang-r prettyprint-override"><code>dplyr::rows_update(df1, df2, by = c("num", "lab"))
# num lab val
# 1 1 A 10
# 2 1 B 10
# 3 1 C 0
# 4 2 A 10
# 5 2 B 0
# 6 2 C 0
</code></pre> | R: merge two tables when one table is a special case of the another one | r|datatable | 1 | 42 | 4 | 72,854,023 | 72,854,023 | 2 | true | 2022-07-04T08:40:58.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R: merge two tables when one table is a special case of the another one<p>I want to merge two table with different row numbers by the specific way.
I have th... |
72,865,470 | CSS selector regex match start and end<p>let say I have elements with <code>title</code> attribute like following</p>
<pre><code><div title="custom-marker-awlr-tailrace bbu-l2"></div>
<div title="custom-marker-aws-tailrace btut"></div>
<div title="custom-marker-arr-ta... | <p>You may use a single attribute selector, e.g.</p>
<pre><code>div[title="custom-marker-wqs-tailrace bbu-l2"] {
...
}
</code></pre>
<p>so you match the exact string or you could chain two attribute selectors, e.g.</p>
<pre><code>div[title^="custom-marker-wqs-tailrace"][title$="bbu-l2"] ... | CSS selector regex match start and end | html|css | -1 | 42 | 2 | 72,865,555 | 72,865,555 | 2 | true | 2022-07-05T07:24:07.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CSS selector regex match start and end<p>let say I have elements with <code>title</code> attribute like following</p>
<pre><code><div title="custom-m... |
72,867,751 | Invalid MultiPolygon value even though all the Polygons are valid<p>I am trying to convert coordinates to WKT format. Here I have a list of polygons which should be identified as a Multi polygon.</p>
<pre><code> 'geometry': [[[129093.87770000007, 6638201.563100001],
[129145.82270000037, 6638246.0934],
[129170.663... | <p>MultiPolygon takes a sequence of rings <em><strong>and</strong></em> holes list tuples, or a sequence of polygons. You can either do:</p>
<pre><code>MultiPolygon((x, None) for x in jk['geometry'])
</code></pre>
<p>or</p>
<pre><code>MultiPolygon(Polygon(x) for x in jk['geometry'])
</code></pre> | Invalid MultiPolygon value even though all the Polygons are valid | python|geojson|geopandas|shapely | 0 | 42 | 1 | 72,867,920 | 72,867,920 | 2 | true | 2022-07-05T10:19:47.653Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Invalid MultiPolygon value even though all the Polygons are valid<p>I am trying to convert coordinates to WKT format. Here I have a list of polygons which sh... |
72,867,137 | Map union type to another type<p>I'm just curious know if this is possible in TypeScript. Imagine I've a list on entity identifiers defined as an union type:</p>
<pre class="lang-js prettyprint-override"><code>type EntityID = 'authors' | 'books' | 'programs';
</code></pre>
<p>Then, imagine we have the following classes... | <p>You can create a mapping type from your enum to the types and then use a generic function (a factory method actually) to create the objects.</p>
<p>Something similar to this:</p>
<pre><code>type EntityID = 'authors' | 'books' | 'programs';
type MapEntity = {
'authors': Author,
'books': Book,
'programs':... | Map union type to another type | typescript | 1 | 42 | 1 | 72,868,633 | 72,868,633 | 2 | true | 2022-07-05T09:35:09.577Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Map union type to another type<p>I'm just curious know if this is possible in TypeScript. Imagine I've a list on entity identifiers defined as an union type:... |
72,871,896 | R join a table column from a vector<p>I would like to get the corresponding values of a vector in a table from a column in another column. (just look below)</p>
<p>example:</p>
<p>Vector:</p>
<pre><code>v = c('A', 'B', 'C')
</code></pre>
<p>Table :</p>
<pre class="lang-py prettyprint-override"><code># key Value
'C... | <p>A possible solution in <code>base R</code>:</p>
<pre class="lang-r prettyprint-override"><code>df$Value[match(v, df$key)]
#> [1] 1 2 3
</code></pre>
<hr />
<p>Using <code>dplyr</code>:</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
df %>%
mutate(x = Value[match(v, key)]) %>%
pull(... | R join a table column from a vector | r|dplyr|data-science | 2 | 42 | 2 | 72,871,945 | 72,871,945 | 2 | true | 2022-07-05T15:22:34.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R join a table column from a vector<p>I would like to get the corresponding values of a vector in a table from a column in another column. (just look below)<... |
72,873,048 | How to change font in BigQuery data [Data Cleaning]<p>In a Bigquery table I have the same value but with 2 different type of fonts (ℂ and Cartagena), for a data cleaning process how can I put it all in one type of font, since it filters as 2 different values?</p>
<p><a href="https://i.stack.imgur.com/HMNY9.png" rel="no... | <p>Use <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#normalize" rel="nofollow noreferrer">NORMALIZE</a> function as in below example</p>
<pre><code>with your_table as (
select 'ℂ' col union all
select 'Cartagena'
)
select *, normalize(col, NFKC) normalized_col
from your_tab... | How to change font in BigQuery data [Data Cleaning] | sql|google-bigquery | 2 | 42 | 1 | 72,873,219 | 72,873,219 | 2 | true | 2022-07-05T16:55:22.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to change font in BigQuery data [Data Cleaning]<p>In a Bigquery table I have the same value but with 2 different type of fonts (ℂ and Cartagena), for a d... |
72,878,094 | Change my If statement to use an Array instead<p>How would I change this If statement to use an array Instead?</p>
<pre><code>Dim with As Workbook: Set wb = ThisWorkbook
Dim sh As Worksheet: Set sh = wb.Worksheets("Sheet1")
Dim tbl As ListObject: Set table = ListObjects("Table1")
Dim lcount As Lo... | <p>You can use this code:</p>
<pre class="lang-vb prettyprint-override"><code>
'this ist the sub to show how to call the basic sub below
Public Sub test_selectColor()
Dim tblData As ListObject
Set tblData = ThisWorkbook.Worksheets(1).ListObjects("tblData") '---> adjust this to your needs
D... | Change my If statement to use an Array instead | excel|vba | 1 | 42 | 1 | 72,878,825 | 72,878,825 | 2 | true | 2022-07-06T04:52:09.537Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change my If statement to use an Array instead<p>How would I change this If statement to use an array Instead?</p>
<pre><code>Dim with As Workbook: Set wb = ... |
72,899,018 | How to make exceptions in SAS eg<p>In python you can make exception like this:</p>
<pre><code>x=0
try:
1/x
except:
1+2
</code></pre>
<p>So if you get an error in the first statement the second one is runs</p>
<p>Does SAS EG have something similar?</p>
<p>I try to do something like this:</p>
<pre><code>try... | <p>SAS does not have try/except blocks, but you can work around it a number of ways. Here are two effective ways of handling it.</p>
<p>The most common way is by specifying the error condition you're looking for. For example, let's say we know our code will fail if <code>&str_PERIOKVT_PREV_YYMMN6</code> does not ex... | How to make exceptions in SAS eg | sql|sas|enterprise-guide | 0 | 42 | 1 | 72,899,485 | 72,899,485 | 2 | true | 2022-07-07T13:48:47.413Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make exceptions in SAS eg<p>In python you can make exception like this:</p>
<pre><code>x=0
try:
1/x
except:
1+2
</code></pre>
<p>So if y... |
72,900,484 | How to get a set of records from within each partition based on a condition<p>From a table like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>status</th>
<th>date</th>
<th>category</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>PENDING</td>
<td>2022-07-01</td>
<td>XYZ</... | <p>The requirements are more hard-coded here then following proper design.
Based on what has been proposed in the question, I just tweaked it a little bit to get last records.</p>
<p>Assuming that records are always in pair, as mentioned in the question.</p>
<pre><code>WITH temp AS (
SELECT *,
row_number... | How to get a set of records from within each partition based on a condition | sql|postgresql | 0 | 42 | 1 | 72,901,493 | 72,901,493 | 2 | true | 2022-07-07T15:25:28.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get a set of records from within each partition based on a condition<p>From a table like this:</p>
<div class="s-table-container">
<table class="s-tab... |
72,908,388 | change legend shape of only one level of a variable in ggplot2<p>I have a dataframe as such:</p>
<pre class="lang-r prettyprint-override"><code>dat <- data.table::data.table(
overlaps = c(1L,2L,3L,4L,5L,6L,7L,8L,9L,10L,
11L,12L,1L,2L,3L,4L,5L,6L,7L,8L,9L,10L,11L,12L),
N = c(4157L,2396... | <p>As you want to remove the line you have to override the <code>linetype</code>aes:</p>
<pre><code>library(ggplot2)
ggplot(mapping = aes(x=factor(overlaps),y=cm_pct,colour=peaks),data = dat) +
geom_pointrange(aes(ymin=cm_pct-pct_sd-.5,ymax=cm_pct+pct_sd+.5)) +
scale_x_discrete(name="overlaps",breaks=seq... | change legend shape of only one level of a variable in ggplot2 | r|ggplot2 | 0 | 42 | 1 | 72,908,571 | 72,908,571 | 2 | true | 2022-07-08T08:00:28.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
change legend shape of only one level of a variable in ggplot2<p>I have a dataframe as such:</p>
<pre class="lang-r prettyprint-override"><code>dat <- dat... |
72,923,757 | Is there a way to round up a constant to a power of 2 in NASM?<p>I am trying to make a constant round up to the nearest power of 2 in NASM, is this possible?</p>
<p>By constant I mean a symbol that you define using EQU.</p>
<p>I don't want to round constant after it is defined, I want to round it while defining it.
The... | <p>From <a href="https://graphics.stanford.edu/%7Eseander/bithacks.html#RoundUpPowerOf2" rel="nofollow noreferrer">Bit Twiddling Hacks</a>, this algorithm rounds a 32-bit unsigned integer to the next power of 2. You can extend it to a larger input range by extending the obvious pattern.</p>
<pre><code>v--;
v |= v >&... | Is there a way to round up a constant to a power of 2 in NASM? | assembly|constants|nasm | 0 | 42 | 2 | 72,924,270 | 72,924,270 | 2 | true | 2022-07-09T18:28:27.943Z | 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 round up a constant to a power of 2 in NASM?<p>I am trying to make a constant round up to the nearest power of 2 in NASM, is this possible?... |
72,865,672 | Use result of binary expression as an instant vector<p>I have a binary expression like the following:</p>
<pre><code>up{instance=~"^.*:.*"} unless up{instance=~"^.*:10000$"}
</code></pre>
<p>It's just an example. I know that I could write regular expression so that it'll be just one. But it's a simp... | <p>Prometheus allows specifying multiple filters for the same label in a single series selector, then apply <code>rate</code> function to it - see <a href="https://stackoverflow.com/a/72926966/274937">this answer</a> for details.</p>
<p>Prometheus allows passing arbitrary query results to functions, which accept e.g. <... | Use result of binary expression as an instant vector | prometheus|promql | 0 | 42 | 1 | 72,927,050 | 72,927,050 | 2 | true | 2022-07-05T07:41:08.250Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use result of binary expression as an instant vector<p>I have a binary expression like the following:</p>
<pre><code>up{instance=~"^.*:.*"} unless ... |
72,915,633 | CMD FOR loop does not output the expected result<p>I'm learning about CMD <code>for</code> loops. I created a directory tree rooting in the folder <code>C:\Users\Ahmed\Desktop\Playing_Field</code>:</p>
<pre><code>├───New folder - Copy
├───New folder - Copy (10)
├───New folder - Copy (11)
├───New folder - Copy (12)
├───... | <p>Modern Windows systems still support so-called <a href="https://ss64.com/nt/syntax-filenames.html" rel="nofollow noreferrer" title="How-to: Long filenames, NTFS and legal filename characters">short file names</a> and even may have them enabled by default, besides the usual long files names. These short file names, a... | CMD FOR loop does not output the expected result | windows|for-loop|cmd | 1 | 42 | 1 | 72,930,546 | 72,930,546 | 2 | true | 2022-07-08T18:32:43.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CMD FOR loop does not output the expected result<p>I'm learning about CMD <code>for</code> loops. I created a directory tree rooting in the folder <code>C:\U... |
72,934,634 | get pandas rows with same specific word in two columns<p>I have a pandas dataframe that looks like this</p>
<pre><code> data1 data2
0 overall_phase1_b3 overall_phase1_b5
1 overall_phase2_b3 overall_phase5_b5
2 overall_phase3_b3 overall_phase3_b5
</code></pre>
<p>My question is how... | <p>You do not need <code>regex</code> to achieve this. You can use something like this instead:</p>
<pre class="lang-py prettyprint-override"><code>df[df.data1.str.split("_", expand=True)[1] == df.data2.str.split("_", expand=True)[1]]
------------------------------------------
data1 ... | get pandas rows with same specific word in two columns | python|python-3.x|pandas|dataframe | 1 | 42 | 3 | 72,934,787 | 72,934,787 | 2 | true | 2022-07-11T06:43:48.197Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
get pandas rows with same specific word in two columns<p>I have a pandas dataframe that looks like this</p>
<pre><code> data1 data2
0 o... |
72,935,968 | Pandas str.extract() regex to extract city info<p>I have a pandas df of addresses like this:</p>
<pre><code>df['address']
0. ALL that certain piece, parcel or tract of land situate, lying and being in the City
of Travelers Rest, County of Greenville, State of South Carolina
1. Townes Street on the West, in the Ci... | <p>One option for the example data could be matching the following words starting with a capital A-Z and optional non whitespace chars excluding a comma:</p>
<pre><code>\bCity\s+of\s+([A-Z][^\s,]+(?:\s+[A-Z][^\s,]+)*)
</code></pre>
<p><a href="https://regex101.com/r/roxrWu/1" rel="nofollow noreferrer">Regex demo</a></p... | Pandas str.extract() regex to extract city info | python|regex|pandas | 0 | 42 | 1 | 72,936,026 | 72,936,026 | 2 | true | 2022-07-11T08:57:22.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas str.extract() regex to extract city info<p>I have a pandas df of addresses like this:</p>
<pre><code>df['address']
0. ALL that certain piece, parcel ... |
72,934,473 | Retrieve Path by Wildcard in custom taget CmakeLists.txt<p>I'm trying to create a custom target in a CmakeList.txt which I'm planning to execute during the build process with Conan. When executing the build with <code>conan build</code> the sources are compiled and built, creating an output file with a dynmic name and ... | <p>If you want to manipulate created library after it is built, you can use <code>add_custom_command</code> with generator expressions:</p>
<pre><code>#create library
add_library(my_lib STATIC my_lib.cpp)
# list the contents of a newly created library
add_custom_command(
TARGET my_lib
POST_BUILD
COMMAND a... | Retrieve Path by Wildcard in custom taget CmakeLists.txt | c++|cmake|target|conan | 0 | 42 | 1 | 72,936,522 | 72,936,522 | 2 | true | 2022-07-11T06:26:10.437Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Retrieve Path by Wildcard in custom taget CmakeLists.txt<p>I'm trying to create a custom target in a CmakeList.txt which I'm planning to execute during the b... |
72,946,937 | pandas string replace multiple character in a cell<pre><code>df = pd.DataFrame({'a': ['123']})
a
0 123
</code></pre>
<p>I want to replace 1 with 4, 2 with 5, and 3 with 6</p>
<p>So this is the desired output</p>
<pre><code> a
0 456
</code></pre>
<p>How can I achieve this using <code>pd.str.replace()</code> ?... | <p>Try <code>.replace</code> (not <code>.str.replace</code>) with option <code>regex=True</code>:</p>
<pre><code>df['a'] = df['a'].replace({'1':'4', '2':'5', '3':'6'}, regex=True)
</code></pre>
<p>Output:</p>
<pre><code> a
0 456
</code></pre> | pandas string replace multiple character in a cell | python|pandas|str-replace | 0 | 42 | 1 | 72,946,960 | 72,946,960 | 2 | true | 2022-07-12T04:09:53.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pandas string replace multiple character in a cell<pre><code>df = pd.DataFrame({'a': ['123']})
a
0 123
</code></pre>
<p>I want to replace 1 with 4, 2 w... |
72,960,393 | Order x-axis numerically ggplot2<p>I have the following dataframe (df):</p>
<pre><code># A tibble: 6 × 2
chromosome n
<chr> <int>
1 TcChr34-S 16
2 TcChr41-S 10
3 TcChr28-S 9
4 TcChr11-S 2
5 TcChr2-S 1
6 TcChr5-S 1
</code></pre>
<p>I want to make a barplot using ggp... | <p>To order in ascending order of the numbers of <code>chromosome</code>, we have to pick out the numbers out of the string. This could be done with <code>readr</code>s <code>parse_number()</code> function (by the way up to this time my favorite function). The whole process is wrapped into to ´forcats´ ´fct_reorder´ fu... | Order x-axis numerically ggplot2 | r|ggplot2 | 2 | 42 | 1 | 72,960,460 | 72,960,460 | 2 | true | 2022-07-13T02:52:37.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Order x-axis numerically ggplot2<p>I have the following dataframe (df):</p>
<pre><code># A tibble: 6 × 2
chromosome n
<chr> <int>
1 ... |
72,964,457 | applying function to select columns in list of dataframes in r<p>I have a list of 1000s of dataframes.</p>
<p>Each one has the following structure:</p>
<pre><code>structure(list(frame = c(222, 223, 224, 225, 226, 227, 228, 229,
230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
243, 244, 245, 246, 247, ... | <p>You can use the same code that you used for a single data frame:</p>
<pre class="lang-r prettyprint-override"><code>test <- lapply(list, function(x) {
x[c('id','x','y')] <- na.locf(x[c('id','x','y')], na.rm = F, maxgap = 20)
x
})
</code></pre> | applying function to select columns in list of dataframes in r | r|lapply | 0 | 42 | 1 | 72,964,937 | 72,964,937 | 2 | true | 2022-07-13T10:06:15.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
applying function to select columns in list of dataframes in r<p>I have a list of 1000s of dataframes.</p>
<p>Each one has the following structure:</p>
<pre>... |
72,975,740 | How do I extract standard errors or variation from predicted ordinal logistic regression analyses?<p>I am undertaking a ordinal logistic regression using R package <code>MASS</code>.</p>
<p>For example:</p>
<pre class="lang-r prettyprint-override"><code>library(MASS)
house.plr <- polr(Sat ~ Infl + Type + Cont, weigh... | <p>First, your predicted values are the predicted probability of each outcome for each observation. It is not the predicted mean on the response scale.</p>
<p>Second, you can use the <code>marginaleffects</code> package to get the standard errors for the predicted probabilities and then calculate the confidence interva... | How do I extract standard errors or variation from predicted ordinal logistic regression analyses? | r|regression|predict | 1 | 42 | 1 | 72,976,906 | 72,976,906 | 2 | true | 2022-07-14T05:45:20.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I extract standard errors or variation from predicted ordinal logistic regression analyses?<p>I am undertaking a ordinal logistic regression using R p... |
72,978,769 | Python: Change a JSON value<p>Let's say I have the following JSON file named <code>output</code>.</p>
<pre><code>{'fields': [{'name': 2, 'type': 'Int32'},
{'name': 12, 'type': 'string'},
{'name': 9, 'type': 'datetimeoffset'},
}],
'type': 'struct'}
</code></pre>
<p>If <code>type</code> key has a value <code>dateti... | <p>You can try this out:</p>
<pre><code>substitute = {"Int32": "integer", "datetimeoffset": "dateTime"}
x = {'fields': [
{'name': 2, 'type': 'Int32'},
{'name': 12, 'type': 'string'},
{'name': 9, 'type': 'datetimeoffset'}
],'type': 'struct'}
for i in range(len(x[... | Python: Change a JSON value | python|json | -1 | 42 | 3 | 72,978,889 | 72,978,889 | 2 | true | 2022-07-14T10:06:41.857Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Change a JSON value<p>Let's say I have the following JSON file named <code>output</code>.</p>
<pre><code>{'fields': [{'name': 2, 'type': 'Int32'},
... |
72,985,253 | STL algorithm to get a per-vector-component min/max<p>I have a <code>std::vector<vec3> points</code> where <code>vec3</code> has <code>float x, y, z</code>.</p>
<p>I want to find the min/max bounds of all the points. I.e. the min and max of all <code>vec3::x</code>, <code>vec3::y</code>, <code>vec3::z</code> sepa... | <p>Of course you can use a lambda with <code>std::reduce</code> on a <code>std::pair<vec3, vec3></code> collext both min and max at the same time.</p>
<pre><code>std::pair<vec3, vec3> minmax_elements(const std::vector<vec3>& points)
{
assert(!points.empty());
return std::reduce(points.cbeg... | STL algorithm to get a per-vector-component min/max | c++|vector|stl|stl-algorithm | 0 | 42 | 1 | 72,985,549 | 72,985,549 | 2 | true | 2022-07-14T18:38:09.553Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
STL algorithm to get a per-vector-component min/max<p>I have a <code>std::vector<vec3> points</code> where <code>vec3</code> has <code>float x, y, z</c... |
72,987,323 | javascript / for-loop even and odd letters from text<p>I want to select even letters and odd letters from text, console.log show mi
(199) [' ', ' ', ' ', ' ', ' '.... How can I fix it ?</p>
<pre><code>
btn.addEventListener('click', function() {
//console.log(newText) ok
let evenletters = []
for (let i = 0; i ... | <p>I'm guessing you are coming from C or another language that can treat a char as an int. What you want to do in JS is use <code>.charCodeAt</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-js lang-js pretty... | javascript / for-loop even and odd letters from text | javascript|for-loop | -1 | 42 | 1 | 72,987,359 | 72,987,359 | 2 | true | 2022-07-14T22:36:31.907Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
javascript / for-loop even and odd letters from text<p>I want to select even letters and odd letters from text, console.log show mi
(199) [' ', ' ', ' ', ' '... |
72,988,929 | Handle testing one text or another text in Cypress test (language variations)<p>The application I'm testing has multi-language capability, so I need to be able to test for text that can be one thing or another and either should pass the test.</p>
<p>Although it's a conditional test, I don't want to use <code>if()</code... | <p>One way to conditionally check for one string or another is to create a dictionary of alternate words, for example</p>
<pre class="lang-js prettyprint-override"><code>const dictionary = {
greeting: ['hello', 'hola', 'namaste'],
...
}
</code></pre>
<p>Then apply it in the test as a regular expression with the use... | Handle testing one text or another text in Cypress test (language variations) | cypress | 2 | 42 | 3 | 72,988,973 | 72,988,973 | 2 | true | 2022-07-15T04:04:33.910Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Handle testing one text or another text in Cypress test (language variations)<p>The application I'm testing has multi-language capability, so I need to be ab... |
72,996,694 | Can't call smart contract from Python<p>I'm trying to call an Algorand smart contract from with python.</p>
<p><a href="https://i.stack.imgur.com/gLMC3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gLMC3.png" alt="enter image description here" /></a></p>
<p>I can't get my private key using mnemonic... | <p>it's super simple, don't put commas between the words.</p> | Can't call smart contract from Python | python|smartcontracts|algorand | 1 | 42 | 1 | 72,996,778 | 72,996,778 | 2 | true | 2022-07-15T15:55:56.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't call smart contract from Python<p>I'm trying to call an Algorand smart contract from with python.</p>
<p><a href="https://i.stack.imgur.com/gLMC3.png" ... |
73,004,110 | TS doesn't see default props in React function component<p>My code</p>
<pre><code>interface ButtonProps {
onClick?: () => void
}
const Button: FC<ButtonProps> = ({ onClick }) => {
const wrapClick = () => {
onClick() // TS2722: Cannot invoke an object which is possibly 'undefined'.
}
return ... | <p>The onClick property in the props object is marked as optional by using a question mark, so we can't directly invoke the function.</p>
<p>To solve the error, use the optional chaining (?.) operator when calling the function.</p>
<pre><code>import { FC } from "react";
interface ButtonProps {
onClick?: ()... | TS doesn't see default props in React function component | reactjs|typescript | 0 | 42 | 2 | 73,004,346 | 73,004,346 | 2 | true | 2022-07-16T12:14:17.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TS doesn't see default props in React function component<p>My code</p>
<pre><code>interface ButtonProps {
onClick?: () => void
}
const Button: FC<Bu... |
73,006,251 | Angular html simple binding<p>I have used this post to crate binding:</p>
<blockquote>
<p><a href="https://stackoverflow.com/questions/31548311/angular-html-binding/42296510#42296510">Angular HTML binding</a></p>
</blockquote>
<p>but messed up with an error:</p>
<blockquote>
<p>Property 'value' does not exist on type '... | <pre class="lang-html prettyprint-override"><code><input [value]="test" (input)="onInput($event)">
</code></pre>
<pre class="lang-js prettyprint-override"><code>onInput(event: Event) {
this.test = ($event.target as HTMLInputElement).value;
}
</code></pre> | Angular html simple binding | html|angular | 0 | 42 | 1 | 73,006,311 | 73,006,311 | 2 | true | 2022-07-16T17:15:51.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular html simple binding<p>I have used this post to crate binding:</p>
<blockquote>
<p><a href="https://stackoverflow.com/questions/31548311/angular-html-... |
73,008,969 | Exclude children from :nth-child(n) / only include certain children<p>Is it possible to only select certain children? Say, the 2nd, 3rd, 5th and 7th?/exclude the 1st and 6th?</p>
<p>This selects all div, and I know e.g <code>n+2</code> starts at 2 onwards and <code>2</code> is only the 2nd.</p>
<pre><code>div:nth-child... | <p>It may be clearer to exclude certain children rather than find a selector for all those to be included. This depends on the exact use case of course.</p>
<p>For the example in the question this snippet specifies two children which are to be excluded using a :not pseudo class:</p>
<p><div class="snippet" data-lang="j... | Exclude children from :nth-child(n) / only include certain children | css|css-selectors | 0 | 42 | 2 | 73,009,150 | 73,009,150 | 2 | true | 2022-07-17T02:53:56.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Exclude children from :nth-child(n) / only include certain children<p>Is it possible to only select certain children? Say, the 2nd, 3rd, 5th and 7th?/exclude... |
73,013,028 | add a key to a pandas dataframe where the column value is json<p>I have a pandas dataframe like this</p>
<pre><code>import pandas as pd
technologies = [
("... | <p>Here's a solution using a function so our lambda does not get too long:</p>
<pre class="lang-py prettyprint-override"><code>def add_key(data: str) -> dict:
data = json.loads(data)
data["madeby"] = "Bae systems"
return data
df["json"] = df.apply(lambda row: add_key(row[&q... | add a key to a pandas dataframe where the column value is json | python|pandas | 0 | 42 | 1 | 73,013,235 | 73,013,235 | 2 | true | 2022-07-17T15:27:00.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
add a key to a pandas dataframe where the column value is json<p>I have a pandas dataframe like this</p>
<pre><code>import pandas as pd ... |
73,019,041 | Pandas - check if a value has appeared in previous rows<p>I have a column in DataFrame that looks like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Col1</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
</tr>
<tr>
<td>B</td>
</tr>
<tr>
<td>A</td>
</tr>
<tr>
<td>C</td>
</tr>
<tr>
<td>B</t... | <p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.duplicated.html" rel="nofollow noreferrer"><code>Series.duplicated</code></a> with invert mask by <code>~</code>, alterntive solution is use <a href="http://%5Bandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.dupli... | Pandas - check if a value has appeared in previous rows | python|pandas|dataframe | 2 | 42 | 2 | 73,019,058 | 73,019,058 | 2 | true | 2022-07-18T08:01:01.113Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas - check if a value has appeared in previous rows<p>I have a column in DataFrame that looks like this:</p>
<div class="s-table-container">
<table class... |
73,023,936 | Null check in foreach loop of JArray.Children()<p>I want to check if JArray.Children() is null in the foreach loop.
I can do:</p>
<pre><code> if (jArrayJson == null)
{
return;
}
</code></pre>
<p>but I want to do it in the foreach.
This is the different things I have tried:</p>
<pre><c... | <p>Apparently, <code>Children()</code> returns a custom <code>JEnumerable</code> type that is actually a struct, so cannot be null, which makes the null propagation awkward. So you could make this work using your first attempt, with a <code>JToken</code> in the type parameter (like Johnathan Barclay already suggested)... | Null check in foreach loop of JArray.Children() | c#|foreach|null | 1 | 42 | 1 | 73,024,114 | 73,024,114 | 2 | true | 2022-07-18T14:25:00.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Null check in foreach loop of JArray.Children()<p>I want to check if JArray.Children() is null in the foreach loop.
I can do:</p>
<pre><code> if (jArr... |
73,024,300 | TypeError a bytes-like object is required, not 'str' (Pydub)<p>I'm getting:</p>
<pre><code>Exception has occurred: TypeError
a bytes-like object is required, not 'str'
</code></pre>
<p>When I run the following code:</p>
<pre><code>from pydub import AudioSegment
from pydub.utils import which
AudioSegment.converter = wh... | <p>Error message seems pretty straightforward : <code>AudioSegment</code> class constructor is expecting a bytes object and you are passing a String instead.</p>
<p>According to the <a href="https://github.com/jiaaro/pydub" rel="nofollow noreferrer">pydub doc</a>, you could simply call <code>from_wav()</code> method by... | TypeError a bytes-like object is required, not 'str' (Pydub) | python|ffmpeg|typeerror|pydub | 0 | 42 | 2 | 73,024,411 | 73,024,411 | 2 | true | 2022-07-18T14:50:45.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TypeError a bytes-like object is required, not 'str' (Pydub)<p>I'm getting:</p>
<pre><code>Exception has occurred: TypeError
a bytes-like object is required,... |
72,910,903 | Is there a way to vectorize adding missing months using resample?<p>I am trying to add missing months for each <code>ID</code>. Added months should have info on <code>ID</code> and <code>year_month</code>, and NaN for Product. My code achieves this using <code>apply()</code>, but is slow -- I am looking for a vectorize... | <p>Not sure if faster, but simplier code is:</p>
<pre><code>df = df.sort_index().groupby('ID').apply(lambda x: x.asfreq('MS'))
</code></pre>
<hr />
<pre><code>df1 = df.groupby('ID').apply(lambda x: x.asfreq('MS'))
df2 = df.set_index(df.index).groupby('ID').apply(add_missing_months)
print (df1.equals(df2))
True
</code>... | Is there a way to vectorize adding missing months using resample? | python-3.x|pandas|vectorization|pandas-resample | 2 | 42 | 2 | 72,910,955 | 72,910,955 | 2 | true | 2022-07-08T11:45:02.633Z | 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 vectorize adding missing months using resample?<p>I am trying to add missing months for each <code>ID</code>. Added months should have info... |
72,911,213 | Get the closest value to another value of a dataframe<p>I have a df like this</p>
<pre><code> SYMBOL price gainddS8 gainddS7_5 gainddS7 gainddS6_5 \
102 1000SHIBUSDT 0.016049 -32.899520 -30.866404 -28.833288 -26.800171
9 ADAUSDT 0.572700 -15.371514 -2.5 -1.0 ... | <p>Use numpy indexing wth position of minimal values by <a href="https://numpy.org/doc/stable/reference/generated/numpy.argmin.html" rel="nofollow noreferrer"><code>numpy.argmin</code></a>:</p>
<pre><code>df1 = df.filter(like='gain')
pos = df1.sub(df['price'], axis=0).abs().to_numpy().argmin(axis=1)
df['closestvalue'] ... | Get the closest value to another value of a dataframe | python|pandas | 2 | 42 | 1 | 72,911,354 | 72,911,354 | 2 | true | 2022-07-08T12:11:44.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get the closest value to another value of a dataframe<p>I have a df like this</p>
<pre><code> SYMBOL price gainddS8 gainddS7_5 gainddS7... |
72,777,545 | Recyclerview is putting images from one object in multiple positions<p>So I have found the source of the problem. Inside my Adapter for my Recyclerview I am trying to check if the imageName is null or empty, if it isn't then we can get the image from the local storage and put it into the holder's ImageView. When doing ... | <p><code>RecyclerView</code>s <em>reuse</em> (recycle) their <code>ViewHolder</code>s, so in <code>onBindViewHolder</code> you're usually getting one that's already displaying stuff for another item. You need to update it so it looks right for your current item.</p>
<p>Here's what you're doing</p>
<pre><code>override f... | Recyclerview is putting images from one object in multiple positions | android|kotlin|user-interface|android-recyclerview|carousel | 1 | 42 | 1 | 72,778,386 | 72,778,386 | 2 | true | 2022-06-27T19:42:24.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Recyclerview is putting images from one object in multiple positions<p>So I have found the source of the problem. Inside my Adapter for my Recyclerview I am ... |
72,846,554 | How to align Stack View with 4 elements and Stack View with 5 elements in XIB?<p>I am creating a custom Numpad keyboard through xib.</p>
<p>The numpad has 4 rows: 3 rows with 5 buttons and 1 last row with 4 buttons.</p>
<p>I can't understand, how to align a width of a yellow button "=" to be equal of doubled ... | <p>You have what appears to be a lot of unneeded embedding in extra views and stack views...</p>
<p>Take a look at this:</p>
<p><a href="https://i.stack.imgur.com/mBWys.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mBWys.png" alt="enter image description here" /></a></p>
<p>Here's the source for th... | How to align Stack View with 4 elements and Stack View with 5 elements in XIB? | ios|swift|layout|uikit|xib | 0 | 42 | 1 | 72,846,885 | 72,846,885 | 2 | true | 2022-07-03T12:36:13.887Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to align Stack View with 4 elements and Stack View with 5 elements in XIB?<p>I am creating a custom Numpad keyboard through xib.</p>
<p>The numpad has 4 ... |
72,900,998 | Renaming files that have specific format like text.*<p>I have a folder containing 1000 coordination files with this pattern: coord.* (* is timestep that is starting from 0 and increased by 10000 each time (<code>coord.0</code> , <code>coord.10000</code> , ...). I want to rename all of them to <code>coordN.*</code> (kee... | <p>You can use <code>glob</code> for get all files with pattern <code>coord.*</code> in your path and rename them with <code>os.rename</code>.</p>
<pre><code>import os
import glob
path = 'Files/'
for file in glob.glob(path+'coord.*'):
f,s = file.split('.',1)
file_new = f+'N.'+s
os.rename(file, file_new)
<... | Renaming files that have specific format like text.* | python|rename | -5 | 42 | 1 | 72,901,108 | 72,901,108 | 2 | true | 2022-07-07T16:03:43.393Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Renaming files that have specific format like text.*<p>I have a folder containing 1000 coordination files with this pattern: coord.* (* is timestep that is s... |
72,872,031 | How do I create a segmented cumulative sum graph in Palantir Foundry Workshop?<p>I have some objects that represent maintenance jobs that look like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Due On</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>2021-12-01</td>
<td>open</td>... | <p>You can do this using a Foundry Function. Create a TypeScript functions repository and use the following code (see comments inline for an explanation):</p>
<pre class="lang-js prettyprint-override"><code>import { Function, Double, ThreeDimensionalAggregation, IRange, IRangeable, Timestamp, BucketKey, BucketValue } f... | How do I create a segmented cumulative sum graph in Palantir Foundry Workshop? | palantir-foundry|foundry-code-repositories|foundry-workshop|foundry-functions | 2 | 42 | 2 | 72,872,032 | 72,872,032 | 2 | true | 2022-07-05T15:32:12.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I create a segmented cumulative sum graph in Palantir Foundry Workshop?<p>I have some objects that represent maintenance jobs that look like this:</p>... |
72,932,411 | Numpy: using a 4D Boolean matrix to apply mathematical calculation to associated 3D matrix<p>I have a 4D Numpy matrix <code>E</code> containing Booleans and with shape (3, 3, 4, 3), which results from:</p>
<pre><code>import numpy as np
threshold = 2
A = np.array([ [ [90, 84, 88], [10, 30, 17], [7, 0, 4] ],
... | <p><code>A</code> has shape (4,3,3)</p>
<p><code>B</code> and <code>C</code> are based of off <code>A.T</code>, (3,3,4), with broadcasting, making a (3,3,4,4). This first 2 dimensions of <code>C</code> correspond to the last 2 of <code>A</code>.</p>
<p><code>D</code> and <code>E</code> further distance themselves with... | Numpy: using a 4D Boolean matrix to apply mathematical calculation to associated 3D matrix | python|numpy | 0 | 42 | 1 | 72,932,519 | 72,932,519 | 2 | true | 2022-07-10T23:00:55.813Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Numpy: using a 4D Boolean matrix to apply mathematical calculation to associated 3D matrix<p>I have a 4D Numpy matrix <code>E</code> containing Booleans and ... |
72,989,231 | How to set cursor position and color of a pattern in assembly language?<p>I'm trying to set the cursor position and color of a specific pattern in assembly; specifically, the pattern is a parallelogram (once again, haha) and its color is red. I have already tried putting only the block of code for coloring at the start... | <h2>What did you expect here?</h2>
<blockquote>
<pre><code>mov ah,09h
mov cx,10
mov bl,74H
mov dx,30h
int 10h
</code></pre>
</blockquote>
<p>This code writes 10 RedOnWhite spaces on the screen. The <code>mov dx,30h</code> instruction has no effect, and the AL register happens to contain 0 and therefore BIOS outputs spa... | How to set cursor position and color of a pattern in assembly language? | assembly|x86-16|tasm|dosbox | 1 | 42 | 1 | 73,005,647 | 73,005,647 | 2 | true | 2022-07-15T05:01:23.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to set cursor position and color of a pattern in assembly language?<p>I'm trying to set the cursor position and color of a specific pattern in assembly; ... |
73,004,309 | open row from List located on second TabItem from first TabItem<p>I have got two tabItems in TabView with FirstScreen and PlacesScreen. FirstScreen contains picker with items located in array in the model PlacesViewModel. The same model is used for the list from the second tabItem on PlacesScreen. By choosing a particu... | <p>You can use NavigationLink(tag: selection:). Here is a fully functional demo based on your code.</p>
<p><a href="https://i.stack.imgur.com/MG71a.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MG71a.gif" alt="enter image description here" /></a></p>
<pre><code>struct ContentView: View {
@... | open row from List located on second TabItem from first TabItem | swiftui | 1 | 42 | 1 | 73,004,943 | 73,004,943 | 2 | true | 2022-07-16T12:41:30.793Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
open row from List located on second TabItem from first TabItem<p>I have got two tabItems in TabView with FirstScreen and PlacesScreen. FirstScreen contains ... |
72,802,112 | R joining on counts of elements in a vector to matching index in a dataframe<p>I have a dataframe df that looks like this:</p>
<pre><code> indx
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
df<-structure(list(indx = 1:10), row.names = c(NA, 10L), class = "data.frame")
<... | <p>You can use merge.</p>
<pre class="lang-r prettyprint-override"><code>x <- merge(df, as.data.frame(table(vec)), by.x = "indx", by.y = "vec", all.x = TRUE)
names(x) <- c("indx", "vec_counts")
x$vec_counts[is.na(x$vec_counts)] <- 0
x
# indx vec_counts
# 1 ... | R joining on counts of elements in a vector to matching index in a dataframe | r | 0 | 42 | 2 | 72,802,221 | 72,802,221 | 2 | true | 2022-06-29T13:17:59.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R joining on counts of elements in a vector to matching index in a dataframe<p>I have a dataframe df that looks like this:</p>
<pre><code> indx
1 1
2 ... |
72,855,902 | Failure of bash script called via command substitution does not stop parent script<p>I have a bash script (<code>exp1.sh</code>)</p>
<pre class="lang-bash prettyprint-override"><code>#!/bin/bash
set -e
for row in $(./exp2.sh);
do
echo $?
echo outer=$row
done
echo "continuing"
</code></pre>
<p>which inv... | <p>Your idea for a solution is good but <code>a=$(./exp2.sh)</code> doesn't populate an array, it populates a string and then <code>for row in $a</code> is leaving the contents of that string unquoted and so open to the shell for interpretation. You can do this to make/use <code>a</code> as an array if the output of <c... | Failure of bash script called via command substitution does not stop parent script | linux|bash|shell|error-handling | 0 | 42 | 1 | 72,859,026 | 72,859,026 | 2 | true | 2022-07-04T11:22:09.293Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Failure of bash script called via command substitution does not stop parent script<p>I have a bash script (<code>exp1.sh</code>)</p>
<pre class="lang-bash pr... |
72,844,739 | Annotate points in Matplotlib<p>I want to annotate points on a plot using the coordinates in the list <code>I5</code>. But running into an error. The expected output is attached.</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
I5 = [[(0.5, -0.5), (1.5, -0.5)], [(0.5, -0.5), (0.5, -1.5)], [(1.5, -0.5)... | <pre><code>import numpy as np
import matplotlib.pyplot as plt
I5 = [[(0.5, -0.5), (0.5, -0.5)], [(0.5, -1.5), (0.5, -1.5)], [(1.5, -0.5), (1.5, -0.5)], [(1.5, -1.5), (1.5, -1.5)]]
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
N=3 #len(inv_r)+1
X = np.arange(0,N,1)
Y = -X
for i in range(0,len(I5)):
plt.anno... | Annotate points in Matplotlib | python|numpy|matplotlib | 1 | 42 | 1 | 72,845,035 | 72,845,035 | 2 | true | 2022-07-03T07:44:45.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Annotate points in Matplotlib<p>I want to annotate points on a plot using the coordinates in the list <code>I5</code>. But running into an error. The expecte... |
72,789,124 | Google sheets converts 01/01/0001 into 01/01/2001<p>How to make it stops? Tried many different formattings and it gives no difference. Could not find anything in settings. Googling only gives how to stop google sheets from auto-formatting numbers into dates, which is not the problem.</p> | <p>also you could use:</p>
<pre><code>="01/01/0001"
</code></pre>
<p>to calculate the age vertically try:</p>
<pre><code>=SUMPRODUCT(REGEXEXTRACT(B1:B2, "\d{4}")*{-1; 1})
</code></pre>
<p><a href="https://i.stack.imgur.com/Jt45f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jt45... | Google sheets converts 01/01/0001 into 01/01/2001 | date|google-sheets|formatting|string-formatting|number-formatting | 1 | 42 | 2 | 72,792,025 | 72,792,025 | 2 | true | 2022-06-28T15:18:01.090Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google sheets converts 01/01/0001 into 01/01/2001<p>How to make it stops? Tried many different formattings and it gives no difference. Could not find anythin... |
72,799,133 | finally: txt.close() SyntaxError in Python<p>I can not use finally:txt.close() to close a txt file. Please help me out. Thank you!</p>
<pre><code>txt = open('temp5.txt','r')
for i in range(5):
try:
10/i-50
print(i)
except:
print('error:', i)
finally:
txt.close()
</code></pre... | <p>Your <code>try</code> and <code>except</code> blocks exist only in your <code>for loop</code> and are executed for every iteration of the loop. Because of this, your <code>finally</code> block will not work as it has no <code>try</code> or <code>except</code> part. If you want to close the file after the loop, you c... | finally: txt.close() SyntaxError in Python | python|finally | -1 | 42 | 2 | 72,799,208 | 72,799,208 | 2 | true | 2022-06-29T09:38:00.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
finally: txt.close() SyntaxError in Python<p>I can not use finally:txt.close() to close a txt file. Please help me out. Thank you!</p>
<pre><code>txt = open(... |
73,009,120 | Looping through a product of two arrays<p>I have this vars file in Ansible:</p>
<pre class="lang-yaml prettyprint-override"><code>for_create:
client: ["VK","SB"]
folders: ["toula","tina"]
for_delete:
client: ["VK","SB"]
folders: ["invoices",... | <p>Iterate the lists <a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-nested-with-cartesian" rel="nofollow noreferrer"><em>with_nested</em></a>. For example,</p>
<pre class="lang-yaml prettyprint-override"><code> - debug:
msg: "folder {{ item.1 }} for client {{ item.... | Looping through a product of two arrays | ansible | 2 | 42 | 1 | 73,009,384 | 73,009,384 | 2 | true | 2022-07-17T03:42:38.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Looping through a product of two arrays<p>I have this vars file in Ansible:</p>
<pre class="lang-yaml prettyprint-override"><code>for_create:
client: [&quo... |
72,965,750 | compare non-numeric values in two rows in a column pandas<p>I asked this question and the answer provided worked for me very well.</p>
<p><a href="https://stackoverflow.com/questions/72956672/compare-value-in-two-rows-in-a-column-pandas#72956881">compare value in two rows in a column pandas</a></p>
<p>However, now I ha... | <p>You can try groupby <code>color</code> then mask <code>text</code> column in each group</p>
<pre class="lang-py prettyprint-override"><code>df['text'] = (df.sort_values(['color', 'days'])
.groupby('color', as_index=False, group_keys=False)
.apply(lambda g: g['text'].mask(g['char'].ne(g['c... | compare non-numeric values in two rows in a column pandas | python|pandas|compare | 0 | 42 | 1 | 72,965,897 | 72,965,897 | 2 | true | 2022-07-13T11:47:43.007Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
compare non-numeric values in two rows in a column pandas<p>I asked this question and the answer provided worked for me very well.</p>
<p><a href="https://st... |
72,963,544 | how to get unpredictable directory path with python?<p>first, I will describe in short the problem I want to solve:</p>
<p>I have a system UNIX based, that running an automatic run that causing images creation.</p>
<p>those images, are saving in a directory that creating during the run and the name of the directory is ... | <p>Not sure how you use <code>pyautogui</code> for that, but the proper solution would be search the directory structure with some <a href="https://docs.python.org/3/library/glob.html" rel="nofollow noreferrer">glob patterns</a></p>
<p>Example:</p>
<pre><code>from pathlib import Path
const_path = Path("const_path... | how to get unpredictable directory path with python? | python|unix|path | 1 | 42 | 1 | 72,963,794 | 72,963,794 | 2 | true | 2022-07-13T08:58:57.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to get unpredictable directory path with python?<p>first, I will describe in short the problem I want to solve:</p>
<p>I have a system UNIX based, that r... |
72,992,596 | How to unmerge in GITHUB<p>I am having an issue with GitHub, which I believe to be easy to resolve but don’t know exactly how to find the solution, hope someone can give me some directions.</p>
<p>I have my project in different branches, where I use the main branch for production and different branches for different fe... | <p>If you've already reverted the merge locally, you can do <code>git push --force origin master</code> to forcibly overwrite the master branch with your local changes. <strong>However</strong>, you should only do this if you're the only person using this branch or if there are very few contributors. I have a more deta... | How to unmerge in GITHUB | git|github | 0 | 42 | 2 | 73,001,888 | 73,001,888 | 2 | true | 2022-07-15T10:28:41.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to unmerge in GITHUB<p>I am having an issue with GitHub, which I believe to be easy to resolve but don’t know exactly how to find the solution, hope some... |
72,840,407 | Binary Shift displaying different results in VB.NET to C#<p>I'm really confused as to why the following code gives me different results when run in VB.NET as opposed to C#. I've read that there are some binary shift differences between the two languages but I can't work out what I need to do to make VB.NET show the sam... | <p>From the <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators#left-shift-operator-" rel="nofollow noreferrer">documentation for the C# <code><<</code> operator</a>:</p>
<blockquote>
<p>Because the shift operators are defined only for the int, uint, lo... | Binary Shift displaying different results in VB.NET to C# | c#|vb.net | 0 | 42 | 1 | 72,841,290 | 72,841,290 | 2 | true | 2022-07-02T15:47:43.200Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Binary Shift displaying different results in VB.NET to C#<p>I'm really confused as to why the following code gives me different results when run in VB.NET as... |
72,911,403 | How to have the result of both values when they have the same frequency in Excel?<p>I want to have the final result based on the frequency. As shown in the figure, in the red area, V1 shows up more, so of course the final result is "V1".
<a href="https://i.stack.imgur.com/q7FN3.png" rel="nofollow noreferrer">... | <p>Use <a href="https://support.microsoft.com/en-us/office/mode-mult-function-50fd9464-b2ba-4191-b57a-39446689ae8c" rel="nofollow noreferrer"><code>MODE.MULT()</code></a>:</p>
<p><a href="https://i.stack.imgur.com/uVVRZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uVVRZ.png" alt="enter image descr... | How to have the result of both values when they have the same frequency in Excel? | excel|excel-formula|frequency | 2 | 42 | 1 | 72,911,645 | 72,911,645 | 2 | true | 2022-07-08T12:26:28.760Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to have the result of both values when they have the same frequency in Excel?<p>I want to have the final result based on the frequency. As shown in the f... |
72,804,154 | Removing anything after first newline in SQL Server select statement<p>I have a column 'Name' that contains newlines. We want to remove the newline as well as anything after the first instance of a newline.</p>
<p>The first step I did was replacing a newline with an empty string and it worked:</p>
<pre><code>REPLACE(RE... | <p>You aren't handling values that <em>don't</em> have a carriage return. As a result the position returned by <code>CHARINDEX</code> would be <code>0</code>, and you can't have the -1 left most characters.</p>
<p>Add a carriage return to the end of your string, and then get the <code>CHARINDEX</code>:</p>
<pre class="... | Removing anything after first newline in SQL Server select statement | sql|sql-server | 1 | 42 | 1 | 72,804,210 | 72,804,210 | 3 | true | 2022-06-29T15:33:49.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Removing anything after first newline in SQL Server select statement<p>I have a column 'Name' that contains newlines. We want to remove the newline as well a... |
72,809,562 | Select going wrong<p>I need to generate this output from this db table</p>
<p>Expected output: Neil</p>
<p>-- Example case create statement:</p>
<pre><code>CREATE TABLE poll
(
id INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(30) NOT NULL,
answer CHAR(1)
);
INSERT INTO poll (id, name, answer) VALUES (1, 'Neil... | <p>Comparing <code>NULL</code> against any string literal will always return false. So, you should also include a null check in your logic:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT *
FROM poll
WHERE name LIKE 'N%' AND
(answer NOT IN ('N', 'Y') OR answer IS NULL);
</code></pre> | Select going wrong | sql | 0 | 42 | 2 | 72,809,588 | 72,809,588 | 3 | true | 2022-06-30T02:01:23.487Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Select going wrong<p>I need to generate this output from this db table</p>
<p>Expected output: Neil</p>
<p>-- Example case create statement:</p>
<pre><code>C... |
72,811,428 | Filter pandas dataframe by condition for each row<pre><code>df= pd.DataFrame({'Age': [30, 35, 37, 33, 34, 30],
'Name': ['A', 'B', 'B', 'A', 'A', 'B']})
</code></pre>
<pre><code>df2= pd.DataFrame({'Age': [30, 35], 'Name': ['A', 'B']})
</code></pre>
<p>How would I go on about filtering df for df2 so tha... | <p>IIUC, you can use <code>merge</code> then <code>query</code>:</p>
<pre><code>out = df.merge(df2, on='Name', suffixes=(None, '2')).query('Age < Age2')[df.columns]
print(out)
# Output
Age Name
5 30 B
</code></pre>
<p>Step by step:</p>
<pre><code># Merge data
>>> out = df.merge(df2, on='Name', suff... | Filter pandas dataframe by condition for each row | pandas | -1 | 42 | 3 | 72,811,604 | 72,811,604 | 3 | true | 2022-06-30T06:53:33.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filter pandas dataframe by condition for each row<pre><code>df= pd.DataFrame({'Age': [30, 35, 37, 33, 34, 30],
'Name': ['A', 'B', 'B', 'A',... |
72,812,366 | 'tuple' object has no attribute 'x'<p><a href="https://i.stack.imgur.com/FtwAW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FtwAW.png" alt="enter image description here" /></a></p>
<p>In function mid(a, b), I cannot access value of object a, b such as x, y, z.<br />
I think my class point composed... | <p>Think this is a typo</p>
<pre><code>next.append(my_length(mid((p, q), q), mid(r, s)))
</code></pre>
<p>Your call to <code>mid</code> is passing a tuple, <code>(p, q)</code> as the first argument instead of a point. I imagine that should be <code>mid(mid(p,q), q)</code></p>
<pre><code>next.append(my_length(mid(mid(p,... | 'tuple' object has no attribute 'x' | python | -3 | 42 | 1 | 72,812,506 | 72,812,506 | 3 | true | 2022-06-30T08:11:34.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
'tuple' object has no attribute 'x'<p><a href="https://i.stack.imgur.com/FtwAW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FtwAW.png" ... |
72,816,856 | How to read a list in a text file in python<p>I have this list</p>
<pre><code>l1=[[[0,1,2,3,4],[5,6,7]],[8,9,10],[11,12,13,14]]
</code></pre>
<p>and I save this list in a text file</p>
<pre><code>with open('l1.txt', 'w') as f1:
f1.write(str(l1))
</code></pre>
<p>Now I have a text file with the list.
How can I rea... | <p>As @Cardstdani mentioned, you can try to use <code>eval</code>. However, I suggest avoiding eval in all but the rarest of cases.</p>
<p>I would suggest serialising and deserialising it in some nice, way, such as using JSON:</p>
<p>Save:</p>
<pre class="lang-py prettyprint-override"><code>import json
l1=[[[0,1,2,3,4... | How to read a list in a text file in python | python|list|text | 0 | 42 | 4 | 72,816,930 | 72,816,930 | 3 | true | 2022-06-30T13:40:20.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to read a list in a text file in python<p>I have this list</p>
<pre><code>l1=[[[0,1,2,3,4],[5,6,7]],[8,9,10],[11,12,13,14]]
</code></pre>
<p>and I save t... |
72,828,944 | java: bad operand types for binary operator '<'<p>today guys i was doing some coding in java. i was creating a game following a tutorial. ut i found this error:</p>
<pre><code>package net.mcreborn.fs;
import java.util.Random;
public class Render2 extends Render1
{
public Render1 render;
public void Render1()... | <p>Change <code>render.pixels</code> to <code>render.pixels.length</code>.</p>
<p>By the way, you need to allocate the <code>pixels</code> property, otherwise you'll get a <code>NullPointerException</code> at runtime, as it is <code>null</code> by default.</p> | java: bad operand types for binary operator '<' | java | -1 | 42 | 1 | 72,828,984 | 72,828,984 | 3 | true | 2022-07-01T11:59:13.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
java: bad operand types for binary operator '<'<p>today guys i was doing some coding in java. i was creating a game following a tutorial. ut i found this err... |
72,885,831 | How to drop rows in R with almost the same column value?<p>I have a dataset with a column of names. I would like to drop rows with the lesser "P" value, if there exists one with a higher value. For example, in the dataset below, I would like to drop the row ID's 3 and 5 since there exists a 'Texas P5' and a '... | <p>Here is a base R way. Use <code>ave</code> to split the data by <code>Name</code> excluding the numbers, and check which group element is equal to its greatest element. <code>ave</code> returns a vector of the same class as its input, in this case character. So coerce to logical and subset the original data frame.</... | How to drop rows in R with almost the same column value? | r|data-cleaning|data-wrangling | 2 | 42 | 4 | 72,885,986 | 72,885,986 | 3 | true | 2022-07-06T15:02:03.273Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to drop rows in R with almost the same column value?<p>I have a dataset with a column of names. I would like to drop rows with the lesser "P" v... |
72,885,904 | table of hash: efficiently count hashes matching a key<p>I want to check the json output of ip -j adds show eno1 in perl.
I want to count how many ipv4 addr the Nic has. I still need the ipv6 info so I want to avoir running twice /usr/bin/ip command with the -4 and then -6 flag.</p>
<p>For now I can access to the ip in... | <p>I think this is what you want.</p>
<p><code>$nic->{addr_info}</code> is a reference to an array where each element describes one of the IP addresses attached to the interface.</p>
<p>So <code>@{ $nic->{addr_info} }</code> dereferences that array so you can now pass it to functions that require arrays or lists.... | table of hash: efficiently count hashes matching a key | arrays|json|perl|hash | 1 | 42 | 1 | 72,886,405 | 72,886,405 | 3 | true | 2022-07-06T15:07:11.527Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
table of hash: efficiently count hashes matching a key<p>I want to check the json output of ip -j adds show eno1 in perl.
I want to count how many ipv4 addr ... |
72,897,203 | GetSelectedItem from TableView JavaFX issue<p>I have some issue with getSelectedRow. I can't make method that puts text from table's row to textfield. I tried to make <code>table.setOnMouseClicked((MouseEvent event) -> {getTextFromSelectedRow();});</code></p>
<p>but everytime got <code>Cannot infer functional interf... | <p>Import is wrong.</p>
<p>Don't use:</p>
<pre><code>java.awt.event.MouseEvent
</code></pre>
<p>Use:</p>
<pre><code>javafx.scene.input.MouseEvent
</code></pre> | GetSelectedItem from TableView JavaFX issue | java|javafx | 0 | 42 | 1 | 72,897,296 | 72,897,296 | 3 | true | 2022-07-07T11:42:59.587Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GetSelectedItem from TableView JavaFX issue<p>I have some issue with getSelectedRow. I can't make method that puts text from table's row to textfield. I trie... |
72,908,880 | return type for getter problem when returning enum<p>In parity I am attempting to return a string which is extracted using enum.enum_entry.name property bit I am getting an error.</p>
<p>Code :</p>
<pre><code>enum SerialPortParity {
none,
even,
odd,
mark,
space,
}
int _parity = UsbPort.PARITY_NONE;
String... | <p>The error says your getter and setter must be the same type.
You have a setter of parity somewhere in your code thay you don't show here. But you can fix this by changing the return type of your getter to SerialPortParity.</p>
<p>Or changing the setter param type to String.</p>
<pre><code>enum SerialPortParity {
n... | return type for getter problem when returning enum | flutter|dart|enums | 0 | 42 | 1 | 72,908,937 | 72,908,937 | 3 | true | 2022-07-08T08:46:10.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
return type for getter problem when returning enum<p>In parity I am attempting to return a string which is extracted using enum.enum_entry.name property bit ... |
72,912,382 | updating a tuple not giving error while tuples are immutable<p>I know that tuples are immutable but the following code is not giving
me any error:</p>
<pre><code>tup=(1,2,3,4)
tup=()
print(tup)
</code></pre>
<p>Please can anyone help me understand why the statement 2 is not giving me any error?</p> | <p>The reason why it's not giving you an error is because the variable <code>tup</code> is a <strong>reference</strong> to the tuple <code>(1, ,2, 3, 4)</code> and then becomes a <strong>reference</strong> to an empty tuple.</p>
<p>The tuple <strong>values</strong> are not modified.</p> | updating a tuple not giving error while tuples are immutable | python|python-3.x|tuples | 0 | 42 | 2 | 72,912,448 | 72,912,448 | 3 | true | 2022-07-08T13:46:21.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
updating a tuple not giving error while tuples are immutable<p>I know that tuples are immutable but the following code is not giving
me any error:</p>
<pre><... |
72,913,774 | Sharing useState between different components ReactJS<p>So I've been trying to make a booking system, each user can only book once the problem being how to check which user is logged in.</p>
<p>The component LoginForm has the following useState:</p>
<pre><code>const [details, setDetails] = useState({ room: ""... | <p>As far as I have seen, There are 2 approaches to store userdetails in the react application,</p>
<p><strong>Approach 1:</strong></p>
<p>You can store the user details in the <code>contextApi</code> and use it accross the application by using the context. You can use <code>createContext</code> to create a context and... | Sharing useState between different components ReactJS | reactjs | 0 | 42 | 1 | 72,914,236 | 72,914,236 | 3 | true | 2022-07-08T15:33:38.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sharing useState between different components ReactJS<p>So I've been trying to make a booking system, each user can only book once the problem being how to c... |
72,918,556 | Reverse items in an array of strings in C<p>I need help on my code. I have done a code (below) to read the numbers from a .txt file. The first two numbers are to be put on a int variable, the numbers from the second line onwards are to be put on an array of strings. But now, i want to reverse the array of strings and p... | <p>You are really close but here are a few things.</p>
<ol>
<li>move the j variable outside the loop so it isn't reset to zero every time through the loop.</li>
<li>add space in the array to store the '\0' string termination.</li>
<li>add 1 to the number of characters to copy</li>
</ol>
<pre><code> char listOfNumber... | Reverse items in an array of strings in C | arrays|c|string | 1 | 42 | 1 | 72,918,676 | 72,918,676 | 3 | true | 2022-07-09T02:41:25.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reverse items in an array of strings in C<p>I need help on my code. I have done a code (below) to read the numbers from a .txt file. The first two numbers ar... |
72,924,625 | C connect() function giving socket error 88<p>I am trying to implement a cross-platform networking program to send simple data. For windows, I am using winsock and I'm using standard linux sockets for unix/linux. The windows portion works perfectly, and so does the server part of the linux portion. The linux client fai... | <p>in C, <code><</code> has higher order of precedence than <code>=</code>. So some of your <code>if</code> statements are not doing what you expect.</p>
<pre><code>if (data->sock = socket(AF_INET, SOCK_STREAM, 0) < 0)
</code></pre>
<p>The above <code>if</code> statement is assigning the result of the <code>&l... | C connect() function giving socket error 88 | c|linux|sockets | 0 | 42 | 1 | 72,925,109 | 72,925,109 | 3 | true | 2022-07-09T21:02:41.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C connect() function giving socket error 88<p>I am trying to implement a cross-platform networking program to send simple data. For windows, I am using winso... |
72,941,327 | How to balance a dataset from a countmap table<p>I have this dataset:</p>
<pre><code>text sentiment
randomstring positive
randomstring negative
randomstring netrual
random mixed
</code></pre>
<p>Then if I run a <code>countmap</code> i have:</p>
<pre><code>"mixed"... | <p>Why do you want a <code>countmap</code> or <code>freqtable</code> solution if you seem do want to use a data frame in the end?</p>
<p>This is how you would do this with DataFrames.jl (but without StatsBase.jl and FreqTables.jl as they are not needed for this):</p>
<pre><code>julia> using Random
julia> using D... | How to balance a dataset from a countmap table | julia|julia-dataframe | 2 | 42 | 1 | 72,944,691 | 72,944,691 | 3 | true | 2022-07-11T15:54:41.463Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to balance a dataset from a countmap table<p>I have this dataset:</p>
<pre><code>text sentiment
randomstring positive
randomstring ... |
72,972,078 | mapping with data from axios call using async await in react<p>I am able to get data back from my api call. But when I try to map it, I get an images.map is not a function. I consoled log the data to make sure it is an array</p>
<p>Here is my code</p>
<pre><code>import { useState, useEffect, useRef } from "react&q... | <p>It's because you initialize the <code>images</code> variable as an object. Objects do not have <code>map</code> method on their prototype and are also not <a href="https://developer.mozilla.org/en-US/docs/Glossary/Falsy" rel="nofollow noreferrer">falsy</a>.</p>
<p>If you want it to not throw an error, initialize as ... | mapping with data from axios call using async await in react | reactjs|async-await|axios | 0 | 42 | 1 | 72,972,117 | 72,972,117 | 3 | true | 2022-07-13T20:10:40.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
mapping with data from axios call using async await in react<p>I am able to get data back from my api call. But when I try to map it, I get an images.map is ... |
72,975,431 | How to fill down values with limit in R?<p>I looking for a python function like <code>fillna(method='bfill', limit=30)</code> but inside R.</p>
<p>I have this data frame.</p>
<pre><code>DATE ELE.CN
<dttm> <dbl>
1 2009-06-30 00:00:00 115942928608
2 2009-06-28 00:... | <p>One potential solution is to use <code>vec_fill_missing()</code> from the <a href="https://cran.r-project.org/web/packages/vctrs/index.html" rel="nofollow noreferrer">vctrs package</a> which has a "max_fill" option:</p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
library(vctrs)
df &l... | How to fill down values with limit in R? | r | 2 | 42 | 2 | 72,975,537 | 72,975,537 | 3 | true | 2022-07-14T05:02:26.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to fill down values with limit in R?<p>I looking for a python function like <code>fillna(method='bfill', limit=30)</code> but inside R.</p>
<p>I have thi... |
72,979,420 | type-parametrized overload in F#<p>when using Microsoft.SqlServer.TransactSql.ScriptDom for parsing, implementation of visitor usually looks like this:</p>
<pre><code>open Microsoft.SqlServer.TransactSql.ScriptDom
let assembly _ =
let refs = ResizeArray()
refs, {
new TSqlFragmentVisitor() with
override thi... | <p>Unfortunately, this is not going to be possible - and I cannot think of an elegant workaround.</p>
<p>The problem is that the <code>Visit</code> methods of <code>TSqlFramentVisitor</code> are not generic. This is an overloaded <code>Visit</code> method that has a large number of overloads (1031 according to my VS to... | type-parametrized overload in F# | f# | 0 | 42 | 1 | 72,981,901 | 72,981,901 | 3 | true | 2022-07-14T11:00:24.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
type-parametrized overload in F#<p>when using Microsoft.SqlServer.TransactSql.ScriptDom for parsing, implementation of visitor usually looks like this:</p>
<... |
72,999,589 | "Bad return type in lambda expression: String cannot be converted to void" in .forEach method<p>I have a class <code>Users</code> with, among others, a <code>List</code> of <code>user</code> objects, the following method, which is supposed to</p>
<ol>
<li>build a <code>list</code> of <code>String</code></li>
<li>check ... | <p>It looks like what you're looking for is <code>map</code> and not <code>forEach</code>:</p>
<pre class="lang-java prettyprint-override"><code>public boolean checkUserExists(String targetUserID) {
List<String> userIDS = users.stream().map((user) -> user.userID).collect(Collectors.toList())
// if you... | "Bad return type in lambda expression: String cannot be converted to void" in .forEach method | java|oop|strong-typing | 0 | 42 | 1 | 72,999,697 | 72,999,697 | 3 | true | 2022-07-15T21:05:38.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
"Bad return type in lambda expression: String cannot be converted to void" in .forEach method<p>I have a class <code>Users</code> with, among others, a <code... |
73,000,524 | Referencing a class variable during call-by-name parameter<p>I have a library I'm building where I have a particular class in which I would like to make a part of the class customizable. The user would be able to pass in a block of code so they can modify the contents as they see fit (within some bounds of course). Thi... | <p>What's wrong with inheritance?</p>
<pre><code>class MyClass[T](s: T){
var i2 = s
}
val myc = new MyClass("You should not use mutable vars") {
i2 += "Because this is not how scala is intended to be used!"
i2 += "Providing library methods allowing users mutate internal structures... | Referencing a class variable during call-by-name parameter | scala | 0 | 42 | 2 | 73,000,711 | 73,000,711 | 3 | true | 2022-07-15T23:44:02.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Referencing a class variable during call-by-name parameter<p>I have a library I'm building where I have a particular class in which I would like to make a pa... |
72,967,016 | Does the 'Element: keydown event' register the same 'number' on a slower CPU compared to a faster CPU, when holding down a key for a period of time?<p>So, when I hold down a key, for lets say 2 seconds, and I call a function for that event which performs some action. Is that action being performed the same amount of ti... | <p>Key repeat is usually handled at the operating system level, and can be set by the user, so your code shouldn't rely on it happening at any particular speed.</p>
<p>If you're okay with that, go ahead and use the OS-defined (and/or user-defined) key repeat.</p>
<p>If you aren't, though, you can easily set up your own... | Does the 'Element: keydown event' register the same 'number' on a slower CPU compared to a faster CPU, when holding down a key for a period of time? | javascript | 0 | 42 | 1 | 72,967,092 | 72,967,092 | 3 | true | 2022-07-13T13:18:34.393Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does the 'Element: keydown event' register the same 'number' on a slower CPU compared to a faster CPU, when holding down a key for a period of time?<p>So, wh... |
72,871,252 | How to allow modification of Class properties only with Action<Class> method?<p>I have class which handles some UI stuff, lets call that class and instance UI for the example.</p>
<p>inside this class I will have an object of type Colors:</p>
<pre><code>public class Colors {
public ConsoleColor Primary { get; set; ... | <p>You can expose the colors through an interface declaring getter-only properties. An implementation can then have setters as well:</p>
<pre class="lang-cs prettyprint-override"><code>public interface IColors
{
ConsoleColor Primary { get; }
ConsoleColor Default { get; }
ConsoleColor Input { get; }
Cons... | How to allow modification of Class properties only with Action<Class> method? | c#|oop | 5 | 42 | 3 | 72,871,461 | 72,871,461 | 3 | true | 2022-07-05T14:37:54.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to allow modification of Class properties only with Action<Class> method?<p>I have class which handles some UI stuff, lets call that class and instance U... |
72,869,106 | How so I stop a shared method from running with class and extends?<p>I am creating two classes, <code>Rectangle</code> and <code>Square</code>, based on the example shown on <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes" rel="nofollow noreferrer">MDN</a>.</p>
<p>Since Rectangle is t... | <p>You can throw an error when the criteria is not matched. This will stop the construction of the object.</p>
<pre><code>class Square extends Rectangle {
constructor(length, height){
super(length, height);
if (length !== height) {
throw new Error("not a square");
}
this.name = "... | How so I stop a shared method from running with class and extends? | javascript|subclass | 0 | 42 | 1 | 72,869,248 | 72,869,248 | 3 | true | 2022-07-05T12:01:18.463Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How so I stop a shared method from running with class and extends?<p>I am creating two classes, <code>Rectangle</code> and <code>Square</code>, based on the ... |
72,837,626 | How Find Digits in Csharp<p>I want write program to get 10 numbers and if input number for exampel more then 3 digit write hello !</p>
<p>How to find out how many digits the number x is ?</p> | <p>I hope I understood you right this is what I think you need:</p>
<pre><code>//MainCode
Random rnd = new Random();
for (int i = 0; i < 10; i++)
{
GetNumberAmountOfDigits(rnd.Next());
}
//function to get amount of digits in an number
int GetNumberAmountOfDigits(int number)
{
if (number == 0){
retu... | How Find Digits in Csharp | c# | -1 | 42 | 1 | 72,837,710 | 72,837,710 | 3 | true | 2022-07-02T08:27:54.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How Find Digits in Csharp<p>I want write program to get 10 numbers and if input number for exampel more then 3 digit write hello !</p>
<p>How to find out how... |
72,860,707 | how can I make `git` fail instead of asking for credentials<p>I am trying to use git commands inside my script, and I want git to fail in any case so that I can check for errors my users supplied in their requests.</p>
<p>The current behavior of <code>git</code> is like this:</p>
<ul>
<li>the address is not a git repo,... | <p>If you want to avoid Git prompting for credentials, you can set <code>GIT_TERMINAL_PROMPT=0</code>. That will prevent Git itself from prompting using a credential helper or making any other terminal requests, but it will not prevent other tools it spawns, such as OpenSSH, from prompting. There is no way to do that... | how can I make `git` fail instead of asking for credentials | node.js|git | 2 | 42 | 1 | 72,860,946 | 72,860,946 | 3 | true | 2022-07-04T18:20:42.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how can I make `git` fail instead of asking for credentials<p>I am trying to use git commands inside my script, and I want git to fail in any case so that I ... |
72,858,200 | Transpose multi column to single column using pandas<p>I am trying to transpose a table, which will combine all the column and make it one without losing the information, my below input and expected output as follows,</p>
<p>I have attached the data link for further understading the data type, kindly use this one for d... | <p>The following code gives output you asked in the question. The <code>df</code> I create <code>7,8,9,10</code> are numeric. If you want the column as string, then use <code>"7","8","9","10"</code></p>
<p><code>Updated code</code>: using file shared. I was using <code>date</cod... | Transpose multi column to single column using pandas | python|pandas|numpy | 0 | 42 | 1 | 72,858,321 | 72,858,321 | 3 | true | 2022-07-04T14:19:53.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Transpose multi column to single column using pandas<p>I am trying to transpose a table, which will combine all the column and make it one without losing the... |
72,996,054 | Rounding up to two limits in Python<p>I am trying to round up to nearest 10 for <code>Max</code> and <code>Min</code>. However, for <code>Max</code>, the nearest 10 should be greater than <code>Max</code> and for <code>Min</code>, the nearest 10 should be less than <code>Min</code>. The current and the expected outputs... | <p>If I understand your question correctly, you'd need the floor and ceil functions from the math module.</p>
<pre><code>import math as m
Max = [99.91540553]
Min = [8.87895014]
Amax = 10*m.ceil(Max[0]/10)
Amin = 10*m.floor(Min[0]/10)
</code></pre>
<p>These also exist in numpy if you would like to perform this on every ... | Rounding up to two limits in Python | python|numpy | 1 | 42 | 2 | 72,996,155 | 72,996,155 | 3 | true | 2022-07-15T15:09:21.167Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rounding up to two limits in Python<p>I am trying to round up to nearest 10 for <code>Max</code> and <code>Min</code>. However, for <code>Max</code>, the nea... |
72,989,030 | How to determine design pattern from time complexity<p>I've encountered this question on an informal test.</p>
<p><em>T(n) is a reccurance relation</em></p>
<blockquote>
<p>If the time complexity of an algorithm with input size of <code>n</code> is defined as:</p>
<p><code>T(1)=A</code></p>
<p><code>T(n)=T(n-1)+B</code... | <p>From <a href="https://en.wikipedia.org/wiki/Divide-and-conquer_algorithm" rel="nofollow noreferrer">Wiki</a>,</p>
<blockquote>
<p>Under this broad definition, however, every algorithm that uses recursion or loops could be regarded as a "divide-and-conquer algorithm". Therefore, some authors consider that t... | How to determine design pattern from time complexity | algorithm|design-patterns | 1 | 42 | 1 | 72,992,191 | 72,992,191 | 3 | true | 2022-07-15T04:24:52.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to determine design pattern from time complexity<p>I've encountered this question on an informal test.</p>
<p><em>T(n) is a reccurance relation</em></p>
... |
72,777,490 | window function on a subset of data<p>I have a table like the below. I want to calculate an average of median but only for Q=2 and Q=3. I don't want to include other Qs but still preserve the data.</p>
<pre class="lang-py prettyprint-override"><code>df = spark.createDataFrame([('2018-03-31',6,1),('2018-03-31',27,2),('2... | <p>For both of your expected output, you can use conditional aggregation, use <code>avg</code> with <code>when</code> (<code>otherwise</code>).</p>
<p>If you want the 1st expected output.</p>
<pre class="lang-py prettyprint-override"><code>window = (
Window
.partitionBy("date", F.col("Q&q... | window function on a subset of data | apache-spark|pyspark | 1 | 42 | 2 | 72,777,639 | 72,777,639 | 3 | true | 2022-06-27T19:36:43.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
window function on a subset of data<p>I have a table like the below. I want to calculate an average of median but only for Q=2 and Q=3. I don't want to inclu... |
72,997,331 | Is there a better way access a same-type enum value than a match?<p>Is there a better way to access the contents of an Enum that in the various cases shares the same variable type?<br />
At the moment I have solved it this way:</p>
<pre class="lang-rust prettyprint-override"><code>enum Token<'a> {
Word(&'... | <p>Not with this implementation. But you could (and maybe should) instead have</p>
<pre><code>enum TokenKind {
Word,
Reserved,
Whitespace,
}
struct Token<'a> {
string: &'a str,
kind: TokenKind
}
</code></pre>
<p>This is more extensible, and less code duplication.</p> | Is there a better way access a same-type enum value than a match? | rust|enums|match|traits | 2 | 42 | 1 | 72,997,404 | 72,997,404 | 3 | true | 2022-07-15T16:51:22.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a better way access a same-type enum value than a match?<p>Is there a better way to access the contents of an Enum that in the various cases shares ... |
72,814,084 | Joining elements together in list but keeping original layout<p>So I have a list that looks like this:</p>
<pre><code>list = ["a","b","c", etc]
</code></pre>
<p>I would like to join the elements together but keep the original layout, so the final output should look like:</p>
<pre><code>li... | <p>You can use list comprehension and <code>join()</code> function to concatenate resulting strings:</p>
<pre><code>l = ["a","b","c"]
out = [''.join(l[:i]) for i in range(1, len(l)+1)]
print(out)
</code></pre>
<p><strong>Output:</strong></p>
<pre><code>['a', 'ab', 'abc']
</code></pre> | Joining elements together in list but keeping original layout | python|list | 0 | 42 | 4 | 72,814,143 | 72,814,143 | 4 | true | 2022-06-30T10:17:25.527Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Joining elements together in list but keeping original layout<p>So I have a list that looks like this:</p>
<pre><code>list = ["a","b",&qu... |
72,904,645 | Selection sort implementation in python<p>I am trying to implement a selection sort in python, which I have done so far. The output of this function is not sorted at all. What do you think I am doing wrong here? as I am storing the index of the smallest element in the array and swapping that. If someone can point out t... | <p>Selection sort looks <em>ahead</em> from the current index <code>i</code>, so the inner loop should only iterate over that range. Secondly the <code>index</code> should be initialised at the current <code>i</code>, as it must indicate where <code>smallest</code> comes from:</p>
<pre><code>def selection_sort(array):
... | Selection sort implementation in python | python|sorting|selection-sort | 1 | 42 | 1 | 72,904,675 | 72,904,675 | 4 | true | 2022-07-07T21:55:14.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Selection sort implementation in python<p>I am trying to implement a selection sort in python, which I have done so far. The output of this function is not s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.