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,357,301
What exactly does most specialized class mean in C++?<p>Let's say we have the following:</p> <pre><code>template&lt;typename T1, typename T2&gt; class A {} template&lt;typename T1, typename T2&gt; class A&lt;T1*, T2*&gt; {} template&lt;typename T&gt; class A&lt;T, T&gt; {} </code></pre> <p>Now, I know that we need to...
<p>First, regarding terminology: Each of these definitions are not definitions for <em>classes</em>. The first definition defines a <em>primary class template</em>. The other definitions define <em>partial specializations</em> of that primary template.</p> <p>It is not possible to categorize partial specializations by ...
What exactly does most specialized class mean in C++?
c++|template-specialization|template-classes
0
57
1
72,357,384
72,357,384
3
true
2022-05-24T04:43:52.810Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What exactly does most specialized class mean in C++?<p>Let's say we have the following:</p> <pre><code>template&lt;typename T1, typename T2&gt; class A {} ...
72,268,600
Clickatel reply to a particular message<p>I am trying to send a message as a reply to a previous message using clickatel api.</p> <p>Below is my payload</p> <pre><code> $header = [ &quot;Content-Type: application/json&quot;, &quot;Accept: application/json&quot;, &quot;Authoriz...
<p>This is not supported by 'Whatsapp Business Platform' as its not in their documentation currently, so also not supported by Clickatell or anyone else.</p> <p>The field you are using 'relatedMessageId' does not apply to sending a message currently - it's only relevant to receiving a message.</p>
Clickatel reply to a particular message
php|whatsapp|clickatell
2
57
1
72,271,214
72,271,214
3
true
2022-05-17T05:30:15.463Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Clickatel reply to a particular message<p>I am trying to send a message as a reply to a previous message using clickatel api.</p> <p>Below is my payload</p> ...
72,360,525
How to add a value to a pseudo table in SQL Server<p>I have a list from a query:</p> <pre><code>SELECT * FROM Orders.Order ID </code></pre> <p>This returns:</p> <pre><code>OrderID 10255 10267 10275 10278 10298 </code></pre> <p>I want to add 11245 to this data, temporarily, not to the original table. Does anyone know ho...
<p>You can do this with the UNION ALL operator, like so:</p> <pre><code>SELECT * FROM Orders.Order ID UNION ALL SELECT 11245 </code></pre> <p>UNION will also work, but in case the new value also exists in the original result set, you will only see that value appearing once in the final result set.</p>
How to add a value to a pseudo table in SQL Server
sql-server
-1
57
1
72,360,556
72,360,556
3
true
2022-05-24T09:33:11.863Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add a value to a pseudo table in SQL Server<p>I have a list from a query:</p> <pre><code>SELECT * FROM Orders.Order ID </code></pre> <p>This returns:<...
72,297,521
In R is there a way to create a new column based on column names and values? Tidy solution welcome<p>Specifically I have an untidy data.frame with subspecies varieties in separate columns, like this;</p> <pre><code># Data Genus&lt;- c(&quot;Metrosideros&quot;, &quot;Gahnia&quot;, &quot;Acacia&quot;) Species&lt;- c(&quo...
<p>You can get there with <code>paste()</code> and a little bit of indexing.</p> <pre><code>with(df, paste( Genus, Species, c(&quot;&quot;, &quot;subsp.&quot;)[(Subspecies != &quot;&quot;) + 1], Subspecies, c(&quot;&quot;, &quot;var.&quot;)[(Variety != &quot;&quot;) + 1], Variety )) [1] &quot;Metrosideros ...
In R is there a way to create a new column based on column names and values? Tidy solution welcome
r|dplyr
1
57
2
72,297,597
72,297,597
5
true
2022-05-19T00:59:50.563Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In R is there a way to create a new column based on column names and values? Tidy solution welcome<p>Specifically I have an untidy data.frame with subspecies...
72,386,370
Why use F_SAME in ASM?<p>What is F_SAME really for in ASM? I looked for this mnemonic in <a href="https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html" rel="nofollow noreferrer">Java Virtual Machine Instruction Set</a> and didn't find anything related.</p> <p>I understand stack map frames and that they save s...
<p>It's not a real opcode. The comment in the source code explains it: ASM specific stack map frame types, used in {@link ClassVisitor#visitFrame}. Bear in mind that the comment is wrong, and the visitFrame method is in MethodVisitor.</p> <p>I think perhaps you're wondering why the frames appear at jump targets, etc. T...
Why use F_SAME in ASM?
java|bytecode|java-bytecode-asm
1
57
1
72,386,776
72,386,776
5
true
2022-05-26T03:29:34.143Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why use F_SAME in ASM?<p>What is F_SAME really for in ASM? I looked for this mnemonic in <a href="https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.h...
72,319,764
Java get FirstDate and LastDate of following month in MM/dd/yyyy format even if the input is not the first day of the month<p>I have a function below which has an input <strong>Date</strong> and it will return the first and last <strong>Date</strong> of the next month in <code>MM/dd/yyyy</code> format.</p> <pre class="...
<p>Don't use Date as it is obsolete and buggy. Use <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/LocalDate.html" rel="nofollow noreferrer">LocalDate</a> and other classes from the <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/package-summary.html" rel...
Java get FirstDate and LastDate of following month in MM/dd/yyyy format even if the input is not the first day of the month
java|date|datetime|calendar
0
57
2
72,320,082
72,320,082
5
true
2022-05-20T13:29:50.477Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java get FirstDate and LastDate of following month in MM/dd/yyyy format even if the input is not the first day of the month<p>I have a function below which h...
72,333,574
Capturing a function call as dict<p>I'm trying to write a python function decorator, and part of my implementation is that I need to capture the function call and look through the supplied values. I already have the function signature by using <code>inspect.signature</code>, but I'm unsure how to compose it with passed...
<p>Whenever you want to introspect function/method signatures, you can use <a href="https://docs.python.org/3/library/inspect.html#introspecting-callables-with-the-signature-object" rel="nofollow noreferrer"><code>inspect.signature</code></a>. In this case:</p> <pre><code>from inspect import signature def decorator(fu...
Capturing a function call as dict
python|python-3.x|function|python-decorators|inspect
1
57
1
72,333,599
72,333,599
-1
true
2022-05-21T22:12:03.213Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Capturing a function call as dict<p>I'm trying to write a python function decorator, and part of my implementation is that I need to capture the function cal...
72,975,520
Changing the systemNavigationBarColor isn't working Flutter<p>I want to change the color of the systemNavigationBar based on the theme.</p> <p>I have been trying to change the color of the system navigation color of the app using the <code>SystemOverlayStyle</code> but it doesn't seem to work.</p> <pre><code> ThemeData...
<p>Wrap <code>Scaffold</code> with <a href="https://api.flutter.dev/flutter/widgets/AnnotatedRegion-class.html" rel="nofollow noreferrer"><code>AnnotatedRegion</code></a> widget. Then set it's value property to <code>SystemUIOverlayStyle</code></p> <p>For Example</p> <pre class="lang-dart prettyprint-override"><code> @...
Changing the systemNavigationBarColor isn't working Flutter
flutter|navigation|themes
0
57
2
72,977,037
72,977,037
1
true
2022-07-14T05:15:27.807Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing the systemNavigationBarColor isn't working Flutter<p>I want to change the color of the systemNavigationBar based on the theme.</p> <p>I have been tr...
73,015,830
I ran `git merge` and got this screen: what editor is this<p><a href="https://i.stack.imgur.com/aJC2R.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aJC2R.png" alt="enter image description here" /></a></p> <p>I tried to merge some changes from my branch to the main, but everytime that I make git mer...
<p>This is an vi editor window. This is happening because git cannot perform a fast forward and is prompting you for a message for a merge commit. Vi has a bit of a learning curve and can be confusing for new users.</p> <p>First, I'd like to mention that you can change what this editor is via the core.editor gitconfig ...
I ran `git merge` and got this screen: what editor is this
git|merge|branch|git-bash
0
57
1
73,016,052
73,016,052
1
true
2022-07-17T22:39:24.087Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I ran `git merge` and got this screen: what editor is this<p><a href="https://i.stack.imgur.com/aJC2R.png" rel="nofollow noreferrer"><img src="https://i.stac...
72,972,175
Find a way to interact with the list generated by scriptAll() with filter<p>Scenario: I have a table where I am trying to iteratively go through each row that matches my expected text and grab a particular column value for that row.</p> <p>The html looks something like this:</p> <pre><code>&lt;table class=&quot;table&q...
<p>You could return an array from the JavaScript expression, containing a first value for filtering and a second string containing the text from your fifth column.</p> <pre class="lang-karate prettyprint-override"><code>* def filter = function(x){ return x[0].contains('TargetProduct') } * def rows = scriptAll('//table/...
Find a way to interact with the list generated by scriptAll() with filter
karate
1
57
2
72,974,827
72,974,827
1
true
2022-07-13T20:20:18.453Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find a way to interact with the list generated by scriptAll() with filter<p>Scenario: I have a table where I am trying to iteratively go through each row tha...
72,808,221
How to expand a huge array into several columns?<p>I am trying to average each element of a column of arrays by index on a group by, so that I can start with a dataframe like this:</p> <pre><code>----------------------- id | weights ----------------------- 1 | [ 34, 23, 56 ] 1 | [ 5, 45, 10 ] 1 | [ ...
<p>Spark doesn't have array aggregate functions that you can use with the <code>agg</code> method of relationally grouped datasets, so you either need to write your own user-defined aggregator or get creative with the available array functions.</p> <p>Provided you do not have too many entries with the same <code>id</co...
How to expand a huge array into several columns?
arrays|dataframe|scala|apache-spark|average
1
57
3
72,812,101
72,812,101
1
true
2022-06-29T21:48:39.157Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to expand a huge array into several columns?<p>I am trying to average each element of a column of arrays by index on a group by, so that I can start with...
72,926,124
Remove a Dimension from Multidimensional Array<p>If we have a 4D cube with integer keys, and we want to convert the 4D array into a 3D array by keeping the 3rd dimension key $i3 fixed at some value $i30, we can do:</p> <pre><code>// ARRAY REMOVE 3RD INDEX IN 4D function array_remove($a,$i30){ $n1=count($a); $n2...
<p>I can't resist.</p> <p>Given an n-dimensional array, return an array of n-1 dimensions, using a particular value for the replaced dimension:</p> <pre><code>$source = [ 1 =&gt; [ 'a' =&gt; ['p', 'q', 'r'], 'b' =&gt; ['s', 't', 'u'], 'c' =&gt; ['v', 'w', 'x'], ], 2 =&gt; [ '...
Remove a Dimension from Multidimensional Array
php|multidimensional-array
0
57
1
72,943,599
72,943,599
1
true
2022-07-10T04:22:00.293Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Remove a Dimension from Multidimensional Array<p>If we have a 4D cube with integer keys, and we want to convert the 4D array into a 3D array by keeping the 3...
73,013,741
How do I construct a crosswalk table with multiple crosswalks with the ggplot2 package?<p>I wanna present my crosswalk results for 5 different crosswalks in a combined table with the ggplot2 package.</p> <p>I've created a data.frame with all results that need to be displayed:</p> <pre><code>crosswalk &lt;- data.frame(s...
<p>Here's an example with the <code>mtcars</code> dataset. We can reshape long, then scale within each variable, and plot:</p> <pre><code>library(tidyverse) mtcars %&gt;% rownames_to_column() %&gt;% pivot_longer(-rowname) %&gt;% group_by(name) %&gt;% mutate(scaled = as.numeric(scale(value))) %&gt;% ungroup() ...
How do I construct a crosswalk table with multiple crosswalks with the ggplot2 package?
r|ggplot2|plot
1
57
1
73,014,034
73,014,034
1
true
2022-07-17T16:59:40.447Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I construct a crosswalk table with multiple crosswalks with the ggplot2 package?<p>I wanna present my crosswalk results for 5 different crosswalks in ...
72,964,383
regex to find word that starts with c and ends with o<p>I am trying to write some code to find sentence that has any word that has a letter c followed by a another letter and ends in o. e.g. cxo, ceo, cfo Aplogies should have mentioned that it can only have one letter in the middle of c and o</p> <p>I've tried</p> <pre...
<p>If your goal is to find any 3-letter word starting with C and ending with O, you can insert a <strong>word boundary</strong> <code>\b</code> before and after your match like so: <code>/\bc\wo\b/</code>. The presence of <code>\b</code> will prevent partial matches like <code>echo</code> from matching your regex, but ...
regex to find word that starts with c and ends with o
python|pandas|regex
0
57
3
72,964,476
72,964,476
1
true
2022-07-13T10:00:14.993Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: regex to find word that starts with c and ends with o<p>I am trying to write some code to find sentence that has any word that has a letter c followed by a a...
72,979,787
data frame and list operation<p>There are three columns in <code>df</code>: <code>mins</code>, <code>maxs</code>, and <code>col</code>. I would like to generate a binary list according to the following rule: if <code>col[i]</code> is smaller than or equal to <code>mins[i]</code>, add a &quot;1&quot; to the list and kee...
<blockquote> <p>My answer may not be elegant but should work according to your expectation.</p> </blockquote> <ol> <li>Import the pandas library. <pre class="lang-py prettyprint-override"><code>import pandas as pd </code></pre> </li> <li>Create dataframe according to data provided. <pre class="lang-py prettyprint-overr...
data frame and list operation
python|list|dataframe
1
57
2
72,980,756
72,980,756
1
true
2022-07-14T11:28:28.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: data frame and list operation<p>There are three columns in <code>df</code>: <code>mins</code>, <code>maxs</code>, and <code>col</code>. I would like to gener...
73,024,516
Symfony 4.4 - Postgresql 9.6 doctrine migrating down error SQLSTATE[42P06]:<p>I can't migrating down with commande line php bin/console doctrine:migrations:migrate DoctrineMigrations\Version20220713135119</p> <pre><code>PS C:\_EnvTest\my_project_composer2&gt; php bin/console doctrine:migrations:migrate DoctrineMigrat...
<p>I just commented :</p> <pre><code>$this-&gt;addSql('CREATE SCHEMA public'); </code></pre> <p>And run the command again and it seems to work.</p> <p><a href="https://github.com/doctrine/migrations/issues/494" rel="nofollow noreferrer">github.com/doctrine/migrations/issues/494</a></p>
Symfony 4.4 - Postgresql 9.6 doctrine migrating down error SQLSTATE[42P06]:
postgresql|symfony|database-migration
0
57
1
73,024,902
73,024,902
1
true
2022-07-18T15:04:54.007Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Symfony 4.4 - Postgresql 9.6 doctrine migrating down error SQLSTATE[42P06]:<p>I can't migrating down with commande line php bin/console doctrine:migrations:m...
72,872,351
const assertion with a Record type<p>I would like to use a const assertion for <code>KEYBINDINGS</code> (see last codeline):</p> <pre><code>export enum KeybindingActivity { SwitchTabLeft = 'switchTabLeft', } export type Keybinding = { defaultKeys: string[], type: TypeOfKeybinding, } export enum TypeOfKeyb...
<p>so you want to declare a <code>Record</code> type where every property (even deeply nested ones) are <code>readonly</code>? That is possible with a <code>DeepReadonly</code> type.</p> <pre><code>type DeepReadonly&lt;T&gt; = T extends object ? { readonly [K in keyof T]: DeepReadonly&lt;T[K]&gt; } : T </code></p...
const assertion with a Record type
typescript
1
57
2
72,901,929
72,901,929
1
true
2022-07-05T15:55:34.410Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: const assertion with a Record type<p>I would like to use a const assertion for <code>KEYBINDINGS</code> (see last codeline):</p> <pre><code>export enum Keybi...
72,779,858
firebase functions deploy had errors<p>I have a function that I want to run every 8 seconds. but i am getting error while installing it. It loads when I change the seconds to &quot;every 8 hours&quot;. it doesn't give any errors. Does firebase pubsub not accept times in seconds?</p> <pre><code>const otherMatchBotModule...
<p><code>functions.pubsub.schedule()</code> uses Cloud Scheduler to schedule running a function. The smallest time granularity is 1 minute.</p> <p>The following image shows the fields that will be translated from &quot;every 8 seconds&quot; to the Cron job format. Notice that there is no second field, therefore your re...
firebase functions deploy had errors
firebase|firebase-realtime-database|google-cloud-functions|firebase-admin
1
57
1
72,779,903
72,779,903
2
true
2022-06-28T01:40:45.620Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: firebase functions deploy had errors<p>I have a function that I want to run every 8 seconds. but i am getting error while installing it. It loads when I chan...
72,784,392
Helm - Is it possible to add quotes to all items in a list on its template?<p>Let's say I'm creating a helm template in which I want the eventual deployments to be able to execute a command to their liking. For this example, I'll use use the <code>touch</code> command.</p> <p>In my templates file, I'd write it down lik...
<p>This will not work as expected. The output syntax you show is a valid YAML list, but only containing a single shell word, and so it is looking for a command named <code>touch bar.txt</code>, where the space would be part of the filename in <code>/usr/bin</code>.</p> <p>The Go text/template engine that Helm uses isn...
Helm - Is it possible to add quotes to all items in a list on its template?
kubernetes|kubernetes-helm
0
57
1
72,785,246
72,785,246
2
true
2022-06-28T09:59:02.533Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Helm - Is it possible to add quotes to all items in a list on its template?<p>Let's say I'm creating a helm template in which I want the eventual deployments...
72,794,274
Convert rows to columns in Bigquery<p>I want to convert the below data into the output. Eg: There are 8 unique areas in the below table and an id can have max of only 4 areas of amount. Input table:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>ID</th> <th>Area</th> <th>Amount</th> </tr...
<p>Consider below approach</p> <pre><code>select * from ( select *, row_number() over(partition by id) pos from your_table ) pivot ( any_value(area) area, any_value(amount) amount for pos in (1,2,3,4) ) </code></pre> <p>if applied to sample data in your question - output is</p> <p><a href="https:/...
Convert rows to columns in Bigquery
sql|google-bigquery
0
57
2
72,794,463
72,794,463
2
true
2022-06-28T23:42:04.850Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert rows to columns in Bigquery<p>I want to convert the below data into the output. Eg: There are 8 unique areas in the below table and an id can have ...
72,801,200
How to handle a complicated state in react<p><strong>Background</strong>: <em>I am kind of new to react and am learning it, I have made some sites in it but i Highly doubt my way of appraching the problem.</em></p> <p>So while handaling a complex state . For example lets say we have a cart which has a product which is ...
<pre><code>setCart(items =&gt; items.map(item =&gt; item.id === &quot;2&quot; ? {...item, quantity: 5} : item)} </code></pre>
How to handle a complicated state in react
javascript|reactjs|state
1
57
4
72,801,311
72,801,311
2
true
2022-06-29T12:09:38.813Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to handle a complicated state in react<p><strong>Background</strong>: <em>I am kind of new to react and am learning it, I have made some sites in it but ...
72,797,073
how can I get the value of static initialised global variables from ELF file?<p>For example I have following c++ source file</p> <pre class="lang-cpp prettyprint-override"><code>// define global variables here int Label = 1234; char Hash[] = &quot;0x11231abc&quot;; </code></pre> <p>compile this to *.o file, and may be ...
<blockquote> <p>Is it possible to get the value from ELF file by using some existing tools, like readelf, objdump?</p> </blockquote> <p>Whether this is possible <em>at all</em> depends on how exactly these variables are used, whether they are local or global, whether they have their address taken, which compiler is use...
how can I get the value of static initialised global variables from ELF file?
elf|objdump|readelf
0
57
1
72,824,053
72,824,053
2
true
2022-06-29T07:01:41.540Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how can I get the value of static initialised global variables from ELF file?<p>For example I have following c++ source file</p> <pre class="lang-cpp prettyp...
72,830,969
CSS Cursor Pointer<p>I have weird issue. When I pass the value to cursor attribute as usual as string like</p> <pre><code>return ( &lt;Grid item&gt; &lt;Card sx={{ padding: &quot;1rem&quot;, &quot;:hover&quot;: { cursor: &quot;pointer&quot; } }} /&gt; &lt;/Grid...
<p>The issue is that you aren't passing the value you think you are.</p> <p>What you have in the second case actually looks like:</p> <pre><code>{ &quot;:hover&quot;: { cursor: { cursorPointer: &quot;pointer&quot; } } } </code></pre> <p>Instead of</p> <pre><code>{ &quot;:hover&quot;: { cursor: &quot;pointer&quot...
CSS Cursor Pointer
css|typescript|material-ui
0
57
1
72,831,414
72,831,414
2
true
2022-07-01T14:44:19.340Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CSS Cursor Pointer<p>I have weird issue. When I pass the value to cursor attribute as usual as string like</p> <pre><code>return ( &lt;Grid item&gt; &l...
72,838,367
Moving average by multiple group<p>I have a following DF (demo). I would like to find the previous 3 month moving average of Amount column per ID, Year and Month.</p> <pre><code> ID YEAR MONTH AMOUNT 1 ABC 2020 09 100 2 ABC 2020 11 200 ...
<p>You can use the following code:</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) arrange(DF,ID,YEAR) %&gt;% group_by(ID) %&gt;% mutate(lag1=lag(AMOUNT), lag2=lag(AMOUNT,2), lag3=lag(AMOUNT,3), movave=(lag1+lag2+lag3)/3) #&gt; # A tibble: 10 × 8 #&gt; # Groups: ID...
Moving average by multiple group
r
2
57
4
72,838,406
72,838,406
2
true
2022-07-02T10:33:10.617Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Moving average by multiple group<p>I have a following DF (demo). I would like to find the previous 3 month moving average of Amount column per ID, Year and M...
72,848,537
Is this possible in c++11? A class with same name but one with template. Ex: Result and Result<T><p>Is this possible in c++11? Two class with same name but one with template. Ex:</p> <p>A class with name <code>Result</code> and another with name <code>Result&lt;T&gt;</code> to use like</p> <pre><code>return Result(&qu...
<p>A couple C++11 options:</p> <p>Provide a default template argument of <code>void</code> and specialize on that.</p> <pre><code>template&lt;class T = void&gt; class response { public: bool success; std::string message; int code; T data; }; template&lt;&gt; class response&lt;void&gt; { public: boo...
Is this possible in c++11? A class with same name but one with template. Ex: Result and Result<T>
c++|templates
0
57
1
72,848,768
72,848,768
2
true
2022-07-03T17:21:45.257Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is this possible in c++11? A class with same name but one with template. Ex: Result and Result<T><p>Is this possible in c++11? Two class with same name but o...
72,848,994
Create svelte component on every click<p>I'm trying to create new instances of the same component in svelte whenever a button or other action happens on the page, without having to make a list and {each} over them. I just want to do something like <code>new Component(some context data)</code> and forget. Another concer...
<p>Just mount it straight on the <code>document.body</code>:</p> <pre class="lang-js prettyprint-override"><code>new Component({ target: document.body }) </code></pre> <p>But be aware that if you do not <a href="https://svelte.dev/docs#run-time-client-side-component-api-$destroy" rel="nofollow noreferrer"><code>$destro...
Create svelte component on every click
javascript|svelte
1
57
1
72,849,149
72,849,149
2
true
2022-07-03T18:33:41.653Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create svelte component on every click<p>I'm trying to create new instances of the same component in svelte whenever a button or other action happens on the ...
72,849,449
Can you use the red zone with/across syscalls?<p>Consider this GNU Assembler program, that copies one byte at a time from stdin to stdout, with a delay of one second between each:</p> <pre><code>#include &lt;sys/syscall.h&gt; .global _start _start: movq $1, -16(%rsp) movq $0, -8(%rsp) movl $1, %edx .agai...
<blockquote> <p>Is this a safe use of the red zone that's guaranteed to always work, or is it UB that just happened to appear to work in my test?</p> </blockquote> <p>It's guaranteed to be safe by the kernel developers.</p> <p>In general (to guard against deliberately malicious software) CPUs are designed so that when ...
Can you use the red zone with/across syscalls?
linux|assembly|x86-64|system-calls|red-zone
1
57
1
72,850,068
72,850,068
2
true
2022-07-03T19:48:54.580Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can you use the red zone with/across syscalls?<p>Consider this GNU Assembler program, that copies one byte at a time from stdin to stdout, with a delay of on...
72,845,653
how to create a pulse train using anonymous function - Matlab<p>I have a pulse shape that is a function of t, call it h(t), that is in the form of:</p> <pre><code>h = @(t) function of t </code></pre> <p>I want to create a pulse train that is consisted of N pulses h(t). I did this by:</p> <pre><code>for n=0:N-1 comb...
<p>You just need to make <code>comb</code> an anonymous function too. You can initialise it to some trivial function (i.e. it always outputs 0), and then repeatedly modify it. Since variables declared before an anonymous function declaration, including anonymous functions, are kind of &quot;frozen&quot; to the definiti...
how to create a pulse train using anonymous function - Matlab
matlab|anonymous-function
2
57
1
72,854,275
72,854,275
2
true
2022-07-03T10:15:43.970Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to create a pulse train using anonymous function - Matlab<p>I have a pulse shape that is a function of t, call it h(t), that is in the form of:</p> <pre>...
72,872,089
Deleting the last four columns starting from specific row linux<p>Here is part of my data</p> <pre><code> 759 L 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 760 Y 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 761 H 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 762 T 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 763 T 0 0 0 0 0 ...
<p>In any POSIX awk, without changing any of the spacing before/after or between the remaining fields:</p> <pre><code>awk 'NR&gt;775{sub(/([[:space:]]+[^[:space:]]+){4}[[:space:]]*$/,&quot;&quot;)} 1' file </code></pre>
Deleting the last four columns starting from specific row linux
awk
1
57
3
72,874,893
72,874,893
2
true
2022-07-05T15:36:33.967Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Deleting the last four columns starting from specific row linux<p>Here is part of my data</p> <pre><code> 759 L 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 76...
72,872,421
Powershell - Find the latest Friday<p>How can the following code be modified to identify the latest Friday within the past week (instead of the next one), but with formatting?</p> <p><code>$Date = @(@(0..7) | % {$(Get-Date).AddDays($_)} | ? {$_.DayOfWeek -ieq &quot;Friday&quot;})[0]</code></p> <p>Source: <a href="https...
<p>The post you linked to offers a <a href="https://stackoverflow.com/a/58416301/45375">more elegant solution</a>, which you can adapt as follows:</p> <pre class="lang-bash prettyprint-override"><code># Get the most recent Friday relative to the given date, # which may be that date itself. $mostRecentFriday = ($date...
Powershell - Find the latest Friday
powershell
0
57
3
72,875,266
72,875,266
2
true
2022-07-05T16:00:12.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Powershell - Find the latest Friday<p>How can the following code be modified to identify the latest Friday within the past week (instead of the next one), bu...
72,886,678
can I omit defer keyword in this case?<pre><code>go func() { defer wg.Done() for i := 0; i &lt; n; i++ { ch &lt;- i } }() </code></pre> <pre><code>go func() { for i := 0; i &lt; n; i++ { ch &lt;- i } wg.Done() }() </code></pre> <p>Are these...
<p>Those 2 seem to be identical, there may be cases when they're not. That's because deferred functions are also executed if the function is panicking.</p> <p>So for example if <code>ch</code> is a closed channel, sending on a closed channel will panic (see <a href="https://stackoverflow.com/questions/39015602/how-does...
can I omit defer keyword in this case?
go|goroutine|deferred
1
57
1
72,886,779
72,886,779
2
true
2022-07-06T16:01:11.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: can I omit defer keyword in this case?<pre><code>go func() { defer wg.Done() for i := 0; i &lt; n; i++ { ch &lt;- i } ...
72,888,490
Replace specific strings with specific images in Google Sheets<p>Essentially I am trying to build a google sheet that will convert specific strings into specific images for a Magic the Gathering google sheet.</p> <p>For example, if I have the text <strong>{3}{G}</strong> I'd like to replace the {3} with <a href="https:...
<p>with some compromises, you can do:</p> <pre><code>=ARRAYFORMULA(IFERROR(VLOOKUP(&quot;&quot;&amp;REGEXEXTRACT(&quot;&quot;&amp;A2:A, REPT(&quot;(.)&quot;, LEN(A2:A))), {F1:F&amp;&quot;&quot;, G1:G}, 2, 0))) </code></pre> <p><a href="https://i.stack.imgur.com/UWFTo.png" rel="nofollow noreferrer"><img src="https://i...
Replace specific strings with specific images in Google Sheets
image|google-sheets|google-sheets-formula|vlookup|spreadsheet
1
57
1
72,890,417
72,890,417
2
true
2022-07-06T18:43:31.447Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Replace specific strings with specific images in Google Sheets<p>Essentially I am trying to build a google sheet that will convert specific strings into spec...
72,900,380
Find first event occurring after given event<p>I am working with a table consisting of a number of web sessions with various events and event id:s. To simplify my question, let's say that I have 4 columns which are session_id, event_name and event_id, where the event id can be used to order the events in ascending/desc...
<p>Use below (assuming you have only one accept or decline per session!)</p> <pre><code>select *, if(event_name != 'open', null, ['decline', 'accept'][ordinal( sum(case event_name when 'decline' then 1 when 'accept' then 2 end) over win )]) staus from your_table window win as ( partition by session_id order by ev...
Find first event occurring after given event
google-bigquery|window-functions|partitioning|database-partitioning|partition-by
0
57
1
72,901,215
72,901,215
2
true
2022-07-07T15:17:49.277Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find first event occurring after given event<p>I am working with a table consisting of a number of web sessions with various events and event id:s. To simpli...
72,906,783
Numpy error when creating ragged nested sequences<p>I have the following Numpy array with will have a shape of (3, N):</p> <pre><code>import numpy as np arr = np.array([[4, 4, 4, 7], [6, 6, 8, 9], [2, 4, 10, 29]]) </code></pre> <p>I have a function named <code>get_wheel_status</code>:</p> <pre><code>def get_wheel_statu...
<p><strong>1. Quick Fix</strong></p> <p>A quick fix would be to add <code>dtype=object</code> to the <code>np.array</code> that is being returned by the function. In particular,</p> <pre><code>np.array([[delta_theta_cumul], [delta_x_cumul], [delta_y_cumul]], dtype=object) </code></pre> <p>The warning stems from the fac...
Numpy error when creating ragged nested sequences
python|numpy
0
57
1
72,906,933
72,906,933
2
true
2022-07-08T04:53:30.413Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Numpy error when creating ragged nested sequences<p>I have the following Numpy array with will have a shape of (3, N):</p> <pre><code>import numpy as np arr ...
72,915,071
Misunderstanding repeat directive - it should fail, but doesn't<p>I would like to write a grammar (highly simplified) with:</p> <pre><code>grr := integer [ . integer ] </code></pre> <p>with</p> <pre><code>integer ::= digit { [ underline ] digit } </code></pre> <p>Since the parsed literals are needed again later (the re...
<blockquote> <p>If the literal is too long, the parser should fail</p> </blockquote> <p>Where does it say that? It looks like the code does exactly what you ask: it parses at most 6 digits with the requisite underscores. The output even confirms that it does exactly that.</p> <p>You can of course make it much more appa...
Misunderstanding repeat directive - it should fail, but doesn't
c++|boost-spirit|boost-spirit-x3
2
57
1
72,916,318
72,916,318
2
true
2022-07-08T17:38:37.030Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Misunderstanding repeat directive - it should fail, but doesn't<p>I would like to write a grammar (highly simplified) with:</p> <pre><code>grr := integer [ ....
72,908,870
How to occupy a 10 by 10 block with 2 * 3 blocks that doesn't let others to push another 2 * 3<p>I want to find out the minimum number of 2 * 3 blocks that I can fill in 100 pixels that don't allow any other 2 * 3 blocks to fill in like the below picture.</p> <pre><code>2 * 3 in 10 * 10 = 6 </code></pre> <p><a href="ht...
<p>From the comments I understood, that we can't rotate rectangles. So then we use the following approach:</p> <p>Imagine, you want to solve the same problem, but only for the line, where rect size is 1xRectW in 1xGridW grid.</p> <p>I will use &quot;X&quot; for rect cell, &quot;0&quot; for empty cell. Example has 1x3 r...
How to occupy a 10 by 10 block with 2 * 3 blocks that doesn't let others to push another 2 * 3
python|algorithm
2
57
1
72,918,065
72,918,065
2
true
2022-07-08T08:45:13.053Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to occupy a 10 by 10 block with 2 * 3 blocks that doesn't let others to push another 2 * 3<p>I want to find out the minimum number of 2 * 3 blocks that I...
72,924,361
Replit: My bot can run but don't reply anything<p>My bot can run but don't reply anything.</p> <p>It shows up it is online but if I input <code>!$help</code>, it doesn't show up anything.</p> <p>The <code>(token)</code> here will be replaced by the real token.</p> <p>This is my code:</p> <pre class="lang-py prettyprint...
<p>Try replacing the <code>ctx=None</code> argument with just <code>ctx</code>.</p> <pre class="lang-py prettyprint-override"><code>@client.command() async def help(ctx): embed = discord.Embed( title=&quot;Help Index&quot;, description=&quot;Got lost? These might help you&quot;, color=discord.Co...
Replit: My bot can run but don't reply anything
python|api|discord|discord.py
0
57
1
72,926,595
72,926,595
2
true
2022-07-09T20:18:46.080Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Replit: My bot can run but don't reply anything<p>My bot can run but don't reply anything.</p> <p>It shows up it is online but if I input <code>!$help</code>...
72,927,120
Search google sheet and return row values based on input value<p>using GAS I'm trying to pass an input value to server side function that searches google sheet values for the row where the value is and returns other values in the same row as follows<br>JS</p> <pre><code>function nameSearch(serial){ try { var sheet = Sp...
<p>If you add an else clause, the function will return prematurely, unless the first row is the one that matches the serial. To prevent that, move the second return statement outside of the for loop, like so:</p> <pre><code>function nameSearch(serial) { try { var sheet = SpreadsheetApp.getActive().getSheetByName(&qu...
Search google sheet and return row values based on input value
javascript|google-apps-script|google-sheets
0
57
1
72,927,914
72,927,914
2
true
2022-07-10T08:24:33.227Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Search google sheet and return row values based on input value<p>using GAS I'm trying to pass an input value to server side function that searches google she...
72,928,612
get font name and size from bigquery tables<p>I have a dataset that has some tables and data in different fonts. Is there a way to get font name using SQL or python from these tables? Here is an example of the font formats stored in BQ table</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>s...
<p>As an option - you can use info about Unicode Characters Blocks (you can find simplified version at the bottom of answer)</p> <p>So, using such a luxury table (<code>char_blocks</code>) you can use below</p> <pre><code>select a.*, font_name from your_table a join char_blocks b on unicode(string) between block_start ...
get font name and size from bigquery tables
sql|google-bigquery
0
57
1
72,930,423
72,930,423
2
true
2022-07-10T12:53:30.860Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: get font name and size from bigquery tables<p>I have a dataset that has some tables and data in different fonts. Is there a way to get font name using SQL or...
72,948,870
Get Common elements and Difference between two Lists by a particular property using Streams<p>I have two lists of objects <code>dbAssets</code> and <code>assetVOS</code>.</p> <p>I want <strong>common</strong> elements (and <strong>difference</strong>) by some property (<code>getSecName()</code> in my case) using stream...
<p>Since you are mapping your <code>SomeClass</code> instances into <code>String</code>s, your stream pipeline produces a <code>List&lt;String&gt;</code>, not a <code>List&lt;SomeClass&gt;</code>.</p> <p>To get a <code>List&lt;SomeClass&gt;</code>, try something like this:</p> <pre><code>List&lt;SomeClass&gt; output = ...
Get Common elements and Difference between two Lists by a particular property using Streams
java|list|java-stream
2
57
2
72,949,149
72,949,149
2
true
2022-07-12T07:58:52.313Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get Common elements and Difference between two Lists by a particular property using Streams<p>I have two lists of objects <code>dbAssets</code> and <code>ass...
72,972,063
Detection of change in consecutive list elements isn't working<p>My goal is to print the value of the elements in the list where the consecutive elements are changed. For instance, if the given input is <code>1 1 1 3 3 3 2</code> then the output should be <code>[1,3,3,2]</code>, because in the input you can see that th...
<p>Code:</p> <pre><code>a = [1, 1, 1, 3, 3, 3, 2] output = [] for i in range(len(a) - 1): if a[i] != a[i + 1]: output.append(a[i]) output.append(a[i+1]) print(output) </code></pre> <p>Output:</p> <pre><code>[1, 3, 3, 2] </code></pre>
Detection of change in consecutive list elements isn't working
python|loops
0
57
3
72,972,138
72,972,138
2
true
2022-07-13T20:09:13.893Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Detection of change in consecutive list elements isn't working<p>My goal is to print the value of the elements in the list where the consecutive elements are...
72,975,490
How to compare string which has dynamic value<p>I have this string. string str = &quot;Connecting to remote server 104.255.152.68 failed&quot;</p> <p>I want to compare this whole string ignoring &quot;104.255.152.68&quot;, something like this - &quot;Connecting to remote server {} failed&quot;. if this satisfied will r...
<p>You may use <code>Regex.IsMatch</code> to find whether a given string contains this string. Feel free to alter the regular expression as you wish!</p> <p>Ex:</p> <pre><code>string str = &quot;Connecting to remote server 104.255.152.68 failed&quot;; string pattern = @&quot;^(Connecting to remote server ).*( failed)$&...
How to compare string which has dynamic value
c#|string
0
57
3
72,975,582
72,975,582
2
true
2022-07-14T05:10:48.263Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to compare string which has dynamic value<p>I have this string. string str = &quot;Connecting to remote server 104.255.152.68 failed&quot;</p> <p>I want ...
72,964,945
Is there a way to optimize the upload of huge json files to mongodb<p>I am working on a project where I need to use a database in order to better manage my data, and so I decided to use MongoDB for performance reasons. After setting everything up, I made a script that uses a pipeline to download a zip file, unpack it, ...
<p>The file seems too big to fit into memory, causing memory exceptions. You need to save the file on disk first. Then you could try command line tools like <a href="https://www.mongodb.com/docs/database-tools/mongoimport/" rel="nofollow noreferrer"><code>mongoimport</code></a> from MongoDB. You will need to convert th...
Is there a way to optimize the upload of huge json files to mongodb
javascript|json|mongodb
0
57
1
72,981,261
72,981,261
2
true
2022-07-13T10:42:34.140Z
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 optimize the upload of huge json files to mongodb<p>I am working on a project where I need to use a database in order to better manage my d...
72,988,979
Sum different rows in data frame based on two columns values<p>For the group where variable 1 is True. I want to sum the column Number in the row where variable 2 is false to the other two rows where variable 2 is True.</p> <pre><code> Variable 1 Variable 2 Number 0 True True 10 1 True ...
<p>No need for a loop or anything complex. Use simple boolean indexing for in place modification:</p> <pre><code>m1 = df['Variable 1'] m2 = df['Variable 2'] # add to the rows where m1 AND m2 # the sum of rows where m1 AND NOT m2 df.loc[m1&amp;m2, 'Number'] += df.loc[m1&amp;~m2, 'Number'].sum() </code></pre> <p>Output:...
Sum different rows in data frame based on two columns values
python|pandas|dataframe
1
57
3
72,989,544
72,989,544
2
true
2022-07-15T04:14:53.460Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sum different rows in data frame based on two columns values<p>For the group where variable 1 is True. I want to sum the column Number in the row where varia...
72,990,266
How do i map through a nested array?<p>How do i extract until the last sub_data into an array and also get the data from the third sub_data to form another structure?</p> <pre><code>[{ &quot;id&quot;: 2, &quot;title&quot;: &quot;Logo&quot;, &quot;sub_data&quot;: [ { &quot;id&quot;: 5, ...
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const data = [{ "id": 2, "title": "Logo", "sub_data": [ { "id": 5, "title": "Facebook",...
How do i map through a nested array?
reactjs
0
57
1
72,990,560
72,990,560
2
true
2022-07-15T07:11:22.930Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do i map through a nested array?<p>How do i extract until the last sub_data into an array and also get the data from the third sub_data to form another s...
73,007,316
Android Kotlin - Saving Preferences (key value pair) - not working for me<p>I am trying various simple Android Kotlin examples, to save some persistent data in my app. To start, I am using a straight forward example of writing one key-value pair, and reading it back. here's my code, in my activity's OnCreate()</p> <pr...
<p>You are not calling <code>commit()</code> or <code>apply()</code> on <code>editor</code>, so the edits are not taking effect. This is covered in <a href="https://developer.android.com/training/data-storage/shared-preferences" rel="nofollow noreferrer">the documentation</a>.</p> <p>So, <code>setPref()</code> should b...
Android Kotlin - Saving Preferences (key value pair) - not working for me
android|kotlin
0
57
1
73,007,340
73,007,340
2
true
2022-07-16T20:06:05.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android Kotlin - Saving Preferences (key value pair) - not working for me<p>I am trying various simple Android Kotlin examples, to save some persistent data ...
73,009,660
How can I rearrange the output of a query based on the order of another sheet?<p>I have the following query I'm working on/building for my work (located in the 'Query Result' sheet of my example link).</p> <pre><code>=QUERY({'1st'!A7:D;'2nd'!A7:D}, &quot;SELECT Col1, SUM(Col2), SUM(Col3), SUM(Col4) GROUP BY Col1&quot;)...
<h2>Answer</h2> <p>The following formula should produce the result you desire:</p> <pre><code>=ARRAY_CONSTRAIN(SORT({QUERY({'1st'!A7:D;'2nd'!A7:D}, &quot;SELECT Col1, SUM(Col2), SUM(Col3), SUM(Col4) WHERE Col1 IS NOT NULL GROUP BY Col1 LABEL SUM(Col2) '', SUM(Col3) '', SUM(Col4) ''&quot;),SORT(FILTER(VLOOKUP(UNIQUE({'1...
How can I rearrange the output of a query based on the order of another sheet?
google-apps-script|google-sheets
0
57
2
73,010,149
73,010,149
2
true
2022-07-17T06:30:59.487Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I rearrange the output of a query based on the order of another sheet?<p>I have the following query I'm working on/building for my work (located in t...
73,013,915
Numba: Parallelization not working properly<br> I have written some code in Python and wanted to improve it using Numba's function decorators. Using a just-in-time compiler works fine (`@jit`). However, when I tried to parralize my code, speeding it up even more, the programm strangely runs slower than the non-parraliz...
<p>As pointed out in the comments, creating temporary Numpy array is expensive because <strong>allocations do not scale</strong> in parallel but also because <strong>memory-bound core also do not scale</strong>. Here is a modified (untested) code:</p> <pre class="lang-py prettyprint-override"><code>@numba.njit(fastmath...
Numba: Parallelization not working properly
python|numba
0
57
1
73,014,650
73,014,650
2
true
2022-07-17T17:27:22.660Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Numba: Parallelization not working properly<br> I have written some code in Python and wanted to improve it using Numba's function decorators. Using a just-i...
73,011,103
React imports CSS from other components<p>I am having a problem with CSS imports in React, I have a page Home that imports Home.css and a page Hero that imports Hero.css appearently in every page of the application the Hero.css is being applied without even declaring it how can I fix this? These are the following compo...
<p>First, it's important to understand that importing CSS into a JS page is not actually a feature that JavaScript has. It's an instruction to a bundler like Webpack to include this CSS in the build process.</p> <p>Moreover, CSS has no native means of scoping it's effects to a cetain component. It's your responsibility...
React imports CSS from other components
html|css|reactjs
0
57
3
73,011,190
73,011,190
2
true
2022-07-17T10:44:10.263Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React imports CSS from other components<p>I am having a problem with CSS imports in React, I have a page Home that imports Home.css and a page Hero that impo...
72,954,684
How to add badges to bottom bar buttons in SwiftUI?<p>I have a bottom bar with buttons in it. I'm having trouble adding badges to the buttons and tried using the native <code>.badges</code> modifier but had no effect.</p> <p>This is what I'm trying:</p> <pre><code>struct ContentView: View { var body: some View { ...
<p>Documentation of badge modifier states &quot;Badges are only displayed in list rows and iOS tab bars&quot; . Toolbar is not a Tabbar.</p> <p>A possible approach is to do that in custom way (because toolbar accepts just a view), so it could be like</p> <p><a href="https://i.stack.imgur.com/TgPWv.png" rel="nofollow no...
How to add badges to bottom bar buttons in SwiftUI?
swiftui
1
57
1
72,955,083
72,955,083
2
true
2022-07-12T15:19:08.763Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add badges to bottom bar buttons in SwiftUI?<p>I have a bottom bar with buttons in it. I'm having trouble adding badges to the buttons and tried using...
72,988,311
Powershell - Write-Host printing in wrong place<p>My code has the following function:</p> <pre><code>function status{ if ($args[0] -eq &quot;Stopped&quot;){ Write-Host -NoNewline &quot;Stopped&quot; -fore red ..... } } </code></pre> <p>and the function is used as:</p> <pre><code>... Write-Host &quot...
<p>You could use <a href="https://en.wikipedia.org/wiki/ANSI_escape_code" rel="nofollow noreferrer">ANSI Escape sequences</a> for this but it wouldn't work in old terminals. I'm not convinced if this is possible combining outputs from <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.util...
Powershell - Write-Host printing in wrong place
powershell
2
57
2
72,988,480
72,988,480
2
true
2022-07-15T01:52:00.533Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Powershell - Write-Host printing in wrong place<p>My code has the following function:</p> <pre><code>function status{ if ($args[0] -eq &quot;Stopped&quot...
72,821,355
SQL - calculate total value of group, row by row<p>I have a fact sales table that is structured like the below. This contains information on subscriptions (sales) by customer.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>CustomerKey</th> <th>SubscriptionKey</th> <th>StartDate</th> <th>En...
<pre><code>select * from T t1 cross apply ( select sum(Value) from T t2 where t2.CustomerKey = t1.CustomerKey and t1.EndDate between t2.StartDate and t2.EndDate ) v(ValueAtEndDate); </code></pre> <p>This could be just a scalar subquery. Either way is essentially the same.</p> <p><a href="https://dbfiddl...
SQL - calculate total value of group, row by row
sql|sql-server|sql-server-2016
-1
57
2
72,821,468
72,821,468
2
true
2022-06-30T19:56:32.670Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL - calculate total value of group, row by row<p>I have a fact sales table that is structured like the below. This contains information on subscriptions (s...
72,815,507
Two map methods inside map method<p>In my example, I have an array of objects which I want to map to another array of objects:</p> <pre><code>Resurs.map((item) =&gt; ({ Cen: item.Cent, level: [ item.NumList.map((item) =&gt; ({ Kom: item.Number, Num: item.Kor, })), item.SerList.map((item) =&g...
<p>You are almost there! The answer is spread operator. Just insert it in your inner map.</p> <p>You can use a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax" rel="nofollow noreferrer">spread operator</a> to expanded the arrays when you insert into level.</p> <p>The s...
Two map methods inside map method
javascript|arrays
1
57
2
72,815,758
72,815,758
2
true
2022-06-30T12:05:02.310Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Two map methods inside map method<p>In my example, I have an array of objects which I want to map to another array of objects:</p> <pre><code>Resurs.map((ite...
72,788,589
Scheduling a release waiting for approval via DevOps API<p>I need to schedule a release deployment via Azure DevOps' API.</p> <p>The release is pending approval and via the interface I can schedule the deployment:</p> <p><img src="https://user-images.githubusercontent.com/472146/176207192-af5e1426-59ee-46f8-9107-ce3d07...
<p>Ok, so, I found the solution.</p> <p>You need to change the release schedule without changing the status (doesn't make sense, but works).</p> <p>So, you need to call the release environment patch API (<code>https://vsrm.dev.azure.com/jato-jaas/Services/_apis/Release/releases/{releaseId}/environments/{environmentId}?...
Scheduling a release waiting for approval via DevOps API
api|azure-devops
1
57
1
72,789,468
72,789,468
2
true
2022-06-28T14:45:01.143Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scheduling a release waiting for approval via DevOps API<p>I need to schedule a release deployment via Azure DevOps' API.</p> <p>The release is pending appro...
72,891,681
Python Convert string to int or float, which one is preferable?<p>Sometime I convert string to int and sometime to float,so I would like to know,what is the better?I mean what is the situation that I should choose convert to int or float?</p>
<p>When in doubt, you should convert the <code>str</code> to a <code>float</code> as it is able to handle a more general input, e.g.</p> <pre><code>float(&quot;1.2&quot;) &gt;1.2 </code></pre> <p>while the conversion attempt to an integer throws a <code>ValueError</code>, i.e.</p> <pre><code>int(&quot;1.2&quot;) &gt;Va...
Python Convert string to int or float, which one is preferable?
python|pandas
-2
57
3
72,891,720
72,891,720
2
true
2022-07-07T02:31:26.893Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python Convert string to int or float, which one is preferable?<p>Sometime I convert string to int and sometime to float,so I would like to know,what is the ...
72,918,501
Check if cell in dataframe is NaN, if it is, iterate to the next cell<p>I have a nested dataframe that I need to <code>explode()</code>.</p> <p>I'm imagining the code will be something like this? I would like to avoid using the explicit column names in the code if possible since then the code would break if the column ...
<p>You do not have a DataFrame, You have a complicated nested dictionary. We can try to make sense of it like this:</p> <p>Every 2nd level value that's a list can be made into a DataFrame, but we still probably want to know where it came from, so we'll give it a MultiIndex with that information.</p> <pre><code>dfs = []...
Check if cell in dataframe is NaN, if it is, iterate to the next cell
python|pandas|dataframe|explode
1
57
1
72,919,087
72,919,087
2
true
2022-07-09T02:28:05.150Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Check if cell in dataframe is NaN, if it is, iterate to the next cell<p>I have a nested dataframe that I need to <code>explode()</code>.</p> <p>I'm imagining...
72,893,265
Python: Create several xml-files from several xlsx-files<p>I found out how to create a singe xml-file from a single xlsx-file using this code:</p> <pre><code>from openpyxl import load_workbook wb = load_workbook(&quot;convert_file.xlsx&quot;,data_only=True) ws = wb.active sheetname_row_list:list =[] for row in ws...
<p>I suggest using pathlib and something like:</p> <pre class="lang-py prettyprint-override"><code>from pathlib import Path source_directory = Path('.') # Pointing to the XLSX files for filename in source_directory.glob('*.xlsx'): # Call to your conversion code ... resultname = f'{filename.stem.replace(&quo...
Python: Create several xml-files from several xlsx-files
python|xml|openpyxl|xlsx|yattag
2
57
1
72,893,684
72,893,684
2
true
2022-07-07T06:37:14.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python: Create several xml-files from several xlsx-files<p>I found out how to create a singe xml-file from a single xlsx-file using this code:</p> <pre><code...
72,937,085
Mat dialog inside a mat table get a same value when hitting addrow<p>here's my table when i tried to open the table</p> <p><a href="https://i.stack.imgur.com/F3zCZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F3zCZ.png" alt="enter image description here" /></a></p> <p>once i open the dialog it wil...
<p>you has wrote</p> <pre><code>&lt;!--REMOVE [(ngModel)]--&gt; &lt;input type=&quot;text&quot; formControlName=&quot;address&quot; [(ngModel)]=&quot;value&quot; /&gt; </code></pre> <p>You need remove the [(ngModel)], futhermore <strong>not</strong> use in the same tag [(ngModel)] and formControlName. You're saying Ang...
Mat dialog inside a mat table get a same value when hitting addrow
arrays|angular|typescript|rxjs
-1
57
1
72,937,420
72,937,420
2
true
2022-07-11T10:24:46.623Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mat dialog inside a mat table get a same value when hitting addrow<p>here's my table when i tried to open the table</p> <p><a href="https://i.stack.imgur.com...
72,812,008
How to mock module attributes and other modules in Elixir?<p>I'm very new to elixir so this is probably basic but couldn't see much online</p> <p>if I have the following code</p> <pre><code>defmodule A do def my_first_function do # does stuff end end defmodule B do @my_module_attribute A.my_first_function(...
<p>I think perhaps you are wanting to use module attributes for more than what they are useful for, and perhaps there is some confusion over the exact definition of &quot;mock&quot;.</p> <p>Avoid thinking of module attributes as &quot;class variables&quot; -- even though they look like they might serve the same purpose...
How to mock module attributes and other modules in Elixir?
testing|mocking|elixir
0
57
1
72,814,536
72,814,536
2
true
2022-06-30T07:42:44.493Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to mock module attributes and other modules in Elixir?<p>I'm very new to elixir so this is probably basic but couldn't see much online</p> <p>if I have t...
72,832,512
How to hold alert box on the page in case of reloading or changing route?<p>I need to maintain an alert box on the <code>Registration</code> page indicating the user has registered successfully. However, by redirecting to the <code>Login</code> form this box disappears, because the page refreshes.<br> I utilize the <co...
<p>Your problem probably comes from <code>window.location.reload();</code> when window is reloaded all components and services are flushed. Find other ways to clear services if that's the point this line. Or find other way to store info that alert should be showing (e.g storing the need to show an alert with info and d...
How to hold alert box on the page in case of reloading or changing route?
javascript|angular|typescript|alert
0
57
1
72,837,382
72,837,382
2
true
2022-07-01T16:59:19.273Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to hold alert box on the page in case of reloading or changing route?<p>I need to maintain an alert box on the <code>Registration</code> page indicating ...
72,910,883
Wrap all occurences of Array<word> in string in <em></em> Javascript, allowing "em" to be a word<p>The usecase: I have a search input that allows users to enter space-separated words to search for in a list of entries. I want to only display matches that match any of the words provided, and highlight those parts of the...
<p>You should aim to create only one, comprehensive regular expression, not one per needle:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const regEscape = s =&gt; s.replace(...
Wrap all occurences of Array<word> in string in <em></em> Javascript, allowing "em" to be a word
javascript|regex|replace
-1
57
1
72,911,228
72,911,228
2
true
2022-07-08T11:43:17.200Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Wrap all occurences of Array<word> in string in <em></em> Javascript, allowing "em" to be a word<p>The usecase: I have a search input that allows users to en...
72,853,658
R new column in a dataframe that contains a vector generated using conditions from other columns<p>I have this dataframe df:</p> <pre><code>df&lt;-structure(list(hex = 1:6, tile_type_index = c(9L, 10L, 5L, 9L, 3L, 2L)), class = &quot;data.frame&quot;, row.names = c(NA, -6L)) hex tile_type_index 1 1 ...
<p>One possible way to solve your problem:</p> <pre><code># way 1 df$material = lapply(df$tile_type_index, \(x) match(1:10, x, 0, 10) * 1000) # way 2 df$material = lapply(df$tile_type_index, \(x) (x!=10 &amp; x==1:10) * 1000) # hex tile_type_index material # 1 1 9 0, 0, 0, 0, ...
R new column in a dataframe that contains a vector generated using conditions from other columns
r
0
57
4
72,853,838
72,853,838
2
true
2022-07-04T08:17:54.503Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R new column in a dataframe that contains a vector generated using conditions from other columns<p>I have this dataframe df:</p> <pre><code>df&lt;-structure(...
72,791,136
mongoose add a field to a document from another document<p>I want to get categories by limit, offset, orderBy viewers from VideoSchema</p> <pre class="lang-js prettyprint-override"><code>const CategoriesSchema = new Schema&lt;ICategories&gt;({ name: String, image: String, }); const VideoSchema = new Schema&lt;IVid...
<p>If I understand correctly, you want for each <code>category</code>, to add the sum of <code>viewers</code> from the relevant <code>videos</code>, sort and slice.</p> <p>On mongoDB you can easily do it all in one query. Since you want to get categories with 0 viewers as well, we will start from the <code>category</co...
mongoose add a field to a document from another document
javascript|mongodb|mongoose
2
57
1
72,825,613
72,825,613
2
true
2022-06-28T17:57:33.890Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: mongoose add a field to a document from another document<p>I want to get categories by limit, offset, orderBy viewers from VideoSchema</p> <pre class="lang-j...
72,803,456
Pivot - Transpose Vertical Data with repeated rows into Horizontal Data with one row per ID<p>I have survey data that was exported as a Vertical dataframe. Meaning for everytime a person responded to 3 questions in the survey, their row would duplicate 3 times, except the content of the question and their answer. I am ...
<h1>Concept</h1> <p>In this scenario, we should consider using:</p> <p><code>pivot()</code>: Pivot without aggregation that can <strong>handle non-numeric data</strong>.</p> <hr /> <br/> <br/> <br/> <br/> <br/> <h1>Practice</h1> <p>Prepare data</p> <pre><code>data = {'ID':[12345,12345,12345,67891,67891,67891], ...
Pivot - Transpose Vertical Data with repeated rows into Horizontal Data with one row per ID
python|pandas|pivot-table
2
57
1
72,803,892
72,803,892
2
true
2022-06-29T14:50:28.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pivot - Transpose Vertical Data with repeated rows into Horizontal Data with one row per ID<p>I have survey data that was exported as a Vertical dataframe. M...
72,927,081
Under the hood, are +myString and Number(myString) identical?<p>I'm not asking which one is best/nicer/whatever.</p> <p>They seem to be identical in functionality:</p> <ul> <li>both return <code>NaN</code> if <code>myString</code> is not a number</li> <li>both are stricter than <code>parseInt()</code> in the sense that...
<p><strong>tl;dr</strong> The end result is the same, but the route taken there is different. But with a <strong>HUGE</strong> caveat!</p> <h1><em>Unary prefix <code>+</code> operator</em></h1> <p>The <em>unary prefix <code>+</code> operator</em> is defined in <a href="https://tc39.es/ecma262/#sec-unary-plus-operator" ...
Under the hood, are +myString and Number(myString) identical?
javascript
0
57
1
72,927,468
72,927,468
2
true
2022-07-10T08:17:29.670Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Under the hood, are +myString and Number(myString) identical?<p>I'm not asking which one is best/nicer/whatever.</p> <p>They seem to be identical in function...
72,857,673
Multidimensional Array as html-table entries per day among themselves<p>is there a easy way to build from this multidimensional array a HTML-Table in this Format:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th style="text-align: left;">Monday</th> <th style="text-align: left;">Tuesday</th>...
<p>You can achieve this by looping through the array.</p> <pre class="lang-php prettyprint-override"><code>$calendar[&quot;Monday&quot;][] = &quot;Otto Monday&quot;; $calendar[&quot;Monday&quot;][] = &quot;Anna Monday&quot;; $calendar[&quot;Tuesday&quot;][] = &quot;Fritz Tuesday&quot;; $calendar[&quot;Wednesday&quot;][...
Multidimensional Array as html-table entries per day among themselves
php|html|arrays|multidimensional-array|html-table
1
57
2
72,857,987
72,857,987
2
true
2022-07-04T13:38:31.170Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Multidimensional Array as html-table entries per day among themselves<p>is there a easy way to build from this multidimensional array a HTML-Table in this Fo...
72,942,005
Extract List of Dictionary in Python<p>I have the following list:</p> <pre><code> { &quot;TargetHealthDescriptions&quot;:[ { &quot;Target&quot;:{ &quot;Id&quot;:&quot;10.101.100.101&quot;, &quot;Port&quot;:8200, &quot;AvailabilityZone&quot;:&quot;all&quot; ...
<p>You need to identify and iterate over the list from within the dictionary by using it's key. The key in this dictionary is <code>the_response['TargetHealthDescriptions']</code>.</p> <p>Once you have that you can then iterate over it like any other list treating each result as a dictionary, getting the value within ...
Extract List of Dictionary in Python
python|boto3
-3
57
5
72,942,078
72,942,078
2
true
2022-07-11T16:51:49.557Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extract List of Dictionary in Python<p>I have the following list:</p> <pre><code> { &quot;TargetHealthDescriptions&quot;:[ { &quot;Targe...
72,936,108
Kotlin: Generic types in Kotlin<p>To get the class definition to be used for example for json deserialization the following can be used in Kotlin:</p> <pre><code>Map::class.java </code></pre> <p>A example usage is the following:</p> <pre><code>val map = mapper.readValue(json, Map::class.java) </code></pre> <p>But now ...
<p><code>Class&lt;T&gt;</code> (in Java) or <code>KClass&lt;T&gt;</code> (in Kotlin) can only represent <em>classes</em>, not all types. If the API you're using only uses <code>Class&lt;T&gt;</code> or <code>KClass&lt;T&gt;</code>, it simply doesn't support generic types (at least in those functions).</p> <p>Instead, <...
Kotlin: Generic types in Kotlin
kotlin|generics
1
57
1
72,936,402
72,936,402
2
true
2022-07-11T09:10:01.767Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kotlin: Generic types in Kotlin<p>To get the class definition to be used for example for json deserialization the following can be used in Kotlin:</p> <pre><...
72,796,962
Create multiple columns by pivoting even when pivoted value doesn't exist<p>I have a PySpark <code>df</code>:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Store_ID</th> <th>Category</th> <th>ID</th> <th>Sales</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>A</td> <td>123</td> <td>23</td>...
<p>This operation is called pivoting.</p> <ul> <li>a couple of aggregations, since you need both, count of ID and sum of Sales</li> <li><code>alias</code> for aggregations, for changing column names</li> <li>providing values in pivot, for cases where you want numbers for Category C, but C doesn't exist. Providing value...
Create multiple columns by pivoting even when pivoted value doesn't exist
apache-spark|pyspark|pivot|multiple-columns|pyspark-pandas
1
57
1
72,798,012
72,798,012
2
true
2022-06-29T06:53:10.923Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create multiple columns by pivoting even when pivoted value doesn't exist<p>I have a PySpark <code>df</code>:</p> <div class="s-table-container"> <table clas...
72,831,725
How to get images from blockcontent body?<p>This is my code. Everything renders except images. How to get images in the right order from body? I'm using <strong>sanity-blocks-vue-component</strong> to render body block. While fetching query Im also fetching body from it. Propably I should use serializers, but I don't k...
<p>You need to serialize the image. Change the template to</p> <pre><code>&lt;SanityBlocks :blocks=&quot;blocks&quot; :serializers=&quot;serializers&quot; /&gt; </code></pre> <p>and then add the serializer code:</p> <pre><code>const serializers = { types: { image: (data) =&gt; { return h(&quot;img&quot;, { ...
How to get images from blockcontent body?
vue.js|sanity
1
57
1
72,837,388
72,837,388
2
true
2022-07-01T15:46:48.660Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get images from blockcontent body?<p>This is my code. Everything renders except images. How to get images in the right order from body? I'm using <str...
73,013,500
Flattening type that gives a union of all keys in a nested object<p>I feel like this should not be so difficult. Yet, no matter what I try, I can't get it to work. Here's the best I got so far:</p> <pre class="lang-js prettyprint-override"><code>// Sample type. I want to make this into 'a' | 'b' | 'x' | 'c' | 'd' type ...
<p>You had a typo in <code>EtractKeys2</code>. You used <code>EtractKeys</code> instead of <code>ExtractKeys2</code> for your recursive call.</p> <pre><code>type ExtractKeys2&lt;T&gt; = T extends Record&lt;string, any&gt; ? keyof T | ExtractKeys2&lt;T[keyof T]&gt; : never const tryIt2: ExtractKeys2&lt;O&gt; = 'z...
Flattening type that gives a union of all keys in a nested object
typescript|typescript-generics
2
57
2
73,013,624
73,013,624
2
true
2022-07-17T16:27:05.767Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flattening type that gives a union of all keys in a nested object<p>I feel like this should not be so difficult. Yet, no matter what I try, I can't get it to...
72,777,590
How to use Resources in c++?<p>I want to put an exe file in my C++ program, but I don't understand how to do it. I am using Visual Studio 2019. I know that it can be done through project resources, but I don't know how to work with it.</p>
<p>Create an <a href="https://docs.microsoft.com/en-us/windows/win32/menurc/about-resource-files" rel="nofollow noreferrer"><code>.rc</code> file</a> to refer to the desired embedded <code>.exe</code> as an <code>RCDATA</code> resource, eg:</p> <pre class="lang-none prettyprint-override"><code>MYEXE RCDATA &quot;path\t...
How to use Resources in c++?
c++|visual-studio-2019
-4
57
1
72,777,625
72,777,625
3
true
2022-06-27T19:48:40.917Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use Resources in c++?<p>I want to put an exe file in my C++ program, but I don't understand how to do it. I am using Visual Studio 2019. I know that i...
72,793,843
How to reverse order of x-axis breaks in ggplot?<p>I'm trying to make a plot wherein large values on the x-axis are actually small, and vice versa. Because of how ggplot reads the data, it's automatically ordering the data such that the x-axis is ordered smallest to largest, and I'm trying to figure out how to reverse ...
<p>This is exactly what <code>scale_x_reverse</code> is for:</p> <pre class="lang-r prettyprint-override"><code>ggplot(test2, aes(Freq, SD, z = Intro_0)) + geom_contour_filled(bins = 9)+ scale_fill_brewer(palette = &quot;BuPu&quot;)+ labs(x = &quot;Frequency&quot;, y = &quot;Magnitude&quot;, title = &quot;Test Pl...
How to reverse order of x-axis breaks in ggplot?
r|ggplot2|plot|x-axis
0
57
1
72,793,922
72,793,922
3
true
2022-06-28T22:33:46.830Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to reverse order of x-axis breaks in ggplot?<p>I'm trying to make a plot wherein large values on the x-axis are actually small, and vice versa. Because o...
72,817,920
Negation of a void pointer Realloc<p>I was reading a C code, and I didn't understand well a line :</p> <pre><code>str = realloc(NULL, sizeof(*str)*size);//size is start size if(!str)return str; </code></pre> <p>what does the <code>!str</code> mean ?</p> <p>The code read an input string from a user then realloc dyn...
<p>A pointer in C is &quot;falsy&quot; if it is a null pointer, and &quot;truthy&quot; otherwise.</p> <p>So <code>if (!str) return str;</code> means that if <code>str</code> is NULL (meaning that the allocation failed) the function returns <code>str</code> (i.e. NULL). It could also be written as <code>if (str == NULL...
Negation of a void pointer Realloc
c|if-statement|realloc|negation
2
57
3
72,817,964
72,817,964
3
true
2022-06-30T14:54:00.507Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Negation of a void pointer Realloc<p>I was reading a C code, and I didn't understand well a line :</p> <pre><code>str = realloc(NULL, sizeof(*str)*size);//si...
72,839,231
Nest a tibble by column prefix<p>We do a normal nesting grouping by rows. Mine is different. I want to create a nested tibble grouping by column prefixes (before the first '_'), preserving the original column names in the nested tibbles. The current approach works but looks overcomplicated.</p> <pre><code>tibble(a_1=1:...
<p>Using a neat little trick I learned lately you could do:</p> <pre class="lang-r prettyprint-override"><code>library(tidyr) library(dplyr, warn = FALSE) tibble(a_1 = 1:3, a_2 = 2:4, b_1 = 3:5) %&gt;% split.default(., gsub(&quot;_[0-9]&quot;, &quot;&quot;, names(.))) %&gt;% lapply(nest, data = everything()) %&gt;...
Nest a tibble by column prefix
r|dplyr|tidyverse|tidyr|purrr
0
57
3
72,839,361
72,839,361
3
true
2022-07-02T12:58:53.867Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Nest a tibble by column prefix<p>We do a normal nesting grouping by rows. Mine is different. I want to create a nested tibble grouping by column prefixes (be...
72,849,313
How to implement p:A=>Boolean in Scala<p>I have below HOF which takes function as an argument</p> <pre><code>def findFirst[A](ss:Array[A], p:A=&gt;Boolean):Int ={ @tailrec def loop(n:Int):Int ={ if(p(ss(n))) n else if (n+1&gt;=ss.length) -1 else loop(n+1) } loop(0) </code></pre> <p>}</p> <p>I can call the above f...
<p>So only regarding the &quot;nicer way to implement the <code>p</code>&quot;, and assuming your coding in Scala 2 (based on the coding style), I suggest you do this:</p> <pre class="lang-scala prettyprint-override"><code>def findFirst[A](ss: Array[A])(p: A =&gt; Boolean): Int = ... // And then when calling the funct...
How to implement p:A=>Boolean in Scala
scala|functional-programming
0
57
1
72,849,355
72,849,355
3
true
2022-07-03T19:26:00.210Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to implement p:A=>Boolean in Scala<p>I have below HOF which takes function as an argument</p> <pre><code>def findFirst[A](ss:Array[A], p:A=&gt;Boolean):I...
72,849,712
How do I initialise a map within a map in F#<p>I want a map of maps in F#, but I can't work out how to initialise it. Both</p> <pre><code>Map.empty.Add(&quot;Foo&quot;: Map.empty.Add(1: &quot;a&quot;).Add(2, &quot;b&quot;)) </code></pre> <p>and</p> <pre><code>Map.empty.Add(&quot;Foo&quot;: Map [ (1, &quot;a&quot;); (2,...
<p>Use commas instead of colons throughout:</p> <pre class="lang-ml prettyprint-override"><code>Map.empty.Add(&quot;Foo&quot;, Map.empty.Add(1, &quot;a&quot;).Add(2, &quot;b&quot;)) </code></pre> <p>Your idea of using the <code>Map</code> constructor instead is definitely easier to manage, but I think it's even better ...
How do I initialise a map within a map in F#
f#
0
57
1
72,849,802
72,849,802
3
true
2022-07-03T20:32:26.057Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I initialise a map within a map in F#<p>I want a map of maps in F#, but I can't work out how to initialise it. Both</p> <pre><code>Map.empty.Add(&quot...
72,887,142
How to select the lowest number per group in R<pre class="lang-r prettyprint-override"><code>rn=c(3,4,5,2,1,5,6,8,10,3,4,5,6,8,9,7) na=c(&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,&quot;B&quot;,&quot;B&quot;,&quot;B&quot;,&quot;B&quot;,&quot;B&quot;,&quot;CD&quot;,&quot;CD&quot;,&quot;CD&quot...
<p>We can use <code>slice_min</code> after grouping (assuming 'dat' is <code>data.frame</code> and not a <code>matrix</code>) - <code>cbind</code> by default returns a <code>matrix</code>, instead use <code>data.frame</code> directly</p> <pre><code>library(dplyr) dat %&gt;% group_by(na) %&gt;% slice_min(n = 1, ord...
How to select the lowest number per group in R
r
2
57
4
72,887,161
72,887,161
3
true
2022-07-06T16:42:29.210Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to select the lowest number per group in R<pre class="lang-r prettyprint-override"><code>rn=c(3,4,5,2,1,5,6,8,10,3,4,5,6,8,9,7) na=c(&quot;A&quot;,&quot;...
72,892,152
What's addr32 in assembly means?<p>I've tried hard to figure out what <code>addr32</code> means in assembly code. For example, I use gdb to trace a binary; below is part of the code.</p> <pre><code>adcx %r13,%r13 #! PC = 0x55555557d9fb adox %rcx,%r10 #! ...
<p><code>addr32</code> is the prefix <code>67h</code>. It does not have an effect on instructions without memory operands.</p> <p>On instructions with memory operands, it changes the address size to 32 bit.</p> <p>Now as for why the prefix is used here, I don't know. It could be some sort of padding or to avoid some ...
What's addr32 in assembly means?
assembly|gdb|x86-64|disassembly|machine-code
1
57
1
72,892,202
72,892,202
3
true
2022-07-07T04:04:54.990Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What's addr32 in assembly means?<p>I've tried hard to figure out what <code>addr32</code> means in assembly code. For example, I use gdb to trace a binary; b...
72,936,720
declare mutable string with varying size dynamically<p>I made my own string declarator with macro in GNU Assembler in x64 machine.</p> <pre><code>.macro declareString identifier, value .pushsection .data \identifier: .ascii &quot;\value&quot; &quot;lengthof.\identifier&quot;= . - \identifier .popsection .en...
<p>Same as in C; if you want to use static storage (in <code>.data</code>) for the characters themselves (like <code>static char myString[4] = &quot;good&quot;;</code> note not including a terminating 0 byte), you actually need to reserve enough space for the largest you ever want this string to be. Like <code>static ...
declare mutable string with varying size dynamically
string|assembly|macros|dynamic-memory-allocation|gnu-assembler
0
57
1
72,937,414
72,937,414
3
true
2022-07-11T09:57:44.050Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: declare mutable string with varying size dynamically<p>I made my own string declarator with macro in GNU Assembler in x64 machine.</p> <pre><code>.macro decl...
72,960,752
Rust error propagation with distinct type across propagation levels<p>What is the recommended way of propagating different error types in Rust (especialy when their definition doesn't merge)?</p> <h1>The Scenario</h1> <p>Initially, I was curious about how to stop a running thread in Rust. Search suggests it goes throug...
<p>The idiomatic way depends on whether you're writing a library or an application.</p> <p>For applications, you usually use some <code>dyn Trait</code> as you just need to display the error.</p> <p>Usually you don't use <code>dyn Any</code> for errors in Rust but <a href="https://doc.rust-lang.org/stable/std/error/tra...
Rust error propagation with distinct type across propagation levels
rust
2
57
1
72,960,994
72,960,994
3
true
2022-07-13T03:54:55.113Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rust error propagation with distinct type across propagation levels<p>What is the recommended way of propagating different error types in Rust (especialy whe...
72,961,962
R: Programmatically changing ggplot scale labels to Greek letters with expressions<p>I am trying to change the labels in a <code>ggplot</code> object to Greek symbols for an <strong>arbitrary</strong> number of labels. Thanks to <a href="https://stackoverflow.com/questions/5293715/how-to-use-greek-symbols-in-ggplot2">t...
<p>Another option to achieve your desired result would be to add a new column to your data which contains the <code>?plotmath</code> expression as a string and map this new column on <code>y</code>. Afterwards you could use <code>scales::label_parse()</code> to parse the expressions:</p> <pre class="lang-r prettyprint-...
R: Programmatically changing ggplot scale labels to Greek letters with expressions
r|ggplot2|label|expression|figure
2
57
1
72,962,198
72,962,198
3
true
2022-07-13T06:46:31.667Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R: Programmatically changing ggplot scale labels to Greek letters with expressions<p>I am trying to change the labels in a <code>ggplot</code> object to Gree...
72,985,482
Show/Hide nav bar elements<p>I want to click on an element to show and when I click on another one the first one to hide. I want to do this with 4 elements but this only works when I'm doing this in an order, as soon as I skip a button the elements just stack on top of each other without hiding.</p> <p>Some code:</p> <...
<p>You're only setting the <code>display</code> property of some items to <code>none</code> when you should be setting all the ones you don't want to see.</p> <p>The items are stacking when you go out of order because your <code>show...()</code> functions are only setting the <code>display</code> property of the item b...
Show/Hide nav bar elements
javascript|html
0
57
2
72,985,840
72,985,840
3
true
2022-07-14T19:01:54.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Show/Hide nav bar elements<p>I want to click on an element to show and when I click on another one the first one to hide. I want to do this with 4 elements b...
73,001,737
hvplot / holoviews (bokeh) timedelta axis with negative values formatter<h3>Issue:</h3> <p>I am trying to plot data with a pandas time delta index with <strong><em>negative</em> time delta</strong> values on the x-axis using hvplot or holoviews (bokeh backend).</p> <p>The labels are just integers, and seem to be in mil...
<p>I found a solution, it is not pretty but it works<br /> (Using the earlier created dataframe):</p> <pre><code>def timedelta_formatter(x): x/=1000 # ms -&gt; seconds # extract seconds, minutes, hours, days from time m, s = divmod(abs(x), 60) h, m = divmod(m, 60) d, h = divmo...
hvplot / holoviews (bokeh) timedelta axis with negative values formatter
python|bokeh|timedelta|holoviews|hvplot
3
57
1
73,001,738
73,001,738
3
true
2022-07-16T05:22:45.193Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: hvplot / holoviews (bokeh) timedelta axis with negative values formatter<h3>Issue:</h3> <p>I am trying to plot data with a pandas time delta index with <stro...
73,026,988
<select> should have {defaultValue} or {value} instead of setting {selected}<p>I'm building an E-Commerce site with reactjs with styled-component. My page <strong>product.jsx</strong> that has the <code>&lt;select&gt;</code> element with different sizes of product <code>[XS,S,M,L,XL]</code> that causes error always sho...
<p>To resolve this error you need change <code>value=&quot;default&quot;</code> instead of <code>selected={true}</code>, and on the <strong>FilterSize</strong> component should add <code>defaultValue=&quot;default&quot;</code>. The <strong>defaultValue</strong> and <strong>value</strong> with the same value, you will b...
<select> should have {defaultValue} or {value} instead of setting {selected}
javascript|reactjs|styled-components
2
57
1
73,027,991
73,027,991
3
true
2022-07-18T18:28:56.853Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: <select> should have {defaultValue} or {value} instead of setting {selected}<p>I'm building an E-Commerce site with reactjs with styled-component. My page <s...
73,007,091
Apps script conditional formatting for value not in array<p><a href="https://i.stack.imgur.com/L1KFZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L1KFZ.png" alt="enter image description here" /></a></p> <p>I have a column containing US state abbreviations. I'd like to have an array of all 50 state...
<p>Here is an example of using a custom formula in conditional formatting.</p> <p>I create a data set in A1:A5.</p> <p>Then I put conditional formatting on A7:A10. The custom formula is <code>=ISNA(MATCH(A7,A$1:A$5,0))</code></p> <p><a href="https://i.stack.imgur.com/wC6hB.png" rel="nofollow noreferrer"><img src="http...
Apps script conditional formatting for value not in array
javascript|google-apps-script|google-sheets|google-sheets-formula|conditional-formatting
0
57
1
73,007,463
73,007,463
3
true
2022-07-16T19:27:56.827Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Apps script conditional formatting for value not in array<p><a href="https://i.stack.imgur.com/L1KFZ.png" rel="nofollow noreferrer"><img src="https://i.stack...
72,834,727
Function to format an HTML string of ul/li into a nested object with a specific format<p>Trying to convert <code>html_string</code> (could have more nested ul li elements) into <code>ideal_data_output</code></p> <pre><code>let html_string = `&lt;ul&gt;&lt;li&gt;&lt;p&gt;one&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;two&lt...
<p>This should be done with a DOM parser.</p> <p>Assuming the HTML structure always has the text in a separate <code>p</code> element, and its only possible next sibling node is an <code>ul</code> node, you can use this recursive function:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true"...
Function to format an HTML string of ul/li into a nested object with a specific format
javascript|arrays|string|recursion|reduce
2
57
2
72,834,895
72,834,895
3
true
2022-07-01T21:22:33.013Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Function to format an HTML string of ul/li into a nested object with a specific format<p>Trying to convert <code>html_string</code> (could have more nested u...
73,028,899
How to find largest property in List?<p>I have linq expression &quot;Where&quot; that may returns several rows:</p> <pre><code>var checkedPrices = prices.Where(...).ToList(); </code></pre> <p>As there are several rows, retrieves from db =&gt; i want to take the largest string from this list of rows.</p> <p>Also there i...
<p>Since it seems you need only one price I would recommend just write correct query to fetch it only. You can order items (with <a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/" rel="nofollow noreferrer">LINQ</a>'s <a href="https://docs.microsoft.com/en-us/dotnet/api/system.linq...
How to find largest property in List?
c#
1
57
1
73,028,946
73,028,946
3
true
2022-07-18T21:37:52.553Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to find largest property in List?<p>I have linq expression &quot;Where&quot; that may returns several rows:</p> <pre><code>var checkedPrices = prices.Whe...
72,977,491
Get the last day of every month using static date in python?<p>I have a static date eg month_end_date = 30/06/2022,</p> <p>how can I get the last day of the month for each month from the month_end_date until next year 30/06/2023 in a dataframe column.</p> <p>Just the last day of the month without creating an entire dat...
<p>You can use <a href="https://pandas.pydata.org/docs/reference/api/pandas.date_range.html" rel="nofollow noreferrer"><code>pandas.date_range</code></a> with a month-end (<code>M</code>) frequency:</p> <pre><code>month_end_date = '30/06/2022' stop = '30/06/2023' pd.date_range(month_end_date, stop, freq='M') </code></...
Get the last day of every month using static date in python?
python|arrays|pandas|numpy|date
1
57
2
72,977,545
72,977,545
3
true
2022-07-14T08:27:24.610Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get the last day of every month using static date in python?<p>I have a static date eg month_end_date = 30/06/2022,</p> <p>how can I get the last day of the ...
72,924,412
How can I get a Ruby variable from a line read from a file?<p>I need to reuse a textfile that is filled with one-liners such:</p> <pre><code>export NODE_CODE=&quot;mio12&quot; </code></pre> <p>How can I do that in my Ruby program the var is created and assign as it is in the text file?</p>
<p>If the file were a Ruby file, you could require it and be able to access the variables after that:</p> <pre><code># variables.rb VAR1 = &quot;variable 1&quot; VAR2 = 2 # ruby.rb require &quot;variables&quot; puts VAR1 </code></pre> <p>If you're not so lucky, you could read the file and then loop through the line...
How can I get a Ruby variable from a line read from a file?
ruby
0
57
2
72,925,082
72,925,082
3
true
2022-07-09T20:25:17.600Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I get a Ruby variable from a line read from a file?<p>I need to reuse a textfile that is filled with one-liners such:</p> <pre><code>export NODE_CODE...
72,883,576
How to convert normal python code into a python function<p>Here i have written a normal python code for api request. I need to write this same code in python function. I have no idea how to convert this. So can anyone please let me kknow how to do this.</p> <pre><code>import requests import json r = requests.post( &...
<p>Here is a suggestion to the code: I've taken liberties to clean up a bit. The function has the URL and text parameters as arguments:</p> <pre class="lang-py prettyprint-override"><code>import requests import json def call_url(url, text): r = requests.post( url, data={'text': text,}, head...
How to convert normal python code into a python function
python
-4
57
2
72,883,614
72,883,614
3
true
2022-07-06T12:28:40.973Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert normal python code into a python function<p>Here i have written a normal python code for api request. I need to write this same code in python...
72,876,472
PHP preg_replace_callback creates false entries in matches for named groups<p>I have a couple of &quot;shortcode&quot; blocks in a text, which I want to replace with some HTML entities on the fly using <strong>preg_replace_callback</strong>.</p> <p>The syntax of a shortcode is simple:</p> <pre><code>[block:type-of-the-...
<p>This behaviour is as expected, although not well documented. In the manual under &quot;<a href="https://www.php.net/manual/en/regexp.reference.subpatterns.php" rel="nofollow noreferrer">Subpatterns</a>&quot;:</p> <blockquote> <p>When the whole pattern matches, that portion of the subject string that matched the subp...
PHP preg_replace_callback creates false entries in matches for named groups
php|regex|pattern-matching|pcre|preg-replace-callback
3
57
2
72,876,569
72,876,569
3
true
2022-07-05T23:26:30.340Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP preg_replace_callback creates false entries in matches for named groups<p>I have a couple of &quot;shortcode&quot; blocks in a text, which I want to repl...
73,014,277
NotifyAll method does not wake up a thread<p>There are 3 simple threads ( two should wait, one - awake threads one by one )</p> <pre><code>public static void main(String[] args) { Main main = new Main(); // instance to call methods and synchronize. Thread thread1 = new Thread(() -&gt; main.methodA()); Thread t...
<p>It's a timing issue. If I modify your code:</p> <pre><code> public synchronized void methodB() { try { this.notifyAll(); Thread.sleep( 1000 ); this.notifyAll(); System.out.println( &quot;Notified...&quot; ); } catch( InterruptedException ex ) { Logger.getLo...
NotifyAll method does not wake up a thread
java|multithreading
0
57
3
73,014,526
73,014,526
3
true
2022-07-17T18:19:20.370Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NotifyAll method does not wake up a thread<p>There are 3 simple threads ( two should wait, one - awake threads one by one )</p> <pre><code>public static void...
72,774,050
PHP - Replace character in PhpStorm<p>I have a small request.</p> <p>On my application, written in PHP 5.3, the PHP is written like that for array:</p> <pre class="lang-php prettyprint-override"><code>$customer[name] = 'Joe'; $customer[city] = 'New York'; </code></pre> <p>At the moment, I'm working on PHP upgrading. Th...
<p>You do want regex. You want to use to use parentheses to grab the word inside the brackets, then use <code>$1</code> to replace it:</p> <p>Find: <code>\[(\w+)\]</code></p> <p>Replace: <code>['$1']</code></p>
PHP - Replace character in PhpStorm
php|arrays|regex|replace|phpstorm
-1
57
1
72,774,144
72,774,144
4
true
2022-06-27T14:46:57.940Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP - Replace character in PhpStorm<p>I have a small request.</p> <p>On my application, written in PHP 5.3, the PHP is written like that for array:</p> <pre ...
72,804,892
CSS style not applying to the html page<p>So I have the code below.</p> <p>I am expecting the <code>.container {background-color: red !important;}</code> to apply color to the HTML page. But for some reason, it is not happening.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel...
<p>This is because you have errantly included the <code>type=&quot;stylesheet&quot;</code> attribute on your <code>&lt;style&gt;</code> element; removing it fixes the problem:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snip...
CSS style not applying to the html page
html|css
0
57
1
72,804,942
72,804,942
4
true
2022-06-29T16:29:42.037Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CSS style not applying to the html page<p>So I have the code below.</p> <p>I am expecting the <code>.container {background-color: red !important;}</code> to ...
72,819,095
Implement the io.Reader interface to cancel the form upload on the client side<p>I've used time.Sleep(n) before to accomplish client-side manual cancellation of uploads, but the value of n is not well determined and this approach is not very elegant. I now want to manually call cancel() by implementing the io.Reader in...
<p>The stdlib <code>testing</code> package has a little-known gem: <code>iotest</code>.</p> <p>In particular, <a href="https://pkg.go.dev/testing/iotest@go1.18.3#HalfReader" rel="nofollow noreferrer">HalfReader</a> might be what you need (or you could take HalfReader and modify it to stop at a different point.</p>
Implement the io.Reader interface to cancel the form upload on the client side
http|go|client
1
57
1
72,819,450
72,819,450
4
true
2022-06-30T16:24:33.183Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Implement the io.Reader interface to cancel the form upload on the client side<p>I've used time.Sleep(n) before to accomplish client-side manual cancellation...
72,843,625
How to change items in a ggplot2 legend?<p>I am trying to change the legend items of this plot.</p> <p>My code is:</p> <pre><code>library(ggplot2) library(HDInterval) library(ggridges) df &lt;- data.frame( density = c(rgamma(400, 2, 10), rgamma(400, 2.25, 9), rgamma(400, 5, 7)), source = rep(c(&quot;source_1&quot;...
<pre><code>ggplot(df, aes(x = density, color = source, linetype = source, fill = after_stat(ifelse(quantile == 2, NA, color)))) + geom_density_ridges_gradient(aes(y = 0), size=1.2, quantile_lines = TRUE, quantile_fun = hdi, key_glyph = &quo...
How to change items in a ggplot2 legend?
r|ggplot2|plot|data-visualization|ggridges
1
57
1
72,843,697
72,843,697
4
true
2022-07-03T02:42:58.340Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change items in a ggplot2 legend?<p>I am trying to change the legend items of this plot.</p> <p>My code is:</p> <pre><code>library(ggplot2) library(HD...
72,993,579
What do round brackets mean here? React Hook Form<p>Here is a custom input component</p> <pre><code>const Input = ({props}) =&gt; { return ( &lt;input type=&quot;text&quot; {...props} {...props.reg}/&gt; ); }; </code></pre> <p>I passed a React Hook Form register function to this custom Input.</p> <pre><...
<p>The comma operator is rarely used in this way but essentially, if you do this</p> <pre><code>statment1, statement2 </code></pre> <p>Then the second statement is returned. However, <code>statment1</code> is executed, just not returned.</p> <p>Here its used to register the field but the result of the statement inside ...
What do round brackets mean here? React Hook Form
javascript|reactjs|react-hook-form
-1
57
1
72,993,625
72,993,625
4
true
2022-07-15T11:54:06.343Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What do round brackets mean here? React Hook Form<p>Here is a custom input component</p> <pre><code>const Input = ({props}) =&gt; { return ( &lt;...
72,997,508
Query rows and include rows with columns reversed<p>I'm trying to query a table. I want the results to include the <code>FROM</code> and <code>TO</code> columns, but then also include rows with these two values reversed. And then I want to eliminate all duplicates. (A duplicate is the same two cities in the same order....
<p>Not sure if I'm following, but doesn't just a simple union work for your sample?</p> <pre><code>select from, to from some_table union select to, from from some_table </code></pre>
Query rows and include rows with columns reversed
sql|sql-server|entity-framework|tsql|entity-framework-core
0
57
2
72,997,658
72,997,658
4
true
2022-07-15T17:07:53.180Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Query rows and include rows with columns reversed<p>I'm trying to query a table. I want the results to include the <code>FROM</code> and <code>TO</code> colu...
73,030,194
create a column based off two columns<p>Hello I would like to know the percentage of gender who saw a movie</p> <p>data:</p> <pre><code>d = {'ID': [1,2,3,4,5,6], 'gender': ['male', 'male','male','male','male','female'], 'seen': ['yes','yes','yes','yes','no','no']} df = pd.DataFrame(data=d) df ID gender seen 0 1 ...
<p>This is one of the many reasons why storing values we mean to be boolean as non-booleans is unhelpful.</p> <pre><code>out = (df.replace({'yes': True, 'no': False}) .groupby('gender')['seen'].mean()) print(out) </code></pre> <p>Output:</p> <pre><code>gender female 0.0 male 0.8 Name: seen, dtype: floa...
create a column based off two columns
python|pandas
1
57
1
73,030,256
73,030,256
4
true
2022-07-19T01:32:21.147Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: create a column based off two columns<p>Hello I would like to know the percentage of gender who saw a movie</p> <p>data:</p> <pre><code>d = {'ID': [1,2,3,4,5...