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,917,782
How to subtract from a Django model?<p>I am trying to add and subtract 1 from the value of a Django model's IntegerField and display it on the webpage, depending on when a button is clicked.</p> <p>models.py</p> <pre><code>class User(AbstractUser): following = models.ManyToManyField(&quot;self&quot;, related_name=&...
<p>you reference the class (model) and not the object (instance)</p> <blockquote> <p>following_num = <strong>U</strong>ser.following_num</p> </blockquote> <p>as you alredy passed your user object to the template you can also access the attributes directly <code>{{user.following_num }} {{request.user.following_num }}</c...
How to subtract from a Django model?
python|django|math
-1
69
2
72,919,874
72,919,874
1
true
2022-07-08T23:08:10.053Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to subtract from a Django model?<p>I am trying to add and subtract 1 from the value of a Django model's IntegerField and display it on the webpage, depen...
72,924,937
Commit to different branch but leave uncommitted in current branch<p>If I have uncommitted changes in my branch master and I checkout a feature branch and commit them, then checkout master again, then &quot;git status&quot; will not show those changes since they've been committed to a different branch.</p> <p>How can I...
<pre><code>git stash git checkout &lt;featurebranch&gt; git stash apply git commit -a -m &quot;saved changes&quot; git checkout - git stash pop </code></pre>
Commit to different branch but leave uncommitted in current branch
git
1
69
5
72,924,994
72,924,994
1
true
2022-07-09T22:13:35.220Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Commit to different branch but leave uncommitted in current branch<p>If I have uncommitted changes in my branch master and I checkout a feature branch and co...
72,936,227
Not shown x-axis labels in matplotlib subplots from pandas dataframe<p>I try to print out subplots. Sadly just the last of those plots has x axis labels / dates shown. How can I show the date below each graph.</p> <p>It looks like this, but I wan't x axis for all graphs</p> <p><a href="https://i.stack.imgur.com/uMCEb.p...
<p>You have <code>subplots=True</code> and all subplots are sharing the same x-axis. Passing in <code>sharex=False</code> in the <code>plot.line</code> method should do the trick.</p> <p>You can pass in keyword arguments into <code>DataFrame.plot.line</code> which are passed onto <code>DataFrame.plot</code>. You can ch...
Not shown x-axis labels in matplotlib subplots from pandas dataframe
python|pandas|matplotlib|google-colaboratory|subplot
1
69
1
72,936,287
72,936,287
1
true
2022-07-11T09:19:22.807Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Not shown x-axis labels in matplotlib subplots from pandas dataframe<p>I try to print out subplots. Sadly just the last of those plots has x axis labels / da...
72,935,458
ChartJS not showing the title<p>The ChartJS is not showing any title. I added the title in option and then plugin, Ieven tried to add some margin because mabe it was hidden by the layout but nothing works. I use node-red to launch the graphic dashboard. I added some CSS to the dashboard but nothing linked directly to t...
<p>You need to set the title in the root of the options, not in the plugins namespace:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var options = { type: 'line', data: {...
ChartJS not showing the title
chart.js|node-red
1
69
1
72,937,748
72,937,748
1
true
2022-07-11T08:06:06.627Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ChartJS not showing the title<p>The ChartJS is not showing any title. I added the title in option and then plugin, Ieven tried to add some margin because mab...
72,913,114
Apache echarts scatter: assign label to each point<p>I am building an echarts scatter graph that contains 6 points. I would like to manually assign a label to each point, like I did with the label of X and Y axis. Is there a way to achieve this? I searched in Apache Echarts docs but I did not find any useful setting fo...
<p>You could specify the labels as an additional value in the data array:</p> <pre><code>data: [ [ 2, 9.8, &quot;label1&quot; ], [ 1, 8.8, &quot;label2&quot; ], ... </code></pre> <p>Then use a formatter function in your label definition, to select the third element of the data array as the label:</p> <pre><...
Apache echarts scatter: assign label to each point
echarts
0
69
2
72,942,092
72,942,092
1
true
2022-07-08T14:42:48.180Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Apache echarts scatter: assign label to each point<p>I am building an echarts scatter graph that contains 6 points. I would like to manually assign a label t...
72,942,360
UNIX Time to Date and Time Conversion Problem Java<p>IMPORTANT: external libraries, Date and Instant class are not allowed</p> <blockquote> <p>You may not use any library routines for manipulation of time or dates, such as converting UNIX time to a date string or for formatting date strings in general. All calculations...
<p>You created your own code. That probably was the intent of the homework. Now pinpoint the problem.</p> <p>For that you can actually create a loop generating different Unix time values. For each of these values calculate the date using your code, in parallel calculate the date using <code>java.util.Date</code> or <co...
UNIX Time to Date and Time Conversion Problem Java
java|datetime|unix-timestamp
0
69
2
72,943,605
72,943,605
1
true
2022-07-11T17:20:23.560Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: UNIX Time to Date and Time Conversion Problem Java<p>IMPORTANT: external libraries, Date and Instant class are not allowed</p> <blockquote> <p>You may not us...
72,943,830
How to write cypress locator for this dynamic button specific to the span element "Agile Fundamentals"<p>I am new to cypress automation. I tried to use the following locator to click on the specific dynamic button.</p> <pre class="lang-js prettyprint-override"><code>cy.contains('span', 'Agile Fundamentals').next().find...
<p><code>.next()</code> won't work in this case because the next element would be the text label with the date.</p> <p>Instead, we can to use <code>.parent()</code> and <code>.siblings()</code> to move over to the other div and grab that button.</p> <pre class="lang-js prettyprint-override"><code>cy.contains('span', 'A...
How to write cypress locator for this dynamic button specific to the span element "Agile Fundamentals"
automation|cypress|relative-locators
2
69
3
72,943,884
72,943,884
1
true
2022-07-11T19:41:11.937Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to write cypress locator for this dynamic button specific to the span element "Agile Fundamentals"<p>I am new to cypress automation. I tried to use the f...
72,938,096
finding the longest common prefix of elements inside a list<p>I have a sequence <code>print(lcp([&quot;flower&quot;,&quot;flow&quot;,&quot;flight&quot;, &quot;dog&quot;]))</code> which should return <em>fl</em>. Currently I can get it to return <em>flowfl</em>.</p> <p>I can locate the instances where <em>o</em> or <em>...
<p>Returns the longest prefix that the set of words have in common.</p> <pre class="lang-py prettyprint-override"><code>def lcp(strs): if len(strs) == 0: return &quot;&quot; result = strs[0] for word in strs[1:]: for i, (l1, l2) in enumerate(zip(result, word)): if l1 != l2:...
finding the longest common prefix of elements inside a list
python
-1
69
3
72,949,401
72,949,401
1
true
2022-07-11T11:47:24.737Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: finding the longest common prefix of elements inside a list<p>I have a sequence <code>print(lcp([&quot;flower&quot;,&quot;flow&quot;,&quot;flight&quot;, &quo...
72,957,283
Populating an even distribution of values across multiple axis?<p>Basic Example:</p> <pre><code># Given params such as: params = { 'cols': 8, 'rows': 4, 'n': 4 } # I'd like to produce (or equivalent): col0 col1 col2 col3 col4 col5 col6 col7 row_0 0 1 2 3 0 1 2 ...
<p>You can <code>tile</code> you input and use a custom roll to shift each row independently:</p> <pre><code>c = params['cols'] r = params['rows'] n = params['n'] a = np.arange(params['n']) # or any input b = np.tile(a, (r, c//n)) # array([[0, 1, 2, 3, 0, 1, 2, 3], # [0, 1, 2, 3, 0, 1, 2, 3], # [0, 1, 2,...
Populating an even distribution of values across multiple axis?
python|permutation
0
69
2
72,957,703
72,957,703
1
true
2022-07-12T19:10:38.680Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Populating an even distribution of values across multiple axis?<p>Basic Example:</p> <pre><code># Given params such as: params = { 'cols': 8, 'rows':...
72,958,208
Order of processing different Redis Streams messages<p>Given that I have a service P (Producer) and C (Consumer) my P service needs to:</p> <ul> <li>Create an object X</li> <li>Create an object Y (dependent on X)</li> <li>Create an object Z (dependent on Y)</li> <li>Notify C about X, Y, and Z (via Redis Streams)</li> <...
<p>I believe IDEA 2 is a better solution cuz I think keep the whole message in one data structure is a good idea.</p> <p>And probably you can try to use multiple keys.</p> <p>For example:</p> <h3>On Service P</h3> <pre><code>def now_timestamp = datetime.currentstamp # let`s say it is 1515151551 redis sadd not_processe...
Order of processing different Redis Streams messages
redis|microservices|redis-streams
0
69
2
72,960,111
72,960,111
1
true
2022-07-12T20:47:44.467Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Order of processing different Redis Streams messages<p>Given that I have a service P (Producer) and C (Consumer) my P service needs to:</p> <ul> <li>Create a...
72,974,266
How do I create a smart contract instance and interact with my smart contract functions?<p>I am studying a <a href="https://www.udemy.com/course/getting-started-with-ethereum-solidity-development/" rel="nofollow noreferrer">course on Udemy</a> to learn more about blockchain technologies and smart contracts. This course...
<p>These both tutorials were great resources for solving your problem!</p> <ol> <li><p><a href="https://medium.com/coinmonks/get-started-with-building-ethereum-dapps-and-smart-contracts-d86b9f7bd1c" rel="nofollow noreferrer">Creating &amp; Deploying a Smart Contract using Web3js &amp; Ganache-CLI — Part 1</a></p> </li>...
How do I create a smart contract instance and interact with my smart contract functions?
node.js|windows|ethereum|solidity|web3js
1
69
1
72,975,171
72,975,171
1
true
2022-07-14T01:32:03.800Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I create a smart contract instance and interact with my smart contract functions?<p>I am studying a <a href="https://www.udemy.com/course/getting-star...
72,975,874
Laravel how to create filter by date for table<p>so I made an update to my table so the user can search the data filtered by date (year), by adding a drop down menu for the selection. I'm trying to use <strong>ajax</strong> to filter the date, but somehow I can't get it to work. May I know what is wrong with my code? O...
<p>Check This</p> <blockquote> <p>$(document).ready(function () { // Setup - add a text input to each footer cell $('#example thead tr') .clone(true) .addClass('filters') .appendTo('#example thead');</p> <pre><code>var table = $('#example').DataTable({ orderCellsTop: true, fixedHeader: true, initComplete: f...
Laravel how to create filter by date for table
php|ajax|laravel
0
69
1
72,975,973
72,975,973
1
true
2022-07-14T06:01:08.747Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Laravel how to create filter by date for table<p>so I made an update to my table so the user can search the data filtered by date (year), by adding a drop do...
72,989,077
Iterate through an array of pointer of pointers<p>I want to iterate through <code>**list_arg[]</code>.</p> <p>I can't make this work, unless I try to iterate through it in another function, then I can do <code>list_arg++</code>.</p> <pre><code>int main(int argc, char *argv[]) { char *three[] = {&quot;Ver&quot;, NUL...
<p>When using arrays of pointers (and <em>especially</em> arrays of pointers to pointers), it is generally better to use the specific <code>[]</code> operator, rather than trying to work out which combination of dereferencing (<code>*</code>) operators will get to (and manipulate) the required target.</p> <p>The follow...
Iterate through an array of pointer of pointers
arrays|c|pointers|iteration|dereference
0
69
2
72,989,166
72,989,166
1
true
2022-07-15T04:32:49.263Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Iterate through an array of pointer of pointers<p>I want to iterate through <code>**list_arg[]</code>.</p> <p>I can't make this work, unless I try to iterate...
72,983,084
I created a graph with Petgraph using structs as nodes but I can't change the values of the struct after the nodes have been put together<p>At the moment, my nodes are made of a struct which hold a name and a value.<br /> Later the graph is created.<br /> I want to change the value of certain nodes. I also want the str...
<p>Your problem is, that your graph does not <strong>own</strong> the values, but instead it only holds references to them.</p> <p>You can't manipulate references, you should either hold a <code>&amp;mut</code>, which is often problematic, or transfer the ownership to the graph.</p> <p>Here's my code, which works:</p> ...
I created a graph with Petgraph using structs as nodes but I can't change the values of the struct after the nodes have been put together
rust
0
69
1
72,990,288
72,990,288
1
true
2022-07-14T15:30:48.240Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I created a graph with Petgraph using structs as nodes but I can't change the values of the struct after the nodes have been put together<p>At the moment, my...
72,989,701
Redux Reducer - Add to Cart Action Functionality with Conditions<p>When the product is in the cart the both conditions return <strong>empty</strong> array for the cart.<br> The cart has <strong>3</strong> objects: <strong>the product, quantity, and variants</strong> (which are color and size)<br> Any help please</p> <p...
<p>You are not returning the result of the map. Try doing this</p> <pre><code> return state.cart.map((item) =&gt; ... </code></pre>
Redux Reducer - Add to Cart Action Functionality with Conditions
javascript|reactjs|redux|react-redux
0
69
1
72,990,329
72,990,329
1
true
2022-07-15T06:10:30.333Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Redux Reducer - Add to Cart Action Functionality with Conditions<p>When the product is in the cart the both conditions return <strong>empty</strong> array fo...
72,988,748
Set the database current timestamp while inserting using JOOQ<p>I am using the following code segment to do the insertion using JOOQ's <code>UpdatableRecord</code>.</p> <pre><code>public void acknowledgeDisclaimer(AcknowledgeDisclaimerReq acknowledgeDisclaimerReq) { DisclaimerRecord disclaimerRecord = dslContex...
<p><code>UpdatableRecord.store()</code> can only set <code>Field&lt;T&gt; =&gt; T</code> key/values, not <code>Field&lt;T&gt; =&gt; Field&lt;T&gt;</code>, so you cannot set an expression in your record. You can obviously run an explicit <code>INSERT</code> / <code>UPDATE</code> / <code>MERGE</code> statement instead.</...
Set the database current timestamp while inserting using JOOQ
java|spring-boot|jooq
0
69
2
72,991,323
72,991,323
1
true
2022-07-15T03:26:09.823Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Set the database current timestamp while inserting using JOOQ<p>I am using the following code segment to do the insertion using JOOQ's <code>UpdatableRecord<...
72,991,956
How to send a HTML file with Nodemailer<p>In my node web application, i used <strong>nodemailer</strong> to sent emails.</p> <pre><code>.then(user =&gt; { const mailOptions = { from: &quot;Mohammad.front.dev@gmail.com&quot;, to: user.email, subject: &quot;Rese...
<p>You can just read the content from the HTML file to the variable and use this variable in <code>mailOptions</code></p> <p>Similar questions:</p> <ul> <li><a href="https://stackoverflow.com/questions/55357774/how-do-i-send-a-html-file-using-nodemailer">How do I send a html file using nodemailer</a></li> <li><a href="...
How to send a HTML file with Nodemailer
node.js|nodemailer
-1
69
3
72,992,052
72,992,052
1
true
2022-07-15T09:35:35.413Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to send a HTML file with Nodemailer<p>In my node web application, i used <strong>nodemailer</strong> to sent emails.</p> <pre><code>.then(user =&gt; { ...
72,993,462
Container with 3 borders and radiuses<p>I'm looking for the way to create rounded container with only <strong>topLeft and topRight</strong> radiuses and <strong>without</strong> bottom border. Here is what I tried:</p> <pre><code> Container( decoration: BoxDecoration( ...
<p>You can use shadow and achieve the same result</p> <pre><code> Container( height: 300, width: 300, decoration: BoxDecoration( borderRadius: BorderRadius.vertical(top: Radius.circular(10)), color: Colors.wh...
Container with 3 borders and radiuses
flutter|containers
1
69
1
72,993,941
72,993,941
1
true
2022-07-15T11:44:01.977Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Container with 3 borders and radiuses<p>I'm looking for the way to create rounded container with only <strong>topLeft and topRight</strong> radiuses and <str...
73,000,576
How to deal with this JSON?<p>I have this JSON coming from server:</p> <pre><code>{ &quot;models&quot;: [ { &quot;code&quot;: &quot;RPX&quot;, &quot;name&quot;: &quot;Tank&quot;, &quot;color&quot;: null, &quot;alias&quot;: [ &quot;tank&quot; ], &quot;plantCode&quot;: &q...
<p>The first thing you should do is get rid of that <code>JSONNull</code> type. It´s not helping. This type will fail to decode as soon as the JSON value is something different then <code>null</code>. And a property that allways stays <code>null</code> seems kind of pointless.</p> <p>Next step would be to replace the <...
How to deal with this JSON?
json|swift
1
69
1
73,001,274
73,001,274
1
true
2022-07-15T23:55:02.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to deal with this JSON?<p>I have this JSON coming from server:</p> <pre><code>{ &quot;models&quot;: [ { &quot;code&quot;: &quot;RPX&quot;, ...
72,885,695
Is there a difference between a for loop without increment vs. one with a non incremented variable?<p>In JS, is there any difference between the following two types of loops?</p> <ol> <li><p>A <code>for</code> loop without an increment such as:</p> <pre class="lang-js prettyprint-override"><code>for (i = 0; i &lt; 1000...
<p>Under normal circumstances: no, there is no difference.</p> <blockquote> <p>The <strong><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for" rel="nofollow noreferrer">for statement</a></strong> creates a loop that consists of three optional expressions, enclosed in parentheses a...
Is there a difference between a for loop without increment vs. one with a non incremented variable?
javascript|for-loop|increment
-2
69
1
73,003,694
73,003,694
1
true
2022-07-06T14:52:04.287Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a difference between a for loop without increment vs. one with a non incremented variable?<p>In JS, is there any difference between the following tw...
72,999,526
Find number of long trades in strategy<p>I was trying to access the number of long and short trades taken in a strategy separately but I could not find any function for this. We can find wintrades and losstrades by strategy.wintrades and strategy.losstrades. Is there a similar function for counting longwintrades and sh...
<p>You'll have to use: <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dsize" rel="nofollow noreferrer">https://www.tradingview.com/pine-script-reference/v5/#fun_strategy{dot}closedtrades{dot}size</a></p> <p>&quot;Returns the direction and the number of contracts ...
Find number of long trades in strategy
pine-script|pinescript-v5
1
69
1
73,004,811
73,004,811
1
true
2022-07-15T20:56:29.573Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find number of long trades in strategy<p>I was trying to access the number of long and short trades taken in a strategy separately but I could not find any f...
73,008,963
Using GridSearchCV for MLPRegressor: How to fit multiple hidden_layer_sizes<p>I'm using GridsearchCV for hyperparameter tuning. Im having problems fitting a variation of &quot;hidden_layer_sizes&quot;, as they have to be tuples.</p> <p>Is there a way to check multiple hidden layer sizes, without manually typing them in...
<p>You can use <code>product</code> from <code>itertools</code>:</p> <pre><code>from itertools import product first_layer_neurons = np.arange(10, 200, 10) second_layer_neurons = np.arange(10, 200, 10) hidden_layer_sizes = list(product(first_layer_neurons, second_layer_neurons)) </code></pre> <p>Output:</p> <pre><code>...
Using GridSearchCV for MLPRegressor: How to fit multiple hidden_layer_sizes
python|pandas
1
69
1
73,009,286
73,009,286
1
true
2022-07-17T02:52:08.220Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using GridSearchCV for MLPRegressor: How to fit multiple hidden_layer_sizes<p>I'm using GridsearchCV for hyperparameter tuning. Im having problems fitting a ...
73,007,795
Why does this suggested solution prefer a different way of calculating percentages based on aggregations?<p>I'm working through a problem set from CMU's public db systems course. I have the following two tables:</p> <p><strong>Order</strong></p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th s...
<p>The official solution is a very bad solution because it aggregates twice on the same table <code>Order</code> and then joins the results whilst the same can be achieved by a single aggregation query (like your first query).</p> <p>I can't believe that this would be proposed as a proper solution for this type of prob...
Why does this suggested solution prefer a different way of calculating percentages based on aggregations?
sql|sqlite|join|optimization|aggregate
0
69
1
73,010,652
73,010,652
1
true
2022-07-16T21:36:43.670Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does this suggested solution prefer a different way of calculating percentages based on aggregations?<p>I'm working through a problem set from CMU's publ...
73,000,253
how to provide service account details to terraform cloud variable? throws 'unexpected end of JSON input'<p>I'm trying to use terraform cloud with a gcp provider, a pretty basic use case.</p> <p>The major issue is -- how do I provide the google provider as a variable to the cloud version of terraform? I've added the JS...
<p>Solution was found on a few hashicorp forum posts -- for the GCP provider specifically the environment variable name must be set to <code>GOOGLE_CREDENTIALS</code> and it does not appear to work with other variable values for this specific provider, it also doesn't seem to be documented on the gcp provider page or o...
how to provide service account details to terraform cloud variable? throws 'unexpected end of JSON input'
terraform|terraform-provider-gcp|terraform-cloud
-3
69
2
73,013,421
73,013,421
1
true
2022-07-15T22:47:37.217Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to provide service account details to terraform cloud variable? throws 'unexpected end of JSON input'<p>I'm trying to use terraform cloud with a gcp prov...
73,012,434
mypy with numbers.Number<p>I was hoping to use mypy's static duck typing facility to write a function that can process a sequence of number-like objects, where &quot;number-like&quot; is defined by numbers.Number:</p> <pre class="lang-py prettyprint-override"><code>from numbers import Number from typing import Sequence...
<p>It was stated in @bzu answer, but I'd like to add some explanation to it.</p> <p>First thing to note: <code>issubclass(int, Number)</code> and <code>issubclass(float, Number)</code> both evaluate to True. This is very surprising type-checking behavior, but it was standardized in <a href="https://peps.python.org/pep-...
mypy with numbers.Number
python-3.x|mypy
2
69
3
73,022,285
73,022,285
1
true
2022-07-17T14:02:55.980Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: mypy with numbers.Number<p>I was hoping to use mypy's static duck typing facility to write a function that can process a sequence of number-like objects, whe...
73,026,939
Spdlog: Only write to file if there is an error<p>At the moment I am combining a file sink with a console sink. (see bellow)</p> <pre class="lang-cpp prettyprint-override"><code>std::vector&lt;spdlog::sink_ptr&gt; sinks; sinks.push_back(std::make_shared&lt;spdlog::sinks::wincolor_stdout_sink_st&gt;(...
<p>You can call <a href="https://github.com/gabime/spdlog/blob/834840636cb52242d0fae2d6233c90067a4248dc/include/spdlog/sinks/sink.h#L21" rel="nofollow noreferrer"><code>file_sink-&gt;set_level(spdlog::level::error)</code></a> to make it log only on error and more severe levels.</p>
Spdlog: Only write to file if there is an error
c++|spdlog
1
69
1
73,028,268
73,028,268
1
true
2022-07-18T18:25:33.720Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spdlog: Only write to file if there is an error<p>At the moment I am combining a file sink with a console sink. (see bellow)</p> <pre class="lang-cpp prettyp...
73,028,314
How to select a specific HTML element from a for loop in a Django template?<p>I am trying to create a button that hides and displays only the specific <code>HTML</code> elements that are in the same div with it through <code>JavaScript</code>. All the divs are within a <code>Django</code> template for loop and display ...
<p>You're sharing the same id for multiple elements. According to MDN,</p> <blockquote> <p>The Document method querySelector() returns the first Element within the document that matches the specified selector, or group of selectors</p> </blockquote> <p>To fix this for your case, append the post ID to the element ID so ...
How to select a specific HTML element from a for loop in a Django template?
javascript|html|django|for-loop|queryselector
0
69
1
73,028,531
73,028,531
1
true
2022-07-18T20:34:38.647Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to select a specific HTML element from a for loop in a Django template?<p>I am trying to create a button that hides and displays only the specific <code>...
73,023,480
Can't get the right AST selector for history.push()<p>I'm migrating a codebase from <code>react-router</code> v5 to v6, and I'd like to add an <code>eslint</code> rule forbidding <code>history.push</code> calls with a <a href="https://eslint.org/docs/latest/rules/no-restricted-syntax" rel="nofollow noreferrer"><code>no...
<p>The following should work for <code>history.push()</code>:</p> <pre><code>/* eslint no-restricted-syntax: ['error', 'CallExpression[callee.object.name=&quot;history&quot;][callee.property.name=&quot;push&quot;]'] */ history.push(); </code></pre>
Can't get the right AST selector for history.push()
eslint|abstract-syntax-tree
0
69
1
73,036,778
73,036,778
1
true
2022-07-18T13:52:57.963Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't get the right AST selector for history.push()<p>I'm migrating a codebase from <code>react-router</code> v5 to v6, and I'd like to add an <code>eslint</...
72,853,519
How can I return two different concrete types from a single method in Go 1.18?<p>Let say that I have this code:</p> <pre><code>type Type1 struct { Name string `json:&quot;name,omitempty&quot;` Path string `json:&quot;path&quot;` File string `json:&quot;file&quot;` Tag int `json:&quot;tag&quot;` ...
<p>Actually the code shown in your question doesn't do anything more than passing a type into <code>json.Unmarshal</code> and format an error so you can rewrite your function to behave just like it:</p> <pre><code>func LoadConfiguration(data []byte) (*Type1, error) { config := &amp;Type1{} if err := loadConf(da...
How can I return two different concrete types from a single method in Go 1.18?
go|generics
3
69
1
72,853,720
72,853,720
1
true
2022-07-04T08:05:48.693Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I return two different concrete types from a single method in Go 1.18?<p>Let say that I have this code:</p> <pre><code>type Type1 struct { Name s...
72,784,537
dafny how to bound set comprehension resolver?<p>Trying to write an algorithm involving paths from a root of a binary tree to a leaf. I ran into the following error for the ghost var I was trying to define. I had intended to try to show that some other path was in this set. How do I resolve this error?</p> <blockquote>...
<p>Dafny enforces finiteness of set using syntactic scan and fixed set of heuristics, as a result it is not exhaustive. Following example give same error</p> <pre><code>predicate test(i: int) { i &gt;= 10 &amp;&amp; i &lt;= 20 } method Test(){ ghost var s := set i | test(i); } </code></pre> <p>Also no language co...
dafny how to bound set comprehension resolver?
set|dafny
1
69
2
72,785,074
72,785,074
1
true
2022-06-28T10:08:54.710Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: dafny how to bound set comprehension resolver?<p>Trying to write an algorithm involving paths from a root of a binary tree to a leaf. I ran into the followin...
73,020,299
Reinsert special character * into strings at predefined positions<p>(This question is based on a previous question <a href="https://stackoverflow.com/questions/73011685/convert-letters-with-duplicates-to-numbers">Convert letters with duplicates to numbers</a>)</p> <p>I have series of events and non-events in column <co...
<p>You can modify the anonymous function with an <code>ifelse()</code> to return <code>*</code> if the input is <code>*</code> but otherwise to follow the logic of your previous code, i.e. match the input to the vector of unique values.</p> <pre class="lang-r prettyprint-override"><code>df$aoi_1 &lt;- sapply( strsp...
Reinsert special character * into strings at predefined positions
r|string|dplyr|sapply
2
69
2
73,020,442
73,020,442
1
true
2022-07-18T09:47:21.980Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reinsert special character * into strings at predefined positions<p>(This question is based on a previous question <a href="https://stackoverflow.com/questio...
72,955,967
Is there any way to format input timeframe with custom options?<p>This - <code>input.timeframe(&quot;&quot;)</code> shows list as <em>'1 minute', '2 hours', '1 day'</em> etc. - Yet still returns the numeric/string representation - i.e. 4hr = 240, 1 day = D</p> <p>I'm aiming to achieve the same but with fewer/custom tim...
<p>The return from <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_input%7Bdot%7Dtimeframe" rel="nofollow noreferrer">input.timeframe()</a> is not a numeric represenation.<br /> It is always a string.<br /> It will <strong>appear</strong> to be a number if you go into the lower timeframes, though.<br...
Is there any way to format input timeframe with custom options?
pine-script|pinescript-v5
0
69
1
72,956,081
72,956,081
1
true
2022-07-12T17:04:39.023Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there any way to format input timeframe with custom options?<p>This - <code>input.timeframe(&quot;&quot;)</code> shows list as <em>'1 minute', '2 hours', ...
73,011,417
Bootstrap menu instead of <select><p>Im finding that a <code>&lt;select&gt;</code> with <code>&lt;option&gt;</code> has limited styling options so I am trying to implement a bootstrap menu which will give me more styling options. I have the basic structure like this:</p> <pre><code>&lt;style&gt; .menuBox { ...
<p>You can change the button itself to use flexbox properties, then just justify it to flex-end (right). You'll lose the default padding from the base settings so I just added it back in using <code>p-3</code></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div clas...
Bootstrap menu instead of <select>
css|bootstrap-4
1
69
1
73,011,960
73,011,960
1
true
2022-07-17T11:36:01.947Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bootstrap menu instead of <select><p>Im finding that a <code>&lt;select&gt;</code> with <code>&lt;option&gt;</code> has limited styling options so I am tryin...
72,894,848
How to make cards blur in flutter?<p>I have a grid in an app. (not made of grid view builder but of column of rows). I have to make the cards blurry. I used backdrop filter but the problem is its blurring the whole screen but i want it to blur the cards only. This is code snippet :</p> <pre><code>Column( ...
<p>I'm not familiar with flutter animations, but from a quick glance on documentation, you might miss a Clip widget in ancestor widget:</p> <blockquote> <p>The filter will be applied to all the area within its parent or ancestor widget's clip. If there's no clip, the filter will be applied to the full screen.</p> </blo...
How to make cards blur in flutter?
flutter
0
69
1
72,894,953
72,894,953
1
true
2022-07-07T08:48:30.980Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make cards blur in flutter?<p>I have a grid in an app. (not made of grid view builder but of column of rows). I have to make the cards blurry. I used ...
72,980,126
'Connection reset by peer' error with web scraping<p>I am trying to get HTML data using urllib but I keep getting Connection reset by peer error. I have tried to use header option to circumvent proxy related issue, but seems like it is not working. Any help would be highly appreciated</p> <pre><code>import urllib.reque...
<p>Use direct <code>requests</code> module along with <code>.get()</code> method</p> <pre><code>import requests res= requests.get('https://wolt.com/az/aze/baku/restaurant/qutabxana') print(res) </code></pre> <p><strong>Output:</strong></p> <p><strong>&lt;Response [200]&gt;</strong></p> <p>Full working code with an exam...
'Connection reset by peer' error with web scraping
python|web-scraping|beautifulsoup|urllib
-1
69
2
72,980,298
72,980,298
1
true
2022-07-14T11:59:10.323Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: 'Connection reset by peer' error with web scraping<p>I am trying to get HTML data using urllib but I keep getting Connection reset by peer error. I have trie...
72,925,584
Deserialize a json object with multiple nested objects /lists using JsonConvert<p>I a beginner in C# application development and have the following json data which I want to de-serialize:</p> <pre><code>{ &quot;Parameters&quot;: [ { &quot;Info&quot;: { &quot;Id&quot;: 0, ...
<p>you have only getters in your classes. you need setters to assign values from json to c# objects</p> <pre><code>List&lt;Parameter&gt; Parameters = JsonConvert.DeserializeObject&lt;ParamList&gt;(json).Parameters; </code></pre> <p>classes</p> <pre><code>public class ParamList { public List&lt;Parameter&gt; Paramet...
Deserialize a json object with multiple nested objects /lists using JsonConvert
c#|json|json.net|json-deserialization|generic-list
0
69
1
72,928,138
72,928,138
1
true
2022-07-10T01:18:32.267Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Deserialize a json object with multiple nested objects /lists using JsonConvert<p>I a beginner in C# application development and have the following json data...
72,785,528
Why the output is incorrect<p>I have this code but I don't know what happen why the result of <code>out</code> is incorrect any advice please?</p> <pre><code>int *getarray(int *out) { int data[20]; for(int i=0;i&lt;20;i++) { data[i]=i; } for(int i=0;i&lt;20;i++) { ou...
<p>Two problems:</p> <ul> <li>The <code>data</code> array in <code>getarray</code> will cease to exist once the <code>getarray</code> function has finished execution.</li> <li>You need to dereference <code>out</code> in order to change the <code>out</code> in <code>resultdata</code>. Read again the chapter dealing with...
Why the output is incorrect
c|arduino-ide|arduino-c++|arduino-esp32
1
69
1
72,785,649
72,785,649
1
true
2022-06-28T11:22:12.703Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why the output is incorrect<p>I have this code but I don't know what happen why the result of <code>out</code> is incorrect any advice please?</p> <pre><code...
72,787,994
How to self join only a subset of rows in PostgreSQL?<p>Given the following table:</p> <pre><code>CREATE TABLE people ( name TEXT PRIMARY KEY, age INT NOT NULL ); INSERT INTO people VALUES ('Lisa', 30), ('Marta', 27), ('John', 32), ('Sam', 41), ('Alex', 12), ('Aris...
<p>At first join two tables to build one table that has all three bits of info: <code>house_name</code>, <code>house_member</code>, <code>age</code>.</p> <p>And then join it with itself just as you did originally and add one extra filter to look only at the same households.</p> <pre><code>WITH CTE_All AS ( SELECT ...
How to self join only a subset of rows in PostgreSQL?
sql|postgresql
3
69
1
72,801,890
72,801,890
1
true
2022-06-28T14:09:24.743Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to self join only a subset of rows in PostgreSQL?<p>Given the following table:</p> <pre><code>CREATE TABLE people ( name TEXT PRIMARY KEY, age I...
72,947,808
How to custom enum with rails radio_buttons?<p>I want to make a simple rating selection with star icon from enum in the form of a radio_button.</p> <p>my model:</p> <pre><code>enum rating: %i(1 2 3 4 5 6 7 8 9 10) </code></pre> <p>and my view:</p> <pre><code>= form_with model: @rating do |f| .form-group label.inpu...
<p>Honestly I would take a completely different approach. There isn't really a good reason to use an enum column to save a rating value, it just needs to be an integer.</p> <p>To capture the value in the view, a radio button is not the best look, I would use a little javascript (shown with jQuery here) and a little css...
How to custom enum with rails radio_buttons?
ruby-on-rails|forms|radio-button|ruby-on-rails-6
0
69
1
72,953,207
72,953,207
1
true
2022-07-12T06:16:47.703Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to custom enum with rails radio_buttons?<p>I want to make a simple rating selection with star icon from enum in the form of a radio_button.</p> <p>my mod...
72,881,249
Is it possible to throw checked exception in Spring AOP?<p>Hello I'm trying to throw custom Exceptions from my @Aspect, but no matter what exception I throw, my Aspect is throwing <strong>UndeclaredThrowableException</strong>,</p> <p>My custom exception is</p> <pre><code>public class AuthorizationException extends Runt...
<p>Your aspect is throwing a checked exception which is not declared in the intercepted method or one of its callers along the call stack. Unfortunately, you did not even post a stack trace, which is not very helpful. An <a href="https://stackoverflow.com/help/mcve">MCVE</a> is also missing, so I can only answer the qu...
Is it possible to throw checked exception in Spring AOP?
spring|spring-boot|spring-aop|aspect
0
69
1
72,920,302
72,920,302
1
true
2022-07-06T09:43:00.783Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to throw checked exception in Spring AOP?<p>Hello I'm trying to throw custom Exceptions from my @Aspect, but no matter what exception I throw,...
72,987,818
Boostrap Vue Change Cell Text in B-table<p>In a b-table, each cell in a column should have different text color. Not the background of the cell, but the actual text color. I am able to change the text color of the column header, but not the individual cell texts.</p> <p>The b-table code:</p> <pre><code>&lt;b-card title...
<p>Here's an example, using the <code>#cell()</code> slot:</p> <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>new Vue({ el: '#app', data: () =&gt; ({ ...
Boostrap Vue Change Cell Text in B-table
javascript|vue.js|bootstrap-vue
0
69
1
72,988,314
72,988,314
1
true
2022-07-15T00:07:12.453Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Boostrap Vue Change Cell Text in B-table<p>In a b-table, each cell in a column should have different text color. Not the background of the cell, but the actu...
72,825,297
When working with blueprints, why do decorators required brackets?<p>I have a blueprint app and I'm trying to integrate <a href="https://github.com/Flask-Middleware/flask-security" rel="nofollow noreferrer">Flask-Security-Too</a>. In my blueprint I have two routes:</p> <pre><code>@core_bp.route(&quot;/&quot;) @auth_req...
<p>You need the parenthesis because there are 3 optional arguments that can be passed to the decorator as you can see here in line 275</p> <p><a href="https://github.com/Flask-Middleware/flask-security/blob/master/flask_security/decorators.py" rel="nofollow noreferrer">https://github.com/Flask-Middleware/flask-security...
When working with blueprints, why do decorators required brackets?
python|flask|python-decorators|flask-security
0
69
1
72,826,055
72,826,055
1
true
2022-07-01T06:43:26.483Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: When working with blueprints, why do decorators required brackets?<p>I have a blueprint app and I'm trying to integrate <a href="https://github.com/Flask-Mid...
72,794,511
How to test if a model has a custom macro method that is called during execution in Rspec<p>In my model, I run the method <code>redefine_associations!</code> during execution:</p> <pre><code># frozen_string_literal: true class MyModule &lt; AnotherModule redefine_associations! end class AnotherModule &lt; Applicatio...
<p>Since this is a macro method, the easiest way to test this would be:</p> <pre><code> let(:class_file_array) do File.readlines(Rails.root.join('app/models/my_module.rb')) end it 'calls redefine_associations!' do expect(class_file_array.include?(&quot; redefine_associations!\n&quot;)).to be true end <...
How to test if a model has a custom macro method that is called during execution in Rspec
ruby-on-rails|ruby|rspec
1
69
2
72,803,996
72,803,996
1
true
2022-06-29T00:28:02.197Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to test if a model has a custom macro method that is called during execution in Rspec<p>In my model, I run the method <code>redefine_associations!</code>...
72,936,078
Find the closest value upper and lower from reference value in pandas df<p>I'm trying to find the closest value upper and lower to an other value(price). My code only show the closest value, no matter if it's up or down.</p> <p>DF</p> <pre><code> SYMBOL price gainddS8 gainddS7_5 gainddS7 gainddS6...
<p>Given your data frame:</p> <pre class="lang-py prettyprint-override"><code>import pandas as pd df = pd.DataFrame( {&quot;Symbol&quot;: [&quot;1000SHIBUSDT&quot;, &quot;ADAUSDT&quot;, &quot;ALGOUSDT&quot;], &quot;Price&quot;: [0.016049, 0.572700, 0.391300], &quot;gainddS8&quot;: [-1.1, -15.371514, -1....
Find the closest value upper and lower from reference value in pandas df
python|pandas|numpy
0
69
1
72,936,500
72,936,500
1
true
2022-07-11T09:06:51.163Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find the closest value upper and lower from reference value in pandas df<p>I'm trying to find the closest value upper and lower to an other value(price). My ...
72,833,900
GitHub action trigger on package<p>I'm trying to create a github action that triggers once a new registry_package (trying to target a specific one) is uploaded to the org. I've gone through all the documentation I can find with various versions and iterations of this, but none of them work for me. So far, this is the o...
<p>So the issue appears to be related to the fact that I'm using docker images for my stuff. From GitHub support: &quot;At the moment, the events that can trigger a workflow are those occurring on the repository itself. When you publish a container package on GitHub Packages, you are publishing the package at the organ...
GitHub action trigger on package
package|github-actions|release
1
69
2
72,886,166
72,886,166
1
true
2022-07-01T19:34:02.100Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GitHub action trigger on package<p>I'm trying to create a github action that triggers once a new registry_package (trying to target a specific one) is upload...
72,889,412
How to replace null value of object into list without for expression<p>How i can do this code with stream and lambda functions, in JAVA 8:</p> <pre><code>//Replace null values with &quot;NO&quot; for (Product product: listProduct) { if(product.getIsBreakStock().equals(null)) product.setIsBreakS...
<p>maybe this will help</p> <pre><code> listProduct.stream().filter(p -&gt; p.getIsBreakStock() == null).peek(p -&gt; p.setIsBreakStock(&quot;NO&quot;) ).collect(Collectors.toList()); </code></pre>
How to replace null value of object into list without for expression
java|spring|lambda|collections|java-stream
0
69
1
72,889,520
72,889,520
1
true
2022-07-06T20:18:43.790Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to replace null value of object into list without for expression<p>How i can do this code with stream and lambda functions, in JAVA 8:</p> <pre><code>//R...
72,903,538
How can I filter out files with a shebang from those passed to xargs?<h3>TL;DR</h3> <p>I'm trying to write a simple script that compiles all <code>.swift</code> files in a given folder and any of it's subfolders, but which excludes those files that start with a shebang.</p> <h3>The Details</h3> <p>I'm trying to write a...
<p>You can run a loop with output of <code>find</code> command and run a <code>grep</code> inside:</p> <pre class="lang-bash prettyprint-override"><code>while IFS= read -rd '' f; do grep -qF '#! /usr/bin/env swift' &quot;$f&quot; || printf '%s\0' &quot;$f&quot; done &lt; &lt;(find . -type f -name &quot;*.swift&quot;...
How can I filter out files with a shebang from those passed to xargs?
bash|shell|awk|grep|zsh
1
69
3
72,903,822
72,903,822
1
true
2022-07-07T19:55:27.867Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I filter out files with a shebang from those passed to xargs?<h3>TL;DR</h3> <p>I'm trying to write a simple script that compiles all <code>.swift</co...
72,918,962
Way to calculate the top x% of users from a database<p>I was wondering if there was an actually good way to aggregate/calculate percentiles based on all data in a database. For example, data like:</p> <pre><code>{ 'name':'John' 'rank':5 }, { 'name':'John' 'rank':4 }, { 'name':'John' 'rank':5 }, { 'name':'James' 'rank':...
<p><em>emphasized text</em>You can do something like:</p> <pre><code>db.collection.aggregate([ { $group: { _id: &quot;$name&quot;, rankFiveCount: {$sum: {$cond: [{$eq: [&quot;$rank&quot;, 5]}, 1, 0]}}} }, { $setWindowFields: { sortBy: {rankFiveCount: -1}, output: { rank: {$...
Way to calculate the top x% of users from a database
python|mongodb|aggregate|pymongo|percentile
0
69
2
72,920,675
72,920,675
1
true
2022-07-09T04:34:01.480Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Way to calculate the top x% of users from a database<p>I was wondering if there was an actually good way to aggregate/calculate percentiles based on all data...
72,965,352
Get current process id when using `concurrent.futures.ProcessPoolExecutor`<p>I am using <code>concurent.futures.ProcessPoolExecutor</code> has a <em>high level</em> API to multiprocessing.</p> <p>I want to identify the current process in the worker functions.</p> <p>With the <em>low level</em> API <code>multiprocessing...
<p>Since each execution happens in a separate process, you can simply do</p> <pre><code>import os def worker(): # Get the process ID of the current process pid = os.getpid() .. .. do something with pid </code></pre> <p>For example,</p> <pre><code>from concurrent.futures import ProcessPoolExecutor import os i...
Get current process id when using `concurrent.futures.ProcessPoolExecutor`
python|multiprocessing
0
69
1
72,965,937
72,965,937
1
true
2022-07-13T11:16:27.207Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get current process id when using `concurrent.futures.ProcessPoolExecutor`<p>I am using <code>concurent.futures.ProcessPoolExecutor</code> has a <em>high lev...
72,939,322
Cypress recording<p>just wanted to ask if this is possible to change the location folder for recorded file? I am running tests for two different applications, one after another, and when tests are finished for both of them, I can only access the latest recording.</p> <p>Thanks in advance!</p>
<p>You can add <code>videosFolder</code> attribute in your <a href="https://docs.cypress.io/guides/references/configuration#Folders-Files" rel="nofollow noreferrer">cypress config file</a> with the folder path.</p> <pre class="lang-js prettyprint-override"><code>videosFolder: 'cypress/videos_project_2' </code></pre> <p...
Cypress recording
cypress|e2e-testing|video-recording|cypress-configuration
1
69
2
72,939,364
72,939,364
1
true
2022-07-11T13:25:27.400Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cypress recording<p>just wanted to ask if this is possible to change the location folder for recorded file? I am running tests for two different applications...
72,833,109
How to update Sorting Algorithm Visualization?<p>I have been making a sorting algorithm visualizer in Java using Java Swing and AWT and coded insertion sort to see if it would be able to work. The algorithm works in the sense that when this program is run you can shuffle and sort the algorithm using insertion short but...
<p>Call an action with a <a href="https://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html" rel="nofollow noreferrer">swing timer</a> every second that will return an intermediate array. Then paint this intermediate array. Repeat until the array is sorted.</p> <p>To obtain an intermediate array, modify the Inser...
How to update Sorting Algorithm Visualization?
java|algorithm|user-interface|visualization
1
69
1
72,858,027
72,858,027
1
true
2022-07-01T18:03:28.667Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to update Sorting Algorithm Visualization?<p>I have been making a sorting algorithm visualizer in Java using Java Swing and AWT and coded insertion sort ...
72,855,682
How to fix " TypeError: list indices must be integers or slices, not str. "?<p>I'm trying to scrape a website. I want to be able to retrieve a URL link from this webpage and use it to get to another page wherein I can access this information that I need.</p> <pre><code>import requests from bs4 import BeautifulSoup hea...
<p>There are two main issues:</p> <ul> <li><p>You are not iterating the <code>ResultSet</code> of urls, you push <code>table</code> as list of urls to your function.</p> </li> <li><p>Your urls become invalid, while prepending <code>baseUrl</code>, just try to use <code>jobUrl = link['href']</code> cause path is absolut...
How to fix " TypeError: list indices must be integers or slices, not str. "?
python|web-scraping|beautifulsoup
0
69
1
72,855,990
72,855,990
1
true
2022-07-04T11:01:03.390Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to fix " TypeError: list indices must be integers or slices, not str. "?<p>I'm trying to scrape a website. I want to be able to retrieve a URL link from ...
72,945,679
How do I create an one-dimensional array of strings in C?<p>I ask this question here bc I haven't found a good one yet. I've seen some videos where a 2D array is created to store the strings, but I wanted to know if it is possible to make a 1D array of strings, thx.</p>
<p><strong>NOTE:</strong> In C, a string is an array of characters.</p> <pre class="lang-c prettyprint-override"><code>//string char *s = &quot;string&quot;; //array of strings char *s_array[] = { &quot;array&quot;, &quot;of&quot;, &quot;strings&quot; }; </code></pre> <p><strong>Example</strong...
How do I create an one-dimensional array of strings in C?
arrays|c|string
-1
69
1
72,945,700
72,945,700
1
true
2022-07-11T23:45:33.917Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I create an one-dimensional array of strings in C?<p>I ask this question here bc I haven't found a good one yet. I've seen some videos where a 2D arra...
72,808,803
Looping through Variable URLs to retrieve HREF tags with BeautifulSoup<p>I'm very new to Python and think I'm 95% there on this one, but truly can't figure out what could be wrong while troubleshooting:</p> <p>I'm looking to loop through 50,000 URLs, but the only thing changing in the URL is the final number</p> <p>Ess...
<p>You were trying to select a list of elements from an element that sometimes is <code>None</code>.</p> <p>Try this:</p> <pre><code>import requests from bs4 import BeautifulSoup profiles = [] for page in range(1, 50000): req = requests.get(&quot;https://basketball.realgm.com/player/Carmelo-Anthony/Summary/{page}...
Looping through Variable URLs to retrieve HREF tags with BeautifulSoup
python|web-scraping|beautifulsoup|href
0
69
1
72,809,551
72,809,551
1
true
2022-06-29T23:20:43.107Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Looping through Variable URLs to retrieve HREF tags with BeautifulSoup<p>I'm very new to Python and think I'm 95% there on this one, but truly can't figure o...
72,935,418
Golang create custom validator that executes method of an interface<p>I am trying to create my own validator for gin, but I want it to be &quot;generic&quot;, so let's say, I want to have an interface IsValid</p> <pre><code>type IsValid interface { IsValid() bool } </code></pre> <p>, and make some structs to have b...
<p>The <a href="https://pkg.go.dev/gopkg.in/go-playground/validator.v9#FieldLevel" rel="nofollow noreferrer"><code>FieldLevel</code></a> type has this method:</p> <pre class="lang-golang prettyprint-override"><code>// returns current field for validation Field() reflect.Value </code></pre> <p><a href="https://pkg.go.de...
Golang create custom validator that executes method of an interface
validation|go|go-playground
-1
69
1
72,938,192
72,938,192
1
true
2022-07-11T08:03:20.573Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Golang create custom validator that executes method of an interface<p>I am trying to create my own validator for gin, but I want it to be &quot;generic&quot;...
73,022,935
Iterating over a vector gives me a different value than what is inside the vector Rust<p>I have been using Petgraph recently to make simple graphs with Structs for nodes and custom edges, but I have come across a problem which I am unsure if it comes from the library or Rust.</p> <p>I have a graph, in which I have mult...
<p><code>graph.add_node()</code> returns a <a href="https://docs.rs/petgraph/latest/petgraph/graph/struct.NodeIndex.html" rel="nofollow noreferrer"><code>petgraph::graph::NodeIndex</code></a>. But you <code>use</code>d <a href="https://docs.rs/petgraph/latest/petgraph/adj/type.NodeIndex.html" rel="nofollow noreferrer">...
Iterating over a vector gives me a different value than what is inside the vector Rust
rust|petgraph
0
69
1
73,023,382
73,023,382
1
true
2022-07-18T13:16:40.203Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Iterating over a vector gives me a different value than what is inside the vector Rust<p>I have been using Petgraph recently to make simple graphs with Struc...
73,016,793
Lotus string matching Questionnaire system<p>I have two string,must be split matching,and need 100% the same count matches,how do this? Thanks a lot for help</p> <p>string A(Reply)</p> <pre><code>&quot;01: 2&quot; &quot;02: 2; 3&quot; &quot;03: 3; 4&quot; &quot;04: 3&quot; &quot;05: 2; 4&quot; &quot;06: 3&quot; &quot;...
<p>Your question is still quite hard to understand.<br /> This is what I understand:<br /> You have a document with two multi value fields and want to compare these and count the &quot;equal&quot; values:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Field A(reply)</th> <th>Field B(answer...
Lotus string matching Questionnaire system
lotus-notes|lotus-domino|lotusscript|lotus
1
69
1
73,019,363
73,019,363
1
true
2022-07-18T02:36:05.350Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Lotus string matching Questionnaire system<p>I have two string,must be split matching,and need 100% the same count matches,how do this? Thanks a lot for hel...
72,823,223
PySpark config through airflow<p>I'm trying to pass <code>packages org.apache.spark:spark-avro_2.12:2.4.3</code> through <code>SparkSubmitOperator</code> to the config as described here: <a href="https://spark.apache.org/docs/2.4.3/sql-data-sources-avro.html" rel="nofollow noreferrer">https://spark.apache.org/docs/2.4...
<p>The <code>SparkSubmitOperator</code> relies on the <code>SparkSubmitHook</code> which at the end composes a <a href="https://github.com/apache/airflow/blob/2.3.2/airflow/providers/apache/spark/hooks/spark_submit.py#L253" rel="nofollow noreferrer"><code>spark-submit</code> CLI command</a> to be executed.</p> <p>In th...
PySpark config through airflow
apache-spark
0
69
1
72,826,977
72,826,977
1
true
2022-07-01T00:16:39.127Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PySpark config through airflow<p>I'm trying to pass <code>packages org.apache.spark:spark-avro_2.12:2.4.3</code> through <code>SparkSubmitOperator</code> to ...
72,933,508
SDL2: Why a figure "blinks"?<p>I'm trying to move a square in a rectangle in SDL, but when i launch it, the rectangle and the square &quot;blinks&quot; until I move the square with up, left, right or down. When the square moves, the rectangle stop blinking and only the square keeps blinking. How can i move it without t...
<p>As @HolyBlackCat <a href="https://stackoverflow.com/questions/72933508/sdl2-why-a-figure-blinks-c-language/72939531#comment128818798_72933508">pointed out</a>, you should only call <code>SDL_RenderPresent()</code> once per frame, not once per shape or keypress:</p> <pre><code>#include &lt;SDL.h&gt; #include &lt;SDL_...
SDL2: Why a figure "blinks"?
c|sdl|sdl-2
2
69
1
72,939,531
72,939,531
1
true
2022-07-11T03:48:32.677Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SDL2: Why a figure "blinks"?<p>I'm trying to move a square in a rectangle in SDL, but when i launch it, the rectangle and the square &quot;blinks&quot; until...
72,793,780
What is causing this error in leetcode problem<p>I am solving an easy question but having this error at solving for <code>&quot;()[]{}&quot;</code>.</p> <p>Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.</p> <p>An input string is valid if:</p> <p>...
<p>Your code is assuming that nothing will be opened after a close bracket. As your simple example shows, the string is not necessarily going to be symmetrical at all. Another simple example is something like <code>(())()</code>.</p> <p>This problem requires a stack, since you need to keep track of a potentially infini...
What is causing this error in leetcode problem
python|algorithm
0
69
1
72,794,529
72,794,529
1
true
2022-06-28T22:25:38.387Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is causing this error in leetcode problem<p>I am solving an easy question but having this error at solving for <code>&quot;()[]{}&quot;</code>.</p> <p>G...
72,396,255
How to convert Sympy formulas like "arctg(5)+..." to float values in list?<p>I have system of differential equations. I must do the Jacobian Matrix, and get it to the method, to find the stability step by using 2/max(abs(eigenvalue)) = hst</p> <p>I am trying to make it like this</p> <pre><code> x, y, z = symbols(&quot...
<p>When expressions involving <code>arctg</code> were sympified, unknown functions of that name were created. You should replace them with <code>atan</code>:</p> <pre><code>&gt;&gt;&gt; eq=S('-3*arctg(x)') &gt;&gt;&gt; eq.subs(Function('arctg'), atan) -3*atan(x) </code></pre> <p>Maybe like this:</p> <pre><code>&gt;&gt;...
How to convert Sympy formulas like "arctg(5)+..." to float values in list?
python|matrix|typeerror|sympy
0
69
1
72,398,602
72,398,602
1
true
2022-05-26T18:11:13.780Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert Sympy formulas like "arctg(5)+..." to float values in list?<p>I have system of differential equations. I must do the Jacobian Matrix, and get ...
72,355,485
Installing knative on existing kind cluster<p>I have an existing kind k8s cluster with a bunch of running services and <code>nginx-ingress</code> setup and I would like to add knative to it.</p> <p>Is there a way of doing this with <code>nginx-ingress</code>, seems like networking for knative is a bit more complex than...
<p>Knative needs more capabilities out of the HTTP routing layer than are exposed via the Kubernetes Ingress resource. (Percentage splits and header rewrite are two of the big ones.)</p> <p>Unfortunately, so one has written an adapter from Knative's &quot;KIngress&quot; implementation to the <code>nginx</code> ingress....
Installing knative on existing kind cluster
kubernetes|knative|kind
0
69
1
72,408,178
72,408,178
1
true
2022-05-23T22:39:45.247Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Installing knative on existing kind cluster<p>I have an existing kind k8s cluster with a bunch of running services and <code>nginx-ingress</code> setup and I...
72,375,119
django: CourseNote() got an unexpected keyword argument 'user'<p>I'm writing a function to save notes to the database from a form but it keeps throwing this error <code>CourseNote() got an unexpected keyword argument 'user'</code> and I don't seem to know where this error is coming from.</p> <p>views.py:</p> <pre class...
<p>@sunderam-dubey <em><strong>It is not good practice to name same your view and model, kindly change it</strong></em></p>
django: CourseNote() got an unexpected keyword argument 'user'
python|django|django-models|django-views|django-urls
1
69
1
72,445,805
72,445,805
1
true
2022-05-25T09:32:02.603Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: django: CourseNote() got an unexpected keyword argument 'user'<p>I'm writing a function to save notes to the database from a form but it keeps throwing this ...
72,310,951
Flutter async await not functioning in order<p>I am working on a project where I have employees scan items into a bin. I am trying to load the information from the database. I have looked at many different posts and found things similar, but never anything that worked.</p> <p>I have a list (binListDBList) that I am add...
<p>You currently are doing:</p> <blockquote> <pre class="lang-dart prettyprint-override"><code> binListCollection .doc(employeeID) .collection(binName) .snapshots() .forEach((element) { ... }); </code></pre> </blockquote> <p><a href="https://pub.dev/documentation/cloud_fires...
Flutter async await not functioning in order
flutter|dart|asynchronous|async-await
0
69
1
72,311,487
72,311,487
1
true
2022-05-19T20:53:32.203Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter async await not functioning in order<p>I am working on a project where I have employees scan items into a bin. I am trying to load the information fr...
72,266,418
Why is the function not called by Start-ThreadJob?<p>I want to backup some data over my script. All data shall be zipped in a separate thread. But two things go wrong:</p> <ol> <li>The function testFct is never called - indication: no &quot;inside: ...&quot;.</li> <li>The parameter ZipSource is missing - see output.</l...
<p>Since <code>testFct</code> doesn't exist in the scope of your ThreadJob, you need to first store the function's definition and then pass it to the runspace scope and define the function there as demonstrated in <a href="https://stackoverflow.com/a/61273544/15339544">this answer</a>.</p> <p>The other issue is trying ...
Why is the function not called by Start-ThreadJob?
powershell|powershell-7.0|powershell-7.2
4
69
1
72,266,633
72,266,633
1
true
2022-05-16T22:53:31.773Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is the function not called by Start-ThreadJob?<p>I want to backup some data over my script. All data shall be zipped in a separate thread. But two things...
72,244,876
plainToClass to call object.method() in web worker thread<p>I am using angular, trying to pass an object to the web worker for the background process. the class is</p> <pre><code>Article{ method1(); propertyA; } </code></pre> <pre><code>addEventListener('message', ({ data }) =&gt; { // if without plainToClass, ho...
<p>Passing data to a Web worker is done by <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#transferring_data_to_and_from_workers_further_details" rel="nofollow noreferrer">serializing the object</a>, so you won't be able to pass in behavior. Instead, you'll need to either use...
plainToClass to call object.method() in web worker thread
angular|web-worker|reflect-metadata
0
69
1
72,245,593
72,245,593
1
true
2022-05-15T01:06:06.367Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: plainToClass to call object.method() in web worker thread<p>I am using angular, trying to pass an object to the web worker for the background process. the cl...
72,383,582
Reverse a Map which has A Set as its value using HOF<p>I am trying to reverse a map that has a String as the key and a set of numbers as its value</p> <p>My goal is to create a list that contains a tuple of a number and a list of strings that had the same number in the value set</p> <p>I have this so far:</p> <pre><cod...
<p>This works to, but it's not exactly what you might need and you may need some conversions to get the exact data type you need:</p> <pre class="lang-scala prettyprint-override"><code>toFlip.foldLeft(Map.empty[Int, Set[String]]) { case (acc, (key, numbersSet)) =&gt; numbersSet.foldLeft(acc) { (updati...
Reverse a Map which has A Set as its value using HOF
scala
0
69
3
72,383,955
72,383,955
1
true
2022-05-25T20:04:39.413Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reverse a Map which has A Set as its value using HOF<p>I am trying to reverse a map that has a String as the key and a set of numbers as its value</p> <p>My ...
72,255,611
How to read the headers of a csv file using csv module in "rb" mode?<p>I am currently reading the csv file in <code>&quot;rb&quot;</code> mode and uploading the file to an s3 bucket.</p> <pre><code>with open(csv_file, 'rb') as DATA: s3_put_response = requests.put(s3_presigned_url,data=DATA,headers=headers) </code><...
<p>Doing what you want is possible but not very efficient. Simply opening a file isn't that expensive. The CSV reader only reads only line at a time, not the entire file.</p> <p>To do what you want you have to :</p> <ol> <li>Read the first line as bytes</li> <li>Decode it into a string (using the correct encoding)</li>...
How to read the headers of a csv file using csv module in "rb" mode?
python|csv
0
69
1
72,255,995
72,255,995
1
true
2022-05-16T07:34:31.657Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to read the headers of a csv file using csv module in "rb" mode?<p>I am currently reading the csv file in <code>&quot;rb&quot;</code> mode and uploading ...
72,245,556
Identify if Socket server is running from client side<p>When the socket server is not running, client-side java script codes creates a connection, and then socket.onopen creates a fetal error and the javascript compiler stops executing.</p> <p>There is apparently no way to detect if socket server is running or not.</p...
<blockquote> <p>There is apparently no way to detect if socket server is running or not.</p> </blockquote> <p>Not specifically, by design. Differentiating <em>why</em> the connection fails is a security risk, per the WebSocket interface spec:</p> <p><a href="https://websockets.spec.whatwg.org/#feedback-from-the-protoco...
Identify if Socket server is running from client side
websocket
0
69
1
72,246,578
72,246,578
1
true
2022-05-15T04:41:37.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Identify if Socket server is running from client side<p>When the socket server is not running, client-side java script codes creates a connection, and then ...
72,326,109
Already defined in dllmain.obj<p>I'm trying to clean a bit my code moving some parts to they .h and .cpp files.</p> <p>The problem is that when I try to compile, I get a &quot;already defined&quot; error.</p> <p>I know there are several questions like this one. But I've checked several times and I don't see any duplica...
<p><code>functions.h</code> declares a bunch of global variables. Any <code>.cpp</code> file that includes <code>functions.h</code> (ie, by including <code>includes.h</code>) will get <em>its own copy</em> of those variables. Hence, the &quot;already defined&quot; errors when the linker tries to bring the compiled un...
Already defined in dllmain.obj
c++
0
69
1
72,326,199
72,326,199
1
true
2022-05-21T01:52:13.193Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Already defined in dllmain.obj<p>I'm trying to clean a bit my code moving some parts to they .h and .cpp files.</p> <p>The problem is that when I try to comp...
72,260,294
How to listen for clicks on dynamically generated buttons in TableCell?<p>I have a class Task that takes field values from the database and is displayed as a row in the table.</p> <pre><code>package com.example.javafxapp.models; import javafx.scene.control.Button; import javafx.scene.layout.HBox; public class Task { ...
<p>Your model class <code>Task</code> should not have any Ui components in it. It should look something like</p> <pre><code>public class Task { private String id; private String task; public Task(String id, String task) { this.id = id; this.task = task; } public String getId() { ...
How to listen for clicks on dynamically generated buttons in TableCell?
java|button|events|javafx|actionlistener
-2
69
1
72,273,688
72,273,688
1
true
2022-05-16T13:49:11.087Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to listen for clicks on dynamically generated buttons in TableCell?<p>I have a class Task that takes field values from the database and is displayed as a...
72,393,237
Loss of precision in decimal display of double<p>Why is there a discrepancy in the display of the following value?</p> <pre><code>double x = (double)988530483551494912L; System.out.printf(&quot;%f%n&quot;, x); -&gt; 988530483551494910.000000 System.out.println(Double.toString(x)); -&gt; 9.8853048355149491E17 ...
<p>Thanks to @user16320675's comment, I'm answering my own question. The reason is that the number <code>988530483551494912L</code> has precision beyond the limit of the <code>double</code> type's precision, and <code>Double.toString()</code> (and similarly <code>%f</code>) will, as per documentation, only use the mini...
Loss of precision in decimal display of double
java|double|precision
3
69
1
72,402,278
72,402,278
1
true
2022-05-26T14:12:44.917Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Loss of precision in decimal display of double<p>Why is there a discrepancy in the display of the following value?</p> <pre><code>double x = (double)98853048...
72,306,270
Iterate over files in GitHub repo from a Jupyter Notebook inside the repo<p>I have this folder in my GitHub repo:</p> <p><a href="https://i.stack.imgur.com/mPufu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mPufu.png" alt="enter image description here" /></a></p> <p>Inside this repo, I have a Jupy...
<p>Your third option works fine.</p> <p>I just tested that and a variation at <a href="https://mybinder.org/v2/gh/ran-pelta/CloudTool/7bd082bb3cf7b2e202dc43841fc60e7796c7402a" rel="nofollow noreferrer">https://mybinder.org/v2/gh/ran-pelta/CloudTool/7bd082bb3cf7b2e202dc43841fc60e7796c7402a</a> , which uses the repo befo...
Iterate over files in GitHub repo from a Jupyter Notebook inside the repo
python-3.x|github|jupyter-notebook
0
69
1
72,310,158
72,310,158
1
true
2022-05-19T14:19:47.597Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Iterate over files in GitHub repo from a Jupyter Notebook inside the repo<p>I have this folder in my GitHub repo:</p> <p><a href="https://i.stack.imgur.com/m...
72,396,269
validate data using map function<p>I would like to validate data using map.I would like to get the key name and check some conditions</p> <pre><code>const obj = { firstName: ['errorFirstName', 'msgFirstName'], lastName: ['errorLastName', 'msgLastName'], middleName: ['errorMiddleName', 'msgMiddleName'], } ...
<p>Simply use the key <code>field</code> to retrieve the value from your object:</p> <pre><code>const obj = { firstName: ['errorFirstName', 'msgFirstName'], lastName: ['errorLastName', 'msgLastName'], middleName: ['errorMiddleName', 'msgMiddleName'], } Object.keys(obj).forEach(fieldName =&gt; { if (this[fieldNa...
validate data using map function
vue.js
0
69
1
72,396,357
72,396,357
1
true
2022-05-26T18:12:32.043Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: validate data using map function<p>I would like to validate data using map.I would like to get the key name and check some conditions</p> <pre><code>const ob...
72,362,855
spring boot MVC: how to redirect to a view<p>I try to do a java web application using SpringBoot and the MVC pattern. How to redirect to a view (html page) from this kind of function located in my controller:</p> <pre><code>@RequestMapping(value=&quot;/authentification&quot;, method= RequestMethod.POST) public @Res...
<p>you won't be able to redirect to a page this way, you're returning the body of a response. you must not include @ResponseBody in the method signature, so that spring understands that it should look for a page.</p> <p>your method needs to be like:</p> <pre><code>@RequestMapping(value=&quot;/authentification&quot;, me...
spring boot MVC: how to redirect to a view
java|spring-mvc
0
69
1
72,368,582
72,368,582
1
true
2022-05-24T12:25:03.387Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: spring boot MVC: how to redirect to a view<p>I try to do a java web application using SpringBoot and the MVC pattern. How to redirect to a view (html page) f...
72,303,289
Why is the signature different for these two Standard ML functions?<p>I am trying to implement a function that checks whether or not a list is empty (similar to <code>List.null</code>).</p> <p>This has signature <code>val isEmpty = fn: ''a list -&gt; bool</code>:</p> <pre class="lang-ml prettyprint-override"><code>fun ...
<p>A big hint to what is happening here is that (in SML/NJ) the first definition triggers <code>Warning: calling polyEqual</code>. It is based on a list comparison, but in SML that only makes sense for equality types. Your first definition fails when you do something like</p> <pre><code>isEmpty [1.0, 2.1]; </code></pre...
Why is the signature different for these two Standard ML functions?
sml
1
69
2
72,303,525
72,303,525
1
true
2022-05-19T10:55:50.590Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is the signature different for these two Standard ML functions?<p>I am trying to implement a function that checks whether or not a list is empty (similar...
72,313,021
How to Add Space Between Product Card HTML<p>I am having a serious problem when creating a HTML and CSS product card page. I managed to create one product card page successfully as below:</p> <p><a href="https://i.stack.imgur.com/szK7x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/szK7x.png" alt="s...
<p>This is piggy backing off of what Mhiko said. Put the cards in a parent div and use display grid with a grid gap. Sizing will need to be adjusted, but this is a quick example.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="...
How to Add Space Between Product Card HTML
javascript|html|css
-2
69
2
72,313,223
72,313,223
1
true
2022-05-20T02:44:25.753Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Add Space Between Product Card HTML<p>I am having a serious problem when creating a HTML and CSS product card page. I managed to create one product ca...
72,303,871
get lead value based on rankings<p>I'm trying to get the lead value based on rankings. Example: for rank #1 (using rank window function), I would need the value of a certain column for rank#2. My problem is, if there's a tie in rank#1 (like 2 rows tied at rank#1) the prior value that i'm getting for row#1 is correct (c...
<p>Your sample is too small to verify the query logic. Depending on the real data, below query may not work as expected. But hope this will be helpful for you to approach your problem.</p> <pre class="lang-sql prettyprint-override"><code>-- Sample Table CREATE TEMP TABLE sample ( employee STRING, col_date STRING, ...
get lead value based on rankings
sql|google-bigquery
0
69
1
72,306,512
72,306,512
1
true
2022-05-19T11:37:58.953Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: get lead value based on rankings<p>I'm trying to get the lead value based on rankings. Example: for rank #1 (using rank window function), I would need the va...
72,288,940
JSR223 Pre Processor code should run for only HTTP Sampler<p>I have a <strong>JSR223 Preprocessor</strong> code given below:</p> <pre><code>String method = sampler.getMethod(); </code></pre> <p>JMeter Test Plan given below:</p> <pre><code> - JSR223 Pre Processor - HTTP Sampler - JSR223 Sampler / Any o...
<p>Check if HTTP Sampler before:</p> <pre><code>if (sampler instanceof org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase) { String method = sampler.getMethod(); } </code></pre> <p>Similar code in <a href="https://github.com/apache/jmeter/blob/c7279348335b820c35ee570462cb2e0b4eb1c370/src/protocol/http/src/mai...
JSR223 Pre Processor code should run for only HTTP Sampler
jmeter|jsr223
1
69
2
72,289,097
72,289,097
1
true
2022-05-18T12:10:11.790Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JSR223 Pre Processor code should run for only HTTP Sampler<p>I have a <strong>JSR223 Preprocessor</strong> code given below:</p> <pre><code>String method = s...
72,265,681
Shell script while loop inside a for loop<p>with tcsh, I want to print &quot;Hello&quot; for each x,y, z, e, and f. But with the following script, it only prints x. Can someone tell me how to print &quot;Hello&quot; also for y, z, e, and f?</p> <pre><code>#! /bin/tcsh -f set arr=(x y z e f) set j = 0 foreach i ($arr) ...
<p>Move the initialization of the 'j' variable inside the foreach loop:</p> <pre><code>#! /bin/tcsh -f set arr=(x y z e f) foreach i ($arr) echo $i set j = 0 while ($j &lt; 5) echo &quot;Hello&quot; @ j++ end end </code></pre> <p>Output:</p> <pre><code>$ ./s.sh x Hello Hello He...
Shell script while loop inside a for loop
shell|tcsh
0
69
1
72,265,799
72,265,799
1
true
2022-05-16T21:11:45.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Shell script while loop inside a for loop<p>with tcsh, I want to print &quot;Hello&quot; for each x,y, z, e, and f. But with the following script, it only pr...
72,248,334
Hello, when i try to print from my class, i get this error:<p>Code:</p> <pre class="lang-py prettyprint-override"><code>class Passangers(): def __init__(self, passangerNames, nationalities, age, gender): self.passangerNames = passangerNames self.nationalities = nationalities self.age = age...
<p>Make sure you actually call the method. The way you are doing it, you are just referencing the function object. Instead do, <code>print(passangers_return.data_base_update())</code></p> <p>In addition, if you are wanting to get <code>passanger_list</code> back from the function, add <code>return passanger_list</code>...
Hello, when i try to print from my class, i get this error:
python|error-handling|printing
0
69
1
72,248,418
72,248,418
1
true
2022-05-15T12:38:15.343Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hello, when i try to print from my class, i get this error:<p>Code:</p> <pre class="lang-py prettyprint-override"><code>class Passangers(): def __init__(...
72,246,442
Specify colors in a Gadfly (Julia) boxplot<p>I am trying to reproduce <a href="https://seaborn.pydata.org/examples/grouped_boxplot.html" rel="nofollow noreferrer">this</a> Seaborn plot using Gadfly.</p> <p>The code I have so far is:</p> <pre><code>using CSV, DataFrames, Gadfly download(&quot;https://raw.githubusercont...
<p>You need to add a line with <code>Scale.color_discrete_manual</code>:</p> <pre><code>using CSV, DataFrames, Gadfly download( &quot;https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv&quot;, &quot;tips.csv&quot;, ) tips = DataFrame(CSV.File(&quot;tips.csv&quot;)); plot( tips, x = ...
Specify colors in a Gadfly (Julia) boxplot
colors|julia|seaborn|boxplot|gadfly
2
69
1
72,254,653
72,254,653
1
true
2022-05-15T07:49:41.853Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Specify colors in a Gadfly (Julia) boxplot<p>I am trying to reproduce <a href="https://seaborn.pydata.org/examples/grouped_boxplot.html" rel="nofollow norefe...
72,256,635
sed command to change value in .spec file<p>How to change a value in .spec file using sed? Want to change the <code>$nmatch</code> value of build to someother value say <code>&quot;build1.1&quot;</code>.</p> <pre><code>{ &quot;files&quot;: [ { &quot;aql&quot;: { &quot;items.find&quot;: { &quot;repo&quot;:...
<p>Your document format is json, so you should use jq for editing:</p> <pre><code>jq '.files[0].aql.&quot;items.find&quot;.&quot;$or&quot;[0].&quot;$and&quot;[0].name.&quot;$nmatch&quot;=&quot;build1.1&quot;' spec </code></pre> <p>With <em>sed</em>, you can't reliably access the correct name node. Your code doesn't wor...
sed command to change value in .spec file
json|linux|sed|jq
0
69
2
72,257,022
72,257,022
1
true
2022-05-16T09:03:23.027Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: sed command to change value in .spec file<p>How to change a value in .spec file using sed? Want to change the <code>$nmatch</code> value of build to someothe...
72,294,049
I have to ask about aborted(core dumped) error i get from this code<p>I got a segfault error while executing this code. It prints the largest of 5 numbers, and those numbers are stored in heap-memory.</p> <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main() { ...
<p>The real problem lies when you are <code>free()</code>-ing the <code>ptr</code>. Once, you increment a pointer its address jumps to next address allocated by <code>malloc()</code>. Always make sure that <code>*ptr</code> is same as <code>ptr[0]</code>. So, to fix this issue, you can decrement the <code>ptr</code> by...
I have to ask about aborted(core dumped) error i get from this code
c|pointers|dynamic-memory-allocation
1
69
1
72,294,403
72,294,403
1
true
2022-05-18T18:10:05.917Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I have to ask about aborted(core dumped) error i get from this code<p>I got a segfault error while executing this code. It prints the largest of 5 numbers, a...
72,267,088
How to change default selected item border rectange?<p>I found <code>QGraphicsEllipseItem</code>, <code>QGraphicsRectItem</code> and other items when them was selected,The Qt will draw a dotted-white rectangel border around it(like the picture bellow).So is that Qt place a <code>QWidget</code> or use <code>paint</code>...
<p>You must override the <code>paint</code> method:</p> <pre class="lang-py prettyprint-override"><code>from PyQt5.QtCore import Qt from PyQt5.QtGui import QColor, QPen from PyQt5.QtWidgets import ( QApplication, QGraphicsEllipseItem, QGraphicsItem, QGraphicsScene, QGraphicsView, QStyle, ) cla...
How to change default selected item border rectange?
python|pyqt|qgraphicsview
0
69
1
72,267,733
72,267,733
2
true
2022-05-17T00:53:32.247Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change default selected item border rectange?<p>I found <code>QGraphicsEllipseItem</code>, <code>QGraphicsRectItem</code> and other items when them wa...
72,302,115
understanding a x86 assembly program<p>I compiled a program in C which just sums all integers up to input. For example if input is 4 the output is 4+3+2+1=10.</p> <p>I am having a bit of a trouble understanding the assembly x86 version of this program.</p> <p>I wrote all the comments myself, please be so kind to indica...
<p>Your analysis is mostly correct with some small mistakes which I'll try to point out. I've taken the liberty to break your comments so they can be read without scrolling.</p> <p>Note that if you intend to pass off compiler output as hand written assembly, your teacher is very likely to catch this. Do not attempt t...
understanding a x86 assembly program
assembly|x86|reverse-engineering|att
2
69
1
72,310,706
72,310,706
2
true
2022-05-19T09:35:10.400Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: understanding a x86 assembly program<p>I compiled a program in C which just sums all integers up to input. For example if input is 4 the output is 4+3+2+1=10...
72,312,765
What is the right way to increase the hard and soft ulimits for a singularity-container image?<p>The task I want to complete: I need to run a python package inside of a singularity-container that is asking to open at least some 9704 files. This is the first I have heard of it and searching around this has something to ...
<p>Short answer:</p> <p>Change the value on the host OS.</p> <p>Long answer:</p> <p>In this instance, running a singularity container is best thought of as any other binary you're executing in your host OS. It creates its own separate environment, but otherwise it follows the rules and restrictions of the user running ...
What is the right way to increase the hard and soft ulimits for a singularity-container image?
containers|hpc|ulimit|singularity-container
0
69
1
72,350,356
72,350,356
2
true
2022-05-20T01:52:13.937Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the right way to increase the hard and soft ulimits for a singularity-container image?<p>The task I want to complete: I need to run a python package ...
72,370,096
Python printing many times over for single print<p>My code is:</p> <pre class="lang-py prettyprint-override"><code>for n in range(1,10000000): if n&gt;1: for i in range(2,n): if n % i == 0: break else: v = 2+n for i in range(2,v): ...
<p>The output is not random, but as the desired output is not defined, I'll start with explaining what the current algorithm actually does;<br /> The code can be split in to two main functionalities. The first functionality looks for a prime number <code>n</code>. If <code>n</code> is not prime, the code continues to t...
Python printing many times over for single print
python
2
69
2
72,371,166
72,371,166
2
true
2022-05-24T22:25:53.093Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python printing many times over for single print<p>My code is:</p> <pre class="lang-py prettyprint-override"><code>for n in range(1,10000000): if n&gt;...
72,390,986
Pandas dataframe list iteration with datetime<p>I have a job which runs every 15 mins and returns an IP array list like this</p> <pre><code>listofIPs = ['1.1.1.1', '2.2.2.2', '3.3.3.3'] </code></pre> <p>I maintain this in a masterlist.csv file against the date like this.</p> <pre><code>IP,Timestamp 1.1.1.1,2022-05-12_2...
<p>this should be the requested solution. It appends only the new IPs to the CSV file (I changed 1.1.1.1 to 1.1.1x as example):</p> <pre><code>import pandas as pd from datetime import datetime mainfile = 'masterlist.csv' runtime = datetime.strftime(datetime.now(), '%Y-%m-%d_%H%M') listofIPs = ['1.1.1.x', '2.2.2.2', '3...
Pandas dataframe list iteration with datetime
python|pandas|dataframe
0
69
2
72,391,830
72,391,830
2
true
2022-05-26T11:19:25.093Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas dataframe list iteration with datetime<p>I have a job which runs every 15 mins and returns an IP array list like this</p> <pre><code>listofIPs = ['1.1...
72,338,304
Cannot create Aspect file in Eclipse<p>I'm trying to add an Aspect class to my Aspect Project. I get this error:</p> <pre><code>An error has occurred. See error log for more details. class org.eclipse.ajdt.core.javaelements.AJCompilationUnit tried to access private field org.eclipse.jdt.internal.core.JavaElement.parent...
<p>AJDT works with Java 17 and 18, you just need to install the right version. The AJDT version also needs to match the Eclipse version.</p> <p>For more information, see the AspectJ quick guide about <a href="https://github.com/eclipse/org.aspectj/blob/master/docs/developer/IDE.md#eclipse" rel="nofollow noreferrer">set...
Cannot create Aspect file in Eclipse
java|eclipse|aspectj
-1
69
1
72,416,568
72,416,568
2
true
2022-05-22T14:05:39.983Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cannot create Aspect file in Eclipse<p>I'm trying to add an Aspect class to my Aspect Project. I get this error:</p> <pre><code>An error has occurred. See er...
72,377,103
remove first occurrence of duplicate column names data.table<p>What is the cleanest way to remove columns with duplicate names with the caveat that I want to keep the second occurrence (or another way, remove the first occurrence)?</p> <p>Given:</p> <pre><code>library(data.table) dt &lt;- structure(list(CERT_NUMBER = c...
<p>Here is a more flexible way:</p> <pre><code>g &lt;- as.integer(ave(names(dt), names(dt), FUN = length)) # for duplicated column names, keep the 1st occurrence dt[, g == 1 | (rowid(names(dt)) == 1), with = FALSE] # keep the 2nd occurrence dt[, g == 1 | (rowid(names(dt)) == 2), with = FALSE] # keep the 2nd and 3rd ...
remove first occurrence of duplicate column names data.table
r|data.table
2
69
2
72,391,585
72,391,585
2
true
2022-05-25T11:50:55.123Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: remove first occurrence of duplicate column names data.table<p>What is the cleanest way to remove columns with duplicate names with the caveat that I want to...
72,392,298
What are these symbols in 'bytes' type?<p>So, I have a single byte in bytes format looking something like that:</p> <pre><code>b'\xFF' </code></pre> <p>It is quite easy to understand that a single byte is the two symbols(0-F) after '\x'</p> <p>But sometimes the pattern doesn't match, containing more than two symbols af...
<p>It's a quirk of the way Python prints byte strings. If the byte value is one of the printable ASCII characters it will print that character; otherwise it prints the hex escape.</p> <p>Show <code>bytes(range(0x100))</code> to see it visually.</p> <p>To get a string that consistently uses hex escapes, you need to bui...
What are these symbols in 'bytes' type?
python|binary|byte
2
69
1
72,392,383
72,392,383
2
true
2022-05-26T13:05:04.653Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What are these symbols in 'bytes' type?<p>So, I have a single byte in bytes format looking something like that:</p> <pre><code>b'\xFF' </code></pre> <p>It is...
72,308,270
update a table by using for loop with parameters in C#<p>I have a table with some columns like <img src="https://i.stack.imgur.com/VOvJR.png" alt="this." /></p> <p>now I want to use a for loop to set</p> <pre><code>out_0 = 0, out_1 = 1, out_2 = 2, out_3 = 3, out_4 = 4 </code></pre> <p>so I update it with such code ...
<blockquote> <p>I'm still wondering why it didn't work by adding parameters?</p> </blockquote> <p>Identifiers such as table and column names cannot be parameterized in this way, only data. Your attempt effectively runs a query like this:</p> <pre><code>update exchange_out set 'out_1' = 1 where member_id = 6; </code></p...
update a table by using for loop with parameters in C#
c#|sql|sql-server
0
69
1
72,308,343
72,308,343
2
true
2022-05-19T16:46:04.717Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: update a table by using for loop with parameters in C#<p>I have a table with some columns like <img src="https://i.stack.imgur.com/VOvJR.png" alt="this." /><...
72,283,120
Sort feature doesn't seem to work. (Javascript)<p>I am looking to implement a price sorting feature where the user can use the drop-down to sort either by; 'high to low', or 'low to high'.</p> <p>The items I'm looking to sort by price are the w3-containers, as each are their own product.</p> <p>What instead happens, is...
<p>This &quot;corrected&quot; snippet below now works in a way, but there is a lot of repetition that could be removed. Also, it occured to me, that you are not merely sorting the divs but you are also destroying the initial structure that has a few <code>&lt;a&gt;</code> elements in it.</p> <p>The lines I changed are:...
Sort feature doesn't seem to work. (Javascript)
javascript|html|jquery|sorting
0
69
2
72,299,748
72,299,748
2
true
2022-05-18T04:12:27.970Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sort feature doesn't seem to work. (Javascript)<p>I am looking to implement a price sorting feature where the user can use the drop-down to sort either by; '...
72,318,894
Golang encoding xml doesn't map empty value to nil<p>I would like to map empty value from tag to nill value in my object e.g. I have this xml</p> <pre><code>&lt;Address&gt; &lt;city&gt;city&lt;/city&gt; &lt;streetNumber&gt;&lt;/streetNumber&gt; &lt;/Address&gt; </code></pre> <p>a my type is</p> <pre><code>type Ad...
<p>You may want to look at making <code>streetNumber</code> its own type with custom marshaling like what they're doing here with time format: <a href="https://www.programming-books.io/essential/go/custom-xml-marshaling-aa8105fe264b4b198647cbc718480ba1" rel="nofollow noreferrer">https://www.programming-books.io/essenti...
Golang encoding xml doesn't map empty value to nil
xml|go
1
69
1
72,325,449
72,325,449
2
true
2022-05-20T12:24:28.913Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Golang encoding xml doesn't map empty value to nil<p>I would like to map empty value from tag to nill value in my object e.g. I have this xml</p> <pre><code>...
72,260,948
PHP Foreach loop returns result twice<p>I am trying to generate a fill-in-the-blank text with php where the parts to be filled are stored in my SQL database with curly brakets.</p> <p>Fore example:</p> <blockquote> <p>7 5 10 7 21 17 68 {63} {315}</p> </blockquote> <p>{63} and {315} should be replaced by inputs type tex...
<p>You can use <code>preg_replace_callback</code> as approach:</p> <pre><code>$chapitre_name = preg_replace_callback( $regex, function($matches) use($chapitre_id) { return '&lt;input type=&quot;text&quot; name=&quot;'.$chapitre_id.'&quot; value=&quot;'.$matches[1].'&quot; size=&quot;'.strlen($matches[0...
PHP Foreach loop returns result twice
php
1
69
1
72,261,922
72,261,922
2
true
2022-05-16T14:35:46.970Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP Foreach loop returns result twice<p>I am trying to generate a fill-in-the-blank text with php where the parts to be filled are stored in my SQL database ...
72,346,450
Find all possible paths in a recursive way<p>Sorry because this question may sound very noob for a lot of people but I am absolutely bad at recursion and need some help.</p> <p>Here is the model:</p> <pre><code>struct Chain { let initialId: Int let chains: [SubChain] } struct SubChain { let id: Int let...
<p>You don't need two different struct types for Chain and SubChain.</p> <p>For recursion, you need to make a <em>function</em>, and it has to always have a <em>base case</em>, and a case that reduces the problem down a bit each time, calling itself</p> <pre><code>struct Node { let id: Int let children: [Node] ...
Find all possible paths in a recursive way
swift|recursion
0
69
2
72,346,927
72,346,927
2
true
2022-05-23T09:45:57.530Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find all possible paths in a recursive way<p>Sorry because this question may sound very noob for a lot of people but I am absolutely bad at recursion and nee...
72,262,920
SwiftUI: how to add type for JSON with 0 index array key<p>I am making a API call in swift and the response of the API looks like this:</p> <pre><code>[ { &quot;response&quot;: { &quot;data&quot;: { &quot;first&quot;: &quot;Hello&quot;, &quot;second&quot;: &quot;H...
<p>Your response is an array of elements:</p> <pre><code>let decodedResponse = try JSONDecoder().decode([APIResponse].self, from: data) </code></pre> <p>and:</p> <pre><code>let element = decodedResponse.first </code></pre> <p>should get you going.</p> <p>And never use <code>try?</code> it will obfuscate all errors.</p>
SwiftUI: how to add type for JSON with 0 index array key
json|swift
2
69
1
72,263,062
72,263,062
3
true
2022-05-16T16:58:11.793Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SwiftUI: how to add type for JSON with 0 index array key<p>I am making a API call in swift and the response of the API looks like this:</p> <pre><code>[ ...
72,286,353
How to prevent a for loop from adding the same element in Python?<p>I have a variable, representing a chessboard filled with random chess pieces. The variable consists of a list of 8 lists,each containing 8 positions filled with either &quot; &quot; (empty position) or a specific chess piece (e.g. &quot;♞&quot;):</p> <...
<p><code>enumerate</code> the rows and columns.</p> <pre><code>pieces = [] for i, row in enumerate(chessboard): for j, piece in enumerate(row): if piece != &quot; &quot;: pieces.append((piece, i, j)) </code></pre>
How to prevent a for loop from adding the same element in Python?
python|arrays|string|for-loop|iterator
1
69
4
72,286,428
72,286,428
3
true
2022-05-18T09:15:09.543Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to prevent a for loop from adding the same element in Python?<p>I have a variable, representing a chessboard filled with random chess pieces. The variabl...
72,286,921
Extract Emails that Lying Between Special Characters Using Regex in SQL<p>How do I extract only email from this certain pattern of string using regex in SQL?</p> <p><strong>What I have :</strong> tb_1</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Logmessage</th> </tr> </thead> <tbody> <tr...
<p>With the use of a helper function</p> <p><strong>Example or <a href="https://dbfiddle.uk/?rdbms=sqlserver_2016&amp;fiddle=8fa31cf23423a18be363c5f8c48329f0" rel="nofollow noreferrer">dbFiddle</a></strong></p> <pre><code>Declare @YourTable Table (LogID int,[Logmessage] varchar(500)) Insert Into @YourTable Values (1...
Extract Emails that Lying Between Special Characters Using Regex in SQL
sql|sql-server
1
69
1
72,287,372
72,287,372
3
true
2022-05-18T09:53:36.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extract Emails that Lying Between Special Characters Using Regex in SQL<p>How do I extract only email from this certain pattern of string using regex in SQL?...