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,169,727
Type annotation for generic (protocol) class argument<p>I'm trying to work out how to add a type annotation for a function argument that should be a class implementing a generic protocol.</p> <p>As an example, assume I have a protocol for a set that could look something like this:</p> <pre class="lang-py prettyprint-ov...
<p><code>Protocol</code> says nothing about the signature of <code>__init__</code>, even if it's defined on the <code>Protocol</code>. <code>Type</code> does a similar thing - even if <code>Set</code> isn't a <code>Protocol</code>, <code>Type[Set]</code> says nothing about how the type is called.</p> <p>I initially sug...
Type annotation for generic (protocol) class argument
python|mypy|python-typing
0
94
1
72,172,434
72,172,434
2
true
2022-05-09T09:27:14.700Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Type annotation for generic (protocol) class argument<p>I'm trying to work out how to add a type annotation for a function argument that should be a class im...
72,178,583
R cdplot() - does the right axis show probability or density?<p>Reproducible data:</p> <pre><code>## NASA space shuttle o-ring failures fail &lt;- factor(c(2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1), levels = 1:2, labels = c(&quot;no&quot;, &quot;yes&quot;)) tem...
<p>The plot shows the <em>probability</em> of an outcome for a given temperature.</p> <p>What the docs are saying is that a standard density distribution is calculated for temperature measurements, and a density is worked out separately for temperature when <code>fail</code> is 'no'. If we divide the density of &quot;n...
R cdplot() - does the right axis show probability or density?
r|probability-density|density-plot
0
30
1
72,178,790
72,178,790
2
true
2022-05-09T21:55:33.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R cdplot() - does the right axis show probability or density?<p>Reproducible data:</p> <pre><code>## NASA space shuttle o-ring failures fail &lt;- factor(c(2...
72,183,918
How to calculate RMSE and standard deviation between a coordinate point and a non-linear regression under the same abscissa value?<p>The original data is as below:</p> <pre><code>ISIDOR &lt;- structure(list(Pos_heliaphen = c(&quot;W30&quot;, &quot;X41&quot;, &quot;Y27&quot;, &quot;Z24&quot;, ...
<p>You didn't show us how you made your model, so I'm assuming it's something like this:</p> <pre class="lang-r prettyprint-override"><code>mod &lt;- nls(NLE ~ 2/(1 + exp(a * FTSW_apres_arros)) - 1, start = list(a = -6), data = ISIDOR) </code></pre> <p>We can use our model to insert the expected value of <co...
How to calculate RMSE and standard deviation between a coordinate point and a non-linear regression under the same abscissa value?
r|ggplot2|standard-deviation|non-linear-regression
0
99
1
72,185,984
72,185,984
2
true
2022-05-10T09:33:54.223Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to calculate RMSE and standard deviation between a coordinate point and a non-linear regression under the same abscissa value?<p>The original data is as ...
72,235,063
Increase space between two discrete values in a ggplot2 plot in R<p>I am trying to figure out how to add space in a plot between two discrete values on the x-axis. For example, in the plot below, I'd like to keep the same spacing between Setosa and Versicolor but add space between Versiolor and Virginica within the plo...
<p>The easiest way I know of to do this is to make the axis numeric, using custom breaks and labels:</p> <pre class="lang-r prettyprint-override"><code>library(ggplot2) iris %&gt;% mutate(Species2 = ifelse(Species == &quot;virginica&quot;, 4, as.numeric(Species))) %&gt;% ggplot(aes(x = Species2, y = Sepal.Width)) ...
Increase space between two discrete values in a ggplot2 plot in R
r|ggplot2
0
87
1
72,235,180
72,235,180
2
true
2022-05-13T20:22:28.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Increase space between two discrete values in a ggplot2 plot in R<p>I am trying to figure out how to add space in a plot between two discrete values on the x...
72,211,355
SwifttUI with Core Data: load from private context<p>I am trying to display some objects in SwiftUI that I created using an NSManagedObjectContext set to a private queue (so that in case the user presses cancel, the objects aren't committed anywhere, basically the 'scratchpad' MOC). I initially create new a background ...
<p>A background context is for performing work in the background. If you want a scratchpad context for managing user edits, you need to make a main queue context:</p> <pre class="lang-swift prettyprint-override"><code>let editingContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType) editingContext...
SwifttUI with Core Data: load from private context
core-data|swiftui|swift-concurrency
0
111
1
72,212,683
72,212,683
2
true
2022-05-12T07:05:06.507Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SwifttUI with Core Data: load from private context<p>I am trying to display some objects in SwiftUI that I created using an NSManagedObjectContext set to a p...
72,140,523
Regex for allowing words which have only first letter as uppercase?<p>I am trying to make a regex which will validate if all the words have their first letter as upper case. ex like <strong>Fruits</strong> is allowed but <strong>fruits</strong> is not allowed. also <strong>United States</strong> is allowed but <strong>...
<p>A pattern like that can look like:</p> <pre><code>^[A-Z][a-z]*(?: [A-Z][a-z]*)*$ </code></pre> <p><strong>Explanation</strong></p> <ul> <li><code>^</code> Start of string</li> <li><code>[A-Z][a-z]*</code> Match a single uppercase char and optional lowercase chars</li> <li><code>(?: [A-Z][a-z]*)*</code> Optionally re...
Regex for allowing words which have only first letter as uppercase?
javascript|regex|jsp|servlets
0
647
1
72,140,755
72,140,755
2
true
2022-05-06T11:08:46.007Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regex for allowing words which have only first letter as uppercase?<p>I am trying to make a regex which will validate if all the words have their first lette...
72,234,435
Lucene NET throwing Fatal Error: AccessViolationException<p>I am using Lucene NET v4.8 beta, and I have a method that is calling MaybeRefresh on a SearcherManager every 5 seconds. 99.9% of the time, everything works fine. However, 0.1% of the time, I am getting an fatal AccessViolationException error. I am not sure w...
<p>First of all, the error message most likely indicates you are opening the <code>MMapDirectory</code> multiple times on the same set of index files, and you are getting the exception because both instances are writing to the same memory space. I am not sure whether that can be considered a bug or not, but it should b...
Lucene NET throwing Fatal Error: AccessViolationException
lucene|lucene.net
0
77
1
72,246,109
72,246,109
2
true
2022-05-13T19:12:09.107Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Lucene NET throwing Fatal Error: AccessViolationException<p>I am using Lucene NET v4.8 beta, and I have a method that is calling MaybeRefresh on a SearcherMa...
72,148,701
Typescript conditional return type based on props<ol> <li>In electron application I have a component that renders a button and sends a message to an arbitrary channel to the <code>main</code> process.</li> <li>The <code>main</code> process does some work and returns back the result, its return type is depended on the c...
<p>There are a number of ways you can tackle this issue.</p> <p><strong>The core problem</strong></p> <p>The reason why you are seeing that error is because even though you had separated the differentiating values for <code>channel</code> and <code>callback</code> properties into two respectively different objects, <co...
Typescript conditional return type based on props
reactjs|typescript|electron
0
237
1
72,149,180
72,149,180
2
true
2022-05-07T01:05:33.537Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Typescript conditional return type based on props<ol> <li>In electron application I have a component that renders a button and sends a message to an arbitrar...
72,236,777
Pythonic way to write OR SQL condition to extract information schema data from Snowflake<p>I am connecting to <code>Snowflake</code> using <code>python</code> (Below code). As you can see I am trying to get Row Count,Date table was created and altered from Information Schema that is present in SNOWFLAKE_SAMPLE_DATA dat...
<p>If just simplifying the query is good enough, you can start with:</p> <pre class="lang-py prettyprint-override"><code>cur.execute( &quot;&quot;&quot; SELECT TABLE_NAME, ROW_COUNT, CREATED, LAST_ALTERED FROM TABLES WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA='TPCDS_SF100TCL' AND TABLE_N...
Pythonic way to write OR SQL condition to extract information schema data from Snowflake
python|sql|snowflake-cloud-data-platform|snowflake-connector
0
45
1
72,236,849
72,236,849
2
true
2022-05-14T01:54:43.890Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pythonic way to write OR SQL condition to extract information schema data from Snowflake<p>I am connecting to <code>Snowflake</code> using <code>python</code...
72,235,798
How to stop a while loop after n iterations?<p>I'm learning python and I am trying to create the guess game with two levels of difficulty: easy (10 tries) and difficult (5 tries). My code works well, but I need to force the while loop to stop asking for the guess after 5 tries in the difficult level and 10 tries in the...
<p>The short answer is that you need to add a <code>n += 1</code> in the while loops, like that:</p> <pre><code>def easy_level(): n= 0 while n &lt; 10: user_number=int(input('Guess the number: ')) if user_number &gt; number: print('Too high') elif user_number &lt; number: print('Too low') ...
How to stop a while loop after n iterations?
python|loops|while-loop
0
287
4
72,235,882
72,235,882
2
true
2022-05-13T22:00:59.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to stop a while loop after n iterations?<p>I'm learning python and I am trying to create the guess game with two levels of difficulty: easy (10 tries) an...
72,145,560
Why Linking.openURL fires automaticaly without TouchableOpacity?<p>i have a problem with function in React Native. I checking if the String is e-mail, text or phone and returns appropriate object, e.g Linking.openURL(<code>mailto:${phone}</code>).</p> <p>But function automatically fires the URL and forwarding me to Pho...
<p><code>onPress={checkResult(result)}</code> this will result in calling the function <code>checkResult</code> when you pass it to the component, so the function will execute on render.</p> <p>Update your onPress callback to <code>() =&gt; checkResult(result)</code>.</p> <pre><code>&lt;TouchableOpacity onPress={() =...
Why Linking.openURL fires automaticaly without TouchableOpacity?
javascript|react-native|function|touchableopacity
0
58
1
72,145,699
72,145,699
2
true
2022-05-06T17:50:14.943Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why Linking.openURL fires automaticaly without TouchableOpacity?<p>i have a problem with function in React Native. I checking if the String is e-mail, text o...
72,227,759
How to call a callback function on a GUI event? Delegates?<p>I'm very new to C# and I'm wondering if using delegates is the right way here:</p> <p>I created a UserControl in Visual Studio Windows Forms Designer. In a TableLayoutPanel I have 3 x 3 of these UserControls. Each of them gets a row and col index through the ...
<p>Winforms would probably use events for this; same idea, different keywords e.g.</p> <p>For the event prop</p> <pre><code>//old public DoubleClickHandler Callback; //new public event EventHandler&lt;(int Row, int Col)&gt; SomethingDoubleClicked; //use a past tense name if you raise after, or a &quot;SomethingDouble...
How to call a callback function on a GUI event? Delegates?
c#|winforms|event-handling|delegates
0
112
1
72,227,995
72,227,995
2
true
2022-05-13T10:00:50.170Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to call a callback function on a GUI event? Delegates?<p>I'm very new to C# and I'm wondering if using delegates is the right way here:</p> <p>I created ...
72,188,250
Pandas, arithmetic operation on grouped data<p>let say I have a pandas data frame and already grouped as</p> <pre><code>grp=df.groupby(['a','b' ]).sum() </code></pre> <p><a href="https://i.stack.imgur.com/C3qRk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C3qRk.png" alt="enter image description he...
<p>You can do:</p> <pre><code>grp.loc[(slice(None), 1),:].droplevel(1)/grp.loc[(slice(None), 0),:].droplevel(1) </code></pre> <p>In practice whith <code>grp.loc[(slice(None), 1),:]</code> and <code>grp.loc[(slice(None), 0),:]</code> I extract only the rows with <code>b==1</code> and <code>b==0</code> (try yourself and ...
Pandas, arithmetic operation on grouped data
python|pandas|multi-index
0
55
2
72,188,698
72,188,698
2
true
2022-05-10T14:31:17.763Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas, arithmetic operation on grouped data<p>let say I have a pandas data frame and already grouped as</p> <pre><code>grp=df.groupby(['a','b' ]).sum() </co...
72,227,976
grep for a pattern "variable=value" and returning only matching entries having a value > threshold<p>I am searching a kubernetes pod logs for the pattern “variable=value” ( e.g., variable=10 or variable=500) using the command below:</p> <pre><code>Kubectl logs -f | grep “variable=” </code></pre> <p>My question is that...
<p>You didn't provide any sample input so it's a guess but this may be what you're trying to do:</p> <pre><code>awk -F'=' '($1==&quot;variable&quot;) &amp;&amp; ($2&gt;300)' file </code></pre> <p>If that's not all you need then please <a href="https://stackoverflow.com/posts/72227976/edit">edit</a> your question to inc...
grep for a pattern "variable=value" and returning only matching entries having a value > threshold
bash|shell|kubernetes|unix
0
69
4
72,241,791
72,241,791
2
true
2022-05-13T10:19:26.110Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: grep for a pattern "variable=value" and returning only matching entries having a value > threshold<p>I am searching a kubernetes pod logs for the pattern “va...
72,164,317
Capacitor Hard ware back button closing the app in release build<p>I am handling the back button by adding a listener in the _app.tsx of my react project like so</p> <pre><code>useEffect(() =&gt; { CapacitorApp.addListener(&quot;backButton&quot;, () =&gt; { if (router.pathname === &quot;/&quot;) { ...
<p>It is a known issue you just need to copy the following proguard rules into your app's proguard rules</p> <pre><code># Rules for Capacitor v3 plugins and annotations -keep @com.getcapacitor.annotation.CapacitorPlugin public class * { @com.getcapacitor.annotation.PermissionCallback &lt;methods&gt;; @com.ge...
Capacitor Hard ware back button closing the app in release build
android|reactjs|ionic-framework|capacitor|capacitor-plugin
0
132
2
72,540,989
72,540,989
2
true
2022-05-08T19:08:41.390Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Capacitor Hard ware back button closing the app in release build<p>I am handling the back button by adding a listener in the _app.tsx of my react project lik...
72,082,361
aarch64-alpine-linux-musl/bin/ld: cannot find -lpq<p>when I build the rust app using the alpine as the base image using this command:</p> <pre><code>docker build -f ./Dockerfile -t=&quot;reddwarf-pro/reddwarf-admin:v.1.0.0&quot; . </code></pre> <p>show error like this:</p> <pre><code>#14 222.9 = note: /usr/lib/gcc/aa...
<p>Perhaps slightly confusingly, the dev version is called <code>postgresql-dev</code> and not <code>libpq-dev</code> in v3.14. (From what I can tell, it was renamed <code>libpq-dev</code> in v3.15).</p> <p><code>libpq</code> does indeed install the shared library, but <code>postgresql-dev</code> creates the symbolic l...
aarch64-alpine-linux-musl/bin/ld: cannot find -lpq
docker|rust|alpine-linux
0
791
2
72,082,686
72,082,686
2
true
2022-05-02T04:35:55.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: aarch64-alpine-linux-musl/bin/ld: cannot find -lpq<p>when I build the rust app using the alpine as the base image using this command:</p> <pre><code>docker b...
72,151,170
How to convert a stream to another type without using map?<p>I've this code:</p> <pre class="lang-dart prettyprint-override"><code>Stream&lt;int&gt; get fooStream async* { barStream.listen((_) async* { int baz = await getBaz(); yield baz; // Does not work }); } </code></pre> <p>How can I return <code>Str...
<ol> <li><p>Use <code>asyncMap</code>.</p> <pre class="lang-dart prettyprint-override"><code>barStream.asyncMap((e) =&gt; getBaz()) </code></pre> </li> <li><p>Use <code>await for</code></p> <pre class="lang-dart prettyprint-override"><code>Stream&lt;int&gt; get fooStream async* { await for (final item in barStream) { ...
How to convert a stream to another type without using map?
flutter|dart
0
104
1
72,151,232
72,151,232
2
true
2022-05-07T09:23:28.833Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert a stream to another type without using map?<p>I've this code:</p> <pre class="lang-dart prettyprint-override"><code>Stream&lt;int&gt; get fooS...
72,156,798
Flutter - How to change button color on the click and disable other buttons?<p>I have a listview with several green buttons, and I need to change the color of a button to red on click. The problem is that in doing that all the other buttons need to go back to their base color green.</p> <p>On this example below (workin...
<pre class="lang-dart prettyprint-override"><code>import 'package:flutter/material.dart'; const Color darkBlue = Color.fromARGB(255, 18, 32, 47); void main() { runApp(MyApp()); } class MyApp extends StatefulWidget { @override MyAppState createState() =&gt; MyAppState(); } class MyAppState extends State&lt;MyA...
Flutter - How to change button color on the click and disable other buttons?
flutter|dart
0
572
5
72,157,050
72,157,050
2
true
2022-05-07T22:32:52.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter - How to change button color on the click and disable other buttons?<p>I have a listview with several green buttons, and I need to change the color o...
72,196,225
C: string limit? No compiler err/warn- why?<p>I am coding some mqtt stuff. The maximum message size for a valid mqtt message is <a href="http://www.steves-internet-guide.com/mqtt-broker-message-restrictions/" rel="nofollow noreferrer">268435455 bytes approx 260MB</a>.</p> <p>Now I encountered several segfaults in my co...
<p>You are allocating the space for the character array on the stack.</p> <p>Compilers commonly don't know how much memory is provided for the stack. It would make no sense, since they don't know how much stack the other modules of the final program might use. And if recursion comes into play, the used stack space can ...
C: string limit? No compiler err/warn- why?
c|linux|segmentation-fault|limit
0
48
1
72,196,366
72,196,366
2
true
2022-05-11T06:17:49.660Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C: string limit? No compiler err/warn- why?<p>I am coding some mqtt stuff. The maximum message size for a valid mqtt message is <a href="http://www.steves-in...
72,151,005
How to access nested array<p><a href="https://i.stack.imgur.com/zYNhV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zYNhV.jpg" alt="enter image description here" /></a></p> <p>I am trying to access recipeIngredient in this array.</p> <p>I have tried this:</p> <pre><code>&lt;cfloop from=&quot;1&quot...
<p>You are using nested data, so you need to check for the existance of that particular struct that has the key <code>recipeIngredient</code> to output it.</p> <p>In that case I wouldn't iterate the arrays by <strong>index</strong>, because CFML gives the wonderful possibilty to cfloop an array by using the attribute <...
How to access nested array
arrays|json|coldfusion|cfloop
0
107
2
72,152,335
72,152,335
2
true
2022-05-07T08:59:23.433Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to access nested array<p><a href="https://i.stack.imgur.com/zYNhV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zYNhV.jpg" alt="ente...
72,149,235
How to print amount of occurrences of specific string in descending order?<p>I'm looking to use a String[] of logs detailing users who have connected to a website to print out in descending order the amount of times each user has connected. Each log contains some information but the unique userID is always within the f...
<p>First of all, I'm assuming that by O(n) you mean O(n) where n = number of unique users (ie. <code>hashmap.keySet().size()</code>). Unfortunately, your problem involves sorting which is at best O(n*log(n)) complexity, so I don't think it is possible to do this in O(n) time. However, I have some code to still get the ...
How to print amount of occurrences of specific string in descending order?
java|hashmap|big-o
0
70
3
72,149,418
72,149,418
2
true
2022-05-07T03:23:29.960Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to print amount of occurrences of specific string in descending order?<p>I'm looking to use a String[] of logs detailing users who have connected to a we...
72,178,620
Create a local REST API for PostgreSQL<p>I hope you are doing well. I have some questions or rather a guide</p> <p>I just finished a training in SQL, and I chose PostgreSQL as my DBMS.</p> <p>Before I start, I'll give you a briefing to put you in the context:</p> <p>I am developing a Windows Desktop application (with F...
<p>Your front-end app will be developed by Flutter, your back-end will be PostgreSQL, then your problem is about API server and how to work with DB. Your API server can be developed in any language, and depending on the language your choose then you will use its respective packages. Dart language offers an API server b...
Create a local REST API for PostgreSQL
windows|postgresql|flutter|api|rest
0
158
1
72,179,055
72,179,055
2
true
2022-05-09T22:00:13.490Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create a local REST API for PostgreSQL<p>I hope you are doing well. I have some questions or rather a guide</p> <p>I just finished a training in SQL, and I c...
72,176,417
Which C-standard introduced the "__weak" keyword?<p>I would like to use <code>__weak</code> in a library I am creating, but I want to make sure it is compliant with a known &quot;C-number&quot; standard. Which standard introduced this? Or is it a non-standard compiler extension that most compilers have supported? (Eith...
<p><code>__weak</code> is not part of the C standard.</p> <p><code>__weak</code> is a compiler extension specific to the compiler, for example available on Keil and COSMIC compiler. <code>__attribute__</code> is a compiler extensions from gcc GNU C compiler, available for example on clang, TASKING Compiler, TI Arm Comp...
Which C-standard introduced the "__weak" keyword?
c
0
75
1
72,176,988
72,176,988
2
true
2022-05-09T18:05:43.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Which C-standard introduced the "__weak" keyword?<p>I would like to use <code>__weak</code> in a library I am creating, but I want to make sure it is complia...
72,153,033
Problem passing a method of a class as a std::function parameter<p>I am trying to write this function:</p> <pre><code>void CChristianLifeMinistryEditorDlg::PerformAutoAssignForAssignment( const MSAToolsLibrary::AssignmentType eAssignType, const CString strStartingName, std::function&lt;void(CString)&gt; f...
<p>In order make a method of a class callable, you must supply a <code>this</code> object. Wrapping such a method in a <code>std::function</code> can be done in 2 ways. Both of them associate a specific class instance with a method, making it callable:</p> <ol> <li><p>Use <code>std::bind</code> - see the documentation:...
Problem passing a method of a class as a std::function parameter
c++|std-function
0
56
1
72,153,249
72,153,249
2
true
2022-05-07T13:34:46.503Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Problem passing a method of a class as a std::function parameter<p>I am trying to write this function:</p> <pre><code>void CChristianLifeMinistryEditorDlg::P...
72,150,357
Dynamic table name in Ruby sqlite query based on class name<p>I have a parent class that looks like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>class Record att...
<p>You define <code>@selfdb</code> in the initialize method which means it is only available in on the instance level. But your <code>self.find</code> method is a class method and therefore <code>@selfdb</code> is undefined on the class level.</p> <p>I would suggest adding a class method that returns the table name lik...
Dynamic table name in Ruby sqlite query based on class name
ruby|sqlite|inheritance
0
50
1
72,151,350
72,151,350
2
true
2022-05-07T07:21:36.833Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dynamic table name in Ruby sqlite query based on class name<p>I have a parent class that looks like this:</p> <p><div class="snippet" data-lang="js" data-hid...
72,196,076
In Ruby, is there a way to have the user loop back through a conditional statement if they input the wrong range?<p>I wonder if there is a way to use the if-else statements to trigger a loop that has the user re-enter a valid input? I have tried using the While loop as that type of structure technically works, but I ca...
<p>I would use a simple <a href="https://ruby-doc.org/core-3.1.2/Kernel.html#method-i-loop" rel="nofollow noreferrer"><code>loop</code></a> that runs forever unless you explicitly <code>return</code> (or <code>break</code>) from it:</p> <pre><code>class Humanoid &lt; Player def play() loop do print 'Enter y...
In Ruby, is there a way to have the user loop back through a conditional statement if they input the wrong range?
ruby|loops|if-statement|conditional-statements|user-input
0
43
2
72,196,127
72,196,127
2
true
2022-05-11T06:00:12.333Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In Ruby, is there a way to have the user loop back through a conditional statement if they input the wrong range?<p>I wonder if there is a way to use the if-...
72,196,515
Attempting to create a json object from ruby<p>I'm attempting to create this string in Ruby.</p> <pre><code>{ quantity: 1, discount_type: :dollar, discount_amount: 0.01, discount_message: 'this is my message', } </code></pre> <p>By reading up on the classes I can see that I can initialize it like so:</p> <pre><code>cla...
<p>I would add a <code>to_json</code> method to the <code>DiscountDisplay</code> class like this:</p> <pre><code>class DiscountDisplay require 'json' def initialize(quantity, type, amount, message) # ... end def to_json JSON.generate( quantity: @quantity, discount_type: @discount_type, ...
Attempting to create a json object from ruby
ruby
0
25
1
72,196,806
72,196,806
2
true
2022-05-11T06:43:52.137Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Attempting to create a json object from ruby<p>I'm attempting to create this string in Ruby.</p> <pre><code>{ quantity: 1, discount_type: :dollar, discount_a...
72,220,076
Can't add column in pgAdmin4 and PostgreSQL 9.5.25<p>I'm working with pgAdmin4 and PostgreSQL 9.5.25 on Ubuntu 16.04 (I know it's outdated but I really need to work on it currently).</p> <p>I can add a new table to my database, however, when I try to add a new column using GUI (Table --&gt; Properties) to an existing t...
<p><code>ADD COLUMN IF NOT EXISTS</code> is only available in <a href="https://www.postgresql.org/docs/9.6/sql-altertable.html" rel="nofollow noreferrer">Postgres 9.6</a> and up. See the documentation for <a href="https://www.postgresql.org/docs/9.5/sql-altertable.html" rel="nofollow noreferrer">Postgres 9.5</a>.</p> <...
Can't add column in pgAdmin4 and PostgreSQL 9.5.25
postgresql|pgadmin-4
0
291
1
72,220,133
72,220,133
2
true
2022-05-12T17:46:53.763Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't add column in pgAdmin4 and PostgreSQL 9.5.25<p>I'm working with pgAdmin4 and PostgreSQL 9.5.25 on Ubuntu 16.04 (I know it's outdated but I really need ...
72,202,620
store function laravel 8 not saving data to the database<p>Thanks in advance for taking the time to read throw the question.</p> <p>so I have a form in a blade view where a user can add a name, a description, and upload an image but the data is not being passed to the database</p> <p>The blade view:</p> <pre><code>&lt;...
<p>You're missing 2 things on your form:</p> <p><code>method='POST'</code> -- this tells the form to actually submit the form as a POST request and <a href="https://stackoverflow.com/questions/2314401/what-is-the-default-form-http-method">not a GET request</a></p> <p><code>@csrf</code> -- All Laravel forms must have a ...
store function laravel 8 not saving data to the database
php|database|eloquent|laravel-8
0
60
1
72,202,685
72,202,685
2
true
2022-05-11T14:13:08.653Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: store function laravel 8 not saving data to the database<p>Thanks in advance for taking the time to read throw the question.</p> <p>so I have a form in a bla...
72,221,125
Regex to match string and special characters<p>I am new to regex and I want to know how to generate a pattern with letters including special characters and Capital letters from 3 letters up.</p> <p>Suppose I have a string like this:</p> <pre><code>my_string = 'Syrians/NORP, Turkish/NORP, Turkish/NORP, Turkish/NORP, the...
<pre><code>&gt;&gt;&gt; re.findall(r'\w[\w, ]+/[A-Z]{3,4}', my_string) ['Syrians/NORP', 'Turkish/NORP', 'Turkish/NORP', 'Turkish/NORP', 'the last 2 , 3 years/DATE', 'Turkey/LOC'] </code></pre> <p>just add space to your character class (where the '+' is not needed after <code>\w</code>), and range from 3 to 4 to match &...
Regex to match string and special characters
python|regex|string
0
449
1
72,221,196
72,221,196
2
true
2022-05-12T19:25:44.943Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regex to match string and special characters<p>I am new to regex and I want to know how to generate a pattern with letters including special characters and C...
72,199,283
In Symfony/Panther when scraping, waitfor function will throw exception if it timesout - i need it to continue if item is not found<p>I have a database of clinics, and an url to each clinic. All clinic pages are the same in terms of html/css, with different content to scrape.</p> <p>However, some clinics have no conten...
<p>You could just catch the exception, like this...</p> <pre><code>try { $this-&gt;client-&gt;waitFor('.facility'); } catch (TimeoutException $e) { // Log something here that it was skipped by a timeout... // PHP will continue } </code></pre> <p>At the top of your class you may need to add (That's what ...
In Symfony/Panther when scraping, waitfor function will throw exception if it timesout - i need it to continue if item is not found
php|symfony|web-scraping|web-crawler|symfony-panther
0
280
1
72,199,542
72,199,542
2
true
2022-05-11T10:16:20.997Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In Symfony/Panther when scraping, waitfor function will throw exception if it timesout - i need it to continue if item is not found<p>I have a database of cl...
72,212,608
Get a rolling order count into session data<p><strong>I have the following table</strong></p> <p><a href="https://i.stack.imgur.com/bmRoF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bmRoF.png" alt="enter image description here" /></a></p> <p>One client has two purchases in one session.</p> <p><st...
<pre><code> ### create sample table (helps to introduce these in your questions) WITH base AS ( SELECT 'A' AS client_id, 1 AS session_id, 'pv' AS event_name, NULL AS order_id, DATETIME(&quot;2022-05-12 10:17:41&quot;) AS event_timestamp UNION ALL SELECT 'A' AS client_id, 1 AS session...
Get a rolling order count into session data
google-bigquery
0
74
1
72,218,674
72,218,674
2
true
2022-05-12T08:50:29.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get a rolling order count into session data<p><strong>I have the following table</strong></p> <p><a href="https://i.stack.imgur.com/bmRoF.png" rel="nofollow ...
72,171,427
Generating multiple csv from a list<p>Using the <code>markovchain</code> library, I managed to generate 144 transitions probability matrixes (eg. matrixList), but how can I save all (<code>143</code>) as a .csv file?</p> <pre><code>library(tidyverse) library(markovchain) mcListFist&lt;-markovchainListFit(data=df[,...
<p>Apply the writing function to every element of the list:</p> <pre><code>mapply(function(data, name) { data &lt;- as.data.frame(data) write.csv(data, paste0(name, &quot;.csv&quot;)) }, matrixList, 1:length(matrixList)) </code></pre>
Generating multiple csv from a list
r|list
0
26
1
72,171,495
72,171,495
2
true
2022-05-09T11:42:38.390Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generating multiple csv from a list<p>Using the <code>markovchain</code> library, I managed to generate 144 transitions probability matrixes (eg. matrixLi...
72,232,975
C#; How to Loop Through/Wrap Enumerations when Incremented?<p>Say you have a byte value equal to its max value, so <code>byte aByte = 255;</code>. When you increment a value past its max value, it usually wraps around to its minimum value, so if I were to write <code>Console.WriteLine(++aByte)</code>, this would print ...
<p>You can write your own custom enum that works in a similar way</p> <pre><code>static void Main() { Console.Title = &quot;Enumerations&quot;; Season currentSeason = Season.Spring; Console.Write($&quot;{currentSeason++} &quot;); Console.Write($&quot;{currentSeason++} &quot;); Console.Write($&quot;...
C#; How to Loop Through/Wrap Enumerations when Incremented?
c#|enums|increment
0
69
1
72,233,195
72,233,195
2
true
2022-05-13T16:50:52.767Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C#; How to Loop Through/Wrap Enumerations when Incremented?<p>Say you have a byte value equal to its max value, so <code>byte aByte = 255;</code>. When you i...
72,198,207
Issues with Git Working Copy moved to another host<p>I moved a Git working copy from one host to another using tar:</p> <pre class="lang-sh prettyprint-override"><code>tar cBpf - workingcopy | ssh targethost 'tar xvBpf -' </code></pre> <p>Now when I enter <code>git pull</code> on the new host I get</p> <pre><code>hint:...
<p>My guess is that you're seeing this <strong>not</strong> because of the repository that you copied (or because of different configs, although that could also be the case).</p> <p>But probably because of the git version being different between the systems.</p> <p>This should be <strong>no</strong> problem when it com...
Issues with Git Working Copy moved to another host
git
0
77
1
72,198,515
72,198,515
2
true
2022-05-11T08:59:07.267Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Issues with Git Working Copy moved to another host<p>I moved a Git working copy from one host to another using tar:</p> <pre class="lang-sh prettyprint-overr...
72,128,322
If an empty Promise is encountered within an infinite while loop, why is the while loop resolved with a pending Promise?<p>If I make a Promise that is never fulfilled:</p> <p><code>const nothingPromise = new Promise((resolve) =&gt; {});</code></p> <p>And then I <code>await</code> that Promise within an infinite <code>w...
<p><code>await</code> sends the function it is in to sleep until:</p> <ul> <li>The promise resolves <em>and</em></li> <li>The main event loop is free</li> </ul> <p>So the <code>while</code> loop starts, the promise is <code>await</code>ed, and the function which calls <code>run()</code> receives the promise returned by...
If an empty Promise is encountered within an infinite while loop, why is the while loop resolved with a pending Promise?
javascript|promise
0
34
1
72,128,360
72,128,360
2
true
2022-05-05T13:48:55.607Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: If an empty Promise is encountered within an infinite while loop, why is the while loop resolved with a pending Promise?<p>If I make a Promise that is never ...
72,170,556
Js axios error: import call expects exactly one argument<p>im a begginer and im trying to do my first project of fetching data from an API but i ran into an error. Im trying to fetch data from the Riot API with axios, the tutorial that im following doesnt run into this error and i cant find a solution anywhere. the err...
<p>Normally I would expect this to provide the error message</p> <blockquote> <p>Uncaught SyntaxError: Cannot use import statement outside a module</p> </blockquote> <p>It isn't clear why you are getting a different error message. Possibly you have previously defined an <code>import</code> function somewhere in your co...
Js axios error: import call expects exactly one argument
javascript|axios
0
101
1
72,170,734
72,170,734
2
true
2022-05-09T10:30:54.193Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Js axios error: import call expects exactly one argument<p>im a begginer and im trying to do my first project of fetching data from an API but i ran into an ...
72,232,621
Using the Context API as a way of mimicking useSelector and useDispatch with redux v5<p>I'm working on a React project where I'm constrained to using React Redux v5, which doesn't include <code>useDispatch</code> and <code>useSelector</code>.</p> <p>Nonetheless I really would like to have these hooks (or something like...
<p>This will cause significant peformance problems. Your mapStateToProps is using the entire state object, so every time anything changes in the state, the provider must rerender. And since the provider rerendered with a new value, so too must every component that consumes the context. In short, you will be forcing mos...
Using the Context API as a way of mimicking useSelector and useDispatch with redux v5
reactjs|redux|react-redux|reselect
0
158
1
72,232,883
72,232,883
2
true
2022-05-13T16:19:06.653Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using the Context API as a way of mimicking useSelector and useDispatch with redux v5<p>I'm working on a React project where I'm constrained to using React R...
72,208,192
How does this switch statement work? The case values appear to be undefined in the debugger<p>I'm trying to understand how this code works, because it seems like it should not, <strong>but it does work.</strong></p> <p>Is this some TypeScript magic I'm not understanding? React magic? How does this work if the cases are...
<p>The code you are seeing in the debugger is <em>not</em> the code being executed. What you see as <code>Container.tsx</code> is actually probably just a snippet of compiled pure JS in a huge <code>bundle.js</code> somewhere.</p> <p>Typescript code requires compilation before the browser can read it. As part of this s...
How does this switch statement work? The case values appear to be undefined in the debugger
javascript|reactjs|typescript|react-native|switch-statement
0
58
1
72,208,480
72,208,480
2
true
2022-05-11T22:19:43.720Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How does this switch statement work? The case values appear to be undefined in the debugger<p>I'm trying to understand how this code works, because it seems ...
72,158,140
Why is cv2.COLOR_RGB2GRAY failing with Unsupported depth of input image?<p>I have a mask that is generated from an ML program which is (544,544,1). RGB image is (544,544,3). I need to find the contours in the mask and draw them on RGB image. I was trying to convert the mask into grayscale but all attempts failed likely...
<h2>Reproduce</h2> <pre class="lang-py prettyprint-override"><code>cv2.cvtColor(np.ones((30,30,3), dtype=np.int32), cv2.COLOR_RGB2GRAY) </code></pre> <h2>Explain</h2> <p><code>depth</code> is not the channel (part of array shape), it is the number of bytes for each number. int32 will use 4*8 bits to represent an intege...
Why is cv2.COLOR_RGB2GRAY failing with Unsupported depth of input image?
python|opencv|grayscale
0
201
1
72,158,431
72,158,431
2
true
2022-05-08T04:47:50.843Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is cv2.COLOR_RGB2GRAY failing with Unsupported depth of input image?<p>I have a mask that is generated from an ML program which is (544,544,1). RGB image...
72,220,916
Adding value to an array in useState but only at a particular index of the array<p>I have a piece of state which holds an array of comments.</p> <p>Each comment has an array of replies.</p> <p>How can I add a reply value to the replies array of a specific comment within the comments array?</p> <p>Here is my current att...
<p>As <code>post.comments</code> is an array, you certainly need to create an array, not a plain object with <code>{ }</code>. You are missing one level in your nested structure (the array of comments, versus the specific comment). You can use <code>Object.assign</code> to replace the entry at <code>[idx]</code>:</p> <...
Adding value to an array in useState but only at a particular index of the array
javascript|reactjs|use-state
0
31
2
72,221,025
72,221,025
2
true
2022-05-12T19:06:31.737Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding value to an array in useState but only at a particular index of the array<p>I have a piece of state which holds an array of comments.</p> <p>Each comm...
72,192,740
Vue JS - Helper Async Await function to fetch data returning undefined<p>In vuejs I'm using a helper file with some custom functions that I ll use everywhere in the project.</p> <p>I was refactoring some async await promises, but I cant seem to solve it.</p> <p>I wish to call the fetchUserData(123), for example, and ge...
<p>you got a few errors in your code here are the solutions:</p> <p>component.vue</p> <pre><code>import { currentDateTime , fetchUserData } from '@/helpers/util.js'; export default { data () { return { userData: null, loaded: false } }, methods : { currentDate...
Vue JS - Helper Async Await function to fetch data returning undefined
javascript|vue.js|vuejs2
0
460
2
72,192,802
72,192,802
2
true
2022-05-10T20:46:01.437Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Vue JS - Helper Async Await function to fetch data returning undefined<p>In vuejs I'm using a helper file with some custom functions that I ll use everywhere...
72,188,298
Reset `ObservableObject` properties after logout<p>I have one <code>ObservableObject</code> class for managing login data:</p> <pre><code>final class LoginData: ObservableObject { // MARK: - Properties @Published var otpVerificationType: OTPVerificationType = .mobileNumber @Published var firstName: String = &quot;&quo...
<pre><code>struct LoginInfo { var otpVerificationType: OTPVerificationType var firstName: String var mobileNumber: String var email: String init(otpVerificationType: OTPVerificationType = .mobileNumber, firstName: String = &quot;&quot;, mobileNumber: String = &quot;&quot;, email: String = &quot...
Reset `ObservableObject` properties after logout
swiftui|observableobject
0
171
1
72,205,987
72,205,987
2
true
2022-05-10T14:34:39.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reset `ObservableObject` properties after logout<p>I have one <code>ObservableObject</code> class for managing login data:</p> <pre><code>final class LoginDa...
72,219,604
Modify date (month) in spark date column based on condition<p>I would like to modify my date column in spark df to subtract 1 month only if certain months appear. I.e. only if date is yyyy-07-31 or date is yyyy-04-30 change it to yyyy-06-31 and yyyy-03-30 respectively. Any ideas how to do it using pyspark functions?</p...
<p>I would recommend using the <code>functions</code> module and then combining several functionalities:</p> <ul> <li><code>.when()</code> and then <code>otherwise()</code></li> <li><code>.month()</code></li> <li><code>.date_format()</code></li> <li><code>.add_months(date, -1)</code></li> </ul> <p>For example, it could...
Modify date (month) in spark date column based on condition
apache-spark|pyspark|apache-spark-sql
0
425
1
72,221,532
72,221,532
2
true
2022-05-12T17:05:31.933Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Modify date (month) in spark date column based on condition<p>I would like to modify my date column in spark df to subtract 1 month only if certain months ap...
72,177,022
How to get hash of string column in Polars or Pyarrow<p>I have a Pandas DataFrame/Polars dataframe / Pyarrow table with a string key column. You can assume the strings are random. I want to partition that dataframe into N smaller dataframes based on this key column.</p> <p>With an integer column, I can just use <code>d...
<p>I would try using <a href="https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.DataFrame.hash_rows.html#polars.DataFrame.hash_rows" rel="nofollow noreferrer"><code>hash_rows</code></a> to see how it performs on your dataset and computing platform. (Note that in the calculation, I'm effectively sele...
How to get hash of string column in Polars or Pyarrow
pandas|pyarrow|python-polars
0
211
2
72,177,391
72,177,391
2
true
2022-05-09T19:01:42.417Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get hash of string column in Polars or Pyarrow<p>I have a Pandas DataFrame/Polars dataframe / Pyarrow table with a string key column. You can assume t...
72,192,272
OCaml: Upon encountering an exception, the for cycle should just ignore it and continue without tossing me out<p>So i have this code:</p> <pre><code>let matrix = [| [| true; true; true |]; [| false; false; false |]; [| false; true; true |]; [| true; false; false |] |];; for i = 0 to 10 do for j = 0 to 10 do ...
<p>When I compile this I get:</p> <pre><code>Warning 52: Code should not depend on the actual values of this constructor's arguments. They are only for information and may change in future versions. (See manual section 9.5) </code></pre> <p>Well, you ignored this, so when I run it I get:</p> <pre><code>worksworksworksE...
OCaml: Upon encountering an exception, the for cycle should just ignore it and continue without tossing me out
for-loop|exception|matrix|ocaml
0
59
3
72,192,326
72,192,326
2
true
2022-05-10T19:56:42.050Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: OCaml: Upon encountering an exception, the for cycle should just ignore it and continue without tossing me out<p>So i have this code:</p> <pre><code>let matr...
72,168,978
How should I correctly learn GNU assembly?<p>I'm learning assembly in ubuntu recently, I found some of assembles, like NASM, MASM, and GAS. Their syntax is different(particularly pseudo-directives), NASM and MASM support Intel syntax, GAS support AT&amp;T Syntax.</p> <p>Now, I want learn AT&amp;T assembly, so, I use th...
<p>When learning assembly, you can <strong>mostly focus on the <em>instructions</em></strong>, and <code>.section</code> and <code>.globl</code> directives. Unless you're trying to learn how GAS directives produce metadata, including debug info and other stuff that's useful for debugging high-level languages moreso tha...
How should I correctly learn GNU assembly?
assembly|att|gnu-assembler
0
129
1
72,169,650
72,169,650
2
true
2022-05-09T08:24:46.983Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How should I correctly learn GNU assembly?<p>I'm learning assembly in ubuntu recently, I found some of assembles, like NASM, MASM, and GAS. Their syntax is d...
72,176,768
Django - accessing a count of a queryset filtered by specific value in my template<p>I had problems even formulating the title to this question :) I am very much a beginner in everything coding but am enjoying learning through a Django project. Usually I can go bit by bit solving my problems by searching around, but I ...
<p>You can use custom filters.</p> <p>Example:</p> <pre><code>@register.filter def status_active_count(partners): return partners.filter(status__code=&quot;active&quot;).count() # in template {{ programme.PartofProgramme.all|status_active_count }} </code></pre> <p>You can read more here: <a href="https://docs.djan...
Django - accessing a count of a queryset filtered by specific value in my template
python|django
0
46
1
72,177,292
72,177,292
2
true
2022-05-09T18:38:05.350Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django - accessing a count of a queryset filtered by specific value in my template<p>I had problems even formulating the title to this question :) I am very ...
72,205,641
How to fix "file too short" error once importing a C shared library with extenstion ".so"?<p>I am trying to run a deep learning python code written based on MASK-CNN deep network. And there is a C shared library &quot;<em><strong>_crop_and_resize.so</strong></em>&quot;, I am trying to import it, but I am receiving the ...
<p>Per @AMIRABBAS's comment, the output of <code>stat _crop_and_resize.so</code> on the Ubuntu 20.04.4 LTS, 64 bit terminal is:</p> <pre><code>File: _crop_and_resize.so Size: 0 Blocks: 40 IO Block: regular empty file Device: Inode: Links: 1 Access: (0640/-rw-r-----) Uid: (000000/ my username) Gid: (000000/ my userna...
How to fix "file too short" error once importing a C shared library with extenstion ".so"?
python|c|shared
0
322
1
72,206,080
72,206,080
2
true
2022-05-11T18:02:12.897Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to fix "file too short" error once importing a C shared library with extenstion ".so"?<p>I am trying to run a deep learning python code written based on ...
72,205,986
Odd-Even sort Java using multithreading<p>I am new to this group, so I believe it is a possibility to get help here since I could not find any information about my question on Google.</p> <p>I am trying to implement Java EvenOdd transposition sort parallel. Therefore, as I algorithm I thought that dividing into partiti...
<p>Welcome to StackOverflow !</p> <blockquote> <p>How to know how many parts should I divide my array list? For example, I use 17 elements for now to make it more understandable.</p> </blockquote> <p>Your intuition to divide the array into subarrays is correct, as it is often the basis for concurrent sorting algorithms...
Odd-Even sort Java using multithreading
java|multithreading|parallel-processing|bubble-sort
0
175
1
72,222,938
72,222,938
2
true
2022-05-11T18:30:49.797Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Odd-Even sort Java using multithreading<p>I am new to this group, so I believe it is a possibility to get help here since I could not find any information ab...
72,196,453
JavaFX How can I access Application object in Controller?<p>I'm creating a <em><strong>simple</strong></em> javaFX program. In <code>HelloApplication</code> I want to do the logic, and in <code>HelloController</code> I want to listen to button clicks which then execute methods inside the <code>HelloApplcation</code>.</...
<p><strong>How can I access the Application object in Controller?</strong></p> <p>To directly answer your question.</p> <ol> <li>Save the application instance to a static variable in the application <code>init</code> method.</li> <li>Provide a static accessor method to access it.</li> </ol> <p>This is kind of like a si...
JavaFX How can I access Application object in Controller?
java|javafx
0
75
1
72,206,263
72,206,263
2
true
2022-05-11T06:39:12.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JavaFX How can I access Application object in Controller?<p>I'm creating a <em><strong>simple</strong></em> javaFX program. In <code>HelloApplication</code> ...
72,177,762
JS get all the arrays within an array<p>I have an object that looks like the following:</p> <pre><code>const test = { leagues: [ { timezone: &quot;GMT&quot;, date: &quot;1/2/2&quot;, premierLeague: [ { name: &quot;Liverpool&quot;, age: 1892 }, { name: &quot;Manchester Utd&quot;, ...
<p>You might be looking for</p> <pre><code>const result = test.leagues.flatMap(league =&gt; Object.values(league).filter(Array.isArray).flat() ); </code></pre>
JS get all the arrays within an array
javascript|ecmascript-6
0
73
4
72,177,847
72,177,847
2
true
2022-05-09T20:16:43.590Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JS get all the arrays within an array<p>I have an object that looks like the following:</p> <pre><code>const test = { leagues: [ { timezone: &quo...
72,140,103
Transform JSON into required format<p>Here is my input JSON</p> <pre><code> [ { &quot;date&quot;: { &quot;value&quot;: &quot;2022-05-01&quot; }, &quot;parent&quot;: { &quot;value&quot;: &quot;Choclate&quot; }, &quot;chi...
<p>This is prefect for me:</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 data = [ { "date": { "value": "2022-05-01" }, ...
Transform JSON into required format
javascript|json|for-loop|javascript-objects
0
82
2
72,174,046
72,174,046
2
true
2022-05-06T10:35:00.900Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Transform JSON into required format<p>Here is my input JSON</p> <pre><code> [ { &quot;date&quot;: { &quot;value&quot;: &...
72,198,513
How do I find a Mattertag sid?<p>I'm trying to inject some html to a Mattertag as shown in this example here:</p> <p><a href="http://jsfiddle.net/guillermo_matterport/njhm5aos/" rel="nofollow noreferrer">http://jsfiddle.net/guillermo_matterport/njhm5aos/</a></p> <pre><code>const postMessage = await sdk.Mattertag.inject...
<p>To get a Mattertag sid, you can set a <a href="https://matterport.github.io/showcase-sdk/docs/sdk/reference/current/index.html#on" rel="nofollow noreferrer">listener</a> to print out the sid on each click:</p> <pre><code>sdk.on(sdk.Mattertag.Event.CLICK, function (tagSid) { console.log(tagSid + ' was selected'...
How do I find a Mattertag sid?
matterport
0
86
1
72,451,527
72,451,527
2
true
2022-05-11T09:23:14.797Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I find a Mattertag sid?<p>I'm trying to inject some html to a Mattertag as shown in this example here:</p> <p><a href="http://jsfiddle.net/guillermo_m...
72,187,143
Need Help Understanding OpenMP Matrix Multiplication C++ code<p>Here is my Matrix Multiplication C++ OpenMP code that I have written. I am trying to use OpenMP to optimize the program. The sequential code speed was 7 seconds but when I added openMP statements but it only got faster by 3 seconds. I thought it was going ...
<p>Matrix size of 1000x1000 with double(64 bit) element type requires 8MB data. When you multiply two matrices, you read 16MB data. When you write to a third matrix, you also access 24MB data total.</p> <p>If L3 cache is smaller than 24MB then RAM is bottleneck. Maybe single thread did not fully use its bandwidth but w...
Need Help Understanding OpenMP Matrix Multiplication C++ code
c++|parallel-processing|openmp
0
90
2
72,187,689
72,187,689
2
true
2022-05-10T13:21:17.490Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Need Help Understanding OpenMP Matrix Multiplication C++ code<p>Here is my Matrix Multiplication C++ OpenMP code that I have written. I am trying to use Open...
72,172,043
can you suggest an alternative for platform.login<p>i recently started experimenting in the RingCentral sandbox environment and facing issues with this part of the code</p> <pre><code>rcsdk = SDK(CLIENTID,CLIENTSECRET,SERVERURL) platform = rcsdk.platform() try: platform.login(USERNAME,EXTENSION,PASSWORD,JWT) except...
<p>Looking at your code snippet, I can see that the <strong>platform.login()</strong> function signature is incorrect as you are passing extra argument.</p> <p>Correct function signatures in Python are:</p> <ol> <li><p>Logging with username, password flow: <code>platform.login(USERNAME, EXTENSION, PASSWORD)</code></p> ...
can you suggest an alternative for platform.login
python|rest|authentication|ringcentral
0
49
1
72,190,213
72,190,213
2
true
2022-05-09T12:29:06.477Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: can you suggest an alternative for platform.login<p>i recently started experimenting in the RingCentral sandbox environment and facing issues with this part ...
72,203,352
tkinter executes function while the button stays pressed and stop when released<p>I'm new to tkinter and I'm looking for a button that executes a function in loop as soon as the button is pressed; when released the button, function will no more be executed</p> <p>I currently have a <code>tk.Button(self, text=&quot;S+&q...
<p>In the function, catch the event of releasing the left mouse button &quot;ButtonRelease-1&quot;,using the method widget.bind(event, handler), by which you interrupt the loop. <a href="https://python-course.eu/tkinter/events-and-binds-in-tkinter.php#:%7E:text=Events%20can%20be%20key%20presses,and%20methods%20to%20an%...
tkinter executes function while the button stays pressed and stop when released
python|tkinter
0
60
1
72,204,551
72,204,551
2
true
2022-05-11T15:03:01.870Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: tkinter executes function while the button stays pressed and stop when released<p>I'm new to tkinter and I'm looking for a button that executes a function in...
72,212,408
How to initialise and return an std::array within a template function?<p>I'd like a template function that returns some initialisation.</p> <p>I did the following:</p> <pre><code>#include&lt;iostream&gt; #include&lt;array&gt; template &lt;typename T&gt; inline static constexpr T SetValues() { if(std::is_integral&...
<p>The problem is that, when <code>T = int</code>, you're trying to trying to initialize <code>int arr</code> with initializer list <code>{1, 2, 3, 4}</code> in the <code>else</code> branch. Even if you don't execute the <code>else</code> branch, the compiler still has to compile it and <code>int arr = {1, 2, 3, 4}</co...
How to initialise and return an std::array within a template function?
c++|templates|typetraits
0
35
1
72,212,479
72,212,479
2
true
2022-05-12T08:35:07.173Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to initialise and return an std::array within a template function?<p>I'd like a template function that returns some initialisation.</p> <p>I did the foll...
72,165,099
Grep command to find same number digits<p>What i am looking for is to find a grep command to find same number digits in a 4 digit sequence.</p> <p>For example</p> <pre><code>1111 1234 5678 1231 2233 4546 </code></pre> <p>output should be</p> <pre><code>1111 1231 2233 4546 </code></pre> <p>Ive tried ...
<p>Using <code>grep</code></p> <pre><code>$ grep '\([0-9]\).*\1' file 1111 1231 2233 4546 </code></pre> <p>Match interger character in any position in the first cature group within the parenthesis. If the number captured is found again as a last occurance with the back reference <code>\1</code>, then a match is made.</...
Grep command to find same number digits
regex|bash|grep
0
82
1
72,165,126
72,165,126
2
true
2022-05-08T21:07:07.753Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Grep command to find same number digits<p>What i am looking for is to find a grep command to find same number digits in a 4 digit sequence.</p> <p>For exampl...
72,142,124
Datetime parse and format in C++<p>I'm using time_point the first time. I want to parse datetime from string and found a difference when returning back to string from 1 hour.</p> <pre><code>std::chrono::system_clock::time_point timePoint; std::stringstream ss(&quot;2021-01-01 00:00:09+01&quot;); std::chrono::from_strea...
<p>This is the expected behavior.</p> <p>Explanation:</p> <p><code>system_clock::time_point</code>, and more generally, all <code>time_point</code>s based on <code>system_clock</code>, have the semantics of <a href="https://en.wikipedia.org/wiki/Unix_time" rel="nofollow noreferrer">Unix Time</a>. This is a count of ti...
Datetime parse and format in C++
c++|datetime|c++17|c++20
0
280
1
72,142,944
72,142,944
2
true
2022-05-06T13:18:59.047Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Datetime parse and format in C++<p>I'm using time_point the first time. I want to parse datetime from string and found a difference when returning back to st...
72,235,859
Can required parameters in a Dart constructor be named?<p>I am working with some Dart code for a Flutter/Dart class I'm taking. I expected the following code to compile, but it did not:</p> <pre><code>class Person { String? name; int? age; Person(this.name, this.age); @override String toString() { retur...
<p>Your first example uses what are called &quot;positional parameters&quot; in dart. You cannot call a positional parameter with a name label, which is why the first example does not compile.</p> <p>The second example uses &quot;named parameters&quot;. Any parameter defined within <code>{}</code> is considered a named...
Can required parameters in a Dart constructor be named?
dart|parameters|constructor
0
145
1
72,236,330
72,236,330
2
true
2022-05-13T22:13:24.727Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can required parameters in a Dart constructor be named?<p>I am working with some Dart code for a Flutter/Dart class I'm taking. I expected the following code...
72,058,927
How <> works when compared with multiple values?<p>I have a table and sample data as below.</p> <pre><code>create table MyTable ( Col1 NUMBER, Col2 VARCHAR2(30) ) MyTable Col1 Col2 1 | Val1 2 | Val2 3 | Val3 4 | Val4 </code></pre> <p>Below is the query which is already written and deployed to the a...
<p>The values are compare one by one.</p> <p>If you have the sample data:</p> <pre class="lang-sql prettyprint-override"><code>CREATE TABLE MyTable(col1, col2) AS SELECT 1, 'Val1' FROM DUAL UNION ALL SELECT 2, 'Val2' FROM DUAL UNION ALL SELECT 3, 'Val3' FROM DUAL UNION ALL SELECT 4, 'Val4' FROM DUAL; </code></pre> <p>T...
How <> works when compared with multiple values?
sql|oracle|inequality
0
34
1
72,059,086
72,059,086
2
true
2022-04-29T13:42:55.717Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How <> works when compared with multiple values?<p>I have a table and sample data as below.</p> <pre><code>create table MyTable ( Col1 NUMBER, Col2 VARCHAR2(...
72,192,971
PL/SQL procedure issue on Dynamic sql<p>following is the sample proc</p> <pre><code>CREATE OR REPLACE MXADMIN.PROCEDURE SP_UPDATE_QTY ( TABLENAME NVARCHAR2, ID IN NUMBER) IS SQL_STMT VARCHAR2 (1000); BEGIN SQL_STMT := 'UPDATE MXADMIN.SAMPLE_TEST SET PROCESSED_RECORDS = ( SELECT COUNT(*) FROM ...
<p>You have multiple errors including:</p> <ul> <li><code>CREATE OR REPLACE MXADMIN.PROCEDURE SP_UPDATE_QTY</code> should be <code>CREATE OR REPLACE PROCEDURE MXADMIN.SP_UPDATE_QTY</code></li> <li>The argument is <code>TABLENAME</code> but in the dynamic query <code>TABLE_NAME</code> is used.</li> <li>You do not want <...
PL/SQL procedure issue on Dynamic sql
oracle|plsql
0
38
2
72,193,183
72,193,183
2
true
2022-05-10T21:09:06.123Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PL/SQL procedure issue on Dynamic sql<p>following is the sample proc</p> <pre><code>CREATE OR REPLACE MXADMIN.PROCEDURE SP_UPDATE_QTY ( TABLENAME NVARCH...
72,197,408
How to write dynamic query with % string compare?<p>I am writing a dynamic query in a pl/sql procedure, in which I want to retrieve records based on a string comparison operation. I have my strings stored in a variable and I want to use it in a query.</p> <pre><code>x:='A'; select * from table_name where category like ...
<p>Use string concatenation:</p> <pre class="lang-sql prettyprint-override"><code>DECLARE x VARCHAR2(20); cur SYS_REFCURSOR; BEGIN x := 'A'; OPEN cur FOR select * from table_name where category like x || '%SITE'; -- Do something with the cursor. END; / </code></pre> <p><em>db&lt;&gt;fiddle ...
How to write dynamic query with % string compare?
sql|oracle|plsql|dynamic
0
220
1
72,197,474
72,197,474
2
true
2022-05-11T07:58:53.603Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to write dynamic query with % string compare?<p>I am writing a dynamic query in a pl/sql procedure, in which I want to retrieve records based on a string...
72,215,948
Snowflake Primary key using alter statement<p>when I was adding primary key to snowflake table I saw something weird.</p> <p>When I ran a query</p> <pre class="lang-sql prettyprint-override"><code>ALTER TABLE &quot;TESTSCHEMA&quot;.table1 ADD PRIMARY KEY (ID); </code></pre> <p>Above query works as expected. But when I ...
<p>Adding a primary key to the same column is expected to result in an error as provided below.</p> <p>create table &quot;TESTSCHEMA&quot;.table (id number); --Statement executed successfully.</p> <p>ALTER TABLE &quot;TESTSCHEMA&quot;.table ADD PRIMARY KEY (ID); --Statement executed successfully.</p> <p>ALTER TABLE &qu...
Snowflake Primary key using alter statement
snowflake-cloud-data-platform
0
80
2
72,216,675
72,216,675
2
true
2022-05-12T12:53:20.837Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Snowflake Primary key using alter statement<p>when I was adding primary key to snowflake table I saw something weird.</p> <p>When I ran a query</p> <pre clas...
72,167,521
Conditional Count in DataFrame with Python<p><a href="https://i.stack.imgur.com/PaoxI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PaoxI.jpg" alt="DataFrame showing trend respective to date" /></a></p> <p>I want to count how many times there is:</p> <ol> <li>&quot;Increase&quot; to &quot;Increase&...
<p>I'm creating a sample dataframe to work on this problem.</p> <pre><code>import pandas as pd import numpy as np df = pd.DataFrame({'id': np.arange(0,16), &quot;trend&quot;: ['in','de', 'in', 'in','in','un','de','de','un','un','de','de','in','de','in','in']}) </code></pre> <p><a href="https://i.stack.imgur.com/84vGT....
Conditional Count in DataFrame with Python
python|dataframe|count
0
191
2
72,180,792
72,180,792
2
true
2022-05-09T05:57:31.633Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Conditional Count in DataFrame with Python<p><a href="https://i.stack.imgur.com/PaoxI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Paox...
72,231,587
Creating interface in dart like typescript<p>I am from typescript background and new to dart, in typescript we are able to define interface and attach those types to the required variable which have the correct format would work, for example</p> <pre><code>interface Answer { text: string; value: number; } interfac...
<p>Actually your data is json. Then use Object class for your data and fromJson function for SingleQuestion. Your main function like this:</p> <pre><code>void main() { Object data = { 'question': &quot;What's your fav color?&quot;, 'answers': [ { 'text': 'red', 'value': 1, ...
Creating interface in dart like typescript
flutter|dart|oop
0
160
1
72,231,913
72,231,913
2
true
2022-05-13T14:55:22.810Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Creating interface in dart like typescript<p>I am from typescript background and new to dart, in typescript we are able to define interface and attach those ...
72,219,421
How to get the first Sunday of the Month given week number and year?<p>Given a week number and a year, I'd like to be able to compute the first Sunday of that month. I've cobbled together some code that &quot;mostly&quot;, but not always, works. Not sure why it doesn't work for every example, but that's why I'm posting...
<h1>tl;dr</h1> <pre><code>org.threeten.extra.YearWeek // Represents a week-based year and week per the ISO 8601 definition. .of( y , w ) // Pass your week-based year number, and your week (0-52, 0-53). .atDay( DayOfWeek.MONDAY ) // Returns `LocalDate`, for the date of the first day (Monday) of th...
How to get the first Sunday of the Month given week number and year?
java
0
68
2
72,219,763
72,219,763
2
true
2022-05-12T16:51:05.783Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get the first Sunday of the Month given week number and year?<p>Given a week number and a year, I'd like to be able to compute the first Sunday of tha...
72,176,542
How to convert between TFM (Target framework moniker) and FrameworkName?<p>E.g.</p> <p><strong><code>netstandard2.0</code></strong> (from <a href="https://docs.microsoft.com/en-us/dotnet/standard/frameworks#supported-target-frameworks" rel="nofollow noreferrer">Supported target frameworks</a>) which is used as <code>&l...
<p>You can use the source code of <a href="https://github.com/NuGet/NuGet.Client/tree/dev/src/NuGet.Core/NuGet.Frameworks" rel="nofollow noreferrer">NuGet.Frameworks</a>:</p> <p>Here is the method that converts TFM to FrameworkName: <a href="https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Frameworks...
How to convert between TFM (Target framework moniker) and FrameworkName?
c#|target-framework
0
174
1
72,179,664
72,179,664
2
true
2022-05-09T18:18:16.293Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert between TFM (Target framework moniker) and FrameworkName?<p>E.g.</p> <p><strong><code>netstandard2.0</code></strong> (from <a href="https://do...
72,194,178
Arrange by Column Before Grouping by Other Columns<p>I am trying to arrange a data frame by one column, and then group it by two other columns.</p> <p>A sample code and my attempt is as follows:</p> <pre><code>df &lt;- data.frame(person = c(&quot;p1&quot;, &quot;p2&quot;, &quot;p4&quot;, &quot;p3&quot;,&quot;p2&quot;, ...
<p>You could get the max data2 by person, and then arrange by that max</p> <pre><code>df %&gt;% group_by(person) %&gt;% mutate(m=max(data2)) %&gt;% arrange(desc(m), person, desc(data2)) %&gt;% select(-m) </code></pre> <p>Output:</p> <pre><code> person data1 data2 1 p1 a 8 2 p1 b 2 3 ...
Arrange by Column Before Grouping by Other Columns
r|dataframe|dplyr
0
47
1
72,194,480
72,194,480
2
true
2022-05-11T00:26:25.550Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Arrange by Column Before Grouping by Other Columns<p>I am trying to arrange a data frame by one column, and then group it by two other columns.</p> <p>A samp...
72,218,339
PHP, how to convert Int value to Week days<p>For saving the days of week in a database, I've the existing code :</p> <pre><code>if (isset($_POST['day7'])){$dayOfWeek = 1;} else { $dayOfWeek = ''; } if (isset($_POST['day1'])){$dayOfWeek = $dayOfWeek + 2;} if (isset($_POST['day2'])){$dayOfWeek = $dayOfWeek + 4;} if (isse...
<p>other idea (instead of padding the string with zeros):</p> <p>convert the binary value to an integer and use the binary &amp;-operator for checking if a day is selected:</p> <pre><code>function binToWeekdays($binvalue) { $decvalue = bindec($binvalue); $weekdays = array(); if($decvalue &amp; 1 &lt;&lt; 1){ ...
PHP, how to convert Int value to Week days
php|integer|bin|days
0
64
4
72,218,897
72,218,897
2
true
2022-05-12T15:28:24.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP, how to convert Int value to Week days<p>For saving the days of week in a database, I've the existing code :</p> <pre><code>if (isset($_POST['day7'])){$d...
72,226,444
next.js, is server side pages rendered faster?<p>I have a page that is hidden behind auth, so SEO doesn't matter.</p> <p>It includes fetching quite a lot of data. Will the page finish loading faster if I use SSR and fetch the data in getServerSideProps, or will it be a marginal difference compared to client side fetchi...
<h1>TLDR;</h1> <p>It depends on many aspects of the page, but it may run faster because it provides a better <a href="https://web.dev/first-meaningful-paint/" rel="nofollow noreferrer">FMP</a> score in terms of performance results. But for pages like signup/sign-in, it won't make any noticeable difference because you s...
next.js, is server side pages rendered faster?
next.js
0
297
1
72,226,666
72,226,666
2
true
2022-05-13T08:18:16.043Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: next.js, is server side pages rendered faster?<p>I have a page that is hidden behind auth, so SEO doesn't matter.</p> <p>It includes fetching quite a lot of ...
72,200,209
Get the parent text and child one separately and store them in dictionary<p>Suppose I have this html,</p> <pre><code>&lt;span class=&quot;name&quot;&gt; &lt;span class=&quot;age&quot;&gt;21&lt;/span&gt; Will Green &lt;/span&gt; </code></pre> <p>I want to extract the <code>name</code> and <code>age</code> text and s...
<p>In fact that structure is still the same you could use <code>stripped_strings</code> and <code>zip()</code> it with expected <code>keys</code>:</p> <pre><code>dict(zip(['age','name'],soup.select_one('span.name').stripped_strings)) </code></pre> <hr /> <p>An alterntive approach could be to select age first and then i...
Get the parent text and child one separately and store them in dictionary
python|web-scraping|beautifulsoup
0
34
1
72,200,345
72,200,345
2
true
2022-05-11T11:25:53.407Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get the parent text and child one separately and store them in dictionary<p>Suppose I have this html,</p> <pre><code>&lt;span class=&quot;name&quot;&gt; &l...
72,172,679
JavaScript - wait for a function to finish processing before going to the next iteration of the loop<p>I would like to make one function wait for another to finish completely. We have this function that processes a list of files and loads each one of them into the loadFileIntoMemory function.</p> <p>I would like this f...
<p>You will need to convert your loadFileIntoMemory into a Promise.</p> <pre><code>function loadFileIntoMemory(file) { return new Promise((resolve,reject) =&gt; { ...... reader.onload = function (file) { ...... return resolve(); //when all is done, resolve the promise. ...
JavaScript - wait for a function to finish processing before going to the next iteration of the loop
javascript|function|asynchronous|wait
0
281
1
72,172,748
72,172,748
2
true
2022-05-09T13:22:00.293Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JavaScript - wait for a function to finish processing before going to the next iteration of the loop<p>I would like to make one function wait for another to ...
72,224,271
Finding the contentLength for response from Salesforce Connector Mule 4<p>I have been working on a mule app(4.4.0) where it calls a salesforce query connector and converts the response from SF connector to CSV and then upload the CSV to AWS s3 via create an object connector.</p> <p>I am getting errors as: &quot;com.ama...
<h3>Short Version:</h3> <p>Opt for either of the two:</p> <ol> <li>Do not pass the <code>contentLength</code> Param unless it is required for some usecase, as it is handled automatically.</li> <li>If, for some reason, you have to pass the <code>contentLength</code> you should write your payload as String using <code>wr...
Finding the contentLength for response from Salesforce Connector Mule 4
mule|mule4|mule-connector
0
82
1
72,226,241
72,226,241
2
true
2022-05-13T03:56:24.553Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Finding the contentLength for response from Salesforce Connector Mule 4<p>I have been working on a mule app(4.4.0) where it calls a salesforce query connecto...
72,230,075
Process.Start() does not work properly on some computers<p>I have a program where I run some .msi files. This program downloads some files from our website and runs the .msi file. When I run the code as below, it runs smoothly on most computers and installs the setup, but on some computers it shows the windows installe...
<p>Answered here: <a href="https://stackoverflow.com/questions/3553542/invoking-msiexec-within-a-process-fails">invoking MSIEXEC within a Process fails</a></p> <p>Apparently the issue will go away if you <strong>&quot;digitally sign the MSI with a valid certificate.&quot;</strong></p> <p>The reason for this user dialo...
Process.Start() does not work properly on some computers
c#|process
0
167
2
72,281,804
72,281,804
2
true
2022-05-13T13:04:38.030Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Process.Start() does not work properly on some computers<p>I have a program where I run some .msi files. This program downloads some files from our website a...
72,151,596
How to create a new index level with columns name in Pandas?<p>I would like to add a new level to the index of a dataframe, based on columns name. How can i do that ?</p> <pre><code>df home city A -0.166809 0.213299 B -0.040300 0.034583 C -0.002245 0.001058 </code></pre> <p>Desired result</p> <pr...
<p>You can use <code>df.stack()</code></p> <pre><code>print(df.stack()) A home -0.166809 city 0.213299 B home -0.040300 city 0.034583 C home -0.002245 city 0.001058 dtype: float64 </code></pre> <p>Back to your code, you can try <a href="https://numpy.org/doc/stable/reference/generated/numpy....
How to create a new index level with columns name in Pandas?
python|pandas
0
31
1
72,151,673
72,151,673
2
true
2022-05-07T10:23:35.223Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create a new index level with columns name in Pandas?<p>I would like to add a new level to the index of a dataframe, based on columns name. How can i ...
72,237,371
Reindex Pandas Series case insensitive (Combining matches)<p>I have a pandas series with string indices and integer values: (My actual series has &gt;1000 entries)</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th></th> <th>Count</th> </tr> </thead> <tbody> <tr> <td>apple</td> <td>1</td> </t...
<p>You can rename the index to first character uppercase only with <code>string.captialized()</code> then groupby index and aggregate sum function</p> <pre class="lang-py prettyprint-override"><code>df = df.rename(index=lambda x: x.capitalize()) df = df.groupby(df.index).agg({'Count': 'sum'}) # or df = df.groupby(df.in...
Reindex Pandas Series case insensitive (Combining matches)
python|pandas|indexing
0
18
1
72,237,381
72,237,381
2
true
2022-05-14T04:32:54.937Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reindex Pandas Series case insensitive (Combining matches)<p>I have a pandas series with string indices and integer values: (My actual series has &gt;1000 e...
72,211,368
Creating default object from empty value Yii2<p>Using yii2 trying make success callback for payments. Callback work, but i need make changes for order. In my common/congig/main.php:</p> <pre><code>'successCallback' =&gt; function($invoice) { $order = \common\models\Checkout::findOne($invoice-&gt;order_id); $ord...
<p>The problem in your code is that <code>findOne()</code> requires the name of the column to compare the value, in this case, the Checkout's ID column.</p> <p><strong>Assuming</strong> it's <code>order_id</code> like in invoice table.</p> <p>The code will be like this:</p> <pre><code>'successCallback' =&gt; function($...
Creating default object from empty value Yii2
php|yii2
0
51
1
72,218,025
72,218,025
2
true
2022-05-12T07:06:14.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Creating default object from empty value Yii2<p>Using yii2 trying make success callback for payments. Callback work, but i need make changes for order. In my...
72,148,826
cant read field in xml section<p>Using python I got to the correct iteration of the XML (forecast) section, but one child field I cant seem to be able to read here is the section from the XML</p> <pre><code>&lt;forecast&gt; &lt;fcst_time_from&gt;2022-05-04T16:00:00Z&lt;/fcst_time_from&gt; &lt;fcst_time_to&gt;2022-05-04...
<p>You are asking for <code>(l.find('sky_condition')).text</code>, but the <code>sky_condition</code> tag has no text content. Take a close look at the source:</p> <pre><code>&lt;sky_condition sky_cover=&quot;SCT&quot; cloud_base_ft_agl=&quot;4500&quot;/&gt; &lt;sky_condition sky_cover=&quot;SCT&quot; cloud_base_ft_agl...
cant read field in xml section
python|xml
0
33
1
72,149,023
72,149,023
2
true
2022-05-07T01:40:02.820Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: cant read field in xml section<p>Using python I got to the correct iteration of the XML (forecast) section, but one child field I cant seem to be able to rea...
72,143,059
Adding a summarised column back into a dataframe in python<p>as part of some data cleansing, i want to add the mean of a variable back into a dataframe to use if the variable is missing for a particular observation. so i've calculated my averages as follows</p> <pre><code>avg=all_data2.groupby(&quot;portfolio&quot;)&qu...
<p><strong>UPDATED</strong></p> <p>This is probably the most succinct way to do it:</p> <pre class="lang-py prettyprint-override"><code>all_data2.sales = all_data2.sales.fillna(all_data2.groupby('portfolio').sales.transform('mean')) </code></pre> <p>This is another way to do it:</p> <pre class="lang-py prettyprint-over...
Adding a summarised column back into a dataframe in python
python|pandas
0
40
2
72,145,080
72,145,080
2
true
2022-05-06T14:24:08.880Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding a summarised column back into a dataframe in python<p>as part of some data cleansing, i want to add the mean of a variable back into a dataframe to us...
72,139,076
How to position a background on one side of centered content while making the BG translucent without distortion?<p>I'm working on the following layout issue: the page heading is center aligned. It should have a background image on its left side, and the background should also be made semi-transparent. The heading conte...
<p>Background sizing and positioning by themselves shouldn't require more than background properties on the element itself. As long as you can get the content box to shrink to fit the content, <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/background-origin" rel="nofollow noreferrer"><code>background-origin<...
How to position a background on one side of centered content while making the BG translucent without distortion?
html|css
0
71
2
72,140,409
72,140,409
2
true
2022-05-06T09:19:26.473Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to position a background on one side of centered content while making the BG translucent without distortion?<p>I'm working on the following layout issue:...
72,188,530
Is it possible to create a rule in a different account?<p>Using CDK I am trying to create an event bus rule in a different account:</p> <pre><code>// Getting source bus ARN const sourceBusArn = Stack.of(this).formatArn({ region: this.region, service: 'events', account: Config.sourceAccount, resource: 'event-bus...
<p>Found the solution. When importing bus from the source account instead of <code>EventBus.fromEventBusArn</code> use <code>EventBus.fromEventBusAttributes</code> - but with one twist: pass source bus ARN as both bus name and bus ARN:</p> <pre><code>// Getting source bus ARN const sourceBusArn = Stack.of(this).formatA...
Is it possible to create a rule in a different account?
typescript|amazon-web-services|amazon-cloudformation|aws-cdk|aws-event-bridge
0
232
1
72,194,202
72,194,202
2
true
2022-05-10T14:49:29.853Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to create a rule in a different account?<p>Using CDK I am trying to create an event bus rule in a different account:</p> <pre><code>// Getting...
72,225,584
How Hibernate process '?'<p>I'm new in Hibernate. I can't understand how Hibernate process <strong>?</strong> in <code>Restrictions.sqlRestriction()</code> method. For example, there is a sample from official <a href="https://docs.jboss.org/hibernate/orm/3.5/reference/en/html/querycriteria.html" rel="nofollow noreferre...
<p>Yes, <strong>?</strong> is a placeholder that is filled with &quot;Fritz%&quot;.</p> <p><strong>%</strong> it's a wildcard, and it is often used with <code>like</code> like in this case.<br /> Basically the query search for every Cat whose name start with &quot;Fritz&quot;.</p> <p><strong>EDIT</strong><br /> I didn'...
How Hibernate process '?'
java|sql|hibernate
0
63
1
72,226,013
72,226,013
2
true
2022-05-13T07:00:34.990Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How Hibernate process '?'<p>I'm new in Hibernate. I can't understand how Hibernate process <strong>?</strong> in <code>Restrictions.sqlRestriction()</code> m...
72,177,558
Function(dot)value [Javascript]<p>How do i create a function with a value after it?</p> <p>e.g</p> <pre><code>function gotolocation(href) { href = href + &quot;?search=stackoverflow&quot;; window.location = href; } gotolocation.href = &quot;https://google.com&quot;; </code></pre>
<p>You could use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set" rel="nofollow noreferrer">Setter</a></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-...
Function(dot)value [Javascript]
javascript
0
51
3
72,177,623
72,177,623
2
true
2022-05-09T19:55:42.810Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Function(dot)value [Javascript]<p>How do i create a function with a value after it?</p> <p>e.g</p> <pre><code>function gotolocation(href) { href = href +...
72,154,646
Permission denied when creating directory<p>So I would like to create a directory in <code>$HOME</code> but then it says permisson denied, how does creating directories in <code>$HOME</code> require permissions?</p> <p>Here's the code</p> <pre class="lang-rs prettyprint-override"><code>let mut dir = home::home_dir().ex...
<p>Don't include the leading <code>/</code> in the directory name. This is interpreted as replacing the entire path from root.</p> <p>If you move the <code>dbg!</code> statement to after the <code>push</code>, then you'd see the directory was <code>/.siriusmart</code> instead of <code>/your/home/director/.siriusmart</...
Permission denied when creating directory
rust|directory|path
0
254
1
72,154,699
72,154,699
2
true
2022-05-07T16:55:08.390Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Permission denied when creating directory<p>So I would like to create a directory in <code>$HOME</code> but then it says permisson denied, how does creating ...
72,158,110
Python Multiprocessing Parallelize Inner or Outer Loop<p>Let's say we have some operation like:</p> <pre><code>groups = ['A','B','C'] idx = [n for n in range(1000)] for group in groups: for i in idx: # Compute something </code></pre> <p>where <code>idx</code> is much larger than <code>groups</code>.</p> <p>...
<p>This wildly depends on the number of groups, number of cores, heaviness of the actual computation and probably several other factors I'm forgetting. You can avoid having to think about this by creating a single iterator that produces all the tuples of <code>(group, i)</code> that appear in the inner loop, i.e. colla...
Python Multiprocessing Parallelize Inner or Outer Loop
python|multiprocessing|python-multiprocessing|hpc
0
62
2
72,158,170
72,158,170
2
true
2022-05-08T04:39:34.020Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python Multiprocessing Parallelize Inner or Outer Loop<p>Let's say we have some operation like:</p> <pre><code>groups = ['A','B','C'] idx = [n for n in range...
72,235,725
Process to Import specific text in excel with VBA<p>I'm trying to import many tables into excel (with fixed width option selected) and I would like it to paste it to certain areas as a function of &quot;i&quot;, see below: <code>For i = 0 to X</code></p> <p>I would like &quot;X&quot; to be the number of tables that are...
<p>This worked for me - you may need to tweak it a bit to get everything to go where you want.</p> <pre class="lang-vb prettyprint-override"><code>Sub ImportLPileTextFile() Dim colTables As Collection, tbl As Collection, cDest As Range Dim ws As Worksheet, rw, n As Long, fName As String Set ws = Active...
Process to Import specific text in excel with VBA
excel|vba
0
53
1
72,263,339
72,263,339
2
true
2022-05-13T21:48:32.347Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Process to Import specific text in excel with VBA<p>I'm trying to import many tables into excel (with fixed width option selected) and I would like it to pas...
72,196,058
in Xamarin form for collection view items how to set button base on item's value? (conditional binfing)<p>I am doing a Xamarin form project, I have a list of tasks that can be completed or in completed. I want to add a button to display &quot;Mark as completed&quot; for in completed tasks and &quot;Mark as in completed...
<p>There are two solutions:</p> <ol> <li>Create a boolean variable which checks the CompletedDate in your viewmodel and binding the Text to it. And then use a converter to convert the bool to string. About the clicked event, you can try to do the same thing as the Text or do a check in the click event in the page.cs.</...
in Xamarin form for collection view items how to set button base on item's value? (conditional binfing)
c#|xaml|xamarin|xamarin.forms|data-binding
0
266
2
72,196,497
72,196,497
2
true
2022-05-11T05:58:25.410Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: in Xamarin form for collection view items how to set button base on item's value? (conditional binfing)<p>I am doing a Xamarin form project, I have a list of...
72,203,905
AppBar full transparent<h2>Problem</h2> <blockquote> <p>Is there any way to make the <code>AppBar</code> <strong>fully transparent</strong> without using the <code>Stack</code> Widget??</p> <p>This is my <code>AppBar</code> right now (<em>It's transparent but not fully, it has a little white shadow</em>)</p> </blockquo...
<p>To set your AppBar completely transparent you need to set the <code>elevation</code> to <code>0</code> and set the color as <code>transparent</code>, as:</p> <pre><code>AppBar( backgroundColor: Colors.transparent, elevation: 0 ) </code></pre> <p>The AppBar will have the same color as the Scaffold's background....
AppBar full transparent
flutter|dart|flutter-layout|appbar|flutter-appbar
0
90
1
72,203,947
72,203,947
2
true
2022-05-11T15:39:43.780Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AppBar full transparent<h2>Problem</h2> <blockquote> <p>Is there any way to make the <code>AppBar</code> <strong>fully transparent</strong> without using the...
72,153,759
why lua bit.lshift(1, 40) is 256, not 1099511627776<p>I tried left-shift in python and lua, but get different result</p> <p>lua</p> <pre><code>print(bit.lshift(1, 40)) --&gt; 256 </code></pre> <p>python</p> <pre><code>1 &lt;&lt; 40 --&gt; 1099511627776 </code></pre>
<p>That's because <code>bit.lshift</code> uses 32 bits (assuming this is the <code>bitop</code> library running under PUC Lua 5.1 / LuaJIT):</p> <blockquote> <p>It's desirable to define semantics that work the same across all platforms. This dictates that all operations are based on the common denominator of 32 bit int...
why lua bit.lshift(1, 40) is 256, not 1099511627776
math|lua|bit|luajit
0
62
1
72,153,784
72,153,784
2
true
2022-05-07T15:09:28.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: why lua bit.lshift(1, 40) is 256, not 1099511627776<p>I tried left-shift in python and lua, but get different result</p> <p>lua</p> <pre><code>print(bit.lshi...
72,169,382
AWS CLI | esc return text<p>How do I escape the AWS CLI return text? i.e. go back to <code>~$: </code></p> <p>For example:</p> <pre><code>~$: aws s3api list-buckets BUCKETS 2021-01-21T10:19:17+00:00 mybucket BUCKETS 2021-05-18T11:37:38+00:00 foobarmadness OWNER itsbritneybitch (END) </code></pre>
<p>Just press <code>q</code> to exit back to your shell.</p> <p>The <code>q</code> keypress serves as a quit signal for whatever the pager the aws cli uses.</p>
AWS CLI | esc return text
amazon-web-services|aws-cli
0
33
2
72,169,445
72,169,445
2
true
2022-05-09T09:00:25.353Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AWS CLI | esc return text<p>How do I escape the AWS CLI return text? i.e. go back to <code>~$: </code></p> <p>For example:</p> <pre><code>~$: aws s3api list-...
72,087,430
Find rank of column relative to other rows<pre><code>df = pd.DataFrame({'Alice': [4,15,2], 'Bob': [9,3,5], 'Emma': [4,7,19]}) </code></pre> <p>I can find who got the highest score in each round with</p> <pre><code>df.idxmax(1) &gt; 0 Bob 1 Alice 2 Emma dtype: object </code></pre> <p>But I would like to...
<p>You can use <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.rank.html" rel="nofollow noreferrer"><code>rank</code></a>:</p> <pre><code>df.rank(axis=1, method='first', ascending=False) </code></pre> <p><em>NB. check the methods to find the one that better suits your need:</em></p> <blockquote>...
Find rank of column relative to other rows
pandas
0
17
1
72,087,481
72,087,481
2
true
2022-05-02T13:28:35.060Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find rank of column relative to other rows<pre><code>df = pd.DataFrame({'Alice': [4,15,2], 'Bob': [9,3,5], 'Emma': [4,7,19]}) </code></pre> <p>I can find who...
72,104,133
Keep Date Values Only When a Pandas DataFrame Column Includes New Lines, non-words<p>I have imported the below sample data set in a pd dataframe.<br> My plan is to generate an output which looks like &quot;wants&quot; from &quot;have&quot;.<br> In other words, I am trying to pick up date values only when it is mixed wi...
<p>Use <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.str.extract.html" rel="nofollow noreferrer"><code>str.extract</code></a> combined with <a href="https://pandas.pydata.org/docs/reference/api/pandas.to_datetime.html" rel="nofollow noreferrer"><code>pandas.to_datetime</code></a>:</p> <pre><code>d...
Keep Date Values Only When a Pandas DataFrame Column Includes New Lines, non-words
python|pandas|date|extract
0
31
1
72,104,182
72,104,182
2
true
2022-05-03T18:51:34.550Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Keep Date Values Only When a Pandas DataFrame Column Includes New Lines, non-words<p>I have imported the below sample data set in a pd dataframe.<br> My plan...
72,164,836
Check Python String Formatting<p>I can accept user's input in two formats:</p> <ol> <li><code>123</code></li> <li><code>123,234,6028</code></li> </ol> <p>I need to write a function/a few lines of code that check whether the input follows the correct format.</p> <p><strong>The rules:</strong></p> <ol> <li>If a single nu...
<p>You can use a simple regex:</p> <pre><code>import re validate = re.compile('\d{1,5}(?:,\d{1,5})*') validate.fullmatch('123') # valid validate.fullmatch('123,456,789') # valid validate.fullmatch('1234567') # invalid </code></pre> <p>Use in a test:</p> <pre><code>if validate.fullmatch(your_string): # do stuff ...
Check Python String Formatting
python|python-re
0
71
3
72,164,918
72,164,918
2
true
2022-05-08T20:25:26.610Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Check Python String Formatting<p>I can accept user's input in two formats:</p> <ol> <li><code>123</code></li> <li><code>123,234,6028</code></li> </ol> <p>I n...
72,067,316
Python is there a way to align my text along and truncate float at the same time<p>I'm trying to find out if in the format function if I can convert my float to 2 decimal points and have it align in the one line. In the example below I want to align the last element, i'm wondering if I can do something like <code>print...
<p>You can do it by changing the number of spaces between the 2nd and 3rd element of <code>i</code> depending on the number of digits in the 3rd element:</p> <pre><code>item1 = 0.312, &quot;longname2&quot;, 123.6, 76.4329 item2 = 0.112, &quot;longname3&quot;, 12.6, 12 arr = [item1, item2] for i in arr: print(f&quot;{...
Python is there a way to align my text along and truncate float at the same time
python|alignment
0
25
1
72,067,361
72,067,361
2
true
2022-04-30T09:38:43.117Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python is there a way to align my text along and truncate float at the same time<p>I'm trying to find out if in the format function if I can convert my float...
72,171,380
How do I access Sound Hardware in Dev-C++?<p>I was following a video tutorial for playing music in <strong>c++</strong>:</p> <p><a href="https://www.youtube.com/watch?v=tgamhuQnOkM&amp;t=1030s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=tgamhuQnOkM&amp;t=1030s</a></p> <p>I am using <strong>Dev-C++</stron...
<p>This is a bug in the linked header file. It should include <code>&lt;algorithm&gt;</code> which is required for <code>std::find</code>, but doesn't.</p> <hr /> <p>I haven't checked the rest of the header file or your posted code for bugs, but I also noticed</p> <pre><code>while (1) { } </code></pre> <p>Infinite...
How do I access Sound Hardware in Dev-C++?
c++|find|auto|dev-c++|synthesizer
0
71
1
72,171,505
72,171,505
2
true
2022-05-09T11:39:33.200Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I access Sound Hardware in Dev-C++?<p>I was following a video tutorial for playing music in <strong>c++</strong>:</p> <p><a href="https://www.youtube....
72,233,372
How to access just the changed data of an 'input' event regardless of text deletion or insertion like pasted or typed or restored text for the latter?<p>I have a textarea and would like to return the most recent change to the text for use in avia JavaScript function. That would include:</p> <ul> <li>Text that is input ...
<p>Reading about <a href="https://developer.mozilla.org/en-US/docs/Web/API/InputEvent" rel="nofollow noreferrer"><code>InputEvent</code></a>, <a href="https://developer.mozilla.org/en-US/docs/Web/API/InputEvent/inputType" rel="nofollow noreferrer"><code>InputEvent.inputType</code></a> and <a href="https://developer.moz...
How to access just the changed data of an 'input' event regardless of text deletion or insertion like pasted or typed or restored text for the latter?
javascript|input|text|event-handling|custom-events
0
84
1
72,240,501
72,240,501
2
true
2022-05-13T17:23:31.760Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to access just the changed data of an 'input' event regardless of text deletion or insertion like pasted or typed or restored text for the latter?<p>I ha...
72,221,223
Getting Unsupported Media Type for .net core<p>I'm new in backend development and Gettig <strong>415 Unsupported Media</strong> Type in multipart API written in .net core. I have attached the postman image for your reference. Thanks in advance.</p> <pre><code>[HttpPost] [Route(&quot;uploadFiles&quot;)] public a...
<p>1.Change your <code>[FromBody]</code> to <code>[FromForm]</code></p> <p>2.In the Body tab, select the form-data option. Then hover your mouse over the row so you can see a dropdown appear that says Text. Click this dropdown and set it to File.</p> <p><a href="https://i.stack.imgur.com/aaIeY.png" rel="nofollow norefe...
Getting Unsupported Media Type for .net core
asp.net-core|.net-core|postman|asp.net-core-webapi|backend
0
54
1
72,223,914
72,223,914
2
true
2022-05-12T19:35:47.390Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting Unsupported Media Type for .net core<p>I'm new in backend development and Gettig <strong>415 Unsupported Media</strong> Type in multipart API written...
72,194,204
kube-apiserver: force etcd worker key to be re-constructed from api-server<p>Problem: I am creating for testing new node conditions and status, when i am removing them from my code or controller they remain in etcd /kubernetes.io/minions/. whenever i rune describe.</p> <p>I can't update it as it's encrypted, I want a w...
<p>I have found that one way to do so is to delete the node key from etcd and restart kubelet in the node. This re-construct the key back again.</p> <p>Workaround: etcdctl get /kubernetes.io/minions/</p> <p>Keep in mind that api sends to it binary proto, so i used &quot;grep -a&quot; or ad to etcdctl get -w json to dec...
kube-apiserver: force etcd worker key to be re-constructed from api-server
kubernetes|etcd|kubernetes-apiserver|kube-apiserver
0
33
1
72,203,802
72,203,802
2
true
2022-05-11T00:30:12.513Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: kube-apiserver: force etcd worker key to be re-constructed from api-server<p>Problem: I am creating for testing new node conditions and status, when i am rem...