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,815,390 | Error 1146 and Error 1051 when dropping table and other commands<p>Comment/Answer if you need clarification.
<strong>I am currently having an issue with MySQL error 1146.</strong></p>
<p>I have a schema called "cia_data" and have 3 files in my database--Query 1, SQL File 3, SQL File 5.</p>
<p>With the code sh... | <p>Corrected text so I can close this thread:</p>
<p>desc CIA_DATA.new_table;</p>
<p>SELECT * FROM CIA_DATA.new_table;</p>
<p>INSERT INTO <code>CIA_DATA</code>.<code>new_table</code>
SELECT <code>Water</code>,
<code>Sanitation</code>,
<code>GDP</code>,
<code>Life</code>,
<code>Underweight</code>,
<code>Literacy</code>,... | Error 1146 and Error 1051 when dropping table and other commands | mysql | 1 | 58 | 1 | 72,974,359 | 72,974,359 | 1 | true | 2022-06-30T11:56:55.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error 1146 and Error 1051 when dropping table and other commands<p>Comment/Answer if you need clarification.
<strong>I am currently having an issue with MySQ... |
72,974,677 | How to calculate the average of 2 different numpy array pairs of bunch of points in list?<p>I have a numpy array pair list</p>
<pre><code>[[214,295], [215, 294], [229, 226], [229, 227]]
</code></pre>
<p>After calculating the average of the bunch of points using the Z score, the result I have is</p>
<pre><code>[[222.0, ... | <p>Well, it's easy to do what you describe just by reshaping the array:</p>
<pre><code>import numpy as np
tempList = np.array([[214,295], [215, 294],[229, 226], [229, 227]])
tempList = tempList.reshape( (-1,2,2) )
print(tempList)
print("---")
print( tempList.mean( axis=1 ) )
</code></pre>
<p>Output:</p>
<pre>... | How to calculate the average of 2 different numpy array pairs of bunch of points in list? | python|arrays|list|numpy | 0 | 58 | 1 | 72,975,227 | 72,975,227 | 1 | true | 2022-07-14T02:53:32.550Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to calculate the average of 2 different numpy array pairs of bunch of points in list?<p>I have a numpy array pair list</p>
<pre><code>[[214,295], [215, 2... |
72,976,224 | find min and max of each column in pandas without min and max of index<p>I have a data frame as shown below.</p>
<p><a href="https://i.stack.imgur.com/iGJHi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iGJHi.png" alt="enter image description here" /></a></p>
<p>I need to find the min and max of ea... | <p>just select from the second column of the result and save it in a new dataframe.</p>
<pre><code>df_thd_funct_mode1_T.agg([min,max]).iloc[:,1:]
</code></pre>
<p>to save it to a new df:</p>
<pre><code>new_df = df_thd_funct_mode1_T.agg([min,max]).iloc[:,1:]
</code></pre> | find min and max of each column in pandas without min and max of index | python|pandas|dataframe | 1 | 58 | 2 | 72,976,480 | 72,976,480 | 1 | true | 2022-07-14T06:40:44.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
find min and max of each column in pandas without min and max of index<p>I have a data frame as shown below.</p>
<p><a href="https://i.stack.imgur.com/iGJHi.... |
72,973,856 | Awk or Sed Command to Fix Bad JSON formatting?<p>Okay, so I've got over a hundred JSON files with predictable bad formatting in several places per file.</p>
<p>Instead of using <code>[ ]</code> to indicate an array, they use <code>{ }</code> instead.</p>
<p>For example:</p>
<pre><code>"grid": {
"C1"... | <p>I propose following GNU <code>AWK</code> solution, let <code>file.json</code> content be</p>
<pre><code>{"hello": 1,
"grid": {"C1", "D1", "E1", "C2", "D2", "E2", "F2", "B3", "C3", "D3", "E3&qu... | Awk or Sed Command to Fix Bad JSON formatting? | json|awk|sed | 0 | 58 | 3 | 72,977,158 | 72,977,158 | 1 | true | 2022-07-14T00:00:38.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Awk or Sed Command to Fix Bad JSON formatting?<p>Okay, so I've got over a hundred JSON files with predictable bad formatting in several places per file.</p>
... |
72,979,863 | logic to verify if the element is present in array from list of object<p>I have an 2 array with some String values. I wanted to check if one array's all value are part of another arrays. Is there any defined method available to check it or how to implement in optimised way.</p>
<p>Ex:</p>
<pre><code>arr1 = ['abc', 'def... | <p>You have a few ways of doing that. Perhaps the easiest way is to use the <a href="https://ruby-doc.org/stdlib-3.1.0/libdoc/set/rdoc/Set.html" rel="nofollow noreferrer">Set</a> class:</p>
<pre><code>a = ["1","2","5"]
b = ["2", "5"]
s1 = Set.new(a)
s2 = Set.new(b)
s2... | logic to verify if the element is present in array from list of object | arrays|ruby-on-rails|ruby|ruby-on-rails-3 | 0 | 58 | 2 | 72,980,360 | 72,980,360 | 1 | true | 2022-07-14T11:35:54.090Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
logic to verify if the element is present in array from list of object<p>I have an 2 array with some String values. I wanted to check if one array's all valu... |
72,986,710 | typescript: Abstract class parameter in constructor of class<p>I want to pass a class as parameter to the constructor of a class.</p>
<pre><code>interface IFileHandler {
getFiles (): string[]
}
class FileHandler implements IFileHandler
{
getFiles ()
{
return ['hello', 'world'];
}
}
class XmlToJson
{
pri... | <p>It has nothing to do with naming, interfaces just don't have constructor signature, you can find more info <a href="https://www.typescriptlang.org/play?&e=83#code/JYOwLgpgTgZghgYwgAgJIDFgBsIAk4gAmOUyA3gLABQyyA5hGJjgM7IAUAlAFzIthRQdANoBdagF9q1UJFiIUzPAWLQAwgHsQ-KAFcEYctVq0QEAO5deGbMqIlJ0qgixwWbJfnvRkwALYADjh+EOBs... | typescript: Abstract class parameter in constructor of class | typescript | 0 | 58 | 3 | 72,987,020 | 72,987,020 | 1 | true | 2022-07-14T21:11:16.860Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
typescript: Abstract class parameter in constructor of class<p>I want to pass a class as parameter to the constructor of a class.</p>
<pre><code>interface IF... |
72,988,187 | R Create a new column with all possible pairs of strings from a column by group ID in another column, then split a 3rd col. into 2 col. by those pairs<p>Title might be a little confusing but I think I can explain it here pretty well.</p>
<p>So I've looked for solutions to this today, but there was nothing similar to mi... | <p>Here is one way using <code>slice()</code> and <code>combn()</code> to expand the data and from there it's just a matter of creating some grouping variables and concatenating <code>Tissue</code> and reshaping to wide format.</p>
<pre><code>library(dplyr)
library(tidyr)
dat %>%
group_by(ID) %>%
slice(c(com... | R Create a new column with all possible pairs of strings from a column by group ID in another column, then split a 3rd col. into 2 col. by those pairs | r | 2 | 58 | 1 | 72,988,303 | 72,988,303 | 1 | true | 2022-07-15T01:28:44.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R Create a new column with all possible pairs of strings from a column by group ID in another column, then split a 3rd col. into 2 col. by those pairs<p>Titl... |
72,972,596 | Alert Condition/Consecutive Signal pinescript<p>I have this code where bars change color if they are above/below an EMA. I got the alert working. However, it alerts me on every single candle.</p>
<p>I would appreciate it if anyone could help me achieve the alert to be run only once.</p>
<p>Here is the code and please d... | <p>You can compare change the alert condition to check for current bar signal and previous bar signal. If previous bar signal is false and current bar signal is true then send the alert. Example below</p>
<pre><code>alertcondition(ut and not ut[1], title="Buy Alert")
alertcondition(dt and not dt[1], title=&qu... | Alert Condition/Consecutive Signal pinescript | pine-script | 0 | 58 | 1 | 72,991,441 | 72,991,441 | 1 | true | 2022-07-13T21:00:57.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Alert Condition/Consecutive Signal pinescript<p>I have this code where bars change color if they are above/below an EMA. I got the alert working. However, it... |
72,988,800 | Nuxt and Internet Explorer support (IE9)<p>I used <code>npx create-nuxt-app xxx</code> to create a demo and found that when launched under ie9, it refreshs infinitely. I did not changed any configuration.</p>
<p>I looked for a lot of documentation and I guess it's because of the router <code>history</code> mode. Becaus... | <p>History mode is not compatible with older browsers (and IE9 is definitely one of them).</p>
<p>You'll need to use the <code>hash</code> mode or have full page refreshs.</p>
<p>Here is an official source: <a href="https://github.com/vuejs/vue-router/issues/1675#issuecomment-321528860" rel="nofollow noreferrer">https:... | Nuxt and Internet Explorer support (IE9) | vue.js|nuxt.js|vue-router | 2 | 58 | 1 | 72,992,432 | 72,992,432 | 1 | true | 2022-07-15T03:36:41.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Nuxt and Internet Explorer support (IE9)<p>I used <code>npx create-nuxt-app xxx</code> to create a demo and found that when launched under ie9, it refreshs i... |
72,986,059 | KQL to identify which vm has CustomScript extension<p>I want how many and what VMs have "CustomScript"extension enabled along with the “properties” of that extensions and I have tried this query but didn't extract the custom-extension</p>
<pre><code> Resources
| where type == 'microsoft.compute/vir... | <p>For the custom script extensions, for Windows and Linux, they have slightly different names. This query will return a list of VM with custom script extension and the properties for the VM and the extension.</p>
<pre><code>resources
| where type == 'microsoft.compute/virtualmachines'
| extend
JoinID = toupper(id)... | KQL to identify which vm has CustomScript extension | azure|kql|azure-resource-graph | -1 | 58 | 1 | 72,995,307 | 72,995,307 | 1 | true | 2022-07-14T20:01:07.837Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
KQL to identify which vm has CustomScript extension<p>I want how many and what VMs have "CustomScript"extension enabled along with the “properties”... |
72,995,532 | Loop Through Rows To Find Value And Copy Data<p>I have a Workbook that imports data from a vendor sheet. The vendor Worksheet Column A is dynamic so it will change from time to time. The import file should copy the appropriate data to an input sheet in my workbook so the data can be verified before transferring to a lo... | <p>This is your code with the added extra, of increasing row numbers on the import sheet for each new row of data, as well as avoiding the copy paste function.</p>
<pre><code>Sub ImportData()
Dim FileOpen As Variant
Dim OpenBook As Workbook
Dim i As Integer
Dim RNmbr As Integer ' Row Number on the import sheet
Applic... | Loop Through Rows To Find Value And Copy Data | excel|vba | 0 | 58 | 1 | 72,996,061 | 72,996,061 | 1 | true | 2022-07-15T14:26:26.530Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Loop Through Rows To Find Value And Copy Data<p>I have a Workbook that imports data from a vendor sheet. The vendor Worksheet Column A is dynamic so it will ... |
72,996,011 | C++ program gives up when reading large binary file<p>I'm using a file from the <a href="http://yann.lecun.com/exdb/mnist/" rel="nofollow noreferrer">MNIST website</a> as an example; specifically, <code>t10k-images-idx3-ubyte.gz</code>. To reproduce my problem, download that file and unzip it, and you should get a file... | <p>Concerning OPs code to open the binary file:</p>
<pre><code>std::ifstream inputStream {path};
</code></pre>
<p>It should be:</p>
<pre><code>std::ifstream inputStream(path, std::ios::binary);
</code></pre>
<p>It's a common trap on Windows:</p>
<p>A file stream should be opened with <a href="https://en.cppreference.co... | C++ program gives up when reading large binary file | c++|windows|stream|binaryfiles | 1 | 58 | 2 | 72,996,692 | 72,996,692 | 1 | true | 2022-07-15T15:05:36.820Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ program gives up when reading large binary file<p>I'm using a file from the <a href="http://yann.lecun.com/exdb/mnist/" rel="nofollow noreferrer">MNIST w... |
73,001,042 | How i do to access key of nested object in my interface with type generics?<p>I want to access my nested object key in my interface, but I cannot access that. In my first case, the not nested object are can be access in my parameter function, but nested key is cannot. Could you help me to solve this?</p>
<pre class="la... | <p>You can look at this post for the possible options - <a href="https://stackoverflow.com/questions/58434389/typescript-deep-keyof-of-a-nested-object">Typescript: deep keyof of a nested object</a></p>
<p>For your specific example I think you can try the following:</p>
<pre><code>type Join<K extends string, P extend... | How i do to access key of nested object in my interface with type generics? | typescript|types|typescript-generics | 0 | 58 | 1 | 73,001,327 | 73,001,327 | 1 | true | 2022-07-16T01:57:08.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How i do to access key of nested object in my interface with type generics?<p>I want to access my nested object key in my interface, but I cannot access that... |
73,000,945 | Can I ingest data into tables in azure data explorer through Databricks?<p>I have to ingest data from ADLS gen2 to tables in ADX.
I first tried to use ADF, but considering the run time and everything, this was an really inefficient way to do it.
I think it would be so much easier if there is a way to ingest data into A... | <p>If it is for continuous ingestion consider creating an <a href="https://docs.microsoft.com/en-us/azure/data-explorer/ingest-data-event-grid?tabs=adx" rel="nofollow noreferrer">Event Grid data connection</a></p>
<p>If it is for one-time ingestion consider using the "<a href="https://docs.microsoft.com/en-us/azur... | Can I ingest data into tables in azure data explorer through Databricks? | azure|azure-databricks|azure-data-explorer | 1 | 58 | 2 | 73,002,278 | 73,002,278 | 1 | true | 2022-07-16T01:31:59.550Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can I ingest data into tables in azure data explorer through Databricks?<p>I have to ingest data from ADLS gen2 to tables in ADX.
I first tried to use ADF, b... |
73,001,917 | What is the equivalent of getAttribute with a parameter in Laravel 9<p>I have a <strong>Laravel 7</strong> project, that I'm converting to <strong>Laravel 9</strong>. I have a Model called Product with an <code>accessor</code> called <code>getAttribute</code> <strong>( in my Laravel 7 project ) :</strong></p>
<pre><cod... | <p>For one i would be concerned with the implementation, since you are discarding a lot of Laravel logic by overwriting that.</p>
<p>With that said, nothing has changed and it should work the same. I think you are mixing up Eloquent Getters, and this functionality that is a general logic to get properties off a model, ... | What is the equivalent of getAttribute with a parameter in Laravel 9 | php|laravel | 1 | 58 | 1 | 73,002,592 | 73,002,592 | 1 | true | 2022-07-16T06:06:33.947Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the equivalent of getAttribute with a parameter in Laravel 9<p>I have a <strong>Laravel 7</strong> project, that I'm converting to <strong>Laravel 9<... |
72,987,127 | How to persist SQL Server system table records?<p>I am running a query that returns the last execution time for a stored procedure:</p>
<pre><code>SELECT
o.name,
ps.last_execution_time
FROM
sys.dm_exec_procedure_stats ps
INNER JOIN
sys.objects o ON ps.object_id = o.object_id
ORDER BY
ps.la... | <p>I would suggest extended events for this. First, the session definition:</p>
<pre class="lang-sql prettyprint-override"><code>CREATE EVENT SESSION [ProcExecutions] ON SERVER
ADD EVENT sqlserver.module_end
ADD TARGET package0.event_file(
SET filename = N'ProcExecutions',
max_file_size = 10,
... | How to persist SQL Server system table records? | sql|sql-server | 0 | 58 | 1 | 73,006,021 | 73,006,021 | 1 | true | 2022-07-14T22:10:16.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to persist SQL Server system table records?<p>I am running a query that returns the last execution time for a stored procedure:</p>
<pre><code>SELECT
... |
73,004,963 | Cannot find method getGridView() in Android View Binding<p>I am using <a href="https://developer.android.com/topic/libraries/view-binding" rel="nofollow noreferrer">view binding</a> with Java and have the following activity_main XML file</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
&l... | <p>Unfortunately, the <a href="https://developer.android.com/topic/libraries/view-binding" rel="nofollow noreferrer">view binding</a> documentation code examples with Java are out of date. Instead of generating a camel-case getter function now the generated binding class has public (and final) fields so you can access ... | Cannot find method getGridView() in Android View Binding | java|android|android-viewbinding | 1 | 58 | 1 | 73,013,880 | 73,013,880 | 1 | true | 2022-07-16T14:23:06.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cannot find method getGridView() in Android View Binding<p>I am using <a href="https://developer.android.com/topic/libraries/view-binding" rel="nofollow nore... |
73,013,487 | Use the controlMatrix in the Kalman Filter Class | OpenCV,Python,NumPy<p>I am using OpenCV to track the position of a Contour.</p>
<p>After recieving the Position(x,y) i pass them to the kalman Filter.</p>
<p>Here an Example:</p>
<pre><code>import cv2
import numpy as np
dt = 1
kalman = cv2.KalmanFilter(4,2,4)
kalman.m... | <p>Kalman Filter is a feedback control where the control, $u_k$ is implicitly calculated in the algorithm, as opposed to the open-loop control problem where the $u_k$ is more explicit. The control is, roughly speaking, calculated from how far your measurement is to the estimate, and how accurate your estimate really is... | Use the controlMatrix in the Kalman Filter Class | OpenCV,Python,NumPy | python|numpy|opencv|signal-processing|kalman-filter | 0 | 58 | 1 | 73,014,137 | 73,014,137 | 1 | true | 2022-07-17T16:24:47.770Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use the controlMatrix in the Kalman Filter Class | OpenCV,Python,NumPy<p>I am using OpenCV to track the position of a Contour.</p>
<p>After recieving the Pos... |
73,016,276 | Cycle through letters of the alphabet in a loop and assign values to them in Python?<p>Here the number of variables (which correspond to <code>numfactors</code>) are assigned manually to each letter of the alphabet. So the first variable is <code>A</code> and it gets assigned the value of an array slice (<code>paths[0... | <p>You can create a dictionary with uppercase letters as key using</p>
<pre><code>import string
dict(zip(string.ascii_uppercase, indexes))
</code></pre> | Cycle through letters of the alphabet in a loop and assign values to them in Python? | python|loops|variable-assignment|alphabet | -2 | 58 | 2 | 73,016,522 | 73,016,522 | 1 | true | 2022-07-18T00:28:40.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cycle through letters of the alphabet in a loop and assign values to them in Python?<p>Here the number of variables (which correspond to <code>numfactors</co... |
73,017,165 | How to count the different values by comparing two columns in R?<p>I want to count the values by comparing two columns of the dataframe in R.</p>
<p>For example:</p>
<pre><code>col1 col2
A A
A A
A B
G G
G H
Y Y
Y Y
J P
J P
J J
K L
</code></pre>
<p>I wish to get an... | <p>You could group the data by <code>col1</code> and <code>summarise()</code>:</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
df %>%
group_by(col1) %>%
summarise(count_match = sum(col1 == col2),
count_nomatch = n() - count_match,
across(contains("match"), ... | How to count the different values by comparing two columns in R? | r|dataframe|dplyr | 0 | 58 | 2 | 73,017,265 | 73,017,265 | 1 | true | 2022-07-18T03:57:23.430Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to count the different values by comparing two columns in R?<p>I want to count the values by comparing two columns of the dataframe in R.</p>
<p>For exam... |
73,017,774 | C# - How create an arch shape using for loop<p>This is the first reverse pyramid</p>
<p>like</p>
<pre><code>for ( i= 10; i >= 1; --i)
{
for (j = 1; j <= i; ++j)
{
Console.Write(j+i);
}
Console.WriteLine();
}
</code></pre>
<p>For the s... | <p>This works for me:</p>
<pre><code>var output =
String.Join(
Environment.NewLine,
from i in Enumerable.Range(0, 10).Select(x => 10 - x)
let ns = Enumerable.Range(1, i).Select(x => x + i)
select $"{String.Concat(ns).PadRight(20)}{String.Concat(ns.Reverse()).PadLeft(20)}&q... | C# - How create an arch shape using for loop | c#|for-loop | -3 | 58 | 1 | 73,017,891 | 73,017,891 | 1 | true | 2022-07-18T05:44:20.533Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# - How create an arch shape using for loop<p>This is the first reverse pyramid</p>
<p>like</p>
<pre><code>for ( i= 10; i >= 1; --i)
{
... |
73,024,034 | Dynamic import in useEffect causes constructor to be called twice<p>I'm dynamically importing <code>@vimeo/player</code> in <code>useEffect</code> but when setting up <code>Player</code> I'm getting <code>Uncaught (in promise) TypeError: You must pass either a valid element or a valid id.</code> which comes from this p... | <p>I don't think any import is causing the issue.</p>
<p>I suggest removing the <code>useEffect</code> hook, because it should only be executed when the <code>playerRef</code> changes right? So you can port your code into a <code>useCallback</code>.</p>
<pre><code>import { useCallback} from 'react';
// Open component
... | Dynamic import in useEffect causes constructor to be called twice | reactjs|use-effect|use-ref|dynamic-import | 1 | 58 | 2 | 73,024,557 | 73,024,557 | 1 | true | 2022-07-18T14:31:41.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dynamic import in useEffect causes constructor to be called twice<p>I'm dynamically importing <code>@vimeo/player</code> in <code>useEffect</code> but when s... |
72,910,979 | How to make only two buttons active in Flutter/Dart?<p>In my code, there is a condition that pops up the following dialog:</p>
<p><a href="https://i.stack.imgur.com/NZzOV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NZzOV.jpg" alt="enter image description here" /></a></p>
<p>Its code looks like th... | <p>You should wrap the AlertDialog with OnWillPop, not the Scaffold, since you need to set the action pop for the AlertDialog widget.</p>
<p>Here's a minimal example of how to implement the OnWillPop widget to match your case:</p>
<pre><code>class MyHomePage extends StatefulWidget {
final String title;
const MyHom... | How to make only two buttons active in Flutter/Dart? | flutter|dart|flutter-layout | 0 | 58 | 3 | 73,075,033 | 73,075,033 | 1 | true | 2022-07-08T11:52:18.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make only two buttons active in Flutter/Dart?<p>In my code, there is a condition that pops up the following dialog:</p>
<p><a href="https://i.stack.im... |
72,802,706 | Object reference exception when importing content in Episerver<p>We are using Optimizely/Episerver CMS 11.20. When trying to export a page hierarchy from our production environment and then import the resulting ExportedFile.episerverdata file to our acceptance test environment I get the following error:</p>
<p><code>[I... | <p>It refers to a specific version of some content (which could be just about anything).</p>
<p>You could try to browse to <code>https://yoursite/EPiServer/CMS/#context=epi.cms.contentdata:///70725_133679</code> (note the ID at the end) to see which content it is.</p> | Object reference exception when importing content in Episerver | import|export|runtime-error|episerver|optimizely | 0 | 58 | 2 | 72,811,340 | 72,811,340 | 1 | true | 2022-06-29T14:01:02.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Object reference exception when importing content in Episerver<p>We are using Optimizely/Episerver CMS 11.20. When trying to export a page hierarchy from our... |
73,014,360 | Convert CNN-LSTM model to 1D-CNN model dimension error - `logits` and `labels` must have the same shape<p>I have a CNN-LSTM model which I want to convert into a simple CNN model for results comparison. This is the original CNN-LSTM model:</p>
<pre><code> # define model CNN-LSTM
model = Sequential()
... | <p>You actually need a 2D tensor with the shape <code>(batch_size, features)</code> and using a <code>flatten</code> layer on <code>None</code> dimensions will not work. Rather remove the last <code>TimeDistributed</code> layer and add a <code>GlobalMaxPool2D</code> (or <code>GlobalAvgPool2D</code>) layer and it will w... | Convert CNN-LSTM model to 1D-CNN model dimension error - `logits` and `labels` must have the same shape | python|tensorflow|keras|lstm|reshape | 1 | 58 | 1 | 73,017,950 | 73,017,950 | 1 | true | 2022-07-17T18:31:41.300Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert CNN-LSTM model to 1D-CNN model dimension error - `logits` and `labels` must have the same shape<p>I have a CNN-LSTM model which I want to convert int... |
72,874,669 | Get an ADO recordset from dynamic SQL<p>I need to be able to run a dynamic query within SQL Server, and store the results in an ADO recordset (in a VBA application). I've read that it's impossible to run dynamic SQL in a function (even a multi-statement function) - is this correct? I've also read that it's impossible t... | <p>You can't execute dynamic SQL in functions. But you <em>can</em> with stored procedures.</p>
<p>There are other issues also:</p>
<ul>
<li>You have extra brackets before and after <code>QUOTENAME</code> (that function will add the brackets anyway.</li>
<li>You need to pass parameters properly in using <code>sp_execut... | Get an ADO recordset from dynamic SQL | sql-server|tsql|adodb | 0 | 58 | 2 | 72,875,001 | 72,875,001 | 1 | true | 2022-07-05T19:36:36.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get an ADO recordset from dynamic SQL<p>I need to be able to run a dynamic query within SQL Server, and store the results in an ADO recordset (in a VBA appli... |
72,893,402 | Threads Running One After One in Python?<p><strong>Update1:</strong></p>
<p>If I change the code inside the for loop to:</p>
<pre><code>print('processing new page')
pool.apply_async(time.sleep, (5,))
</code></pre>
<p>I see 5 sec delay after <strong>Every</strong> printing, so the problem isn't related to webdriver.</p>... | <p>I just created a simple example to show case how I would solve it. You need to add your own code of course.</p>
<pre><code>from concurrent.futures import ThreadPoolExecutor, as_completed
from selenium import webdriver
driver = webdriver.Chrome()
urls = ["https://www.wikipedia.org", "https://www.wikip... | Threads Running One After One in Python? | python|python-3.x|multithreading|thread-safety|threadpool | 1 | 58 | 1 | 72,894,144 | 72,894,144 | 1 | true | 2022-07-07T06:49:41.713Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Threads Running One After One in Python?<p><strong>Update1:</strong></p>
<p>If I change the code inside the for loop to:</p>
<pre><code>print('processing new... |
72,824,413 | Transitive graph relationship mapping back to the same label<p>How do I create a transitive relationship which maps back to the same initial label.
I am trying to map data from tables that go something like this :-</p>
<blockquote>
<p>A -> B -> C -> A</p>
</blockquote>
<p>B has the index column from A, and C h... | <p>If you already have relations from A->B and B->C, then it can be simply achieved as follows, assuming the relationship type to be <code>X</code>:</p>
<pre><code>MATCH (a:A)-[:X]->(:B)-[:X]->(c:C)
MERGE (c)-[:X]->(a)
</code></pre>
<p>This will create a relationship between every <code>C</code> and <cod... | Transitive graph relationship mapping back to the same label | neo4j|cypher|graph-databases | 1 | 58 | 1 | 72,831,842 | 72,831,842 | 1 | true | 2022-07-01T04:33:30.997Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Transitive graph relationship mapping back to the same label<p>How do I create a transitive relationship which maps back to the same initial label.
I am tryi... |
72,952,290 | Typescript - Detect sentences in an non consecutive array of words<p>I'm trying to detect sentences in an array of words to determine which ones are unique.</p>
<p>Right know my function is able to detect sentences but only if the words in the array are consecutive, example:</p>
<pre><code>const words: Words[] = [
{ ... | <p>Check if this suits your needs:</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 words = [
{ id: 8, content: 'Birthday' },
{ id: 1, content: 'Date' },
{ id:... | Typescript - Detect sentences in an non consecutive array of words | javascript|arrays|typescript|algorithm | 1 | 58 | 1 | 72,956,040 | 72,956,040 | 1 | true | 2022-07-12T12:26:02.123Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typescript - Detect sentences in an non consecutive array of words<p>I'm trying to detect sentences in an array of words to determine which ones are unique.<... |
72,854,237 | React Native DateTimePicker: Why is it keep opening after I press the "OK" buton<p>I'm trying to create a date picker. When the user press on the "OK" button the modal should have closed but it keeps reopening. I'm using react-native-datetimepicker. I did tried putting <code>setShow(false)</code> when the &qu... | <p>In my opinion, you are not setting show to false, in case if the user selects an option. Please try this and let me know if it fixes your problem or not:</p>
<pre><code>const onChange = (event, selectedDate) => {
if (event.type == 'set') {
const currentDate = selectedDate || startDate;
... | React Native DateTimePicker: Why is it keep opening after I press the "OK" buton | javascript|react-native|date|react-hooks | 1 | 58 | 2 | 72,854,758 | 72,854,758 | 1 | true | 2022-07-04T09:05:29.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React Native DateTimePicker: Why is it keep opening after I press the "OK" buton<p>I'm trying to create a date picker. When the user press on the "OK&qu... |
72,873,172 | How to implement Auto Layout to fit a StackView with UIButtons inside UIView?<p>I create a custom Numpad keyboard through xib and stuck on its proper layout.</p>
<p><code>NumpadView</code> has 4 rows in total: 3 rows with 5 buttons and 1 last row with 4 buttons.</p>
<p>Here is how it looks in a <code>xib</code> now:</p... | <p>The problem is not with your height, its with your width.
It doesn't work because your main UIStackView (vertical) has leading and trailing constraint with constant of 10 it overrides the ratio you set and causes the stretch of the buttons.</p>
<p>The solution is to add a center constraint between that UIStackView a... | How to implement Auto Layout to fit a StackView with UIButtons inside UIView? | swift|uiview|autolayout|uikit|xib | 0 | 58 | 1 | 72,873,799 | 72,873,799 | 1 | true | 2022-07-05T17:06:23.553Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to implement Auto Layout to fit a StackView with UIButtons inside UIView?<p>I create a custom Numpad keyboard through xib and stuck on its proper layout.... |
72,946,406 | Native Modules Bridges React Native<p>I have an issue when i try to bridge an Native Modules.</p>
<p>I have a function in Java , the function will calculate the progress when i write a byte , i have a while loop at there.
The problem is whenever i return the value inside of loop , the loop is gonna be broke, but if i p... | <p>You should handle this sending events from Java and listen for them in JS.
You can use <code>DeviceEventManagerModule.RCTDeviceEventEmitter</code> for this purpose.</p> | Native Modules Bridges React Native | java|react-native|react-native-native-module|native-module|react-native-bridge | 0 | 58 | 1 | 72,946,729 | 72,946,729 | 1 | true | 2022-07-12T02:23:25.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Native Modules Bridges React Native<p>I have an issue when i try to bridge an Native Modules.</p>
<p>I have a function in Java , the function will calculate ... |
72,823,327 | How do I push to my GitHub repo without cloning it again?<p>My PC died a few weeks back, I've replaced it since, but I'm now unsure as to how to push to my repo without having to re-clone the entire repo again on my new PC.</p>
<p>I've created another SSH key and linked to my GitHub.</p> | <p>Since you are talking about pushing, i assume you have the local repo on the new computer and you've installed the git client on the new computer.</p>
<p>You can do a git pull or git fetch request so that you can reconnect to the repo.</p>
<p>After entering the git pull or git fetch command, your computer will ask f... | How do I push to my GitHub repo without cloning it again? | git|github|git-bash|repo | 1 | 58 | 2 | 72,823,409 | 72,823,409 | 1 | true | 2022-07-01T00:37:57.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I push to my GitHub repo without cloning it again?<p>My PC died a few weeks back, I've replaced it since, but I'm now unsure as to how to push to my r... |
72,820,099 | Improve my solution to basic C linked list management functions<p>I would appreciate some help relative to my code solution, which deals with linked list management in C. I'll already declare the only strange thing with my request: I am writing a C++ file, but I am actually mostly leveraging C resources (<code>malloc()... | <p>There are many duplicated code. Also the function should not output any message. It is the caller of the function that decides whether to output a message. So the function should have the return type <code>bool</code> if you are considering the program as a C++ program or <code>bool</code> or <code>int</code> if you... | Improve my solution to basic C linked list management functions | c++|linked-list|dynamic-memory-allocation|singly-linked-list|double-pointer | 1 | 58 | 1 | 72,820,355 | 72,820,355 | 1 | true | 2022-06-30T17:53:39.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Improve my solution to basic C linked list management functions<p>I would appreciate some help relative to my code solution, which deals with linked list man... |
72,852,241 | Regex pattern equivalent of %word% in mysql<p>I need 2 regex case insensitive patterns. One of them are equivalent of SQL's <code>%</code>. So <code>%word%</code>. My attempt at this was <code>'^[a-zA-Z]*word[a-zA-Z]*$'</code>.</p>
<p><strong>Question 1:</strong> This seems to work, but I am wondering if this is the eq... | <p><strong>First Question</strong>:</p>
<p>According to <a href="https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html#operator_like" rel="nofollow noreferrer">https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html#operator_like</a></p>
<blockquote>
<p>With <strong>LIKE</strong> you... | Regex pattern equivalent of %word% in mysql | mysql|sql|regex | 2 | 58 | 2 | 72,852,353 | 72,852,353 | 1 | true | 2022-07-04T05:49:09.293Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex pattern equivalent of %word% in mysql<p>I need 2 regex case insensitive patterns. One of them are equivalent of SQL's <code>%</code>. So <code>%word%</... |
72,972,075 | Axios doesn't GET data in React render but it does in console<p>I'm building an e-commerce website and i'm trying to get an image data stored in MongoDB and must be rendered after fetching it with <code>axios</code>.
The problem is that the image doesn't render at all, even thought in console i can see the product data... | <p>I fixed my own problem by changing <code><Image src={product.img} /></code> to <code><Image src={product?.product?.img} /></code></p>
<p>Check this <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining" rel="nofollow noreferrer">MDN</a> for more informatio... | Axios doesn't GET data in React render but it does in console | javascript|node.js|reactjs|mongodb|axios | 1 | 58 | 1 | 72,982,684 | 72,982,684 | 1 | true | 2022-07-13T20:10:23.393Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Axios doesn't GET data in React render but it does in console<p>I'm building an e-commerce website and i'm trying to get an image data stored in MongoDB and ... |
72,774,675 | Shorten text after 50 characters but only after the current word<p>I need to shorten text after 50 characters but if the 50th char is at the middle of a word - cut only after the word and not before.</p>
<p>example text:
Contrary to popular belief, Lorem Ipsum is not simply text (59 chars)</p>
<p>expected output: Contr... | <p>Regular expression can help you with it.<br />
The idea is to find at least 50 symbols that finishes with word boundary <code>\b</code></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-overr... | Shorten text after 50 characters but only after the current word | javascript|node.js | 2 | 58 | 5 | 72,775,000 | 72,775,000 | 1 | true | 2022-06-27T15:29:29.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Shorten text after 50 characters but only after the current word<p>I need to shorten text after 50 characters but if the 50th char is at the middle of a word... |
72,856,050 | SQL Percentage increase/decrease<p>I've attempted to work out percentage increases/decreases but it doesn't seem to be calculating it correctly. You can see in column 4 where I've attempted this. I've tried other ways of doing this by researching on stackoverflow, but without luck.</p>
<p>I get:</p>
<p>| Itemcode X | C... | <p>You can try this one:</p>
<pre><code>SELECT OITM.ITEMCODE,
round(isnull(FO.[QTY ORDERED],0),0) as Current_Day_Orders,
round(isnull(PSO.[QTY PST ORDERED],0),0) as Previous_Sales,
/* The expression for "% Change" updated.*/
round(isnull((FO.[QTY ORDERED]-PSO.[QTY PST ORDERED])*10... | SQL Percentage increase/decrease | sql | -1 | 58 | 3 | 72,856,396 | 72,856,396 | 1 | true | 2022-07-04T11:33:46.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL Percentage increase/decrease<p>I've attempted to work out percentage increases/decreases but it doesn't seem to be calculating it correctly. You can see ... |
72,778,396 | XSD complexType with element AND simpleContent<p>Working with XML 1.1 in Oxygen XML Editor version 23.1.
Originally I wandted to make an xsd schema that can have a complexType-element with a child-element, an extension and a bunch of attributes. A first possible solution I was able to get here but figured out it didn't... | <p>As far as I understand, XSD (not even 1.1) doesn't offer a way to restrict the mixed content text to some simple type, so the only way, if you really need that single element together with a certain list of values seems to be an assertion; that means, unfortunately, you need to duplicate the values you also want for... | XSD complexType with element AND simpleContent | xsd|attributes|complextype | 0 | 58 | 1 | 72,788,177 | 72,788,177 | 1 | true | 2022-06-27T21:17:50.397Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
XSD complexType with element AND simpleContent<p>Working with XML 1.1 in Oxygen XML Editor version 23.1.
Originally I wandted to make an xsd schema that can ... |
72,804,929 | Typescript generic function changing argument type<p>I have a question regarding generic function (specifically why i'm able to modify an object from specific type)</p>
<p>example :</p>
<pre><code>interface UserConfig {
name: string;
age: number;
}
let user: UserConfig = {
name: "Eyal",
age: 23,
... | <p>First, you are not mutating "user", you are creating a new object that has all the fields of user, plus the timestamp field--the original user object doesn't change.</p>
<p>TypeScript doesn't complain here because the new object you return is still <em>compatible</em> with the original type T--you've not c... | Typescript generic function changing argument type | typescript|generics|types|interface | 1 | 58 | 1 | 72,806,173 | 72,806,173 | 1 | true | 2022-06-29T16:32:48.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typescript generic function changing argument type<p>I have a question regarding generic function (specifically why i'm able to modify an object from specifi... |
72,852,261 | Sqlite create table with check constraint<p>I am adding check constraint in sqlite android using create table query but Getting error like this</p>
<blockquote>
<p>android.database.sqlite.SQLiteException: no such column: bloodgrp (code 1): ,</p>
</blockquote>
<pre><code> String query = " CREATE TABLE " + re... | <p>Please use the check constraint as shown below. This answer assumes <em>register</em>, <em>Name</em>, <em>Age</em>, <em>gender</em>, <em>Email</em>, <em>Username</em>, <em>password</em>, <em>contactNo</em>, <em>Address</em>, <em>city</em>, <em>img</em>, <em>bloodgrp</em>, <em>Uid</em> are initialized correctly.</p>
... | Sqlite create table with check constraint | android|sqlite|android-sqlite | -2 | 58 | 1 | 72,855,618 | 72,855,618 | 1 | true | 2022-07-04T05:51:25.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sqlite create table with check constraint<p>I am adding check constraint in sqlite android using create table query but Getting error like this</p>
<blockquo... |
72,953,209 | I need to separate an array into sub arrays where each sub array represents a distinct line on an image<p>My goal with this project is to start with one large 2d array and separate it into multiple arrays. Here is the original array:</p>
<pre><code>arr = np.array([[0,0,0,0,0,0,0,0,0],
[0,0,0,0,1,0,0,0,0... | <p>If you don't mind using pre-built function, you could use the <code>scipy</code> library:</p>
<pre><code>import numpy as np
from scipy.signal import convolve2d
from scipy.ndimage import label
## Example matrix
arr = [...]
## Check if neighboring cells are zero using a 2d convolution:
# The kernel
ker = np.array([... | I need to separate an array into sub arrays where each sub array represents a distinct line on an image | python|arrays|numpy | 2 | 58 | 1 | 72,954,005 | 72,954,005 | 1 | true | 2022-07-12T13:34:55.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I need to separate an array into sub arrays where each sub array represents a distinct line on an image<p>My goal with this project is to start with one larg... |
72,984,023 | Specify pandoc option in YAML Markdown header<p>I need to disable pandoc email obfuscation. I have tried several variations in the YAML header of the .rmd, and I can't make it work. Any feedback, even including "it can't be done", is appreciated.</p>
<p>I make a call from within my R script ("gary_rend... | <p>Normally we can't put two ":" in the same line (that breaks YAML parsing). So you need to put <code>html_document:</code> in a separate line, when it is followed by other options (not necessarily pandoc ones). Also note that indentation is important in YAML. So the correct header is</p>
<pre><code>---
outp... | Specify pandoc option in YAML Markdown header | r|yaml|r-markdown|pandoc | 1 | 58 | 1 | 72,984,208 | 72,984,208 | 1 | true | 2022-07-14T16:46:42.007Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Specify pandoc option in YAML Markdown header<p>I need to disable pandoc email obfuscation. I have tried several variations in the YAML header of the .rmd, ... |
73,023,586 | grep match a concat of variable and string (dash) in piped input<p>(NOTE: this is a bash question, not k8s)</p>
<p>I have a working script which will fetch the name</p>
<pre><code>admin-job-0
</code></pre>
<p>from a list of kubernetes cronjobs, of which there can be up to 32 ie. <code>admin-job-0 -1, -2, -3 ... -31</co... | <p>If you pass to grep a double-hyphen (<code>--</code>), this signals the end of the option and a dash at the start of the pattern does not harm, i.e.</p>
<pre><code>grep -- "$1"
</code></pre>
<p>or</p>
<pre><code>grep -- "$1$"
</code></pre>
<p>or whatever you want to achieve.</p> | grep match a concat of variable and string (dash) in piped input | bash|awk|grep | 1 | 58 | 2 | 73,023,896 | 73,023,896 | 1 | true | 2022-07-18T13:59:58.020Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
grep match a concat of variable and string (dash) in piped input<p>(NOTE: this is a bash question, not k8s)</p>
<p>I have a working script which will fetch t... |
72,908,750 | Data Source Error when sharing Excel Power Query file with others<p>I have an Excel file that combines Excel templates from a sharepoint folder via Power Query.
On my computer this works wonderfully. However, as soon as I make the Excel file available to other colleagues, they can no longer refresh the data. After some... | <p>In excel, pick a cell and give it a range name, like NameVariable</p>
<p>Enter your filepath like <strong>C:\temp\samplefile.xlsx</strong> in that named range</p>
<p>Then in powerquery, in home ... advanced editor ... add a formula that refers to that range name, similar to this:</p>
<pre><code>Location = Excel.Curr... | Data Source Error when sharing Excel Power Query file with others | excel|sharepoint|powerquery | 0 | 58 | 1 | 72,909,873 | 72,909,873 | 1 | true | 2022-07-08T08:33:32.793Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Data Source Error when sharing Excel Power Query file with others<p>I have an Excel file that combines Excel templates from a sharepoint folder via Power Que... |
72,898,562 | Calculate percentages of occurrences by rolling window in pyspark<p>I have the following pyspark dataframe:</p>
<pre><code>import pandas as pd
foo = pd.DataFrame({'id': [1,1,1,1,1, 2,2,2,2,2],
'time': [1,2,3,4,5, 1,2,3,4,5],
'value': ['a','a','a','b','b', 'b','b','c','c','c']})
... | <p>You can use count with a window function.</p>
<pre class="lang-py prettyprint-override"><code>w = Window.partitionBy('id').orderBy('time').rowsBetween(Window.currentRow, 2)
df = (df.select('id', F.col('time').alias('window'),
*[(F.count(F.when(F.col('value') == x, 'value')).over(w)
... | Calculate percentages of occurrences by rolling window in pyspark | python|pyspark | 1 | 58 | 2 | 72,900,299 | 72,900,299 | 1 | true | 2022-07-07T13:18:33.007Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculate percentages of occurrences by rolling window in pyspark<p>I have the following pyspark dataframe:</p>
<pre><code>import pandas as pd
foo = pd.DataF... |
72,834,788 | How to draw rowstacked histogram in gnuplot with value labels in each bar<p>I want to draw a rowstacked histogram. The following is what I have so far <a href="https://i.stack.imgur.com/wWMCU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wWMCU.png" alt="enter image description here" /></a>.</p>
<p>... | <p>You can merge all 4 files in one file. I would recommend a separation with two empty lines, because with this, you can easily address the (sub)datablocks via <code>index</code>, check <code>help index</code>.</p>
<p>For the labels you can make a double loop, one for the (sub)datablocks and one for the columns. You h... | How to draw rowstacked histogram in gnuplot with value labels in each bar | label|gnuplot|histogram|stacked | 1 | 58 | 1 | 72,839,972 | 72,839,972 | 1 | true | 2022-07-01T21:31:00.587Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to draw rowstacked histogram in gnuplot with value labels in each bar<p>I want to draw a rowstacked histogram. The following is what I have so far <a hre... |
72,977,810 | Annotating python function that returns two different values<p>I have learned about python type hints and annotations, I know how to annotate a function that returns <strong>single value</strong>. In some cases we need to return different type of values, how to annotate in this situations.</p>
<pre><code>def findElemen... | <p>Have a look on the library called <a href="https://docs.python.org/3/library/typing.html" rel="nofollow noreferrer"><code>typing</code></a>. It supports type hints and is quite powerful. According to the documentation:</p>
<p><strong><code>Union[X, Y]</code> is equivalent to <code>X | Y</code> and means either <code... | Annotating python function that returns two different values | python|function|annotations|type-hinting | 1 | 58 | 1 | 72,977,844 | 72,977,844 | 1 | true | 2022-07-14T08:52:47.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Annotating python function that returns two different values<p>I have learned about python type hints and annotations, I know how to annotate a function that... |
72,855,289 | Time complextity and efficiency<p>I have written two programs to find the number of divisors of a number.</p>
<p>The first function has less code than the second one but for a number like 500 000, it make 250 001 iterations.</p>
<p>However the second function which has more code make 800 iterations.</p>
<p>Which functi... | <p>The first is <a href="https://en.wikipedia.org/wiki/Big_O_notation" rel="nofollow noreferrer">O(n)</a> with its <code>for (i = 1; i <= n / 2; i++)</code>.</p>
<p>The second is O(sqrt(n)) with its <code>div_2 = nbr / div_1;</code> and <code>}while(div_1<div_2);</code> - a lower time complexity.</p>
<p>With larg... | Time complextity and efficiency | c|time|complexity-theory | -1 | 58 | 1 | 72,857,961 | 72,857,961 | 1 | true | 2022-07-04T10:27:28.167Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Time complextity and efficiency<p>I have written two programs to find the number of divisors of a number.</p>
<p>The first function has less code than the se... |
72,795,903 | Create Python Data Models with conditions<h2>How do I create <em>pydantic model</em> with <strong>conditions</strong>?</h2>
<p>I have a pydantic model. It works well when declaring new class with this model as base. The problem I have is, the</p>
<ul>
<li><code>BaseUser.username</code> should have
<ul>
<li><em>maxlengt... | <p>Have you considered using <a href="https://pydantic-docs.helpmanual.io/usage/types/#constrained-types" rel="nofollow noreferrer">Contraint types</a>?</p>
<pre><code>from pydantic import BaseModel, constr
class BaseUser(BaseModel):
id: int
username: constr(min_length=6, max_length=32)
password: constr(mi... | Create Python Data Models with conditions | python|types|conditional-statements|pydantic | 1 | 58 | 1 | 72,796,280 | 72,796,280 | 1 | true | 2022-06-29T04:47:58.837Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create Python Data Models with conditions<h2>How do I create <em>pydantic model</em> with <strong>conditions</strong>?</h2>
<p>I have a pydantic model. It wo... |
72,894,819 | How to convert tree json to nested Object in js<p>I converted a nested object into tree JSON format but now I need to convert it back to a nested object I tried so many ways but not working as expected. while converting nested object JSON I used recursion to achieve but here is how to operate it with the object.</p>
<p... | <p>You can use this recursive function:</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 toObject = (arr) =>
Object.assign(...arr.map(({name, children, ...rest}) =&... | How to convert tree json to nested Object in js | javascript|node.js | 0 | 58 | 4 | 72,895,121 | 72,895,121 | 1 | true | 2022-07-07T08:46:23.857Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert tree json to nested Object in js<p>I converted a nested object into tree JSON format but now I need to convert it back to a nested object I tr... |
73,024,094 | All the possible states for wild tic tac toe (wild Tic-tac-toe combinatorics)<p>Wild tic-tac-toe is an impartial game similar to tic-tac-toe. However, in this game players can choose to place either X or O on each move
what are all the possible states after the change in that rule? and how can I generate all the valid ... | <p>You could apply this logic to determine if a board is valid or not:</p>
<p>If there are multiple three-in-a-rows for a certain symbol, make sure they all overlap at the same cell.</p>
<p>I would represent the board state as an integer: each pair of bits represent a cell. The pair can be 0b00 (empty), 0b01 ("X&q... | All the possible states for wild tic tac toe (wild Tic-tac-toe combinatorics) | python|combinatorics|tic-tac-toe | 0 | 58 | 1 | 73,028,162 | 73,028,162 | 1 | true | 2022-07-18T14:36:28.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
All the possible states for wild tic tac toe (wild Tic-tac-toe combinatorics)<p>Wild tic-tac-toe is an impartial game similar to tic-tac-toe. However, in thi... |
72,907,496 | Subset data to contain only columns whose names match multiple condition using data.table<p>This is based upon this <a href="https://stackoverflow.com/questions/18587334/subset-data-to-contain-only-columns-whose-names-match-a-condition">question</a>. The question said:</p>
<blockquote>
<p>Is there a way for me to subse... | <p>You can select multiple columns that match certain patterns in data.table using <code>patterns</code> in its <code>.SDcols</code> argument:</p>
<pre><code># turn df into data.table
setDT(df)
# select columns that contain ABD or XYZ
df[, .SD, .SDcols=patterns("ABC|XYZ")]
# or
df[, grep("ABC|XYZ"... | Subset data to contain only columns whose names match multiple condition using data.table | r|data.table|subset | 0 | 58 | 4 | 72,911,592 | 72,911,592 | 1 | true | 2022-07-08T06:31:07.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Subset data to contain only columns whose names match multiple condition using data.table<p>This is based upon this <a href="https://stackoverflow.com/questi... |
73,019,170 | How to include or deleat completely the figure axis using Sklearn ConfusionMatrixDisplay?<p>I am using the below code to generate a confusion matrix using the Sklearn library. But while saving the image the y-axis label i.e. True label is not printed completely. It is shown <a href="https://i.stack.imgur.com/TgVzg.png"... | <p>The picture is a matplotlib plot. So, to remove the ticks for each axis and the labels, you can use <code>set_ticks([])</code> which will remove both. I am using the sample from <a href="https://scikit-learn.org/stable/modules/generated/sklearn.metrics.ConfusionMatrixDisplay.html" rel="nofollow noreferrer">here</a> ... | How to include or deleat completely the figure axis using Sklearn ConfusionMatrixDisplay? | matplotlib|scikit-learn | 0 | 58 | 1 | 73,026,357 | 73,026,357 | 1 | true | 2022-07-18T08:11:31.283Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to include or deleat completely the figure axis using Sklearn ConfusionMatrixDisplay?<p>I am using the below code to generate a confusion matrix using th... |
72,907,297 | How would you convert A string into A Array/ArrayList<p>I have this code in which I want to convert a String (e.g. [15, 52, 94, 20, 92, 109])
to an Array/ArrayList.</p>
<p>I have tried this code:</p>
<pre><code>ArrayList<Byte> sdata = new ArrayList<>();
String bytessonvert = new String();
boolean run = true... | <p>No need for bytes. Java handles text well.</p>
<p>Use <code>String#split</code> to make an array of the parts.</p>
<p>Make a stream of that array of string parts.</p>
<p>Parse each <code>String</code> part into a <code>Integer</code> object using <code>Stream#map</code> to make another stream of the new objects.</p>... | How would you convert A string into A Array/ArrayList | java|arraylist | 0 | 58 | 1 | 72,907,366 | 72,907,366 | 1 | true | 2022-07-08T06:09:46.727Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How would you convert A string into A Array/ArrayList<p>I have this code in which I want to convert a String (e.g. [15, 52, 94, 20, 92, 109])
to an Array/Arr... |
72,983,785 | Does this scroll effect have a name?<p>I'm looking to find the name of this scrolling effect.</p>
<p>As you scroll, the text on the screen changes, as if you were going through a slideshow. <a href="https://app.optimism.io/announcement" rel="nofollow noreferrer">The gif is from this website</a>.</p>
<p>I have an idea o... | <p>It's just called scroll-linked animations.</p>
<p>Typically for website animations, you would want to use CSS keyframes, as it is more performant than using javascript. Though you can always trigger CSS keyframe animations with javascript, and tie it to scroll events to create the above effect.</p> | Does this scroll effect have a name? | javascript|html|css|reactjs|frontend | 1 | 58 | 1 | 72,983,830 | 72,983,830 | 1 | true | 2022-07-14T16:27:24.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does this scroll effect have a name?<p>I'm looking to find the name of this scrolling effect.</p>
<p>As you scroll, the text on the screen changes, as if you... |
72,902,748 | Deleting a table then adding a new one in Office Scripts<p>I'm trying to create a Power automate flow that records a table, then clears it out for the next step. I currently have this script to create the table:</p>
<pre><code> function main(workbook: ExcelScript.Workbook,
TableName: string = "Table1&qu... | <p>You can use <code>workbook.getWorksheet(SheetName).getTables()[0].delete();</code> This will remove the first table in a sheet, or you can use <code>workbook.getWorksheet(SheetName).getTable(TableName).delete()</code>
if you know the table name of the old table you are trying to delete.</p>
<p>You need to have the d... | Deleting a table then adding a new one in Office Scripts | excel|power-automate|office-scripts | 0 | 58 | 1 | 72,903,455 | 72,903,455 | 1 | true | 2022-07-07T18:38:26.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deleting a table then adding a new one in Office Scripts<p>I'm trying to create a Power automate flow that records a table, then clears it out for the next s... |
72,985,870 | CI 3 to CI 4 Encryption Compability<p>I have 1 app for SSO, use CI 3. Now i am creating new app with CI 4.
code in CI 3 for encryption :</p>
<pre><code>$otp = 123;
$this->encryption->initialize(array(
'cipher' => 'aes-256',
'mode' => 'ctr',
'key' => '12345678901234567890123456789012'
));
... | <p>Since no one seem interesting to the subject. i have figure it out hot to resolve this problem.
so. what i am doing is. take / copy Codeigniter 3 encryption class from <code>system/libraries/Encryption.php</code> and make it third party Library in Codeigniter 4 and put it in <code>app/libraries/Ci3encrypt.php</code>... | CI 3 to CI 4 Encryption Compability | codeigniter-4 | 1 | 58 | 1 | 73,098,139 | 73,098,139 | 1 | true | 2022-07-14T19:42:27.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CI 3 to CI 4 Encryption Compability<p>I have 1 app for SSO, use CI 3. Now i am creating new app with CI 4.
code in CI 3 for encryption :</p>
<pre><code>$otp ... |
72,864,699 | How to programatically install Google Workspace add-on app which is deployed using gcp cloud run<p>I have created a Google Workspace Add app, which I created and deployed with cloud run.
Now I have to deploy the app to selected users in an organization after getting admin credentials using Admin Google API.</p> | <h2>There is no way to install Addons programatically - be it through <a href="https://cloud.google.com/run/docs/apis" rel="nofollow noreferrer">Cloud Run</a> or <a href="https://developers.google.com/admin-sdk" rel="nofollow noreferrer">Admin SDK</a>, however you can do it centrally from the <a href="https://admin.goo... | How to programatically install Google Workspace add-on app which is deployed using gcp cloud run | google-apps-script|google-cloud-platform|gmail-api|google-cloud-run|google-apps-marketplace | 0 | 58 | 1 | 72,866,759 | 72,866,759 | 1 | true | 2022-07-05T06:11:35.250Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to programatically install Google Workspace add-on app which is deployed using gcp cloud run<p>I have created a Google Workspace Add app, which I created... |
72,847,398 | Find key in std::unordered_map won't find an existing key<p>I'm trying to make a simple ResourceManager which uses an ordered_map to find how to import files using the extension :</p>
<pre class="lang-cpp prettyprint-override"><code>#include <iostream>
#include <unordered_map>
#include <string>
class... | <p>Problem is that your container is using <code>const char*</code> as a key. Note that <code>std::unorderd_map</code> uses standard operator <code>==</code> for type provided as key. In case of <code>const char *</code> this equal operator compares only a pointers.</p>
<p>So only case where you will find item is when ... | Find key in std::unordered_map won't find an existing key | c++|c++17 | 0 | 58 | 1 | 72,847,823 | 72,847,823 | 1 | true | 2022-07-03T14:41:35.913Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find key in std::unordered_map won't find an existing key<p>I'm trying to make a simple ResourceManager which uses an ordered_map to find how to import files... |
73,003,146 | why is this.input.keyboard.on('keyup-LEFT', function() {}) not working in phaser.js?<p>In my sprite sheet I have two separate frames for when the character is not moving, one is for when she was moving left and then stopped and the other for when she was moving right and then stopped, so i need it to fire up on sort of... | <p>The most common way to implement player movement and/or input is, to put the logic in the <code>update</code> function, and check if the keys are pressed/down (<code>isDown</code>).</p>
<p><em>I would only use <code>this.input.keyboard</code>, for hot-key like 'ESC' or some special hot-keys.</em></p>
<p><strong>Here... | why is this.input.keyboard.on('keyup-LEFT', function() {}) not working in phaser.js? | javascript|keyboard-events|phaser-framework | 1 | 58 | 1 | 73,003,377 | 73,003,377 | 1 | true | 2022-07-16T09:41:22.257Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why is this.input.keyboard.on('keyup-LEFT', function() {}) not working in phaser.js?<p>In my sprite sheet I have two separate frames for when the character i... |
72,995,300 | ffmpeg scroll overlay. How to end scroll with image remaining till end of input<p>The code below scrolls an image from the bottom of the output frame and, using the enable option, stops at the 9sec position. However, the last frame of the scrolled image does not remain till the end of the output. My workaround is to cr... | <p>How about:</p>
<pre><code>overlay=x=0:y='H-2*clip(t,0,9)'
</code></pre>
<p><code>clip</code> function limits the value to be between 2nd and 3rd arguments.</p>
<p>[update] here is a way to scroll the frame from bottom to top in 9 seconds:</p>
<pre><code>overlay=x=0:y='H*(1-clip(t,0,9)/9)'
</code></pre>
<p>If you are... | ffmpeg scroll overlay. How to end scroll with image remaining till end of input | ffmpeg | -1 | 58 | 2 | 72,997,007 | 72,997,007 | 1 | true | 2022-07-15T14:09:04.570Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ffmpeg scroll overlay. How to end scroll with image remaining till end of input<p>The code below scrolls an image from the bottom of the output frame and, us... |
72,395,807 | Python function used with pandas groupby&aggregate<p>I'm playing with data analysis, using imdb dataset from kaggle.</p>
<p>I'm grouping several features like this:</p>
<pre><code>color = df_q6.groupby('color', as_index=False).agg(profit_margin_mean=('profit_margin', 'mean'), \
... | <p>You want to use the <code>.agg()</code> function and it takes a dictionary with column name as key and desired aggregation function as value so your aggregation function:</p>
<pre><code>color = df_q6.groupby('color', as_index=False).agg(profit_margin_mean=('profit_margin', 'mean'), \
... | Python function used with pandas groupby&aggregate | python|pandas|pandas-groupby | 0 | 58 | 1 | 72,396,004 | 72,396,004 | 1 | true | 2022-05-26T17:30:51.067Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python function used with pandas groupby&aggregate<p>I'm playing with data analysis, using imdb dataset from kaggle.</p>
<p>I'm grouping several features lik... |
72,399,529 | Why is there extra space on WPF?<p>this is in XAML Designer</p>
<p>Expected:</p>
<p><a href="https://i.stack.imgur.com/O5jLb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O5jLb.jpg" alt="enter image description here" /></a></p>
<p>Actual:</p>
<p><a href="https://i.stack.imgur.com/rB46R.jpg" rel="no... | <p>In WPF <code>SizeToContent</code> does not work very well with <code>WindowStyle=None</code>. It seems the renderer is still taking a non-existant border into account when initially drawing the Window.</p>
<p>A simple hack to overcome this: set <code>Height="1"</code> on the Window to force its initial siz... | Why is there extra space on WPF? | c#|wpf | 1 | 58 | 1 | 72,401,373 | 72,401,373 | 1 | true | 2022-05-27T01:18:58.997Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is there extra space on WPF?<p>this is in XAML Designer</p>
<p>Expected:</p>
<p><a href="https://i.stack.imgur.com/O5jLb.jpg" rel="nofollow noreferrer"><... |
72,396,884 | Numbering tables where multiple instances count as one table XSLT 3.0<p>Given this XML:</p>
<pre><code> <preliminaryRqmts>
<!-- Table 1 -->
<reqCondGroup>
<reqCondNoRef>
<reqCond>Lorem ipsum</reqCond>
</reqCondNoRef>
</reqCo... | <p>I would check whether you can use <code>xsl:number count="some pattern matching the elements you want to count" level="any"</code> e.g. in XSLT 3</p>
<pre><code><xsl:param name="table-count-pattern" static="yes" as="xs:string" select="'preliminaryRqmts/reqCon... | Numbering tables where multiple instances count as one table XSLT 3.0 | count|xslt-3.0 | 0 | 58 | 1 | 72,408,257 | 72,408,257 | 1 | true | 2022-05-26T19:12:31.607Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Numbering tables where multiple instances count as one table XSLT 3.0<p>Given this XML:</p>
<pre><code> <preliminaryRqmts>
<!-- Table 1 -->... |
72,344,518 | Allow linked/member account access "Bill details by account"<p>I have done to setup AWS Organizations with 4 accounts (including management account), for example:</p>
<pre><code>[management account]
|
----- company-billing
----- company-production
----- company-development
</code></pre>
<p>From <code>[management accoun... | <p>Unfortunately, it's not Possible to see [Bill details by account] through member accounts. You can see [Bill details by account] only through AWS master account.</p> | Allow linked/member account access "Bill details by account" | amazon-web-services | 2 | 58 | 1 | 72,520,239 | 72,520,239 | 1 | true | 2022-05-23T07:11:09.720Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Allow linked/member account access "Bill details by account"<p>I have done to setup AWS Organizations with 4 accounts (including management account), for exa... |
72,391,840 | If values in multiple columns match another dataframe, get sum based on range of dates pandas<p>I have a two dfs:</p>
<p><code>df1</code>:</p>
<pre><code> item_code store_code start_1 end_1
0 11185 01 2022-03-06 2022-03-08
1 11185 02 2022-03-26 2022-03-28
2 118113 ... | <p>You can use <code>merge</code> and <code>query</code>:</p>
<pre><code>out = (df1.merge(df2, how='left', suffixes=('', '_'))
.query('(start_1 <= date_code) & (date_code <= end_1)')
.groupby(df1.columns.tolist(), as_index=False, sort=False)
['sales_sum'].sum())
print(out)
# Out... | If values in multiple columns match another dataframe, get sum based on range of dates pandas | python|pandas|datetime|sum|conditional-statements | 1 | 58 | 1 | 72,392,021 | 72,392,021 | 1 | true | 2022-05-26T12:30:01.517Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
If values in multiple columns match another dataframe, get sum based on range of dates pandas<p>I have a two dfs:</p>
<p><code>df1</code>:</p>
<pre><code> ... |
72,389,617 | Angular RXJS calling http post request is not working<p>I am new to Angular RXJS, I am trying to add the post to the server, and then get all posts from the server because I am using Server-side pagination.</p>
<p>Could you please let me know why the addPostToServer function is called but the HTTP Post is not! or if yo... | <p>The HTTPClient will not make a call to the server until you subscribe to the Observable, so call to addPostToServer won't send the HTTP request.</p>
<p>You can subscribe to the observable</p>
<pre class="lang-js prettyprint-override"><code>
addPostToServer(post: Post | string) {
console.log('Function calle... | Angular RXJS calling http post request is not working | angular|rxjs | 0 | 58 | 1 | 72,389,695 | 72,389,695 | 1 | true | 2022-05-26T09:26:28.643Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular RXJS calling http post request is not working<p>I am new to Angular RXJS, I am trying to add the post to the server, and then get all posts from the ... |
72,364,777 | R- compare different columns of a data frame with different values<p>I am currently working on microdata, using a survey called SHARE. I want to use a variable for education but the way it was coded makes it kind of hard.</p>
<p>In the survey, households are asked what degree they have. There is one column for each deg... | <p>Here is an approach using <code>data.table</code></p>
<pre><code>library(data.table)
##
# create degree map by country
#
degreeMap <- data.table(country=c('France', 'Germany'))
degreeMap <- degreeMap[, .(degree=paste('degree', c('one', 'two', 'three', 'four'), sep='_')), by=.(country)]
degreeMap[country=='Fra... | R- compare different columns of a data frame with different values | r|dplyr|while-loop|columnsorting | 0 | 58 | 2 | 72,375,317 | 72,375,317 | 1 | true | 2022-05-24T14:33:35.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R- compare different columns of a data frame with different values<p>I am currently working on microdata, using a survey called SHARE. I want to use a variab... |
72,291,207 | Laravel foreach to retrive user IDs<p>In my laravel project i has model Promo, where located only <code>user_id</code> column.
I have 2 records in this Model.
I need to retrive all <code>user_id</code>'s from Promo model.</p>
<p>First i take all user_id's from Model:</p>
<p><code>$userList = Promo::get();</code></p>
<p... | <p>You are replacing the value of <code>$userIds</code> each time the loop count and the final value is the last value of the <code>$userList</code>.
You can do it in 2 different ways:</p>
<p>with the loop:</p>
<pre><code>$userList = Promo::get();
$userIds = [];
foreach ($userList as $user) {
$userIds[] = $user-&g... | Laravel foreach to retrive user IDs | php|laravel | -1 | 58 | 3 | 72,291,360 | 72,291,360 | 1 | true | 2022-05-18T14:36:41.773Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Laravel foreach to retrive user IDs<p>In my laravel project i has model Promo, where located only <code>user_id</code> column.
I have 2 records in this Model... |
72,319,906 | How to use an argument as return value in gmock<p>I have the following call:</p>
<pre><code>EXPECT_CALL(myMock, myFunction(someSpecifiedParameter, _, _))
.WillOnce(DoAll(SaveArg<2>(&bufferSize), Return(make_pair(Success, bufferSize))));
</code></pre>
<p>I'm trying to return whatever value that is passed... | <p>Your way is right, you deanonymize the value in the third parameter. In my opinion using a lambda or a custom actions is the more preferable way. A stored lambda or an action can be reused in other expectations.</p>
<pre><code>EXPECT_CALL(myMock, myFunction(someSpecifiedParameter, _, _))
.WillOnce(WithArgs<0, 2... | How to use an argument as return value in gmock | c++|googletest|googlemock | 1 | 58 | 1 | 72,321,752 | 72,321,752 | 1 | true | 2022-05-20T13:40:29.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use an argument as return value in gmock<p>I have the following call:</p>
<pre><code>EXPECT_CALL(myMock, myFunction(someSpecifiedParameter, _, _))
... |
72,291,185 | MapReduce using DataFlow library<p>I am trying to implement a classic map-reduce problem using <code>System.Threading.Tasks.Dataflow</code>, and although I can get something (sort of) working I'm struggling to see how to generalise this functionality.</p>
<p>Given a simple problem</p>
<ul>
<li>Produce a stream of integ... | <p>One idea is to configure the <a href="https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.dataflow.batchblock-1" rel="nofollow noreferrer"><code>BatchBlock<T></code></a> with the maximum <code>batchSize</code>:</p>
<pre><code>var batchBlock = new BatchBlock<double>(Int32.MaxValue);
</code>... | MapReduce using DataFlow library | c#|mapreduce|.net-6.0|tpl-dataflow | 2 | 58 | 1 | 72,296,503 | 72,296,503 | 1 | true | 2022-05-18T14:35:05.593Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MapReduce using DataFlow library<p>I am trying to implement a classic map-reduce problem using <code>System.Threading.Tasks.Dataflow</code>, and although I c... |
72,351,677 | react functional component Strange behavior of setHooks when I fetch data<p>I had a React class that did the job I needed and I had to change it to a functional component to use useLocation().</p>
<p>It turns out that by switching to a functional component the update of my states does not work normally anymore.</p>
<p>... | <p>One way would be to put the <code>setSomeBoolean</code> part into another <code>useEffect</code> which runs when the <code>dataFetch</code> changes. Something like that:</p>
<pre><code>import * as React from "react";
import { useEffect, useState } from "react";
import Axios from "axios"... | react functional component Strange behavior of setHooks when I fetch data | typescript|asynchronous|react-hooks|axios|react-functional-component | 0 | 58 | 1 | 72,352,881 | 72,352,881 | 1 | true | 2022-05-23T16:10:29.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
react functional component Strange behavior of setHooks when I fetch data<p>I had a React class that did the job I needed and I had to change it to a functio... |
72,238,525 | How to tell to tox use trusted host and index?<p>I use the following usage for pip3 to install modules from my host:</p>
<pre><code>pip3 install tox -i http://myhost/sample+ --trusted-host
</code></pre>
<p>I downloaded a bog code.It uses <code>tox</code> for installing modules.<br>
How can I tell to <code>tox</code> u... | <p>You can use the <a href="https://tox.wiki/en/latest/config.html#conf-install_command" rel="nofollow noreferrer">install_command</a> option from <code>tox</code>.</p>
<p>This should result in a command like this within your tox.ini configuration:</p>
<pre><code>[testenv:your_env]
install_command=pip install --index-u... | How to tell to tox use trusted host and index? | python|pip|tox | 0 | 58 | 1 | 72,238,750 | 72,238,750 | 1 | true | 2022-05-14T08:27:15.007Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to tell to tox use trusted host and index?<p>I use the following usage for pip3 to install modules from my host:</p>
<pre><code>pip3 install tox -i http:... |
72,314,353 | Time complexity when Stream, string split and collect are used together<p>I have to split a string using comma delimiters and lookup a value in it. I am thinking which way is faster splitting string in array and checking if array contains it or splitting string in Set and doing lookup in Set.</p>
<p>I want to know what... | <p>Let <code>n</code> be the string length, <code>k</code> the number of comma-separated words, and <code>w</code> the maximum length of a word. Also, lets assume that our unit cost is character comparison/copying.</p>
<p>Splitting the string to words (<code>String.split()</code> method) will cost <code>O(n)</code>.</p... | Time complexity when Stream, string split and collect are used together | java|time-complexity | 0 | 58 | 1 | 72,325,419 | 72,325,419 | 1 | true | 2022-05-20T06:18:26.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Time complexity when Stream, string split and collect are used together<p>I have to split a string using comma delimiters and lookup a value in it. I am thin... |
72,283,979 | Update table as soon as a new database table row is inserted<p>So I want to know how I should make a table, written in PHP 8, that updates as soon a new insert has been made in the database table (SQL Server 2019). I've created a simple table like this:</p>
<pre class="lang-html prettyprint-override"><code><table>... | <p>If you want your forms to submit without reloading, you should use AJAX.
E.g. Almost all of the chat boxes in the websites use AJAX to submit information.
I think <a href="https://stackoverflow.com/questions/16323360/submitting-html-form-using-jquery-ajax">this question</a> will help you.</p>
<p>If you want to use A... | Update table as soon as a new database table row is inserted | javascript|php|html | 1 | 58 | 1 | 72,284,119 | 72,284,119 | 1 | true | 2022-05-18T06:10:28.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Update table as soon as a new database table row is inserted<p>So I want to know how I should make a table, written in PHP 8, that updates as soon a new inse... |
72,355,315 | How to group data by count of columns in Pandas?<p>I have a CSV file with a lot of rows and different number of columns.</p>
<p>How to group data by count of columns and show it in different frames?</p>
<p>File CSV has the following data:</p>
<pre><code>1 OLEG US FRANCE BIG
1 OLEG FR 18
1 NATA 18
</code></pre>
<p>Becau... | <p>since pandas doesn't allow you to have different length of columns, just don't use it to import your data. Your goal is to create three seperate <code>df</code>, so first import the data as lists, and then deal with it and its differents lengths.</p>
<p>One way to solve this is read the data with <code>csv.reader</c... | How to group data by count of columns in Pandas? | python|pandas|csv | 0 | 58 | 1 | 72,355,708 | 72,355,708 | 1 | true | 2022-05-23T22:12:45.213Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to group data by count of columns in Pandas?<p>I have a CSV file with a lot of rows and different number of columns.</p>
<p>How to group data by count of... |
72,364,219 | Python get parameter outside of class<p>I have this code :</p>
<pre><code>class X(object):
def func1(self, arg):
print("Button {0} clicked".format(arg))
return True
class Y(X):
def func2(self):
self.btn = QPushButton()
self.btn.clicked.connect(partial(self.func1 , True )... | <p>If you have to do something when you click button then you should do it directly inside <code>func1</code>.</p>
<p>But if you want to set some value which will be used later then you should use <code>self.value</code> to keep this value inside instance of this class - and later other function should get this value -... | Python get parameter outside of class | python|qt|pyqt5 | 0 | 58 | 1 | 72,365,482 | 72,365,482 | 1 | true | 2022-05-24T13:55:15.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python get parameter outside of class<p>I have this code :</p>
<pre><code>class X(object):
def func1(self, arg):
print("Button {0} clicked&q... |
72,325,479 | Select rows from pandas dataframe by two values at the same time from rows in another dataframe<p>Have a question about pandas:</p>
<p>I have two dataframes:</p>
<pre><code>df1 = pd.DataFrame({'user_id': ['12', '22', '33', '44'],
'time': ['t1', 't2', 't3', 't4'],
'data': [{'av': ... | <p>Having data normalized should ease this and every potential comparison much easier and cleaner.</p>
<h2>Normalize + Apply clean conditions:</h2>
<pre><code>df1 = pd.concat([df1.drop(columns=['data']), pd.json_normalize(df1.data)], axis=1)
df2 = pd.concat([df2.drop(columns=['data']), pd.json_normalize(df2.data)], axi... | Select rows from pandas dataframe by two values at the same time from rows in another dataframe | python|pandas|dataframe|numpy|data-science | 0 | 58 | 1 | 72,325,661 | 72,325,661 | 1 | true | 2022-05-20T23:05:41.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Select rows from pandas dataframe by two values at the same time from rows in another dataframe<p>Have a question about pandas:</p>
<p>I have two dataframes:... |
72,314,852 | TypeError: Cannot read properties of undefined while using getter js<p>I built two classes, a product with name and price and a shopping cart for an array of products; for the ShoppingCart get totPrice method I'm using the reduce() function on the array cart of the constructor, but I'm always getting the error above an... | <p>There is already an answer for this one explained <a href="https://stackoverflow.com/questions/5732043/how-to-call-reduce-on-an-array-of-objects-to-sum-their-properties">here</a>.</p>
<p>After the first iteration your're returning a number and then trying to get property sum.price of it to add it to the next object ... | TypeError: Cannot read properties of undefined while using getter js | javascript | 0 | 58 | 1 | 72,315,526 | 72,315,526 | 1 | true | 2022-05-20T07:04:09.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TypeError: Cannot read properties of undefined while using getter js<p>I built two classes, a product with name and price and a shopping cart for an array of... |
72,357,873 | Fetch runs double with old and updated value<p>I have a fetch function as a component:</p>
<pre><code>export const FetchBooksBySubject = (selectedValue) => {
const options = {
method: `GET`,
};
return fetch(`${server}/books?subjects_like=${selectedValue}`, options)
.then((response) => {
... | <p>First, <code>FetchBooksBySubject</code> is not a valid function component. Component should return <a href="https://reactjs.org/docs/rendering-elements.html" rel="nofollow noreferrer">React element</a>.</p>
<pre><code>const element = <h1>Hello, world</h1>;
</code></pre>
<p><code>FetchBooksBySubject</code... | Fetch runs double with old and updated value | reactjs|use-effect | 0 | 58 | 1 | 72,358,230 | 72,358,230 | 1 | true | 2022-05-24T06:02:51.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fetch runs double with old and updated value<p>I have a fetch function as a component:</p>
<pre><code>export const FetchBooksBySubject = (selectedValue) =>... |
72,394,681 | Converting the time format from $7. to time5. in sas<p>I have a sas dataset with a column called "time" in the format of $7., such as 23:57.</p>
<p>I tried to covert it into the format of time5. as below, but it returned errors as "invalid numeric data...".</p>
<pre><code>data want;
set have;
time1 ... | <p>It should work. Note if you want times before 10AM to print with a leading zero and none of the times are larger than 24 hours then use TOD5. instead of TIME5. in the format statement. Also try reading all 7 bytes of the original string variable instead of just the first 5.</p>
<pre><code>data want;
set have;
... | Converting the time format from $7. to time5. in sas | sas | 0 | 58 | 1 | 72,395,042 | 72,395,042 | 1 | true | 2022-05-26T15:57:42.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting the time format from $7. to time5. in sas<p>I have a sas dataset with a column called "time" in the format of $7., such as 23:57.</p>
<p... |
72,322,678 | Phaser 3: Draw a live curve<p>I am following the post:</p>
<p><a href="https://cedarcantab.wixsite.com/website-1/post/phaser-coding-tips1-2-revisited-part-1-creating-a-game-like-tanks---worms" rel="nofollow noreferrer">https://cedarcantab.wixsite.com/website-1/post/phaser-coding-tips1-2-revisited-part-1-creating-a-game... | <p>A solution without much calculations could be, use a dummy object as a <em>"tracer bullet"</em>.<br />
With other Words, make a physics object, that doesn't collide with anything, <em>"shoot"</em> that object, and draw, in a specific interval a small <em>"marker"</em>, that would <em>tr... | Phaser 3: Draw a live curve | typescript|phaser-framework|curve | 1 | 58 | 1 | 72,327,800 | 72,327,800 | 1 | true | 2022-05-20T17:24:49.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Phaser 3: Draw a live curve<p>I am following the post:</p>
<p><a href="https://cedarcantab.wixsite.com/website-1/post/phaser-coding-tips1-2-revisited-part-1-... |
72,239,179 | how do I save the videos in an specific bitrate using ffmpeg?<p>I am trying to save some videos in specific bitrate (8000k) and for this, I used the following code:</p>
<pre><code>ffmpeg -i input_1080p60 -c:v libx264 -pix_fmt yuv420p -b:v 8000K -bufsize 8000K -minrate 8000K -maxrate 8000K -x264opts keyint=120:min-... | <p>That's what 2-pass encoding is for. See <a href="https://trac.ffmpeg.org/wiki/Encode/H.264#twopass" rel="nofollow noreferrer">FFmpeg Wiki</a></p>
<p>The idea behind 2-pass encoding is that by running FFmpeg twice it can first analyze the video to decide how to best allocate the bits to meet the specific bitrate then... | how do I save the videos in an specific bitrate using ffmpeg? | video|ffmpeg|video-streaming|video-processing|bitrate | 0 | 58 | 1 | 72,240,309 | 72,240,309 | 1 | true | 2022-05-14T10:05:41.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how do I save the videos in an specific bitrate using ffmpeg?<p>I am trying to save some videos in specific bitrate (8000k) and for this, I used the followin... |
72,320,265 | Python pandas: how does chunksize works?<p>I have the following code:</p>
<pre><code>from numpy import dtype
import pandas as pd
import os
import sys
inputFile='data.json'
chunks = pd.read_json(inputFile, lines=True, chunksize = 1000)
original_stdout = sys.stdout
i = 1
for c in chunks:
location = c.location.str.... | <p>The problem is that by doing <code>location[b]</code> you are accessing the <code>location</code> frame <strong>by index</strong> (i.e., here you are asking for the row with the index value <code>b</code>). The chunks will follow the index correctly, which means the first chunk will have the index starting by <code>... | Python pandas: how does chunksize works? | python|pandas|chunks | 1 | 58 | 1 | 72,320,595 | 72,320,595 | 1 | true | 2022-05-20T14:06:02.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python pandas: how does chunksize works?<p>I have the following code:</p>
<pre><code>from numpy import dtype
import pandas as pd
import os
import sys
inputF... |
72,341,317 | Create a Polygon in Google Maps with Coordinates from a SQLite Database Android<p>I want to create a Polygon in Google Maps with Coordinates out of my SQLite Database. My Code can already create multiple Markers with Coordinates out of my Database. The Database contains an ID, E-Coordinates and N-Coordinates. I tried i... | <p>Creating a polygon is simply a matter of invoking the API as described here: <a href="https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/Polygon" rel="nofollow noreferrer">https://developers.google.com/maps/documentation/android-sdk/reference/com/google/and... | Create a Polygon in Google Maps with Coordinates from a SQLite Database Android | java|android|database|sqlite|android-studio | 1 | 58 | 1 | 72,341,599 | 72,341,599 | 1 | true | 2022-05-22T21:09:59.437Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create a Polygon in Google Maps with Coordinates from a SQLite Database Android<p>I want to create a Polygon in Google Maps with Coordinates out of my SQLite... |
72,328,573 | dictionary value not printing when I press submit in tkinter program<p>I am trying to create the below tkinter program:</p>
<ol>
<li><strong>Select an option from each of the 4 optionmenus.</strong></li>
<li>Click <strong>Submit</strong></li>
<li>Value from a dictionary where I have set up the keys to match the combina... | <p>You forgot to do a function call for <code>userresult()</code>.</p>
<p><code>if userresult in recommendedproducts</code> Here you are checking if the function object is a key in the dictionary <code>recommendedproducts</code>. So what is happening can be compared to this:</p>
<pre class="lang-py prettyprint-override... | dictionary value not printing when I press submit in tkinter program | python|dictionary|tkinter | 1 | 58 | 1 | 72,329,228 | 72,329,228 | 1 | true | 2022-05-21T10:07:45.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
dictionary value not printing when I press submit in tkinter program<p>I am trying to create the below tkinter program:</p>
<ol>
<li><strong>Select an option... |
72,364,596 | inner join without unique identifier<p>On the screenshot below you see two tables. On the left side I have a table with accidents, in this case the ID is unique and it is always the same accident with ID=68.</p>
<p>On the right side is the weather data available with the temperature of the specific day.</p>
<p>However,... | <p>Instead use a subquery to get your average temperature for that time:</p>
<pre><code>UPDATE accident_copy as a
LEFT JOIN
(
SELECT avg(temperatur) temparatur, year, month, day, hour
FROM wetterdaten
GROUP BY year, month, day, hour
) as w
ON a.year = w.year
and a.monthDE = w.month
an... | inner join without unique identifier | mysql|sql|join|inner-join | 0 | 58 | 1 | 72,364,631 | 72,364,631 | 1 | true | 2022-05-24T14:20:50.260Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
inner join without unique identifier<p>On the screenshot below you see two tables. On the left side I have a table with accidents, in this case the ID is uni... |
72,277,412 | Flutter - Can only pop AlertDialog OR execute passed function - need to do both<p><em>TL;DR: Trying to pass a function call to a custom AlertDialog. AlertDialog needs to be popped after the function -> can't make it work.</em></p>
<p>I've created a custom AlertDialog to use throughout my app. It looks something like... | <p>This is because you call <code>pop()</code> on a <code>Navigator</code> from an incorrect <code>BuildContext</code>. So instead of</p>
<pre class="lang-dart prettyprint-override"><code>buttonAction: () {
deleteUser(context);
Navigator.of(context).pop();
}
</code></pre>
<p>you have to do something like this:</p>
... | Flutter - Can only pop AlertDialog OR execute passed function - need to do both | flutter|dart | 0 | 58 | 2 | 72,279,450 | 72,279,450 | 1 | true | 2022-05-17T16:11:25.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter - Can only pop AlertDialog OR execute passed function - need to do both<p><em>TL;DR: Trying to pass a function call to a custom AlertDialog. AlertDia... |
72,346,640 | How can one swap elements which come from a function?<p>So I have defined a class called "Particles":</p>
<pre class="lang-py prettyprint-override"><code>class Particle:
def __init__(self, posInit, momInit, spin):
self.posInit = posInit
self.momInit = momInit
self.spin = spin
d... | <p>It seems that you intend to store the position and momentum of your particle over time in <code>posfT</code> and <code>momfT</code> respectfully <em>(edit: I previously thought you wanted only the current position)</em>. If so, they should not be methods, but attributes. You should also have separate methods to modi... | How can one swap elements which come from a function? | python|function|swap | 0 | 58 | 1 | 72,348,366 | 72,348,366 | 1 | true | 2022-05-23T09:59:56.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can one swap elements which come from a function?<p>So I have defined a class called "Particles":</p>
<pre class="lang-py prettyprint-override"... |
72,282,495 | Problem with pulling data from Graphql into Gatsby<p>I'm pretty new here to gatsby/programming and i was playing around with the gatsby. I have below issue and I would appreciate if you could let me know where does it goes wrong? Below is my code.</p>
<p>Problem 1: Why i can't return/access the {post1.categories.nodes.... | <blockquote>
<p>Problem 1: Why i can't return/access the {post1.categories.nodes.name}
? It shows nothing on my page.</p>
</blockquote>
<p><code>nodes</code> (in <code>post1.categories.nodes.name</code>) is likely to be an array, so you will need to loop through it or access a specific position:</p>
<pre><code>return &... | Problem with pulling data from Graphql into Gatsby | graphql|gatsby | 1 | 58 | 1 | 72,283,587 | 72,283,587 | 1 | true | 2022-05-18T02:08:19.637Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Problem with pulling data from Graphql into Gatsby<p>I'm pretty new here to gatsby/programming and i was playing around with the gatsby. I have below issue a... |
72,246,192 | How do I insert into database from model that get value from an array<p>I have a table in a database with 2 columns:</p>
<p><code>MyTable</code></p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Column1</th>
<th>Column2</th>
</tr>
</thead>
</table>
</div>
<p>In my code, I have 2 String arrays... | <p>Your db code seems OK but I would use try-with-resources blocks.
Run this and please confirm if this is what you intend:</p>
<pre><code>import java.util.List;
import java.util.ArrayList;
import java.util.stream.Collectors;
public class Model {
private int col1;
private String col2;
public Model() {
... | How do I insert into database from model that get value from an array | java|arrays | 0 | 58 | 1 | 72,247,973 | 72,247,973 | 1 | true | 2022-05-15T07:05:46.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I insert into database from model that get value from an array<p>I have a table in a database with 2 columns:</p>
<p><code>MyTable</code></p>
<div cla... |
72,247,481 | Javascript How To Format An Integer As A Currency String?<p>I have an integer stored as US cents, ie 1700 cents. How can I convert that to a string that is $17.00 using javascript? I have tried <code>toFixed</code> and <code>Intl.NumberFormat</code> but they return $1700?</p> | <p>You can use <code>toLocaleString()</code> function for this.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var cents = 1629;
var dollars = cents / 100;
dollars = dollars.t... | Javascript How To Format An Integer As A Currency String? | javascript|currency | 1 | 58 | 1 | 72,247,552 | 72,247,552 | 2 | true | 2022-05-15T10:37:28.210Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript How To Format An Integer As A Currency String?<p>I have an integer stored as US cents, ie 1700 cents. How can I convert that to a string that is $... |
72,268,845 | How is it determined which memory block to use in c/c++?<p><strong>This is the code I wrote:</strong></p>
<pre><code>#include <iostream>
using namespace std;
int main() {
int x[3] = {30,31,32}, y[3] = {40,41,42}, z[3] = {50,51,52};
for (int i=0; i < 3; i++) {
cout << *(x+i) << end... | <blockquote>
<p>Here you can see the array which was declared at last takes the foremost memory address and second last takes memory address after the last one and so on.</p>
</blockquote>
<p>No, this is not what is happening. The program has <strong>undefined behavior</strong> because you're going out of bounds of the... | How is it determined which memory block to use in c/c++? | c++|memory|memory-management | 0 | 58 | 1 | 72,268,943 | 72,268,943 | 2 | true | 2022-05-17T05:58:48.720Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How is it determined which memory block to use in c/c++?<p><strong>This is the code I wrote:</strong></p>
<pre><code>#include <iostream>
using namespac... |
72,270,452 | Why one element of SubString Vector can not be tested into conditional evaluation if (Julia)?<p>I want to create a function in which, first, it filters one element of a dataframe in Julia. Second, it tests if the element is "missing". If the answer is rue, it return the value "0.0". My issue is that... | <p>You should write:</p>
<pre><code>ismissing(only(sireOfrecent))
</code></pre>
<p>The meaning of this:</p>
<ul>
<li><code>only</code> checks if you picked exactly one row (if not - you will get an error, as then there is ambiguity; if yes - you extract out the element from an array)</li>
<li><code>ismissing</code> is ... | Why one element of SubString Vector can not be tested into conditional evaluation if (Julia)? | function|if-statement|vector|julia|missing-data | 3 | 58 | 1 | 72,270,953 | 72,270,953 | 2 | true | 2022-05-17T08:17:00.533Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why one element of SubString Vector can not be tested into conditional evaluation if (Julia)?<p>I want to create a function in which, first, it filters one e... |
72,272,800 | Awk to extract platformio.ini environments to a bash array<p>I'm trying to extract all the environments defined in a platformio.ini file so I can loop through them and perform some action before building. The file looks like:</p>
<pre><code>; PlatformIO Project Configuration File
[env]
extra_scripts = pre:./somescript... | <p>Using <code>bash + awk</code> you can do this:</p>
<pre class="lang-sh prettyprint-override"><code>readarray -t environments < <(
awk -F 'env:' 'NF==2 {sub(/\]$/, ""); print $2}' file)
# check content of array
declare -p environments
declare -a environments=([0]="FirstEnvironment" [1]=... | Awk to extract platformio.ini environments to a bash array | bash|awk|sed | 1 | 58 | 2 | 72,272,997 | 72,272,997 | 2 | true | 2022-05-17T10:55:44.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Awk to extract platformio.ini environments to a bash array<p>I'm trying to extract all the environments defined in a platformio.ini file so I can loop throug... |
72,281,629 | C++ Most effective way to grab a substring with a value in the middle of a long string<p>I want to find the most effective way to do something like this:</p>
<p>A big string containing all kinds of data, for example:</p>
<pre><code>plushieid:5637372&plushieposition:12757&plushieowner:null&totalplushies:5637... | <p>Use <code>std::string::find()</code> to find the starting and stopping positions, and then use <code>std::string::substr()</code> to extract what is between them, eg:</p>
<pre><code>string extract(const string &s, const string &name)
{
string to_find = name + ":";
string::size_type start = ... | C++ Most effective way to grab a substring with a value in the middle of a long string | c++|string|substring | -1 | 58 | 1 | 72,281,675 | 72,281,675 | 2 | true | 2022-05-17T23:11:58.423Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ Most effective way to grab a substring with a value in the middle of a long string<p>I want to find the most effective way to do something like this:</p>... |
72,299,536 | Reference over array into array of reference<p>I have an array <code>std::array<T, N> arr</code> for some <code>T</code>, <code>N</code> and I'd like to get an array of reference over <code>arr</code>'s elements like so <code>std::array<std::reference_wrapper<T>, N> arr_ref</code>.</p>
<p>But as a ref... | <pre><code>#include <array>
#include <functional>
#include <utility>
#include <cstddef>
template<typename x_Item, ::std::size_t x_count, ::std::size_t... x_index___>
auto wrap_impl(::std::array<x_Item, x_count> & items, ::std::index_sequence<x_index___...>)
{
return ::... | Reference over array into array of reference | c++|arrays|c++17 | 1 | 58 | 1 | 72,299,612 | 72,299,612 | 2 | true | 2022-05-19T06:22:12.173Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reference over array into array of reference<p>I have an array <code>std::array<T, N> arr</code> for some <code>T</code>, <code>N</code> and I'd like t... |
72,310,748 | How can I use grep or any other utility to get a string from a structured data based on a condition?<pre><code>Name State Dns
DeltaService running DeltaService.test.qa.domain.com
DeltaService_1 stopped
DeltaService_2 stopped DeltaService_2.test.qa.domain.... | <p><code>awk</code> seems to be the right tool for that:</p>
<pre class="lang-sh prettyprint-override"><code>printf -- '%s\n' "${serviceLogs[@]}" |
awk '$1 ~ /^DeltaService/ && $3 != "" {print $1}'
</code></pre>
<pre><code>DeltaService
DeltaService_2
</code></pre> | How can I use grep or any other utility to get a string from a structured data based on a condition? | bash|unix | -1 | 58 | 2 | 72,310,868 | 72,310,868 | 2 | true | 2022-05-19T20:30:25.210Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I use grep or any other utility to get a string from a structured data based on a condition?<pre><code>Name State Dns
Delta... |
72,325,104 | //@ts-check and DOM element properties gives an error<p>I've got some simple browser-side JS code, and thought I'd try using @ts-check to pick out any fluff. Some valid bugs were found, and I've added js-doc parameter type information as well. I don't want a transpile step so this needs to be vanilla Javascript.</p>
<p... | <p>The TypeScript compiler supports <a href="https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#casts" rel="nofollow noreferrer">inline type casting</a> when using JSDoc syntax. From the link:</p>
<blockquote>
<p>TypeScript borrows cast syntax from Google Closure. This lets you cast types to other ... | //@ts-check and DOM element properties gives an error | javascript|typescript|ts-check | 0 | 58 | 2 | 72,325,965 | 72,325,965 | 2 | true | 2022-05-20T21:52:38.553Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
//@ts-check and DOM element properties gives an error<p>I've got some simple browser-side JS code, and thought I'd try using @ts-check to pick out any fluff.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.