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,226,417
Clean way to write this if<p>Hi I'm writing python function and when I try to test it with pylint it shows: R0912: Too many branches (20/12) (too-many-branches). How should I write this code below cleaner?</p> <pre><code>rows = len(board) cols = len(board[0]) count = 0 copy_board = deepcopy(board) for i in range(rows):...
<p>Make two lists:<br> <code>dx = [-1, -1, -1, 0, 0, 1, 1, 1]</code> <br> <code>dy = [-1, 0, 1, -1, 1, -1, 0, 1]</code></p> <p>then you can write the if part as:</p> <pre><code>for k in range(len(dx)): if check(i+dx[k], j+dy[k], rows, cols) and copy_board[i+dx[k]][j+dy[k]]: count+=1 </code></pre>
Clean way to write this if
python|coding-style|pylint
-1
60
1
72,226,599
72,226,599
1
true
2022-05-13T08:15:46.853Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Clean way to write this if<p>Hi I'm writing python function and when I try to test it with pylint it shows: R0912: Too many branches (20/12) (too-many-branch...
72,226,588
Deep find object in tree, then return object and the path to it through the tree<p>I've written a recursive function to find a given object and the path within that tree, but when I change the target id (over here : if(tree.targetModuleId === 7)) to 10 I got error:</p> <blockquote> <p>&quot;message&quot;: &quot;Uncaugh...
<p>Some issues in <code>findInTree</code>:</p> <ul> <li><p><code>return []</code> is not correct: this is a truthy value, and so the caller's <code>if (tmp)</code> will be true, and it should not. The data type that your function returns should be consistent. It seems it should be an object with <code>result</code> and...
Deep find object in tree, then return object and the path to it through the tree
javascript|reactjs|typescript|algorithm|recursion
-1
98
1
72,226,911
72,226,911
1
true
2022-05-13T08:29:42.003Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Deep find object in tree, then return object and the path to it through the tree<p>I've written a recursive function to find a given object and the path with...
72,226,691
Can my symbol be exactly at the middle of mu button?<p>I have my &quot;+&quot; that is a little bellow the center in my button. How can he be right in the center? Here is my code: <a href="https://snack.expo.dev/@ljacquet/exemple-buton-plus" rel="nofollow noreferrer">Code</a></p>
<ol> <li>Wrapper <code>TouchableOpacity</code> - should be <code>justifyContent: &quot;center&quot;</code></li> <li>For <code>Text</code> need to set <code>fontFamily</code>. Or set <code>lineHeight</code> and <code>justifyContent</code></li> </ol>
Can my symbol be exactly at the middle of mu button?
css|reactjs|react-native
-1
31
2
72,226,964
72,226,964
1
true
2022-05-13T08:38:29.920Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can my symbol be exactly at the middle of mu button?<p>I have my &quot;+&quot; that is a little bellow the center in my button. How can he be right in the ce...
72,228,475
args[max_input] woocommerce if statement confused<p>Cant seem to figure this out with if statements. Wanting it to show QTY 4 unless stock available is less than 4..</p> <p>So far I have this..</p> <pre><code>function wpse_292293_quantity_input_default( $args, $product ) { $args['max_value'] = $product-&gt;managing...
<blockquote> <p>Wanting it to show QTY 4 unless stock available is less than 4..</p> </blockquote> <p>So that would be the minimum of the actual available stock, and 4.</p> <pre><code>$args['input_value'] = min(4, $product-&gt;get_stock_quantity()); </code></pre>
args[max_input] woocommerce if statement confused
php|wordpress|woocommerce
-1
22
1
72,228,652
72,228,652
1
true
2022-05-13T10:57:04.013Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: args[max_input] woocommerce if statement confused<p>Cant seem to figure this out with if statements. Wanting it to show QTY 4 unless stock available is less ...
72,225,577
How to get difference of response received time and request made time<p>i need a difference between response recieved time - request made time.it should print the difference on the screen.for now it shows a button and if we click that button it prints response time stamp.</p> <p><a href="https://i.stack.imgur.com/zKyjv...
<p>Try This-</p> <pre><code>import android.annotation.SuppressLint; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import com.android.volley.Request; import com.android.volley.R...
How to get difference of response received time and request made time
android
-1
22
1
72,229,283
72,229,283
1
true
2022-05-13T06:59:29.323Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get difference of response received time and request made time<p>i need a difference between response recieved time - request made time.it should prin...
72,229,681
How to remove property from object<p>We have an array of objects like this:</p> <pre><code>const arrOfObjects = [ { name: 'Ronaldo', age: 20, status: true }, { name: 'Messi', age: 30, status: false }, { name: 'Benzema', age: 40, status: false }, { name: 'Vini', ...
<p>Extract the <code>age</code> with destructuring and use a conditional part to insert it again:</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 arrOfObjects = [{name: '...
How to remove property from object
javascript
-1
36
3
72,229,761
72,229,761
1
true
2022-05-13T12:33:50.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to remove property from object<p>We have an array of objects like this:</p> <pre><code>const arrOfObjects = [ { name: 'Ronaldo', age: 20, s...
72,229,478
Compose's "AndroidView"'s factory method doesn't recall when "remember" value change<p>I've an <code>AndroidView</code> on my UI and I'm creating a custom view class using factory scope. And I've <code>remember</code> value above my android view which is changing by user actions.</p> <pre><code> val isActive = remem...
<p>As given in the <a href="https://developer.android.com/jetpack/compose/interop/interop-apis" rel="nofollow noreferrer">Docs</a>,<br /> Use <code>update</code> to handle state changes.</p> <pre><code>update = { view -&gt; // View's been inflated or state read in this block has been updated // Add logi...
Compose's "AndroidView"'s factory method doesn't recall when "remember" value change
android|kotlin|android-jetpack-compose|android-jetpack
-1
154
1
72,230,027
72,230,027
1
true
2022-05-13T12:16:42.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compose's "AndroidView"'s factory method doesn't recall when "remember" value change<p>I've an <code>AndroidView</code> on my UI and I'm creating a custom vi...
72,229,794
Systemd consumer service starts before broker (RabbitMQ )<p>I have a RabbitMQ server set up on my raspberry Pi and I want the same device to run a consumer to handle messages to one of my queues. I first tried executing it from the crontab but realized later that running it as a systemd service may be a better idea. Th...
<p>Replace <code>Wants</code> with <code>Requires</code>, <code>Wants</code> is meaning good to have while <code>Requires</code> is a must.</p> <p>Also, make sure the rabbitmq-server.service is in rabbitmq-server.target. If not, replace rabbitmq-server.target with rabbitmq-server.service</p> <p>Reference: <a href="http...
Systemd consumer service starts before broker (RabbitMQ )
python|rabbitmq|systemd
-1
87
1
72,230,278
72,230,278
1
true
2022-05-13T12:42:01.800Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Systemd consumer service starts before broker (RabbitMQ )<p>I have a RabbitMQ server set up on my raspberry Pi and I want the same device to run a consumer t...
72,230,888
C,Reading From File,Prinintg, Syntax Error identifier<p>Im trying to run my c code. but im getting a problem and really tried that much to get the right thing and i couldnt know what the problem. what is visual studio telling me that, i have syntax error also missed &quot;}&quot; but i checked every thing and its still...
<h1>Syntax errors</h1> <p>In the C Playground (<a href="https://cplayground.com/?p=axolotl-albatross-okapi" rel="nofollow noreferrer">editable</a>) I get the following errors:</p> <pre><code>/cplayground/code.cpp:7:5: error: unknown type name 'Student' Student* arr; ^ </code></pre> <p>Here, in the definition of...
C,Reading From File,Prinintg, Syntax Error identifier
c|syntax-error
-1
41
3
72,231,432
72,231,432
1
true
2022-05-13T14:04:26.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C,Reading From File,Prinintg, Syntax Error identifier<p>Im trying to run my c code. but im getting a problem and really tried that much to get the right thin...
72,226,730
Output doesn't come. Plotting issue [Matlab to python conversion]<p>This is my Pyhton code.</p> <pre><code>import numpy as np import matplotlib.pyplot as plt n = 3; #% No of image T = 100; #% for the time period user wants to see the mirage ts = .2*...
<p>Here is a fixed version of your code. The basic idea is not to mix <code>concatenate</code> with <code>append</code>. In MATLAB, <code>[[a],[b]]</code> is a horizontal concatenation and is different from <code>list.append()</code> in Python. Also take care of the inclusive range in MATLAB vs. exclusive range in Pyth...
Output doesn't come. Plotting issue [Matlab to python conversion]
python|numpy|matlab
-1
46
1
72,231,622
72,231,622
1
true
2022-05-13T08:42:11.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Output doesn't come. Plotting issue [Matlab to python conversion]<p>This is my Pyhton code.</p> <pre><code>import numpy as np import matplotlib.pyplot as plt...
72,231,472
How to update jetpack compose slider state outside of the slider<p>So, I'm using the Jetpack compose for my app and I have a state with a float value in the viewModel. This value can be updated outside of the slider; but also from the slider when the finger is lifted (I'd rather not update it while the user is still sl...
<p>Just update the model value in the <code>onValueChange</code>. You never need an internal state, since that causes ambiguity. Just follow the &quot;single source of truth&quot; principle.</p> <p>Use this</p> <pre><code>Slider( modifier = Modifier .fillMaxWidth(), v...
How to update jetpack compose slider state outside of the slider
android|kotlin|android-jetpack-compose
-1
350
2
72,231,694
72,231,694
1
true
2022-05-13T14:47:26.750Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to update jetpack compose slider state outside of the slider<p>So, I'm using the Jetpack compose for my app and I have a state with a float value in the ...
72,230,306
React Boostrap Select, First Select Option ins not triggered by onChange event<p>I'm using React Boostrap Select component :</p> <pre><code> &lt;Form.Group className=&quot;mb-1&quot;&gt; &lt;Form.Label htmlFor=&quot;type&quot; className=&quot;iig-form-label d-inline-block text-truncate&quot; &gt; ...
<p>I couldn't follow your example, so I created a minimal example to show you how it works:</p> <ul> <li>Create state to store the value and <strong>give the id/value of the selected option you want to see initially as default value</strong></li> <li>Write onChange handler</li> <li>Pass state value and onChange handler...
React Boostrap Select, First Select Option ins not triggered by onChange event
javascript|reactjs|dom-events|jsx|react-bootstrap
-1
86
1
72,232,007
72,232,007
1
true
2022-05-13T13:24:00.043Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React Boostrap Select, First Select Option ins not triggered by onChange event<p>I'm using React Boostrap Select component :</p> <pre><code> &lt;Form.Group ...
72,231,786
Need help printing execution details when I manually place a trade using IBKR API (Interactive Brokers)<p>I am trying to print execution details when an order is filled. I got this working in code using the execDetails method, however it only prints the execution details when it's the bot that places a trade. I am tryi...
<p>Alright, I figured it out. To get it to talk back to you with manual orders, you need to go to your TWS API settings and set the Master API Client ID to 0, then match it with the connect clientID:</p> <pre><code>app.connect('127.0.0.1', 7497, 0) </code></pre>
Need help printing execution details when I manually place a trade using IBKR API (Interactive Brokers)
python|algorithmic-trading|trading|interactive-brokers
-1
46
1
72,232,474
72,232,474
1
true
2022-05-13T15:09:54.883Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Need help printing execution details when I manually place a trade using IBKR API (Interactive Brokers)<p>I am trying to print execution details when an orde...
72,232,527
Using an empty string in path fails<p>In my node API i have some function that updates the email address Array of either a contact or a farm, its the same concept but the difference is where the array is located in farms is in Records.emails and in Contacts its in emails. So in my case I decide based on _type what the ...
<p>You can't do it like that, and more so, you don't need too.</p> <ol> <li>Define a variable that will receive the value of emails.</li> <li>Use the conditional to disambiguate the input</li> <li>Copy the emails from where it resides in the input, based on type</li> </ol> <pre><code>let e_emails if(result.content._ty...
Using an empty string in path fails
javascript|node.js
-1
24
1
72,232,651
72,232,651
1
true
2022-05-13T16:11:43.313Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using an empty string in path fails<p>In my node API i have some function that updates the email address Array of either a contact or a farm, its the same co...
72,232,207
Updating a Value of A Panda Dataframe with a Function<p>I have a function which updates a dataframe that I have passed in:</p> <pre><code>def update_df(df, x, i): for i in range(x): list = ['name' + str(i), i + 2, i - 1] df.loc[i] = list return df, i df = pd.DataFrame(columns=['lib', 'qty1'...
<p>If all you want is to concatenate the last two values in the <code>lib</code> column, and reassign the last row's <code>lib</code> column to that value:</p> <pre class="lang-py prettyprint-override"><code>df.loc[df.index[-1], &quot;lib&quot;] = df[-2:][&quot;lib&quot;].sum() </code></pre>
Updating a Value of A Panda Dataframe with a Function
python-3.x|pandas|dataframe
-1
24
1
72,232,923
72,232,923
1
true
2022-05-13T15:43:28.210Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Updating a Value of A Panda Dataframe with a Function<p>I have a function which updates a dataframe that I have passed in:</p> <pre><code>def update_df(df, x...
72,233,688
find unique lists inside another list in an efficient way<pre><code>solution = [[1,0,0],[0,1,0], [1,0,0], [1,0,0]] </code></pre> <p>I have the above nested list, which contain some other lists inside it, how do we need to get the unique lists inside the solution</p> <pre><code>output = [[1,0,0],[0,1,0] </code></pre> <p...
<p>If you don't care about the order, you can use <code>set</code>:</p> <pre class="lang-py prettyprint-override"><code>solution = [[1,0,0],[0,1,0],[1,0,0],[1,0,0]] output = set(map(tuple, solution)) print(output) # {(1, 0, 0), (0, 1, 0)} </code></pre>
find unique lists inside another list in an efficient way
python|list|multidimensional-array|nested-lists
-1
53
5
72,233,765
72,233,765
1
true
2022-05-13T17:55:17.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: find unique lists inside another list in an efficient way<pre><code>solution = [[1,0,0],[0,1,0], [1,0,0], [1,0,0]] </code></pre> <p>I have the above nested l...
72,233,965
Javascript: How would you get the highest rated product category based on these 2 arrays<p>Assuming I have 2 arrays:</p> <pre><code>const products = [ { name: 'prod1', category: 'Meat' }, { name: 'prod2', category: 'Meat' }, { name: 'prod3', category: 'Dairy' }]; const rate = [ {...
<p>As the OP probably knows, canonical grouping goes like this...</p> <pre><code>const prodsByCategory = products.reduce((acc, p) =&gt; { let cat = p.category; if (!acc[cat]) acc[cat] = []; acc[cat].push(p); return acc; }, {}); </code></pre> <p>Modify this a little to add the data which will be needed to optimi...
Javascript: How would you get the highest rated product category based on these 2 arrays
javascript|arrays|sorting
-1
24
1
72,234,545
72,234,545
1
true
2022-05-13T18:24:18.760Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript: How would you get the highest rated product category based on these 2 arrays<p>Assuming I have 2 arrays:</p> <pre><code>const products = [ { ...
72,233,429
C# WinForms | Can I detect specific Sounds with a Microphone Input and let my program detect that specific sound and respond to it?<p>I'm currently trying to make a C# programm that simulates a Dial-Up Connection. So this what the programm should do:</p> <p>When I play a DTMF Tone like 212 5678912 or the Phone Ring Sig...
<p>To elaborate on @Jimi's link, this is pretty easy to do with NAudio and DtmfDetection.</p> <pre class="lang-cs prettyprint-override"><code>using DtmfDetection.NAudio; using NAudio.CoreAudioApi; using NAudio.Wave; static class Program { static void Main(string[] args) { using var audioSource = new Wa...
C# WinForms | Can I detect specific Sounds with a Microphone Input and let my program detect that specific sound and respond to it?
c#|winforms|audio
-1
82
1
72,234,581
72,234,581
1
true
2022-05-13T17:29:48.153Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# WinForms | Can I detect specific Sounds with a Microphone Input and let my program detect that specific sound and respond to it?<p>I'm currently trying to...
72,233,887
Regex to search for unique last names in XML<p>I have last names in an XML file that I would like to capture, which are unique. I am going off this other StackOverflow answer to start: <a href="https://stackoverflow.com/questions/40469320/only-match-unique-string-occurrences">Only match unique string occurrences</a> I ...
<p>Does this work for you?</p> <p><code>/&lt;LastName&gt;(\w+)&lt;\/LastName&gt;(?!.*&lt;LastName&gt;\1&lt;\/LastName&gt;)/gsm</code> (note the flags, they're important)</p> <p><a href="https://regex101.com/r/O1RocE/3" rel="nofollow noreferrer">Demo</a></p> <p>The issue was that your <code>(.*)</code> to match the name...
Regex to search for unique last names in XML
regex
-1
37
2
72,235,121
72,235,121
1
true
2022-05-13T18:14:53.017Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regex to search for unique last names in XML<p>I have last names in an XML file that I would like to capture, which are unique. I am going off this other Sta...
72,233,721
Selecting From multidimensional Numpy array with multidimensional mask<p>I am trying to build an example to understand image segmentation, you are given an image of shape (1,2,2,3) it's a 2x2 image where each pixel has 3 numbers indicating the probability that this pixel is belonging to a specific class. what I want is...
<p>I think you want to use:</p> <pre><code>np.take_along_axis(pixel, mask, axis = -1) </code></pre> <p>You would also be able to get the same result without the use of a mask by using:</p> <pre><code>pixel.max(axis = -1, keepdims = True) </code></pre>
Selecting From multidimensional Numpy array with multidimensional mask
python|arrays|numpy|multidimensional-array|image-segmentation
-1
45
1
72,235,134
72,235,134
1
true
2022-05-13T17:58:33.610Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Selecting From multidimensional Numpy array with multidimensional mask<p>I am trying to build an example to understand image segmentation, you are given an i...
72,233,586
Flask Login is not working properly on Python Anywhere<p>This morning I tried to login in my account from my website(deployed on pythonanywhere</p> <p>After that, I tried to login from my main device. It worked perfectly. I checked if I entered the same credentials and I did.</p> <p>The view function:</p> <pre><code>@a...
<p>You should see whats being sent over when you post by printing the form data.</p> <pre class="lang-py prettyprint-override"><code>@application.route('/logmein', methods=['POST']) def logmein(): print(request.form) # print each method so you can look around print(dir(request.form)) return 'test' </co...
Flask Login is not working properly on Python Anywhere
flask|pythonanywhere
-1
96
1
72,235,249
72,235,249
1
true
2022-05-13T17:45:33.947Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flask Login is not working properly on Python Anywhere<p>This morning I tried to login in my account from my website(deployed on pythonanywhere</p> <p>After ...
72,231,371
How to pull out the word I need in a column in Snowflake?<p>So I have a column in a table as follows:</p> <p><strong>TBL</strong></p> <pre><code>JFK 257: Gremlin vs Ronald 2 JFK 271: Walter vs Hamburglar JFK 272: Pizza vs Papa 1 JFK 272: Pizza vs Papa 2 JFK 267: JFK 275: Texas vs Cheese </code></pre> <p>And I want to ...
<p>Another approach without using regex. Load the data:</p> <pre><code>CREATE TABLE TEMP2 (CUSTOMER VARCHAR); INSERT INTO TEMP2 VALUES ('JFK 257: Gremlin vs Ronald 2'), ('JFK 271: Walter vs Hamburglar'), ('JFK 272: Pizza vs Papa 1'), ('JFK 272: Pizza vs Papa 2'), ('JFK 267: '), ('JFK 275: Texas vs Cheese'); </code></pr...
How to pull out the word I need in a column in Snowflake?
snowflake-cloud-data-platform
-1
51
2
72,236,011
72,236,011
1
true
2022-05-13T14:40:23.880Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to pull out the word I need in a column in Snowflake?<p>So I have a column in a table as follows:</p> <p><strong>TBL</strong></p> <pre><code>JFK 257: Gre...
72,236,729
Currently able to calculate total neighbors, I need just the neighbors that are alive<p>I have a bool [,] board that stores if the cell is alive or dead. The code I have provided is correctly telling me the total neighbors for each cell, the problem is I need to only count the alive neighbors. My thought was to have a ...
<p>assuming that the array is called 'alive'</p> <pre><code> if (alive[row,col] &amp;&amp; WithinBounds(row, col)) </code></pre>
Currently able to calculate total neighbors, I need just the neighbors that are alive
c#|multidimensional-array|boolean|nearest-neighbor
-1
34
1
72,236,754
72,236,754
1
true
2022-05-14T01:39:25.613Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Currently able to calculate total neighbors, I need just the neighbors that are alive<p>I have a bool [,] board that stores if the cell is alive or dead. The...
72,236,728
JavaScript - How do I print an input inside an array?<p>I already tried many ways to solve this, but it always returns <code>undefined</code>. What should I do to solve this issue?</p> <pre class="lang-js prettyprint-override"><code>function printThreeFavoriteColours() { const colours = []; const colorUserFav1 = pr...
<p>You almost got it, you just need to remove <code>=</code> from your example</p> <pre><code>function printThreeFavoriteColours() { const colours = []; const colorUserFav1 = prompt(&quot;type your first favorite color&quot;); const colorUserFav2 = prompt(&quot;now, type your second favorite color&quot;); const...
JavaScript - How do I print an input inside an array?
javascript|arrays|arraylist
-1
28
2
72,236,779
72,236,779
1
true
2022-05-14T01:39:05.827Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JavaScript - How do I print an input inside an array?<p>I already tried many ways to solve this, but it always returns <code>undefined</code>. What should I ...
72,236,631
hallway problem - is there a way to solve in python?<p><a href="https://i.stack.imgur.com/yZGGs.png" rel="nofollow noreferrer">hallway problem picture</a></p> <p>There is a some rooms and a hallway. Two of the rooms are connected to the hallway. Each of those rooms have one room connected to them. Those have no connect...
<p>You only need to change <code>range(len(lst))</code> to <code>range(1, len(lst))</code>. This is because when <code>i == 0</code>, the <code>if</code> condition becomes <code>if not lst[0] in d[-1]</code>, which you don't want.</p> <pre class="lang-py prettyprint-override"><code>def possible_path(lst): d = {1: [...
hallway problem - is there a way to solve in python?
python|logic
-1
32
1
72,236,861
72,236,861
1
true
2022-05-14T01:09:25.163Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: hallway problem - is there a way to solve in python?<p><a href="https://i.stack.imgur.com/yZGGs.png" rel="nofollow noreferrer">hallway problem picture</a></p...
72,230,361
How to change the structure of an an XML<p>From this string:</p> <pre><code>label_config={ &quot;label1&quot;: [ &quot;modality1&quot;, &quot;modality2&quot;, &quot;modality3&quot;], &quot;choice&quot;:&quot;single&quot;, &quot;required&quot;: &quot;true&quot;, &quot;name&quot; :...
<p>To correctly encapsulate the <code>&lt;Choice&gt;</code> nodes under its parent, <code>&lt;Choices&gt;</code>, simply make the following very simple two changes to your <code>choiceXML</code> method. Namely, add <code>opEl</code> sub elements under the <code>choisesEl</code> element (not <code>root</code>) and remov...
How to change the structure of an an XML
python|xml|lxml
-1
84
3
72,241,861
72,241,861
1
true
2022-05-13T13:28:47.887Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change the structure of an an XML<p>From this string:</p> <pre><code>label_config={ &quot;label1&quot;: [ &quot;modality1&quot;, &...
72,236,581
Object with Unpredictable Fields in TypeScript Interface<p>I am working on a web application in Angular and am making the following call to a service <code>return this.http.get&lt;SiteContent&gt;(this.apiUrl + this.endpoint + id)</code> The issue is that the JSON which is being mapped to a SiteContent interface contain...
<p>JavaScript background, not specific to TypeScript:</p> <p><a href="https://www.json.org/json-en.html" rel="nofollow noreferrer">JSON</a> is a data format based on JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#object_literal_notation_vs_json" rel="n...
Object with Unpredictable Fields in TypeScript Interface
angular|typescript
-1
113
1
72,244,878
72,244,878
1
true
2022-05-14T00:53:42.403Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Object with Unpredictable Fields in TypeScript Interface<p>I am working on a web application in Angular and am making the following call to a service <code>r...
72,234,997
stop and execute a promise javacript<p>How do I execute a HTTP request synchronously and store the result in a local object with Javascript?</p> <p>Given the following javascript module:</p> <pre><code>var Promise = require(&quot;promise&quot;); ...
<p><code>myReq</code> returns a Promise, NOT just the data! That is why you need to use <code>then</code> &amp; <code>catch</code> blocks, or alternatively use <code>await</code>.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="...
stop and execute a promise javacript
javascript|asynchronous|promise|xmlhttprequest
-1
55
2
72,255,970
72,255,970
1
true
2022-05-13T20:16:03.333Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: stop and execute a promise javacript<p>How do I execute a HTTP request synchronously and store the result in a local object with Javascript?</p> <p>Given the...
72,212,189
C# MySql Login Admin panel<p>I have a project and that project has a login part. Users will be able to login with their own accounts and will be transferred to a different Form. But I want to login to the admin panel, I don't know how to login. When I type name=&quot;admin&quot; password=&quot;admin123&quot; from the s...
<pre><code>if (rd.HasRows) // Girilen K.Adı ve K.Parola Dahilinde Gelen Data var ise { while (rd.Read()) { if (rd[&quot;ID&quot;].ToString() == &quot;1&quot;) // Admin Panel Login { Form2 frm2 = new Form2(); ...
C# MySql Login Admin panel
c#|mysql
-1
67
1
72,328,412
72,328,412
1
true
2022-05-12T08:17:12.193Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# MySql Login Admin panel<p>I have a project and that project has a login part. Users will be able to login with their own accounts and will be transferred ...
72,224,988
Change OpenLayers map style<p>I am trying to create a map in OpenLayers. I have no problem with other APIs, but the map style is old. Also, there is another application named Snap (it's using OSM) that has a prettier style:</p> <p><a href="https://i.stack.imgur.com/enNtu.jpg" rel="nofollow noreferrer"><img src="https:/...
<p>You have to change the layer being displayed or the map. Different API's provide different layers that might have multiple styles.</p> <p>For example here: <a href="https://cloud.maptiler.com/maps/" rel="nofollow noreferrer">https://cloud.maptiler.com/maps/</a></p>
Change OpenLayers map style
javascript|dictionary|openlayers
-1
114
1
72,361,104
72,361,104
1
true
2022-05-13T05:54:05.400Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change OpenLayers map style<p>I am trying to create a map in OpenLayers. I have no problem with other APIs, but the map style is old. Also, there is another ...
72,174,787
How to get the latest date of entry for each user in Sqlite?<p>If I make a <code>GROUP BY auth_user.id</code> it gives me the list. If the users who are grouped has more than one rows I get the date when the user filled my form first time. If I order it by date (<code>DESC</code>), it orders it by the date when of the ...
<p>You can use <code>max(date)</code> to get the most recent date for each user.</p> <pre><code>SELECT user_id, MAX(date) FROM answers GROUP BY user_id, ORDER BY date DESC; </code></pre>
How to get the latest date of entry for each user in Sqlite?
sql|sqlite|group-by
-1
100
1
72,174,982
72,174,982
1
true
2022-05-09T15:50:20.270Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get the latest date of entry for each user in Sqlite?<p>If I make a <code>GROUP BY auth_user.id</code> it gives me the list. If the users who are grou...
72,172,793
Received a ServerHelloDone handshake message while expecting [CertificateRequest]<p>I'm getting this error in fetch with Deno:</p> <pre><code>Received a ServerHelloDone handshake message while expecting [CertificateRequest] </code></pre> <p>I'm hitting a web api I don't control.</p>
<p>According to <a href="https://github.com/denoland/deno/issues/14494" rel="nofollow noreferrer">this issue</a>, it’s a bug in <a href="https://github.com/rustls/rustls/issues/1012" rel="nofollow noreferrer">one of Deno's upstream rust dependencies</a> which has already been patched, but not yet released.</p>
Received a ServerHelloDone handshake message while expecting [CertificateRequest]
javascript|typescript|fetch|deno
-1
284
1
72,173,141
72,173,141
1
true
2022-05-09T13:30:04.903Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Received a ServerHelloDone handshake message while expecting [CertificateRequest]<p>I'm getting this error in fetch with Deno:</p> <pre><code>Received a Serv...
72,139,194
How to change array rows places whithouth numpy<p>Hello everyone here is my code:</p> <pre><code>n =[[34,2,55,24,22],[31,22,4,7,333],[87,74,44,12,48]] for r in n: for c in r: print(c,end = &quot; &quot;) print() sums=[] for i in n: sum=0 for num in i: sum+=int(num) sums.append(sum) print(*sum...
<p>I assume you want the list with max at the first index and the one with the min at the end,</p> <pre class="lang-py prettyprint-override"><code>maxs = [max(i) for i in n] mins = [min(i) for i in n] max_idx = maxs.index(max(maxs)) min_idx = mins.index(min(mins)) n[max_idx], n[min_idx] = n[min_idx], n[max_idx] # you ...
How to change array rows places whithouth numpy
python|arrays|python-3.x|list|multidimensional-array
-1
16
1
72,139,438
72,139,438
1
true
2022-05-06T09:29:38.790Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change array rows places whithouth numpy<p>Hello everyone here is my code:</p> <pre><code>n =[[34,2,55,24,22],[31,22,4,7,333],[87,74,44,12,48]] for r ...
72,169,961
Mysql distinct json key values<p>I have this mysql table that has a column containing json with random keys/values. Using below query I can get the keys/values for all id's, but as you can see; it contains duplicate packages.</p> <pre><code>CREATE TABLE `my_table` ( `package` mediumtext NOT NULL, `id` varchar(255) ...
<p>You can try to use <code>ROW_NUMBER</code> window function with a subquery to get the leatest each <code>id</code> and <code>pkg</code></p> <p><strong>Query #1</strong></p> <pre><code>SELECT id,time,pkg,version FROM ( SELECT id,time,pkg,Json_unquote(Json_extract(package, Concat('$.', pkg))) AS version, ...
Mysql distinct json key values
mysql|json
-1
37
1
72,170,041
72,170,041
1
true
2022-05-09T09:44:57.177Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mysql distinct json key values<p>I have this mysql table that has a column containing json with random keys/values. Using below query I can get the keys/valu...
72,161,866
cannot be used as a member pointer, since it is of type 'void (*)()'<p>I'm trying to dereference a method pointer stored in a static array and call it from within a method, but I'm getting the following error:</p> <pre><code>error: 'chip8::Chip8::table[0]' cannot be used as a member pointer, since it is of type 'void (...
<p>The <strong>problem</strong> is that when you wrote:</p> <pre><code>static void (*table[16])(); </code></pre> <p>you're declaring a <strong>static data member</strong> named <code>table</code> that is an <em>array of size <code>16</code> whose elements are pointers to <strong>free function</strong> with no parameter...
cannot be used as a member pointer, since it is of type 'void (*)()'
c++|class|methods|function-pointers
-1
90
2
72,162,062
72,162,062
1
true
2022-05-08T14:16:04.893Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: cannot be used as a member pointer, since it is of type 'void (*)()'<p>I'm trying to dereference a method pointer stored in a static array and call it from w...
72,168,499
Split a column into multiple columns pandas depending on the values in a column<p>I have a dataframe as shown below.</p> <pre><code> A B timestamp 2022-05-09 09:28:00 0 45 2022-05-09 09:28:01 3 NaN 2022-05-09 09:28:02 4 30 2022-05-09 09:28:03 5 ...
<p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.set_index.html" rel="nofollow noreferrer"><code>DataFrame.set_index</code></a> with <code>append=True</code> for <code>MultiIndex</code> and reshape by <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Ser...
Split a column into multiple columns pandas depending on the values in a column
python|pandas|dataframe
-1
65
2
72,168,515
72,168,515
1
true
2022-05-09T07:40:59.127Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Split a column into multiple columns pandas depending on the values in a column<p>I have a dataframe as shown below.</p> <pre><code> A ...
72,162,137
Exclude a command in docker<p>I have the following <code>ENTRYPOINT</code> in my Dockerfile:</p> <pre><code>ENTRYPOINT[&quot;/setup.sh&quot;] </code></pre> <p>I need to run a container without running <code>setup.sh</code> and run install.sh.<br> How do I do it?</p>
<p>Just change your docker entrypoint when executing docker run :</p> <pre><code>docker run -d --rm --entrypoint WHATEVER_COMMAND_YOU_WANT image_name </code></pre> <p>It will replace your dockerfile' entrypoint.</p>
Exclude a command in docker
docker|dockerfile
-1
61
1
72,166,971
72,166,971
1
true
2022-05-08T14:47:11.167Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Exclude a command in docker<p>I have the following <code>ENTRYPOINT</code> in my Dockerfile:</p> <pre><code>ENTRYPOINT[&quot;/setup.sh&quot;] </code></pre> <...
72,235,497
Flutter _AssertionError 'initialValue == null || controller == null': is not true. Error<p>I have a code like this:</p> <pre><code> TextEditingController adSoyadTextBox = TextEditingController(text: &quot;Loading..&quot;); // ... TextFormField( controller: adSoyadTextBox, initialValue: ad, decoration: ...
<p>Asserting some enforcement ensures components works correctly. You cant give the initial value and controller together. As it says for the component to work correctly either initialValue or controller must be null.</p> <p>if you want to set your text fields value you can use like</p> <pre><code> TextEditingControlle...
Flutter _AssertionError 'initialValue == null || controller == null': is not true. Error
flutter
-1
62
1
72,235,551
72,235,551
1
true
2022-05-13T21:16:15.960Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter _AssertionError 'initialValue == null || controller == null': is not true. Error<p>I have a code like this:</p> <pre><code> TextEditingController ad...
72,230,299
Find most elegant way to return key if condition is set to true<p>I have a python dictionary</p> <pre><code>slot_a = 'a' slot_b = 'b' # dict which lists all possible conditions con_dict = {&quot;branch_1&quot;: slot_a == 'a' and slot_b == 'b', &quot;branch_2&quot;: slot_a == 'a' and slot_b == 'c'} </code><...
<p>You could try to use an <a href="https://docs.python.org/3/library/functions.html#iter" rel="nofollow noreferrer">iterator</a>. It will stop as soon it gets the first match without going through the whole &quot;object&quot;.</p> <pre><code>ks, vs = zip(*con_dict.items()) # decoupling the list of pairs i = 0 vs = ite...
Find most elegant way to return key if condition is set to true
python|dictionary|key
-1
54
1
72,232,886
72,232,886
1
true
2022-05-13T13:22:48.903Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find most elegant way to return key if condition is set to true<p>I have a python dictionary</p> <pre><code>slot_a = 'a' slot_b = 'b' # dict which lists all...
72,145,371
JavaFX ImageIO.write() doesn't save modified BufferedImage<p>I'm trying to create an application that lets users modify pictures and then save them. I'm having trouble with the saving part.</p> <p>This is the method that rotates the picture:</p> <pre><code>public void process(ImageView imageView) { if(imageView.get...
<p>The method in <code>ImageIO</code> you call is specified below and it returns a boolean status code that you ignore:</p> <pre><code>public static boolean write(RenderedImage im, String formatName, File output) throws IOException </code></pre> <p>You haven't inc...
JavaFX ImageIO.write() doesn't save modified BufferedImage
java|javafx|bufferedimage|javax.imageio
-1
77
1
72,150,592
72,150,592
1
true
2022-05-06T17:29:46.440Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JavaFX ImageIO.write() doesn't save modified BufferedImage<p>I'm trying to create an application that lets users modify pictures and then save them. I'm havi...
72,189,452
How can I provide an alternate definition of an extern "C" FFI binding?<p>I'm using a 3rd party library which contains a binding to an <code>extern &quot;C&quot;</code> function:</p> <pre><code>extern &quot;C&quot; { pub fn PageAddItemExtended( page: Page, item: Item, size: Size, off...
<p>As the compiler says, it fails because <code>PageAddItemExtended</code> is already defined. Omit the previous definition <code>use crate::pg_sys::PageAddItemExtended;</code> and it will compile successfully.</p>
How can I provide an alternate definition of an extern "C" FFI binding?
rust|ffi|rust-bindgen
-1
69
1
72,189,676
72,189,676
1
true
2022-05-10T15:50:41.553Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I provide an alternate definition of an extern "C" FFI binding?<p>I'm using a 3rd party library which contains a binding to an <code>extern &quot;C&q...
72,174,029
Vue3 Component doesn't render in production when using v-bind:href require()<p>Everything works fine when developing but once I export for production 1 component doesn't render and instead gets replaced by &lt;!---&gt;</p> <p>After some debugging, I discovered that this happens because of require()</p> <p>I have images...
<p>The expression inside <strong>v-bind</strong> is executed at runtime, webpack aliases at compile time.</p> <p>Move require() from html template to data() and it should work in production.</p> <p>Simple example:</p> <pre><code>&lt;template&gt; &lt;img :src=&quot;getImg&quot; /&gt; &lt;/template&gt; &lt;script&gt; ex...
Vue3 Component doesn't render in production when using v-bind:href require()
vue.js|webpack|vue-component|vuejs3|vue-composition-api
-1
187
1
72,175,499
72,175,499
1
true
2022-05-09T14:56:11.040Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Vue3 Component doesn't render in production when using v-bind:href require()<p>Everything works fine when developing but once I export for production 1 compo...
72,210,908
How can I structure multiple 2D arrays of test data into a properties file and read them for my tests?<p>I need to save all the test data into a <code>properties</code> file or a <code>JSON</code> file (since they're easier to read than an <code>XML</code>). I'm thinking of using a single properties file for storing da...
<p>Say you have <code>src/test/resources/test_data.json</code> file which looks like</p> <pre class="lang-json prettyprint-override"><code>{ &quot;infoOnCars&quot;: [ [&quot;Mercedes as key&quot;, &quot;Value with any special char ~!@#$%^&amp;*()_'\\\&quot;,./&lt;&gt;?+&quot;], [&quot;Jaguar&quot;, &quot;&lt;...
How can I structure multiple 2D arrays of test data into a properties file and read them for my tests?
java|json|testing|properties|testng
-1
50
1
72,212,128
72,212,128
1
true
2022-05-12T06:21:12.463Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I structure multiple 2D arrays of test data into a properties file and read them for my tests?<p>I need to save all the test data into a <code>proper...
72,202,135
Antlr4 problems with negativ sign and operator<p>Hello we have this antlr4 Tree Parser:</p> <pre><code>grammar calc; calculator: (d)*; c : c '*' c | c '/' c | c '+' c | c '-' c | '(' c ')' | '-'? | ID ; d: ID '=' c; NBR: [0-9]+; ID: [a-zA-Z][a-zA-Z0-9]*; WS: [ \t\r\n]+ -&gt; skip;...
<p>Just do something like this:</p> <pre><code>c : '-' c | c ('*' | '/') c | c ('+' | '-') c | '(' c ')' | ID | NBR ; </code></pre> <p>That way all these will be OK:</p> <ul> <li><code>-1</code></li> <li><code>- 2</code></li> <li><code>-3-4</code></li> <li><code>5+-6</code></li> <li><code>-(7*8)</code></li> <li>...
Antlr4 problems with negativ sign and operator
regex|antlr4
-1
41
2
72,203,552
72,203,552
1
true
2022-05-11T13:41:00.660Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Antlr4 problems with negativ sign and operator<p>Hello we have this antlr4 Tree Parser:</p> <pre><code>grammar calc; calculator: (d)*; c : c '*' c ...
72,166,180
How to print star pattern using Dart<p>Im trying to figure out to print star pattern using Dart language which implementing logic code. The existing code I use as indent so that the star have some space. Is this the right method to do so?</p> <p><a href="https://i.stack.imgur.com/SUP7L.png" rel="nofollow noreferrer"><i...
<p>Here is my answer write in dartpad, change <code>starWidth</code> to adjust star size.</p> <p>Idea is get string of the <strong>star</strong> and it padding per row then printing its.</p> <p><em>EDIT: Updated description comment for each functional</em></p> <pre class="lang-dart prettyprint-override"><code>void main...
How to print star pattern using Dart
flutter|dart
-1
591
2
72,166,703
72,166,703
1
true
2022-05-09T01:32:28.990Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to print star pattern using Dart<p>Im trying to figure out to print star pattern using Dart language which implementing logic code. The existing code I u...
72,182,515
Rust: argument requires that `[VARIABLE]` is borrowed for `'static`<p>I get this unhelpful error message:</p> <pre><code>error[E0597]: `msg` does not live long enough --&gt; src/main.rs:25:23 | 25 | let msg_str = msg.as_str(); | ^^^^^^^^^^^^ | | | ...
<p>The problem is that <code>msg</code> is a variable you get from the iteration, and therefore is only valid during one iteration step. It ceases to exist at the end of the iteration step, hence the comiler message <code>- msg dropped here while still borrowed</code> at the end of the loop.</p> <p>The reason why this ...
Rust: argument requires that `[VARIABLE]` is borrowed for `'static`
rust
-1
259
1
72,182,712
72,182,712
1
true
2022-05-10T07:49:44.543Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rust: argument requires that `[VARIABLE]` is borrowed for `'static`<p>I get this unhelpful error message:</p> <pre><code>error[E0597]: `msg` does not live lo...
72,218,804
How to add Timer after clicking a button to get response<p>If i click button it prints response on the screen.but what i want is for every response it should print corresponding time also.and then it should show difference between time if we click button multiple time.it should print the difference between last and 2nd...
<p>Try this-</p> <p><strong>XML File-</strong></p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot; ...
How to add Timer after clicking a button to get response
android
-1
27
1
72,218,848
72,218,848
1
true
2022-05-12T16:02:51.067Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add Timer after clicking a button to get response<p>If i click button it prints response on the screen.but what i want is for every response it should...
72,157,294
Dart language, How to extract specific part from a string<p>I want to extract from the full String this part:</p> <pre><code>&lt;a href=\&quot;https://example.com/members/will/\&quot;&gt;Will&lt;/a&gt; </code></pre> <p>full String:</p> <pre><code>&quot;&lt;a href=\&quot;https://example.com/members/will/\&quot;&gt;Will&...
<p>From the top of my head, this could work.</p> <p><strong>Regex</strong></p> <p><code>&lt;a\b[^&gt;]*&gt;(.*?)&lt;/a&gt;</code></p> <p><strong>Dart</strong></p> <pre><code>final myString = &quot;&lt;a href=\&quot;https://example.com/members/will/\&quot;&gt;Will&lt;/a&gt; bla bla bla&quot;; final regexp = RegExp(r'&lt...
Dart language, How to extract specific part from a string
flutter|dart
-1
129
2
72,157,393
72,157,393
1
true
2022-05-08T00:36:38.497Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dart language, How to extract specific part from a string<p>I want to extract from the full String this part:</p> <pre><code>&lt;a href=\&quot;https://exampl...
72,155,794
codeigniter 3 when session will expire?<p>I have a simple question to which I couldn't find the answer on this page:</p> <p><a href="https://codeigniter.com/userguide3/libraries/sessions.html#how-do-sessions-work" rel="nofollow noreferrer">https://codeigniter.com/userguide3/libraries/sessions.html#how-do-sessions-work<...
<p>Assuming <code>$config['sess_expiration'] = 600;</code> (10 minutes), the session cookie will expire 10 minutes after the last time you accessed the page, or &quot;answer 2&quot; as you called it.</p> <p><code>sess_time_to_update</code> controls how long before the session ID is changed, but that has nothing to do w...
codeigniter 3 when session will expire?
php|codeigniter-3
-1
89
1
72,156,036
72,156,036
1
true
2022-05-07T19:28:58.387Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: codeigniter 3 when session will expire?<p>I have a simple question to which I couldn't find the answer on this page:</p> <p><a href="https://codeigniter.com/...
72,168,090
extending Number to get a flags type with instance methods<p>I would like to make a flag-enum and put instance methods on it. Since this is not directly possible with the <code>enum</code> construct, I decided to do the following experiment:</p> <pre><code>class SelectionsMade extends Number implements Number { con...
<blockquote> <p>how to avoid the caveat, that you need to call valueOf explicitly for TS to accept the class as a number...</p> </blockquote> <p>You can't. Your instances are objects, not primitive numbers. You need to use <code>valueOf</code> (or a unary <code>+</code> or similar) to get the underlying primitive numbe...
extending Number to get a flags type with instance methods
javascript|typescript
-1
22
1
72,168,345
72,168,345
1
true
2022-05-09T07:04:15.070Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: extending Number to get a flags type with instance methods<p>I would like to make a flag-enum and put instance methods on it. Since this is not directly poss...
72,152,684
Getting sql data based on row value<p>I have a table like so:</p> <pre><code>date | id ------------------------ 2022-04-01 | 1 2022-04-02 | 1 2022-04-03 | 1 2022-04-01 | 2 2022-04-03 | 2 2022-04-02 | 3 </code></pre> <p>I'm trying to get the last date when the account was active, not counting ...
<p>you can work with the window function <code>ROW_NUMBER</code> to get the date you want</p> <pre><code>WITH CTE AS (select id,date, ROW_NUMBER() OVER(PARTITION BY id ORDER BY Date DESC) rn from table) SELECT id,date FROM CTE where rn = 2 </code></pre> <p>Torpas is right, to exclude todays logins you and add another c...
Getting sql data based on row value
sql|hql
-1
54
3
72,152,781
72,152,781
1
true
2022-05-07T12:50:20.353Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting sql data based on row value<p>I have a table like so:</p> <pre><code>date | id ------------------------ 2022-04-01 | 1 2022-04-02 | 1 ...
72,184,192
Get rid of uncaught errors when resolving a promise<p>I have the following method</p> <pre><code>export abstract class BaseCalculator { /** * Compute the promise parameter. * @param name name of the parameter. * @param method promise to resolve. * @returns CalculatorResult. */ public async computePar...
<p>You are using <code>.then</code>/<code>.catch</code> in a function tagged <code>async</code> (and never use <code>await</code> in that function) - this <em>may</em> be why errors slip between the cracks</p> <p>So, either make computeParameter like this</p> <p>(note, no <code>async</code> here, since <code>await</cod...
Get rid of uncaught errors when resolving a promise
javascript|angular|asynchronous|async-await
-1
51
1
72,186,147
72,186,147
1
true
2022-05-10T09:53:33.997Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get rid of uncaught errors when resolving a promise<p>I have the following method</p> <pre><code>export abstract class BaseCalculator { /** * Compute th...
72,050,204
I frequently face "Cannot find symbol", how to avoid it?<pre><code>import java.util.Scanner; public class MainFile { public static void main(String[] args) { do { Scanner asc = new Scanner(System.in); String userTXT = asc.nextLine(); } while(userTXT != &quot;Twitter!&quo...
<p>It's because you haven't defined or initialised <code>userTXT</code> in a scope that can be seen from within the while loop.</p> <p>You have defined it within the scope of the <code>while</code> loop which can't see variables defined inside it as the <code>while</code> loop and the variable are not in the same scope...
I frequently face "Cannot find symbol", how to avoid it?
java|input|error-handling|java.util.scanner|symbols
-1
32
1
72,050,602
72,050,602
1
true
2022-04-28T21:04:41.837Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I frequently face "Cannot find symbol", how to avoid it?<pre><code>import java.util.Scanner; public class MainFile { public static void main(String[] ar...
72,174,580
Python calling method in class has no attribute/got an unexpected keyword argument<p>I am new to Python and I am trying to define a simple class with attributes and one method.</p> <pre><code>import scipy.optimize as optimize class BondPricing: def __init__(self, price = 95.0428,par = 100,T = 1.5,freq = 2,cou...
<blockquote> <p>When I try to call the method of the class with <code>bond1.ytm(price = 95.0428, par = 100, T = 1.5, coup_perc = 5.75, freq = 2)</code>, I get the following error:</p> </blockquote> <blockquote> <p><code>TypeError: ytm() got an unexpected keyword argument 'price'</code></p> </blockquote> <p>The error is...
Python calling method in class has no attribute/got an unexpected keyword argument
python|class
-1
45
1
72,174,863
72,174,863
1
true
2022-05-09T15:33:41.283Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python calling method in class has no attribute/got an unexpected keyword argument<p>I am new to Python and I am trying to define a simple class with attribu...
72,152,367
Last number of iterator in python<p>How to edit the iterator giving also the last number in the sequence, please? I mean in general, not for such an easy sequence. Using &lt; instead of == is not an option.</p> <pre><code>class P(): def __init__(self, n0): self.n = n0 def __iter__(self): return...
<p>Use a local variable in your class to determin how many time you have get a next one:</p> <pre><code>class P(): i = 0 def __init__(self, n0): self.i=n0-1 self.n = n0 def __iter__(self): return self def __next__(self): self.i=self.i-1 if self.i == 1: ...
Last number of iterator in python
python-3.x|iterator
-1
24
1
72,152,555
72,152,555
1
true
2022-05-07T12:13:08.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Last number of iterator in python<p>How to edit the iterator giving also the last number in the sequence, please? I mean in general, not for such an easy seq...
72,215,820
apply styles to all tables except one<p>I would like some styles not to be applied to a table when the screen is too small.</p> <p>The problem is that these styles are applied to table or tr or td etc.</p> <p>Is there a way to point to all tables except this one? Maybe with some specific id? What I don't want is to hav...
<p>You can use the <code>:not</code> selector.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>div:not(.main){ display:none; }</code></pre> <pre class="snippet-code-html la...
apply styles to all tables except one
css|css-selectors
-1
36
1
72,216,421
72,216,421
1
true
2022-05-12T12:44:42.773Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: apply styles to all tables except one<p>I would like some styles not to be applied to a table when the screen is too small.</p> <p>The problem is that these ...
72,185,468
How to apply the condition 'book id which consists of six alphanumeric characters and starts with B' during creating table in SQL?<p>My query in SQL to create 'book' table(database):</p> <pre><code>CREATE TABLE book( bookid VARCHAR(6) where bookid LIKE 'B_____', bookTitle VARCHAR(50), author VARCHAR(20), genre VARCHAR(...
<p>You can use a check constraint like the constraint concerning the genre which is already part of your command. So your create table command will be:</p> <pre><code>CREATE TABLE book(bookid VARCHAR(6) CHECK (bookid LIKE 'B_____'), bookTitle VARCHAR(50), author VARCHAR(20), genre VARCHAR(10) CHECK(genre IN('Myste...
How to apply the condition 'book id which consists of six alphanumeric characters and starts with B' during creating table in SQL?
sql-server|sql-like|create-table
-1
122
2
72,185,581
72,185,581
1
true
2022-05-10T11:22:59.320Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to apply the condition 'book id which consists of six alphanumeric characters and starts with B' during creating table in SQL?<p>My query in SQL to creat...
72,209,653
How to search objects react.js javascript?<p>Thanks for your time reading.</p> <p>I need to sort countries by Language or Continent, the user selects the option he wants in the buttons.</p> <p>countries is an array of objects of each country that contain:</p> <ul> <li>languages is an array of objects, because each coun...
<p>First filter the data and then group it by continent using <code>reduce</code> and then loop over the arrays and create the desired JSX.</p> <p>You can refer the snippet below (<em>type &quot;s&quot; in the input box</em>):</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="...
How to search objects react.js javascript?
javascript|arrays|reactjs|graphql|jsx
-1
86
1
72,209,865
72,209,865
1
true
2022-05-12T02:58:40.247Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to search objects react.js javascript?<p>Thanks for your time reading.</p> <p>I need to sort countries by Language or Continent, the user selects the opt...
72,152,893
JavaScript code does not output the result on the first attempt<p>When I run the script (see below), the first attempt fails to get the result,</p> <p>the &quot;result&quot; variable outputs &quot;underfined&quot;</p> <pre><code>var result; Promise.resolve('information') .then(res =&gt; {return result=res}) res...
<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve</a></p> <p><code>Promise.resolve</code> returns a promise. If it's accompanied by a <co...
JavaScript code does not output the result on the first attempt
javascript
-1
78
2
72,153,047
72,153,047
1
true
2022-05-07T13:16:56.310Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JavaScript code does not output the result on the first attempt<p>When I run the script (see below), the first attempt fails to get the result,</p> <p>the &q...
72,158,300
Is there a way to use (std::cin).get() to accept newlines when asking for input?<h1>(std::cin).get()</h1> <p>I want to use std::cin to collect a string with spaces, like &quot;1/2 oz of flower&quot;. When I add a space and then press enter it exits the program instead of collecting the rest of the input. Found this <a ...
<p>I think you should use <a href="https://en.cppreference.com/w/cpp/string/basic_string/getline" rel="nofollow noreferrer">https://en.cppreference.com/w/cpp/string/basic_string/getline</a> to parse the whole input and then split it on space according to your needs.</p>
Is there a way to use (std::cin).get() to accept newlines when asking for input?
c++|std|ostream
-1
41
1
72,158,465
72,158,465
1
true
2022-05-08T05:20:58.920Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to use (std::cin).get() to accept newlines when asking for input?<h1>(std::cin).get()</h1> <p>I want to use std::cin to collect a string with ...
72,213,755
How do I get lst1 to be alphabetical while being in the same order as lst2<p>Input:</p> <pre><code>list_sorting(['Chris','Amanda','Boris','Charlie'],[35,43,55,35]) </code></pre> <p>Output:</p> <pre><code>['Boris', 'Amanda', 'Charlie', 'Chris'], [55, 43, 35, 35] </code></pre> <p>My Code:</p> <pre><code>def list_sorting...
<p>You can do a small trick to get what you need. Since you want numbers to be descendent and words to be ascendent, you can make it work ascendently and negate numbers:</p> <pre><code>lst1 = ['Boris', 'Amanda', 'Charlie', 'Chris'] lst2 = [55, 43, 35, 35] def list_sorting(lst1, lst2): out = sorted(zip(lst1, lst2),...
How do I get lst1 to be alphabetical while being in the same order as lst2
python|list
-1
39
2
72,213,947
72,213,947
1
true
2022-05-12T10:13:51.693Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get lst1 to be alphabetical while being in the same order as lst2<p>Input:</p> <pre><code>list_sorting(['Chris','Amanda','Boris','Charlie'],[35,43,5...
72,230,721
ERROR : Input String was not in a correct format when calculating multiple columns in DATAGRIDVIEW<p>I want to calculate the value of 3 cells in DATAGRIDVIEW</p> <p>the calculation :</p> <p>SDI = ((result - mean ) / SD)</p> <p>I tried the following code :</p> <pre><code>private void dgvResult_CellEndEdit(object sender,...
<p>It is unclear how the grid is populated with data. However, when you want to “calculate” a value in a grid cell based on other cells in the same row, then, you should consider using a <code>DataTable</code> and a <a href="https://docs.microsoft.com/en-us/dotnet/api/system.data.datacolumn.expression?view=net-6.0" rel...
ERROR : Input String was not in a correct format when calculating multiple columns in DATAGRIDVIEW
c#|datagridview
-1
126
4
72,234,163
72,234,163
1
true
2022-05-13T13:53:08.240Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ERROR : Input String was not in a correct format when calculating multiple columns in DATAGRIDVIEW<p>I want to calculate the value of 3 cells in DATAGRIDVIEW...
72,225,951
Parse txt file in Pandas<p>I have the table in file and it looks like that:</p> <pre><code>+-------------+-----------------+---------------+---------------+--------------+ |number |name |very |column4 |very long | | | |long column3 | |co...
<p>You could try this:</p> <p><strong>1. step</strong>: Converting the file into a csv-file (adjust the file names accordingly):</p> <pre><code>import csv from itertools import groupby with open(&quot;file.txt&quot;, &quot;r&quot;) as fin, open(&quot;file.csv&quot;, &quot;w&quot;) as fout: writer = csv.writer(fout...
Parse txt file in Pandas
python|pandas
-1
80
2
72,232,801
72,232,801
1
true
2022-05-13T07:35:46.900Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parse txt file in Pandas<p>I have the table in file and it looks like that:</p> <pre><code>+-------------+-----------------+---------------+---------------+-...
72,144,503
Convert Json string literals to utf8 characters with perl or bash<p>I have a file full of \u codes and want to replace them all with corresponding utf8 character, for example &quot;\u00FC&quot; will become &quot;ü&quot;:</p> <p>Here is how far I got:</p> <pre><code>echo 'f\u00FCr' | perl -C -p -e &quot;s/\\\\(u[0-9A-Fa...
<p><code>$1</code> is correct, although you are mistakenly including the <code>u</code> in the capture.</p> <p>But you have to be careful about escaping for the shell. You are apparently using <code>sh</code> or similar (based on your need to escape the <code>\</code>), so you have to escape certain characters when usi...
Convert Json string literals to utf8 characters with perl or bash
regex|perl|printf
-1
86
1
72,144,893
72,144,893
1
true
2022-05-06T16:10:28.907Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert Json string literals to utf8 characters with perl or bash<p>I have a file full of \u codes and want to replace them all with corresponding utf8 chara...
72,167,049
How can I get the start and end dates for each week?<pre><code>week = datetime.date(2022,4,10).isocalendar()[1] </code></pre> <p>After finding the week, how can I get the start and end date of the week?</p>
<p>Python 3.6 version of rshepp's answer:</p> <pre><code>from datetime import datetime, date year, week, day = date(2022, 4, 10).isocalendar() date_first = datetime.strptime(f'{year}{week}0', '%Y%U%w') date_last = datetime.strptime(f'{year}{week}6', '%Y%U%w') print(date_first, date_last, sep='\n') </code></pre> <p>O...
How can I get the start and end dates for each week?
python
-1
60
2
72,168,746
72,168,746
1
true
2022-05-09T04:38:38.843Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I get the start and end dates for each week?<pre><code>week = datetime.date(2022,4,10).isocalendar()[1] </code></pre> <p>After finding the week, how ...
72,218,203
'NoneType' object has no attribute 'text' when attempting to retrieve Table Data<p>People have asked similar questions like this 100 times before but none of the solutions are working to fix my issue! I have created a html doc that I am hosting off github that has a table on it! The table is going to be used to store a...
<p>That's because you don't have a <code>class</code> attribute in the <code>&lt;td&gt;</code> tags. You do have a <code>,class</code> attribute though, and bs4 won't recognise that.</p> <p>So what I'm saying is, your html is wrong. Get rid of those commas before the class attributes in your source html.</p> <p>For exa...
'NoneType' object has no attribute 'text' when attempting to retrieve Table Data
python|web-scraping|beautifulsoup
-1
59
1
72,218,497
72,218,497
1
true
2022-05-12T15:18:25.743Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: 'NoneType' object has no attribute 'text' when attempting to retrieve Table Data<p>People have asked similar questions like this 100 times before but none of...
72,192,847
assigning a var inside AWK for use outside awk<p>I am using ksh on AIX.</p> <p>I have a file with multiple comma delimited fields. The value of each field is read into a variable inside the script.</p> <p>The last field in the file may contain multiple | delimited values. I need to test each value and keep the first...
<p>To answer your specific question:</p> <pre><code>$ principal_diagnosis0='R65.20|A41.9|G30.9|F02.80' $ foo=$(echo &quot;$principal_diagnosis0&quot; | awk -v RS='|' '/^[^R]/{sub(/\n/,&quot;&quot;); print; exit}') $ echo &quot;$foo&quot; A41.9 </code></pre> <p>The above will work with any awk, you can do it more brie...
assigning a var inside AWK for use outside awk
variables|unix|awk|ksh
-1
62
2
72,193,610
72,193,610
1
true
2022-05-10T20:56:18.483Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: assigning a var inside AWK for use outside awk<p>I am using ksh on AIX.</p> <p>I have a file with multiple comma delimited fields. The value of each field i...
72,147,201
How to get max value from a MySQL Database<p>I have an MYSQL database table of student info and their test scores per subject and I am trying to fetch each student's highest score in all subjects using the SQL query below</p> <pre><code>SELECT DISTINCT first_name, last_name, subject_id, (SELECT ...
<p>In your subselect you need to link both tables, for example by using an alias</p> <pre><code>SELECT DISTINCT first_name, last_name, subject_id, (SELECT MAX(score) FROM cbt_attempts_tbl WHERE first_name = f1.first_name) AS MAX_SCORE FROM cbt_att...
How to get max value from a MySQL Database
mysql|sql
-1
52
2
72,147,258
72,147,258
1
true
2022-05-06T20:47:42.197Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get max value from a MySQL Database<p>I have an MYSQL database table of student info and their test scores per subject and I am trying to fetch each s...
72,174,464
Finding which node version manager is installed<p>I don't know which node version managers there are, but it's not installed with apt, and nvm. I'm using Debian based pop_os. If there's a way to tell where nodejs is installed then that would be super, as I imagine that would indicate node version manager is used.</p>
<p><em>npm</em> is the package manager for the Node JavaScript platform in Ubuntu-based operating systems. It puts modules in place so that node can find them, and manages dependency conflicts intelligently. It is extremely configurable to support a wide variety of use cases. Most commonly, it is used to publish, disc...
Finding which node version manager is installed
node.js|ubuntu
-1
85
1
72,179,443
72,179,443
1
true
2022-05-09T15:24:32.130Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Finding which node version manager is installed<p>I don't know which node version managers there are, but it's not installed with apt, and nvm. I'm using Deb...
72,040,113
want to filter an array<p>I want to get an array with filtered values. My arrays are like,</p> <pre><code>let arr=[{name:'trt,tet', id:5},{name:td, id:25},{name:fxg, id:1},{name:fs, id:4},{name:ste, id:41}] </code></pre> <p>&amp;</p> <pre><code>let arr1 =[{data:fxg, addr:po 87987},{data:tert, addr:po8798fvd7},{data:trt...
<p>try this</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>let arr=[{name:'trt,tet', id:5},{name:'td', id:25},{name:'fxg', id:1},{name:'fs', id:4},{name:'ste', id:41}] let arr...
want to filter an array
reactjs|filter
-1
27
2
72,040,168
72,040,168
1
true
2022-04-28T08:07:51.830Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: want to filter an array<p>I want to get an array with filtered values. My arrays are like,</p> <pre><code>let arr=[{name:'trt,tet', id:5},{name:td, id:25},{n...
72,181,808
array reverse dosen't effect<p>I try to sort my array to revers and I use the <code>reverse()</code> function but it doesn't affect to view. I must to change the file and save it then I can see the changes.</p> <p>Items.js:</p> <pre><code>import { useState } from &quot;react&quot;; const Items = (props) =&gt; { cons...
<p>You are reversing an array of objects. use the spread operator to spread the elements of your array.</p> <p>This should work fine. <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> ...
array reverse dosen't effect
javascript|reactjs|next.js
-1
37
1
72,181,946
72,181,946
1
true
2022-05-10T06:51:24.953Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: array reverse dosen't effect<p>I try to sort my array to revers and I use the <code>reverse()</code> function but it doesn't affect to view. I must to change...
72,225,772
Printing strings and characters as hexadecimal in Go<p>Why cyrillic strings in hexadecimal format differ from cyrillic chars in hexadecimal format?</p> <pre><code>str := &quot;Э&quot; fmt.Printf(&quot;%x\n&quot;, str) //result d0ad str := 'Э' fmt.Printf(&quot;%x\n&quot;, str) //result 42d </code></pre>
<p>Printing the hexadecimal representation of a <code>string</code> prints the hex representation of its bytes, and printing the hexadecimal representation of a <code>rune</code> prints the hex representation of the number it is an alias to (<code>rune</code> is an alias to <code>int32</code>).</p> <p>And <code>string<...
Printing strings and characters as hexadecimal in Go
string|go|char|hex|printf
-1
113
1
72,225,799
72,225,799
1
true
2022-05-13T07:20:12.227Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Printing strings and characters as hexadecimal in Go<p>Why cyrillic strings in hexadecimal format differ from cyrillic chars in hexadecimal format?</p> <pre>...
72,144,802
Dynamic heap implementation with insert O(log n)<p>I'm trying to implement a Min Heap in Java, but between studying the complexity and the actual implementation, I realized that it is not clear to me how O (log n) insertion into the heap can be if a dynamic array (such as ArrayList) is used as the base structure.</p> <...
<p>You can implement a heap with nodes that are both part of a doubly linked list, and part of a threaded binary tree.</p> <p>The heap maintains a reference to the root (head) and tail node.</p> <p>So we can imagine a node having 5 pointers: <code>prev</code>, <code>next</code>, <code>left</code>, <code>right</code>, <...
Dynamic heap implementation with insert O(log n)
java|arraylist|time-complexity|heap
-1
167
2
72,148,023
72,148,023
1
true
2022-05-06T16:38:40.183Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dynamic heap implementation with insert O(log n)<p>I'm trying to implement a Min Heap in Java, but between studying the complexity and the actual implementat...
72,224,993
JSON.stringify on Arrays adding numeric keys for each array value<p>I am trying to convert an array to object .</p> <p>Below is the array value which I am trying to transform into an object.</p> <pre><code>kbInfo : [{ &quot;questionId&quot;: &quot;1&quot;, &quot;customQuestion&quot;: &quot;What is your first car make a...
<p>I suppose that you mean that <code>kbInfo</code> and <code>kbaInfo</code> are the same variable. To get that &quot;SQA&quot; property in your output object, you'll need to create it...</p> <p>For example:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class=...
JSON.stringify on Arrays adding numeric keys for each array value
javascript|arrays|json|rhino|stringify
-1
55
1
72,225,063
72,225,063
1
true
2022-05-13T05:54:30.257Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JSON.stringify on Arrays adding numeric keys for each array value<p>I am trying to convert an array to object .</p> <p>Below is the array value which I am tr...
72,217,523
Fastest way in numpy to get distance of product of n pairs in array<p>I have <code>N</code> number of points, for example:</p> <pre class="lang-py prettyprint-override"><code>A = [2, 3] B = [3, 4] C = [3, 3] . . . </code></pre> <p>And they're in an array like so:</p> <pre class="lang-py prettyprint-override"><code>arr ...
<p>As an alternative method, but similar to <a href="https://stackoverflow.com/a/72218182/13394817"><strong>ddejohn</strong> answer</a>, we can use <code>np.triu_indices</code> which return just the upper triangular indices in the matrix, which may be more memory-efficient:</p> <pre><code>np.linalg.norm(arr - arr[:, No...
Fastest way in numpy to get distance of product of n pairs in array
python|arrays|python-3.x|numpy|bigdata
-1
127
3
72,219,014
72,219,014
1
true
2022-05-12T14:32:53.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fastest way in numpy to get distance of product of n pairs in array<p>I have <code>N</code> number of points, for example:</p> <pre class="lang-py prettyprin...
72,176,729
Problem Installing netfilterque in Python<p>I have a problem installing netfilterqueue for Python. I have this logs.</p> <p><a href="https://i.stack.imgur.com/yIrCq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yIrCq.png" alt="enter image description here" /></a></p> <p>I am using Windows 10, not L...
<p>I've supplied both a short answer, and a longer explanation of it.</p> <p><strong>Short Answer</strong> Unfortunately, the project seems to be abandoned after it only working with Python2. As a result, many people decided to downgrade to python2 to continue using it. However, forking a repo on GitHub fixed it for a ...
Problem Installing netfilterque in Python
python
-1
56
1
72,177,176
72,177,176
1
true
2022-05-09T18:34:38.763Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Problem Installing netfilterque in Python<p>I have a problem installing netfilterqueue for Python. I have this logs.</p> <p><a href="https://i.stack.imgur.co...
72,173,791
Moving two rectangles at the same time with different keys Java<p>Trying to moving two rectangles at the same time with different keys. Using KeyListener. I'm doing Pong Game in Java and have some troubles with this. If I try to move the first paddle, the second will not moving while I'm moving the first. Help me pleas...
<p>I reorganized your code to fit in a single file (easier to debug that way). I do not see the problem you are talking about as I am able to move both paddles at the same time.</p> <p>Changes made.</p> <ul> <li>invoke via SwingUtilties.</li> <li>override <code>getPreferredSize()</code> in <code>PaintPanel</code> cla...
Moving two rectangles at the same time with different keys Java
java|keylistener
-1
49
1
72,186,197
72,186,197
1
true
2022-05-09T14:38:08.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Moving two rectangles at the same time with different keys Java<p>Trying to moving two rectangles at the same time with different keys. Using KeyListener. I'...
72,224,487
Apply column name to row values unless nan or null<p>I'm attempting to add the column name of a dataframe to each row containing a non null value.</p> <p>A sample data set I am working with is:</p> <pre><code> ID County Other Phone 2 Gender 0 10379 ELKHART nan M 1 10319 VAN BUREN 555-7...
<p>You can try <code>apply</code> on columns</p> <pre class="lang-py prettyprint-override"><code>df = df.apply(lambda col: col.mask(col.notna(), col.name+': '+col.astype(str))) </code></pre> <p>or with <code>df.mask</code></p> <pre class="lang-py prettyprint-override"><code>m = df.notna() df = df.mask(m, df.columns + '...
Apply column name to row values unless nan or null
python|pandas|dataframe
-1
31
1
72,224,652
72,224,652
1
true
2022-05-13T04:34:01.073Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Apply column name to row values unless nan or null<p>I'm attempting to add the column name of a dataframe to each row containing a non null value.</p> <p>A s...
72,154,725
deleting words from a file and saving the rest to the same file<p>I have a trivial problem</p> <p>I want the words that were removed to all be uploaded to the same file where I'm making a mistake: D</p> <pre><code>infile = &quot;tada.txt&quot; outfile = &quot;tada.txt&quot; word = &quot;vul&quot; tada=(''.join(word)) ...
<p>You can effectively change a file &quot;in place&quot; by using Python's <a href="https://docs.python.org/3/library/fileinput.html#module-fileinput" rel="nofollow noreferrer"><code>fileinput</code></a> module. Here's how it could be used to what you want (i.e. remove words from each line).</p> <p><strong>Note</stron...
deleting words from a file and saving the rest to the same file
python|file
-1
49
1
72,154,969
72,154,969
1
true
2022-05-07T17:07:37.207Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: deleting words from a file and saving the rest to the same file<p>I have a trivial problem</p> <p>I want the words that were removed to all be uploaded to th...
72,118,132
How to modify or add new Nginx configuration in Tomcat AWS Elastic beanstalk (Spring Boot Application)<p>I had a Spring Boot Application and it was deployed in the AWS Elastic beanstalk (Tomcat server). It was a war deployment.</p> <p>I need to change the Nginx configuration. Need to add <code>client_max_body_size 50M;...
<p>If you are using Amazon Linux version 2, you need to put nginx config into following path:</p> <p><code>.platform/nginx/conf.d/config.conf</code></p> <p>If you are using Amazon Linux version 1, location should be:</p> <p><code>.ebextensions/nginx/conf.d/config.conf</code></p> <p>This folder (.platform/.ebextension) ...
How to modify or add new Nginx configuration in Tomcat AWS Elastic beanstalk (Spring Boot Application)
java|amazon-web-services|spring-boot|amazon-elastic-beanstalk
-1
279
1
72,118,274
72,118,274
1
true
2022-05-04T18:56:01.257Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to modify or add new Nginx configuration in Tomcat AWS Elastic beanstalk (Spring Boot Application)<p>I had a Spring Boot Application and it was deployed ...
72,156,704
Why when adding new text the lines have empty lines between them?<pre><code>private void Println(string text, SolidColorBrush brush) =&gt; Dispatcher.Invoke(() =&gt; { RichTextBoxLogger.Document.Blocks.Add(new Paragraph(new Run(text) { Foreground = brush })); }); private void Printl...
<p>To prevent a break from occurring between two consecutive paragraphs, you must set the <code>Paragraph.KeepWithNext</code> property to <code>true</code>:</p> <pre class="lang-cs prettyprint-override"><code>var paragraphWithoutBreak = new Paragraph { KeepWithNext = true }; </code></pre> <hr /> <p>I don't recommend to...
Why when adding new text the lines have empty lines between them?
c#|wpf|wpf-controls
-1
49
1
72,159,454
72,159,454
1
true
2022-05-07T22:10:58.510Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why when adding new text the lines have empty lines between them?<pre><code>private void Println(string text, SolidColorBrush brush) =&gt; Dispatcher.Invoke(...
72,205,094
How can I get multiple output variables into a list?<p>I'm wondering if there's a way of getting multiple outputs from a function into a list. I'm not interested in creating a list inside of a function for reasons I'm not going to waste your time going into.</p> <p>I know how many output variables I am expecting, but o...
<p>yes, with the unpacking assignments expression ex <code>a,b,c= myfunction(...)</code>, you can put * in one of those to make it take a variable number of arguments</p> <pre><code>&gt;&gt;&gt; a,b,c=range(3) #if you know that the thing contains exactly 3 elements you can do this &gt;&gt;&gt; a,b,c (0, 1, 2) &gt;&gt;&...
How can I get multiple output variables into a list?
python-3.x|list|function|return
-1
200
1
72,205,313
72,205,313
1
true
2022-05-11T17:15:20.553Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I get multiple output variables into a list?<p>I'm wondering if there's a way of getting multiple outputs from a function into a list. I'm not intere...
72,064,076
How to stop a commit if test coverage is below a certain percentage?<p>I'm using Jest to test a NestJS application and I'm trying to create a git hook with husky that will <strong>not allow a commit if tests coverage are under 95%</strong>, I haven't tried anything yet cause I really don't know how to even describe my ...
<blockquote> <p>create a git hook with husky that will not allow a commit if tests coverage are under 95%</p> </blockquote> <p>It seems you already have a test hook on husky, and if that <code>npm run test</code> is using Jest as I'm assuming it does, all you need to do is add a Jests configuration to your <code>packag...
How to stop a commit if test coverage is below a certain percentage?
node.js|typescript|unit-testing|jestjs|git-husky
-1
291
1
72,064,142
72,064,142
1
true
2022-04-29T22:01:48.383Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to stop a commit if test coverage is below a certain percentage?<p>I'm using Jest to test a NestJS application and I'm trying to create a git hook with h...
72,226,583
Simple java questionnaire using json<p>I made a simple questionnaire. I need to write the responses to a JSON file. How to do it? I use IDEA Intellij and library GSON for work with JSON. This is main class &quot;Quiz&quot;:</p> <pre><code>package questions; import com.google.gson.Gson; import com.google.gson.reflect.Ty...
<p>You have created a FileWriter, but you are never actually writing anything to the file. This is why the file is empty.</p> <pre><code> string jsonData = &quot;{}&quot;; FileWriter output = new FileWriter(&quot;answer.json&quot;); // Writes the string to the file output.write(jsonData); // Closes the writer...
Simple java questionnaire using json
java|json|gson|file-writing
-1
76
2
72,226,748
72,226,748
1
true
2022-05-13T08:29:25.777Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Simple java questionnaire using json<p>I made a simple questionnaire. I need to write the responses to a JSON file. How to do it? I use IDEA Intellij and lib...
72,176,896
How to open fli files<p>I'm new to C++ and was tasked with processing a fli file, but have no idea how to open them correctly. So far my code looks like this:</p> <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; using namespace std; int main() { fstream newfile; newfile.open...
<p>I haven't worked with .fli files before. Is it a <a href="https://en.wikipedia.org/wiki/FLIC_(file_format)" rel="nofollow noreferrer">FLIC file</a> (used to store animations)? Then it makes sense that trying to reading them as strings produces gibberish. You could try either the <a href="https://github.com/aseprite/...
How to open fli files
c++|video
-1
42
1
72,176,942
72,176,942
1
true
2022-05-09T18:50:57.340Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to open fli files<p>I'm new to C++ and was tasked with processing a fli file, but have no idea how to open them correctly. So far my code looks like this...
72,085,781
add column in pandas dataframe by condition<p>I have a list</p> <pre><code>sample_dates = [&quot;10/07/2021&quot;,&quot;11/07/2021&quot;,&quot;12/07/2021&quot;,&quot;13/07/2021&quot;, &quot;14/07/2021&quot;,&quot;15/07/2021&quot;,&quot;16/07/2021&quot;,&quot;17/07/2021&quot;, &quot;18/07...
<p>You can compute the group number (from 0 to n) using <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.GroupBy.ngroup.html" rel="nofollow noreferrer"><code>GroupBy.ngroup</code></a>, and <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.map.html" ...
add column in pandas dataframe by condition
python|pandas|dataframe
-1
31
2
72,085,812
72,085,812
1
true
2022-05-02T11:05:39.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: add column in pandas dataframe by condition<p>I have a list</p> <pre><code>sample_dates = [&quot;10/07/2021&quot;,&quot;11/07/2021&quot;,&quot;12/07/2021&quo...
72,209,761
Unable to determine the relationship represented by navigation 'Customer.BoughtProducts' of type 'ICollection<Product>'<p>I have 3 models and a User class which defines the common properties for customer and seller so I won't attach it (I guess it would be useless info).</p> <pre><code>public class Seller : User { ...
<p>I don't know your Customer's code. But I guess you maybe use <code>ICollection&lt;Product&gt; </code> for more than one. Take seller as an example.</p> <p>According to your Seller.cs, I add below code in Product,</p> <pre><code> public Guid SellerId { get; set; } public Seller ProductSeller { get; se...
Unable to determine the relationship represented by navigation 'Customer.BoughtProducts' of type 'ICollection<Product>'
sql-server|asp.net-core|asp.net-core-webapi|database-relations
-1
168
1
72,212,411
72,212,411
1
true
2022-05-12T03:19:42.190Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to determine the relationship represented by navigation 'Customer.BoughtProducts' of type 'ICollection<Product>'<p>I have 3 models and a User class wh...
72,172,531
How to concatenate values of a string in MySQL<p>I'm trying to concat values column values in MySQL db but I get an error</p> <blockquote> <p>FUNCTION sales.STRING_AGG does not exist</p> </blockquote> <pre><code>SELECT city, STRING_AGG(email,';') email_list FROM sales.customers GROUP BY city; </code><...
<p>You need to use <code>group_concat</code></p> <pre><code>SELECT city, group_concat(email) email_list FROM customers GROUP BY city; </code></pre> <p><a href="https://dbfiddle.uk/?rdbms=mysql_8.0&amp;fiddle=e49f7ebe2592ac99842d7e3f4e82cb85" rel="nofollow noreferrer">DEMO</a></p> <p>You can also order by insi...
How to concatenate values of a string in MySQL
mysql|sql
-1
30
2
72,172,567
72,172,567
1
true
2022-05-09T13:09:20.433Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to concatenate values of a string in MySQL<p>I'm trying to concat values column values in MySQL db but I get an error</p> <blockquote> <p>FUNCTION sales....
72,165,469
Programmatically stopping a docker container<p>I want to programmatically fetch the id of a running container and stop it. However, I'm a little lost</p> <p>Here's the command I use to fetch the id of the running container:</p> <pre><code>docker ps -q --no-trunc --format=&quot;{{.ID}}&quot; --filter &quot;ancestor=&lt;...
<p>If you are using bash, you can use back ticks to evaluate a command and substitute in the command output, in your case:</p> <pre class="lang-sh prettyprint-override"><code>docker stop `docker ps -q --no-trunc --format=&quot;{{.ID}}&quot; --filter &quot;ancestor=&lt;repo-name&gt;&quot;` </code></pre> <p>Please, consi...
Programmatically stopping a docker container
bash|docker
-1
44
1
72,165,525
72,165,525
1
true
2022-05-08T22:18:30.733Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Programmatically stopping a docker container<p>I want to programmatically fetch the id of a running container and stop it. However, I'm a little lost</p> <p>...
72,185,563
Manipulate Object with JS<p>I have this object:</p> <pre><code>const data = { Jan: [{product: 'Shirt', num: '13'}, {product: 'Shoes', num: '15'}], Feb: [{product: 'Shirt', num: '22'}, {product: 'Shoes', num: '1'}], Mar: [{product: 'Shirt', num: '15'}, {product: 'Shoes', num: '25'}] } </code></pre> <p>I need...
<p>You can create the dataset using <code>Array.prototype.reduce</code> and create the new data array.</p> <p>Note that you have to flatten the array as the <code>Object.values(data)</code> gives you an array of array.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> ...
Manipulate Object with JS
javascript|arrays|object
-1
36
1
72,185,713
72,185,713
1
true
2022-05-10T11:31:14.903Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Manipulate Object with JS<p>I have this object:</p> <pre><code>const data = { Jan: [{product: 'Shirt', num: '13'}, {product: 'Shoes', num: '15'}], Fe...
72,222,063
How to save/load values from board to file<p>Im using c++ 11,</p> <p>I need to save/load array to and from file. Its the battleship game its need to be done for both user and computer array but i have no idea how to start with this task.</p> <p>I want to use code in class method to print it in file and get in front it ...
<p>Aggregating discussion above:</p> <p>To <code>class Board</code> you add a <code>&lt;&lt;</code> operator that knows how to write one <code>Board</code>.</p> <pre><code>friend std::ostream &amp; operator&lt;&lt;(std::ostream &amp; out, const Board &amp; b); </code></pre> <p>Then in Board.cpp you implement <code>&lt;...
How to save/load values from board to file
c++|file|c++11|pointers
-1
76
1
72,222,568
72,222,568
1
true
2022-05-12T21:07:03.583Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to save/load values from board to file<p>Im using c++ 11,</p> <p>I need to save/load array to and from file. Its the battleship game its need to be done ...
72,184,541
Issue writing to JSON-file with Python<p>The JSON-file</p> <pre><code>{ &quot;site1&quot;: [ { &quot;sw1&quot;: { &quot;device_type&quot;: &quot;cisco_ios&quot;, &quot;host&quot;: &quot;sw1.test.local&quot; }, &quot;sw2&quot;: { &quot;device_type&quot;: &quot;cisco_ios&qu...
<p>Change your code to this:</p> <pre><code>data['site1'][0]['sw3'] = {&quot;device_type&quot;: &quot;cisco_ios&quot;, &quot;host&quot;: &quot;sw3.tpo.local&quot;} </code></pre> <p>Because now you specify where to put the dict exactly.</p>
Issue writing to JSON-file with Python
python|json|append|indentation|writetofile
-1
42
1
72,184,681
72,184,681
1
true
2022-05-10T10:19:51.973Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Issue writing to JSON-file with Python<p>The JSON-file</p> <pre><code>{ &quot;site1&quot;: [ { &quot;sw1&quot;: { &quot;device_type&quot;...
72,213,309
how to use dropdownbutton with same value?<p>There are few same values in the <strong>dropdown button</strong> , when i tap on that it show the error ,is there any way to use the use the dropdown with same values .I have tried using the value :</p> <pre><code>DropdownButtonHideUnderline( child: Drop...
<p>Value of every <code>DropdownMenuItem</code> should be unique. In order to make use of list which have repetitive values, you should have a unique identifier for each.</p> <p>You can create a model:</p> <pre><code>class Model { int id; String value; Model(this.id, this.value); } </code></pre> <p>You can create...
how to use dropdownbutton with same value?
flutter|dart
-1
129
3
72,214,428
72,214,428
1
true
2022-05-12T09:40:48.203Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to use dropdownbutton with same value?<p>There are few same values in the <strong>dropdown button</strong> , when i tap on that it show the error ,is the...
72,207,669
Django Model Form is not validating the BooleanField<p>In my model the validation is not validating for the boolean field, only one time product_field need to be checked , if two time checked raise</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-c...
<p>You can tidy up the check a little with <a href="https://docs.python.org/3/library/functions.html#sum" rel="nofollow noreferrer"><code>sum(iterable, /, start=0)</code></a>:</p> <pre class="lang-py prettyprint-override"><code>product_field_name_count = sum( [ True for row in range(0, product_field...
Django Model Form is not validating the BooleanField
python|django|django-models|django-forms|django-validation
-1
47
1
72,207,997
72,207,997
1
true
2022-05-11T21:16:01.477Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django Model Form is not validating the BooleanField<p>In my model the validation is not validating for the boolean field, only one time product_field need t...
72,235,641
Selecting data from a pandas DataFrame<p>I have defined a pandas DataFrame, given the number of rows (index) and columns. I perform a series of operations and store the data in such DataFrame. The code that makes this operation is the next one:</p> <pre><code>import math import numpy as np import pandas as pd sens_fac...
<p>The data frame values can be accessed using explicit indexing(loc), implicit indexing (iloc). To be more clear: suppose column 3 has the name 'qwe', and the index of row 2 will be 'c'. This is called explicit reference to indexes.</p> <p><code>data.loc['c', 'qwe']</code></p> <p>Implicitly , you can apply like this:<...
Selecting data from a pandas DataFrame
python|pandas|dataframe
-1
96
1
72,240,640
72,240,640
1
true
2022-05-13T21:34:46.433Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Selecting data from a pandas DataFrame<p>I have defined a pandas DataFrame, given the number of rows (index) and columns. I perform a series of operations an...
72,075,523
How to generate a nested list of finite differences in Python?<p>I am solving a problem in which it is necessary to calculate the finite differences Δy. We have the original list of y values: <code>[0.0000, 0.0016, 0.5875, 0.8087, 0.9509, 1.0000]</code>.</p> <p>We need to get the differences:</p> <blockquote> <p>из пос...
<p>Please, post the text in English! Also, provide the result you are expecting from that example.</p> <p>However, if I understood correctly:</p> <pre><code>import numpy as np my_list = [0.0000, 0.0016, 0.5875, 0.8087, 0.9509, 1.0000] result = [np.diff(my_list, n=d) for d in range(1, len(my_list))] </code></pre> <p>H...
How to generate a nested list of finite differences in Python?
python|list
-1
25
1
72,075,594
72,075,594
1
true
2022-05-01T09:29:32.337Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to generate a nested list of finite differences in Python?<p>I am solving a problem in which it is necessary to calculate the finite differences Δy. We h...
72,156,636
How do I check if entered captcha code is valid in php?<p>I have a registration form with a captcha code I want to know how I can check if entered captcha code is valid or not.</p> <p>if valid finish the registration process if not display an error message.</p> <p>I made an example but I get this error like the image b...
<p>Many things.</p> <p>You're using different variable names in each script.</p> <ul> <li>In register.php you're comparing the POST variable to $_SESSION['verif_code']</li> <li>In captcha/verif_code_gen.php you call it $_SESSION[&quot;alert_nbr&quot;]</li> <li>In captcha.php you call it $_SESSION[&quot;code&quot;]</li>...
How do I check if entered captcha code is valid in php?
php|html|bootstrap-5
-1
74
1
72,157,740
72,157,740
1
true
2022-05-07T22:00:37.817Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I check if entered captcha code is valid in php?<p>I have a registration form with a captcha code I want to know how I can check if entered captcha co...
72,161,324
replacing new with smart pointers in this example<p>In the following I would like to replace usage of &quot;new&quot; with smart pointers. However, so far my attempts were not successfully. The commented lines are what I tried to change for smart pointers.</p> <pre><code>int main(){ int n, val; cin...
<p>You're not allocating the actual object, so use <a href="https://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared" rel="nofollow noreferrer">std::make_shared</a> :</p> <pre><code>per[i] = std::make_shared&lt;Student&gt;(); </code></pre> <p>Although <a href="https://stackoverflow.com/questions/20895648/differe...
replacing new with smart pointers in this example
c++|smart-pointers
-1
88
1
72,161,370
72,161,370
1
true
2022-05-08T13:09:37.433Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: replacing new with smart pointers in this example<p>In the following I would like to replace usage of &quot;new&quot; with smart pointers. However, so far my...
72,169,890
Code that works, but makes little sense to me: if str1.find("not")<p>New to coding/Python and doing codingbat challenges. Really basic stuff.</p> <p><a href="https://codingbat.com/prob/p189441" rel="nofollow noreferrer">https://codingbat.com/prob/p189441</a></p> <p>^ This problem can be solved writing:</p> <pre><code>d...
<p><code>str1.find(&quot;not&quot;)</code> returns the index of the substring, if it is found; and -1 if it is not found.</p> <p>If you use it as a condition:</p> <pre><code>if str1.find(&quot;not&quot;): </code></pre> <p>then it will only be falsey if <code>str1.find(&quot;not&quot;)</code> returns zero, because all i...
Code that works, but makes little sense to me: if str1.find("not")
python
-1
45
2
72,169,962
72,169,962
1
true
2022-05-09T09:40:09.660Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Code that works, but makes little sense to me: if str1.find("not")<p>New to coding/Python and doing codingbat challenges. Really basic stuff.</p> <p><a href=...
72,212,334
Matplotlib / df.plot(): set custom integer xticks for spectrum of floats<p>Edit: please note that I have more values in x axis (and in floats) that I want ticks (integers), which makes usual solution not work (like <a href="https://stackoverflow.com/questions/21910986/why-set-xticks-doesnt-set-the-labels-of-ticks">Why ...
<p>You can try:</p> <pre class="lang-py prettyprint-override"><code># set the x tick positions ax.set_xticks(list(range(0, 101, 2))) # now set the xtick labels at those positions ax.set_xticklabels([f&quot;{int(xval)}&quot; for xval in range(0, 101, 2)]) </code></pre> <p>Note that the <code>range</code> goes to 101, s...
Matplotlib / df.plot(): set custom integer xticks for spectrum of floats
python|dataframe|matplotlib
-1
45
2
72,213,992
72,213,992
1
true
2022-05-12T08:28:39.963Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Matplotlib / df.plot(): set custom integer xticks for spectrum of floats<p>Edit: please note that I have more values in x axis (and in floats) that I want ti...