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,378,598
Occurence of name in dictionary<p>The situation is as follows: we extracted data from a .txt file with names, children etc. and extracted it into a dictionary. The dictionary is accessed with the name as the key, e.g:</p> <pre><code># access a single person in allPersons via the name as key p1 = allPersons['jan'] print...
<pre><code>occu = {} for p in persons: for i,k in enumerate(p): if k.isdigit(): p = p[:i] if p in occu: occu[p] += 1 else: occu[p] = 1 </code></pre> <p>Hope this helps</p> <p>edit: this doesn't work if the digits are not at the end of the name, eg</p> <pre><code>tom --...
Occurence of name in dictionary
python
2
50
3
72,378,748
72,378,748
2
true
2022-05-25T13:31:45.097Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Occurence of name in dictionary<p>The situation is as follows: we extracted data from a .txt file with names, children etc. and extracted it into a dictionar...
72,379,663
Make a parabola steeper at both sides while keeping both ends<p>I'm having a parabola with both axes being from 0 to 1 as follows:</p> <p><a href="https://i.stack.imgur.com/stqlO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/stqlO.png" alt="enter image description here" /></a></p> <p>The parabola i...
<p>If you want to modify any arbitrary curve, you can change the x values, for example taking a power of it:</p> <pre><code># x and y are defined for factor in [1.1, 1.5, 2, 3, 4]: x2 = 2*x-1 x3 = (abs(x2)**(1/factor))*np.sign(x2)/2+0.5 ax.plot(x3, y, label=f'{factor=}') </code></pre> <p>output:</p> <p><a ...
Make a parabola steeper at both sides while keeping both ends
python|numpy|matplotlib
1
50
2
72,379,953
72,379,953
2
true
2022-05-25T14:37:58.827Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Make a parabola steeper at both sides while keeping both ends<p>I'm having a parabola with both axes being from 0 to 1 as follows:</p> <p><a href="https://i....
72,379,716
Oracle APEX - Store login value into session<p>I want to store data into the session from the login page (9999 - login page). When I log in and check the session, the items are there, but with no values.</p> <p>I tried to set the Source/Maintain session state/Per session (disk) option. Then I tried with pl/sql script b...
<p>You can always find username by addressing <code>:APP_USER</code>.</p> <p>I have no idea what <code>P9999_NEW</code> is supposed to mean nor contain.</p>
Oracle APEX - Store login value into session
oracle|oracle-apex|apex
-1
50
1
72,381,227
72,381,227
2
true
2022-05-25T14:41:39.640Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Oracle APEX - Store login value into session<p>I want to store data into the session from the login page (9999 - login page). When I log in and check the ses...
72,390,984
Confusion about data types in Haskell<p>I have to write a simple pi approximation and I did and it works fine, but in the task it says to write a function with the header &quot;pi_approx :: Int -&gt; Double&quot;.</p> <p>My code:</p> <pre><code>pi_approx x = sqrt (pi2_approx(x)) pi2_approx x = if x/= 1 then (...
<p>because <code>x</code> is an <code>Int</code>, hence <code>x * x</code> is also an <code>Int</code>, and you can not use an <code>Int</code> for <code>(/) :: Floating a =&gt; a -&gt; a -&gt; a</code>.</p> <p>You need to convert this to a <code>Double</code>, for example with <a href="https://hackage.haskell.org/pack...
Confusion about data types in Haskell
haskell|types
2
50
1
72,391,016
72,391,016
2
true
2022-05-26T11:19:11.927Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Confusion about data types in Haskell<p>I have to write a simple pi approximation and I did and it works fine, but in the task it says to write a function wi...
72,394,196
Push JAWS to read updated title or text<p>I need to push JAWS screen reader to pronounce a new page title that gets updated in let's say 10 seconds. Unfortunately, the issue doesn't look that trivial.</p> <p>It looks like setting title dynamically with javascript inside <code>&lt;head&gt;</code> is ignored by JAWS no m...
<p>A JAWS user can hear the page title by using the <kbd>Ins</kbd>+<kbd>T</kbd> shortcut key but that's not what you're asking about. And the user wouldn't know they need to hit that key unless they were told a new title was set, which is your main question. But I wanted to point out the key as FYI.</p> <p>You're on ...
Push JAWS to read updated title or text
javascript|html|accessibility|title|jaws-screen-reader
0
50
1
72,394,952
72,394,952
2
true
2022-05-26T15:22:26.907Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Push JAWS to read updated title or text<p>I need to push JAWS screen reader to pronounce a new page title that gets updated in let's say 10 seconds. Unfortun...
72,267,193
Two distinct aggregate queries combined: possible? (EF Core 5, SQL Server)<p>I've got a table like this:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id (PK)</th> <th>name</th> <th>course</th> <th>date</th> <th>grade</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Jane</td> <td>french</t...
<p>It is going to be somewhat more difficult to combine these, and it's pretty much impossible to do in EF/Linq. I would say it's only worth it if querying the table twice is massively inefficient. Otherwise just do them in either EF or as a single T-SQL batch of two queries.</p> <ul> <li>The first query could easily b...
Two distinct aggregate queries combined: possible? (EF Core 5, SQL Server)
sql|sql-server|linq|tsql|entity-framework-core
0
50
1
72,270,819
72,270,819
2
true
2022-05-17T01:19:52.433Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Two distinct aggregate queries combined: possible? (EF Core 5, SQL Server)<p>I've got a table like this:</p> <div class="s-table-container"> <table class="s-...
72,282,107
How to change StatusBar colour android studio?<p>No matter what I try within themes I cant seem to change the colour of the status bar from this grey colour:</p> <p><a href="https://i.stack.imgur.com/lO7cu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lO7cu.png" alt="enter image description here" /...
<p>Add your custom color to <code>themes.xml</code> and also don't forget to add in the <code>night\themes.xml</code> file. Otherwise, your status bar color shows the default color in <code>DarkMode</code>.</p> <p>path-1:- res&gt;values&gt;themes&gt;<code>themes.xml</code></p> <p>path-2:- res&gt;values&gt;themes&gt;<co...
How to change StatusBar colour android studio?
android|xml|android-studio|kotlin|android-theme
1
50
2
72,284,090
72,284,090
2
true
2022-05-18T00:45:07.613Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change StatusBar colour android studio?<p>No matter what I try within themes I cant seem to change the colour of the status bar from this grey colour:...
72,311,476
PHP INSERT INTO doesn't insert data into database<p>So basically I have multiple-step form, which I handle through jQuery and AJAX request. Request goes through fine, but it seems like my PHP code doesn't work (it doesn't insert data into database table).</p> <p>Here's my code jQuery AJAX code:</p> <pre><code>$(&quot;....
<p>I will suggest you use a prepared statement and bind the values using execute. Change your query to something like this</p> <pre><code>try { $conn = new PDO(&quot;mysql:host=$servername;dbname=$dbname&quot;, $username, $password); // set the PDO error mode to exception $sql = &quot;INSERT INTO appointmen...
PHP INSERT INTO doesn't insert data into database
php|jquery|ajax
1
50
1
72,311,567
72,311,567
2
true
2022-05-19T21:56:45.943Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP INSERT INTO doesn't insert data into database<p>So basically I have multiple-step form, which I handle through jQuery and AJAX request. Request goes thro...
72,335,412
Dax/powerquery retrieve last date with a country based on restriction<p>I have a data set containing: Accounts selling various fruits in various countries, im working on some metrics and I really want to calculate the time between the first sold fruit in a country to the last sold fruit in the same country.</p> <p>For ...
<p>If I understand you correctly, you can do what you want entirely in Power Query.</p> <ul> <li>Group by <code>Fruit</code> and <code>Country</code></li> <li>Aggregate by <code>Min</code> of <code>Start Date</code> and <code>Max</code> of <code>End Date</code></li> <li>Add column to calculate the Days difference:</li>...
Dax/powerquery retrieve last date with a country based on restriction
powerbi|dax|powerquery|powerbi-desktop
1
50
1
72,336,686
72,336,686
2
true
2022-05-22T06:54:01.473Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dax/powerquery retrieve last date with a country based on restriction<p>I have a data set containing: Accounts selling various fruits in various countries, i...
72,388,907
Javascript if-else statement not running correctly<p>I don't know why the <code>if-else</code> statement given in the question is function incorrectly. Even <code>cashProvided.value &gt;billAmount.value</code> I keep getting the <code>errorMsg</code> which is being executed in the else statement. I tried using <code>co...
<p>Values are coming as string. you should parse the value first.</p> <p>second way: <code>if(parseInt(cashProvided.value, 10) &gt;= parseInt(billAmount.value, 10))</code></p> <p>also you can set them as variables outside of the if statement.</p> <p>Edit: in response for peter's comment. you should include a second arg...
Javascript if-else statement not running correctly
javascript
-1
50
2
72,389,065
72,389,065
2
true
2022-05-26T08:27:56.763Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript if-else statement not running correctly<p>I don't know why the <code>if-else</code> statement given in the question is function incorrectly. Even ...
72,352,291
map array inside an array Js<p>how can I map array inside ?</p> <pre><code>array = [[{},{},{}],[{},{}],[{},],[{},{},{},{}]] </code></pre> <p>I tried</p> <pre><code>data.map((array) =&gt; { console.log(array); return ( array.map((doc) =&gt; &lt;p&gt;{doc}&lt;/p&gt;) );...
<p>you can use <code>flat</code> and then <code>map</code> like this</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const data = [[{value: 1},{value: 2},{value: 3}],[{value: ...
map array inside an array Js
javascript|reactjs
2
50
1
72,352,425
72,352,425
2
true
2022-05-23T17:02:33.967Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: map array inside an array Js<p>how can I map array inside ?</p> <pre><code>array = [[{},{},{}],[{},{}],[{},],[{},{},{},{}]] </code></pre> <p>I tried</p> <pre...
72,290,042
Is it possible to append string to many matching rows in one query<p>For an example, i have following table:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Id</th> <th>Name</th> <th>Color</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>FirstCar</td> <td>White</td> </tr> <tr> <td>2</td> <td...
<p>You can use <a href="https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_concat" rel="nofollow noreferrer">CONCAT</a>, which will apply <code>_123</code> at our matching <code>where name in ('SecondCar','FourthCar','SixthCar')</code> condition .</p> <pre><code>UPDATE test set name = CONCAT(name,'_...
Is it possible to append string to many matching rows in one query
mysql|sql
2
50
2
72,290,170
72,290,170
2
true
2022-05-18T13:23:25.800Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to append string to many matching rows in one query<p>For an example, i have following table:</p> <div class="s-table-container"> <table class...
72,279,567
Bash array loop only takes the first entry<p>Good evening,</p> <p>i just try to stop some docker containers defined in an array. But only the first one is stopped but four times.</p> <p><code>CONTAINERTOSTOP=(webgrabplus Nextcloud ddclient MariaDB-10.6)</code></p> <pre><code>for constopping in &quot;${CONTAINERTOSTOP[@...
<p>To stop just using (without loop):</p> <pre><code>CONTAINERTOSTOP=(webgrabplus Nextcloud ddclient MariaDB-10.6) docker stop &quot;${CONTAINERTOSTOP[@]}&quot; </code></pre>
Bash array loop only takes the first entry
bash
0
50
2
72,279,858
72,279,858
2
true
2022-05-17T19:17:13.297Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bash array loop only takes the first entry<p>Good evening,</p> <p>i just try to stop some docker containers defined in an array. But only the first one is st...
72,326,696
How to get variable changes outside of nesting in rust?<p>Hey so I'm really new to rust and programming at large and I'm having some issues I haven't encountered before. I'm attempting to return the results of user input variables to the screen outside of nesting but I haven't seemed to have any luck.</p> <pre><code>us...
<p>There are several flaws in your code, and since your question in only about one, I'll explain only about that one. This means that the code below <strong>will not compile</strong>. But it will get you closer to the solution.</p> <p>Your problem, I think, comes from the fact that you don't know the difference between...
How to get variable changes outside of nesting in rust?
rust
3
50
1
72,326,870
72,326,870
2
true
2022-05-21T04:35:41.803Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get variable changes outside of nesting in rust?<p>Hey so I'm really new to rust and programming at large and I'm having some issues I haven't encount...
72,240,095
(R) How can a bigger expression be written by combining shorter variable expressions?<p>Brief introduction, I have multiple data file that can be fitted by models based in mathematical equations that are a combination (by sum, mutiplication, etc...) of other shorter mathematical equations.</p> <p>As an example I have t...
<p><strong>1)</strong> Presumably you meant expression rather than exp. Making that change we define e1, e2, e3 and e. esub is a function which replaces a variable name with another in an expression. gsubfn in the package of the same name is like gsub except the second argument can be a function (possibly expresse...
(R) How can a bigger expression be written by combining shorter variable expressions?
r|expression
1
50
2
72,240,661
72,240,661
2
true
2022-05-14T12:16:20.597Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: (R) How can a bigger expression be written by combining shorter variable expressions?<p>Brief introduction, I have multiple data file that can be fitted by m...
72,399,353
R - how to filter after a certain date by group in a different DF<p>I would like some help if possible as I am new to R in filtering after a certain date and then summing the results.</p> <p>For example, we have these organisations:</p> <p><a href="https://i.stack.imgur.com/YpJQs.png" rel="nofollow noreferrer"><img src...
<p>There may be more elegant solutions, but one option is to create variable with the number of repeating instances, the take the last one:</p> <p>Since you didnt provide reproducible data, here is some similar sample data (edited to use TarJae's more accurate data):</p> <pre><code>df &lt;- structure(list(Organisation ...
R - how to filter after a certain date by group in a different DF
r
2
50
2
72,399,441
72,399,441
2
true
2022-05-27T00:44:44.277Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R - how to filter after a certain date by group in a different DF<p>I would like some help if possible as I am new to R in filtering after a certain date and...
72,298,043
How do I make a top down view with the ability to rotate with built in java graphics?<p>I'm trying to make a racing game with the top down view on a static player in the middle of the screen, so instead of moving the player through the map, the map would move around the player. Since it's a racing game, I wanted it to ...
<p>You have to keep in mind that transformations are compounding, so if you rotate the <code>Graphics</code> context by 45 degrees, everything painted after it will be rotated 45 degrees (around the point of rotation), if you rotate it again by 45 degrees, everything painted after it will be rotated a total of 90 degre...
How do I make a top down view with the ability to rotate with built in java graphics?
java|swing|graphics|jframe|java-2d
1
50
1
72,299,955
72,299,955
2
true
2022-05-19T02:42:01.467Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I make a top down view with the ability to rotate with built in java graphics?<p>I'm trying to make a racing game with the top down view on a static p...
72,251,107
array has got same item every push<p>Array Push will replace old value, with new one, bot i dont understand why this happend.<br></p> <p>this is my code:</p> <pre><code> let meta = []; let counter = 0; let temp_item = {} for (let ele of found_spec) { let ele_clean = cleanItem(ele) if (...
<p>You have one object <code>temp_item</code> that you create before your loop. Then, your loop just sets properties on that one object and then pushes the object into the array. Since pushing into an array does NOT create a copy of the object, you end up just modifying the same object over and over in the loop and p...
array has got same item every push
javascript|node.js
0
50
1
72,251,225
72,251,225
2
true
2022-05-15T18:27:08.447Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: array has got same item every push<p>Array Push will replace old value, with new one, bot i dont understand why this happend.<br></p> <p>this is my code:</p>...
72,331,387
How to remove specific Array value like this example?<p>I want to remove the value &quot;4&quot; in array.</p> <p><code>[&quot;5&quot; , &quot;4&quot; , &quot;10&quot; , &quot; &quot;]</code></p> <p>to</p> <p><code>[&quot;5&quot; , &quot;10&quot; , &quot; &quot;]</code></p>
<p>If you know the specific position of the array you can do something like this:</p> <pre><code>string[] someArray = {&quot;5&quot;, &quot;4&quot;, &quot;10&quot;, &quot;&quot;}; someArray = someArray.Where(w =&gt; w != someArray[1]).ToArray(); </code></pre> <p>if you don't you can convert to a list and search for any...
How to remove specific Array value like this example?
c#
1
50
2
72,331,471
72,331,471
2
true
2022-05-21T16:27:54.663Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to remove specific Array value like this example?<p>I want to remove the value &quot;4&quot; in array.</p> <p><code>[&quot;5&quot; , &quot;4&quot; , &quo...
72,370,208
Pass variables between Pool workers?<p>I have a pool of 2 processes. Process #1 with infinite loop. I need to stop infinite loop in process #1 when something happens in process #2. How to pass info from process #1 to process #2?</p> <pre><code>def do_smth(value): a = 0 if value == &quot;1&quot;: while 1: ...
<p>If what you wish is to share a full variable, and not just a stop condition for an infinite loop, you may use <code>multiprocessing.Value()</code>. Keep in mind you have to initialize the value differently, as <code>multiprocessing.Pool</code> cannot pass around synchronization primitives that can't be pickled:</p> ...
Pass variables between Pool workers?
python|multiprocessing|infinite-loop|pool
2
50
2
72,370,523
72,370,523
2
true
2022-05-24T22:45:06.617Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pass variables between Pool workers?<p>I have a pool of 2 processes. Process #1 with infinite loop. I need to stop infinite loop in process #1 when something...
72,267,343
is there a way in R to mutate a cumulative subtraction to update the same mutated var?<p>This is straightforward but for whatever reason I'm having difficulty. Say I have:</p> <pre><code>data &lt;- data.frame (n1 = c(14,9,7,2, 23,21,10,8), n2 = c(65, 65, 65, 65, 78, 78, 78, 78), n3=c(51, NA, NA, NA, ...
<p>There's no cumulative subtraction, but you can do a cumulative sum and then subtract it.</p> <pre><code>library(dplyr) data %&gt;% group_by(group) %&gt;% mutate(want = ifelse(!is.na(n3), n3, first(n3) - lag(cumsum(n1)))) %&gt;% ungroup() </code></pre>
is there a way in R to mutate a cumulative subtraction to update the same mutated var?
r
2
50
2
72,267,497
72,267,497
3
true
2022-05-17T01:53:15.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: is there a way in R to mutate a cumulative subtraction to update the same mutated var?<p>This is straightforward but for whatever reason I'm having difficult...
72,280,743
How to save dataframe to dictionary of different length<p>So I have a data frame that looks like this</p> <pre><code>2018-01-01 00:00:00 False 2018-01-01 00:30:00 False 2018-01-01 01:00:00 False 2018-01-01 01:30:00 True 2018-01-01 02:00:00 True 2018-01-01 02:30:00 True 2018-01-01 03:00:00 False 201...
<p>You can use filtering and <code>groupby.agg</code>:</p> <pre><code>(df .loc[df[1], 0] .groupby((~df[1]).cumsum()) .agg(list) .reset_index(drop=True) .to_dict() ) </code></pre> <p>Output:</p> <pre><code>{0: ['2018-01-01 01:30:00', '2018-01-01 02:00:00', '2018-01-01 02:30:00'], 1: ['2018-01-01 04:00:00', '2018-...
How to save dataframe to dictionary of different length
python|pandas|dataframe
1
50
2
72,280,861
72,280,861
3
true
2022-05-17T21:15:03.170Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to save dataframe to dictionary of different length<p>So I have a data frame that looks like this</p> <pre><code>2018-01-01 00:00:00 False 2018-01-01 ...
72,301,975
Fetch line starting with a specific string in powershell<p>I am executing a command for which I am getting output like below</p> <pre><code>Identifier: 3 SFP Connector: 7 LC Transceiver: 7004404000000000 4,8,16_Gbps M5 sw Short_dist Encoding: 6 64B66B Baud Rate: 140 (units 100 megabaud) Length 9u: ...
<p>As you clarified, the <code>$streamOut</code> variable contains a single, multiline string.</p> <p>In this case you can use <code>Select-String</code> with <code>-AllMatches</code> like this:</p> <pre class="lang-sh prettyprint-override"><code>$RXTX_Data = ($streamOut | Select-String -Pattern '(?m)^(RX|TX).*$' -AllM...
Fetch line starting with a specific string in powershell
regex|powershell
1
50
2
72,304,667
72,304,667
3
true
2022-05-19T09:25:59.020Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fetch line starting with a specific string in powershell<p>I am executing a command for which I am getting output like below</p> <pre><code>Identifier: 3 ...
72,306,791
Why \r required when using tput el1<p>While creating a countdown timer in <a href="/questions/tagged/bash" class="post-tag" title="show questions tagged &#39;bash&#39;" rel="tag">bash</a>, I came up with the following code:</p> <pre class="lang-sh prettyprint-override"><code>for ((n=15; n &gt; 0; n--)); do printf &...
<p>Compare <code>el1</code></p> <pre><code>tput el1 Clear to beginning of line </code></pre> <p>and <code>clear</code></p> <pre><code>tput clear clear screen and home cursor </code></pre> <p>Note that <code>clear</code> explicitly states that it moves the cursor; <code>el1</code> does not. It <em>only</em> eras...
Why \r required when using tput el1
bash|printf|tput
1
50
1
72,307,442
72,307,442
3
true
2022-05-19T14:54:06.080Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why \r required when using tput el1<p>While creating a countdown timer in <a href="/questions/tagged/bash" class="post-tag" title="show questions tagged &#39...
72,310,076
How to convert values from certain keys of an array to numbers?<p>I have the following array of objects</p> <pre><code>const mi_array = [{ agrupacion: &quot;Total país&quot;, col2015: '81.8', col2016: '86.4', col2017: '67.3', col2018: '70.8', col2019: '67.6' },{ agrupacion: &quot;otra cosa&quot;, col201...
<p>You could destructure <code>name</code> and take from the rest only the values as <code>data</code>, after mapping with <code>Number</code>.</p> <p>This approach takes the original order of the object.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="sn...
How to convert values from certain keys of an array to numbers?
javascript|arrays
1
50
4
72,310,220
72,310,220
3
true
2022-05-19T19:24:28.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert values from certain keys of an array to numbers?<p>I have the following array of objects</p> <pre><code>const mi_array = [{ agrupacion: &quo...
72,315,021
How to parse a given key-value parameters string?<p>I have this string:</p> <blockquote> <p>Parameter1=&quot;Something related to this&quot; Parameter2=&quot;Another value&quot; Parameter3='Single quotes are permitted' Parameter4=&quot;Even HTML entities are permitted&quot;</p> </blockquote> <p>I want to get this list:...
<p>You can use</p> <pre class="lang-cs prettyprint-override"><code>(\w+)=(['&quot;]|&amp;quot;)(.*?)\2 </code></pre> <p>See the <a href="https://regex101.com/r/rjIBB2/1" rel="nofollow noreferrer">regex demo</a>. <em>Details</em>:</p> <ul> <li><code>(\w+)</code> - Group 1: one or more word chars</li> <li><code>=</code> ...
How to parse a given key-value parameters string?
c#|regex
1
50
1
72,315,278
72,315,278
3
true
2022-05-20T07:22:35.547Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to parse a given key-value parameters string?<p>I have this string:</p> <blockquote> <p>Parameter1=&quot;Something related to this&quot; Parameter2=&quot...
72,336,459
WinUI: does property "Disabled" exist for checkbox?<p>I read MSDN for WinUI but haven't found any information about how to disable checkbox. If it's exists, what's the name of property?</p> <p>If it doesn't, how should I control, that checkbox cannot be changed? By overriding <code>onClick</code>?</p>
<p>Yes. <code>Disabled</code> doesn't exists, but all controls have <code>Enabled</code> property, and you can set it to False. This will disable your CheckBox, as you want.</p>
WinUI: does property "Disabled" exist for checkbox?
c#|winui-3
0
50
2
72,336,719
72,336,719
3
true
2022-05-22T09:52:44.853Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: WinUI: does property "Disabled" exist for checkbox?<p>I read MSDN for WinUI but haven't found any information about how to disable checkbox. If it's exists, ...
72,375,359
Allowing a class that inherits from an abstract class to return undefined<p>I have an abstract class that looks like this:</p> <pre class="lang-js prettyprint-override"><code>// step.ts import { AllowedStepNames } from &quot;./interfaces&quot;; abstract class Step { abstract nextStep(): AllowedStepNames | undefine...
<p>I think I got the issue now:</p> <p>TypeScript is automatically inferring the type <code>string</code> instead of <code>foo | undefined</code> to your function based on the return type and <code>string</code> is not assignable to the union <code>AllowedStepNames</code>.</p> <p>What can you do to fix this?</p> <h3>Op...
Allowing a class that inherits from an abstract class to return undefined
javascript|typescript|abstract-class
1
50
1
72,376,600
72,376,600
3
true
2022-05-25T09:47:19.857Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Allowing a class that inherits from an abstract class to return undefined<p>I have an abstract class that looks like this:</p> <pre class="lang-js prettyprin...
72,379,364
What does "template <> int line<0>::operator[](int y) const" do?<pre><code>#include &lt;bits/stdc++.h&gt; using namespace std; constexpr int mod = 1e9 + 7, maxn = 2e6; int N, M, p[1 &lt;&lt; 10], buf[maxn]; template &lt;bool t&gt; struct line { int *v; int operator[](int y) const; }; template &lt;&gt;...
<blockquote> <p>What is this operator thing? Is it a function? If it is then why does it have square brackets</p> </blockquote> <p>You're declaring <code>operator[]</code> as a member function of the class template named <code>line</code>. By providing this, we say that we're <strong>overloading</strong> <code>operator...
What does "template <> int line<0>::operator[](int y) const" do?
c++|templates|operator-overloading|template-specialization
2
50
1
72,379,654
72,379,654
3
true
2022-05-25T14:20:38.670Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What does "template <> int line<0>::operator[](int y) const" do?<pre><code>#include &lt;bits/stdc++.h&gt; using namespace std; constexpr int mod = 1e9 + 7, ...
72,378,191
Fastest way to build matrix with concentric "rings" of values<p>Say I have a vector <code>Q = [Q1 Q2 .... QN]</code>.</p> <p>I would like to create a matrix A such that the kth &quot;ring&quot; of the matrix is equal to Qk, with the following constraint:</p> <p>if <code>N</code> is odd, the central patch is composed of...
<p>The logic of the code is lightly simpler if you follow the advice <a href="https://stackoverflow.com/questions/72378191/fastest-way-to-build-matrix-with-concentric-rings-of-values?noredirect=1#comment127865286_72378191">in Wolfie's comment</a>, and compute only one quadrant that you repeat:</p> <pre class="lang-matl...
Fastest way to build matrix with concentric "rings" of values
performance|matlab|matrix
4
50
2
72,380,372
72,380,372
3
true
2022-05-25T13:03:35.647Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fastest way to build matrix with concentric "rings" of values<p>Say I have a vector <code>Q = [Q1 Q2 .... QN]</code>.</p> <p>I would like to create a matrix ...
72,242,575
what are these gray lines inside the bars of my ggplot bargraph?<p>I wanted to create a graph to show which continent has the highest co2 emissions total per capita over the years, so I coded this:</p> <pre><code>barchart &lt;- ggplot(data = worldContinents, aes(x = Continent, y ...
<p>You have a couple of issues here. First of all, I'm guessing you want the <code>fill</code> to be mapped to the continent, not <code>color</code>, which only controls the color of the bars' outlines.</p> <p>Secondly, there are multiple values for each continent in your data, so they are simply stacking on top of eac...
what are these gray lines inside the bars of my ggplot bargraph?
r|ggplot2
0
50
1
72,242,749
72,242,749
3
true
2022-05-14T17:35:36.963Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: what are these gray lines inside the bars of my ggplot bargraph?<p>I wanted to create a graph to show which continent has the highest co2 emissions total per...
72,248,277
How to multithread uploads in python?<p>In python I have a list of files that needs to be uploaded.</p> <p>An example code might look like this:</p> <pre><code> for path, key in upload_list: upload_function.upload_file(path, key) </code></pre> <p>How can I multithread such tasks?</p> <p>I already cam...
<p>It's not that complicated with <code>ThreadPoolExecutor</code></p> <pre><code>def upload_files(upload_list): def __upload(val): upload_function.upload_file(*val) with ThreadPoolExecutor() as executor: executor.map(__upload, upload_list) upload_files(upload_list) </code></pre> <p>If you can ...
How to multithread uploads in python?
python|multithreading
1
50
1
72,248,387
72,248,387
3
true
2022-05-15T12:30:54.027Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to multithread uploads in python?<p>In python I have a list of files that needs to be uploaded.</p> <p>An example code might look like this:</p> <pre><co...
72,385,633
Java HashMap and Iterator - How to know if value is the same as user<p>I'm learning how to use a hashmap. I am trying to build an ATM program which allow the user to log in if they enter their card number and pin number correctly. Below is my code.</p> <pre><code>import java.util.*; import java.util.Scanner; import jav...
<h1><code>Map#get</code></h1> <p>As a rule of thumb, if you're iterating through a map looking for a particular entry, you're doing it wrong. The whole point of a map is that you can look up a key directly. Call <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Map.html#get(java.lang.Obje...
Java HashMap and Iterator - How to know if value is the same as user
java|hashmap|iterator
0
50
2
72,385,888
72,385,888
3
true
2022-05-26T01:13:33.173Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java HashMap and Iterator - How to know if value is the same as user<p>I'm learning how to use a hashmap. I am trying to build an ATM program which allow the...
72,316,088
Partial credit for numeric exercises (e.g. for guessing tasks)?<p>I'm teaching students to visually approximate effect sizes from typical plot types (e.g. Pearson's <em>r</em> from scatter and parallel coordinates plots, Kendall's τ from alluvial plots, Cramer's <em>V</em> from mosaic plots, ...). Dynamic generation of...
<p>I don't think it is possible to use a continuous function for assigning partial credits in Moodle. But for <code>NUMERICAL</code> answers in Moodle cloze questions you can set discrete steps of partial credits, see the accompanying <a href="https://docs.moodle.org/310/en/Embedded_Answers_(Cloze)_question_type#Numeri...
Partial credit for numeric exercises (e.g. for guessing tasks)?
r|r-exams
1
50
1
72,319,795
72,319,795
3
true
2022-05-20T08:50:04.437Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Partial credit for numeric exercises (e.g. for guessing tasks)?<p>I'm teaching students to visually approximate effect sizes from typical plot types (e.g. Pe...
72,274,743
Pivot to get row and column names as rows along with values in R<p>I have a dataset which looks like below and i want to flatten it.</p> <pre><code>inp &lt;- matrix(c(0,1,0,0,2,3,5,0,4,3,6,0),nrow = 4, byrow = T) rownames(inp)&lt;- c(&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;) colnames(inp) &lt;-c(&quot;x&...
<p>Regarding inp as a table, convert it to a data frame and remove zero rows. Omit the last line if the order of rows is unimportant. No packages are used.</p> <pre><code>d &lt;- subset(as.data.frame.table(inp), Freq &gt; 0) d[order(d$Var1), ] </code></pre> <p>giving:</p> <pre><code> Var1 Var2 Freq 5 A y ...
Pivot to get row and column names as rows along with values in R
r
1
50
3
72,274,882
72,274,882
4
true
2022-05-17T13:15:40.587Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pivot to get row and column names as rows along with values in R<p>I have a dataset which looks like below and i want to flatten it.</p> <pre><code>inp &lt;-...
72,274,914
r - replacing multiple column values in selected rows based on another df<p>I am looking for an iterative way (e.g. <code>for loop</code>, <code>purrr</code>) to replace the values of some cols for a selected row of a dataframe with the values of similar cols from another dataframe.</p> <pre><code># Here is a toy df df...
<p>You don't need a loop here at all. You can replace the entire row in one go.</p> <pre class="lang-r prettyprint-override"><code>df[df$id %in% df_replace$id,] &lt;- df_replace df #&gt; # A tibble: 3 x 4 #&gt; id subj_1 subj_2 subj_3 #&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;ch...
r - replacing multiple column values in selected rows based on another df
r|for-loop|purrr
0
50
2
72,275,103
72,275,103
4
true
2022-05-17T13:28:00.813Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: r - replacing multiple column values in selected rows based on another df<p>I am looking for an iterative way (e.g. <code>for loop</code>, <code>purrr</code>...
72,386,955
C# base constructor determination<p>Can I choose a base constructor based on some non-instance related conditions in C#? If I can't, any idea to meet my requirement? Thanks!</p> <pre><code>class X {} class Y {} class A { public A(X x) {} public A(Y y) {} // I don't want to add another constructor with an ...
<p>It sounds like you're looking for a <a href="https://en.wikipedia.org/wiki/Factory_(object-oriented_programming)" rel="nofollow noreferrer">Factory method</a>:</p> <blockquote> <p><a href="https://refactoring.guru/design-patterns/factory-method/csharp/example" rel="nofollow noreferrer">https://refactoring.guru/desig...
C# base constructor determination
c#
-1
50
1
72,386,977
72,386,977
4
true
2022-05-26T05:08:41.057Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# base constructor determination<p>Can I choose a base constructor based on some non-instance related conditions in C#? If I can't, any idea to meet my requ...
72,251,624
Polymorphism produces odd behaviour<p>I have a vector wrapper class which is aimed to simplify polymorphism:</p> <pre><code>class Shape { public: Shape(string Name) : name(Name) {} virtual ~Shape() = default; string name; private: }; class Point : public Shape { public: Point(string Name, float X,...
<p>You can't reassign a reference. <code>ref = v[1]</code> copies the value of <code>v[1]</code> into the object referenced by <code>ref</code>. As the compiler only knows that <code>ref</code> is a <code>Shape</code> it calls <code>Shape</code>'s assignment operator and therefore only copies the <code>Shape</code> mem...
Polymorphism produces odd behaviour
c++|templates|polymorphism
0
50
1
72,251,708
72,251,708
5
true
2022-05-15T19:37:42.450Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Polymorphism produces odd behaviour<p>I have a vector wrapper class which is aimed to simplify polymorphism:</p> <pre><code>class Shape { public: Shape(s...
72,294,115
How do I do foreach loop with a where clause for a multidimensional array in Powershell?<p>For example</p> <pre class="lang-sh prettyprint-override"><code>$people = @( @('adam', '24', 'M') @('andy', '20', 'M') @('alex', '30', 'M') @('ava', '25', 'F') ) foreach($person in $people | where ($person[1] -lt '25') -and ...
<p>The syntax you should use for your <code>Where-Object</code> statement would be:</p> <pre class="lang-sh prettyprint-override"><code>$people = @( @('adam', '24', 'M'), @('andy', '20', 'M'), @('alex', '30', 'M'), @('ava', '25', 'F') ) $people | Where-Object { $_[1] -lt '25' -and $_[2] -eq 'M' } | For...
How do I do foreach loop with a where clause for a multidimensional array in Powershell?
powershell
3
50
3
72,294,264
72,294,264
5
true
2022-05-18T18:15:21.717Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I do foreach loop with a where clause for a multidimensional array in Powershell?<p>For example</p> <pre class="lang-sh prettyprint-override"><code>$p...
72,377,016
Getting Rolling Sum per Group<p>I have a dataframe like this:</p> <pre><code>Product_ID Quantity Year Quarter 1 100 2021 1 1 100 2021 2 1 50 2021 3 1 100 2021 4 1 ...
<p>You need to apply the rolling sum per group, you can use <code>apply</code> for this:</p> <pre><code>df['Qty_Sum_3qrts'] = (df.groupby('Product_ID')['Quantity'] .apply(lambda s: s.shift(1,fill_value=0) .rolling(3, min_periods=1).sum()) ...
Getting Rolling Sum per Group
python|python-3.x|pandas|rolling-computation
2
50
1
72,377,088
72,377,088
5
true
2022-05-25T11:44:51.413Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting Rolling Sum per Group<p>I have a dataframe like this:</p> <pre><code>Product_ID Quantity Year Quarter 1 100 2021 ...
72,353,393
Why does a Django foreign key id __in query fail to match None?<p>When filtering a queryset on a nullable foreign key, I can filter by an ID value (<code>foo_id=123</code>) or by None (<code>foo_id=None</code>). However, if I attempt to filter by a list (<code>foo_id__in=[123, None]</code>) the <code>None</code> is ign...
<p>The key insight is that in SQL, <code>NULL</code> represents an unknown value, which cannot be compared using normal operators:</p> <pre><code>SELECT NULL = NULL; -- =&gt; NULL </code></pre> <p>(This syntax does not work in all DB engines - for example, SQL Server - and in those you would have to write something lik...
Why does a Django foreign key id __in query fail to match None?
django|django-models|django-3.2
1
50
2
72,353,542
72,353,542
5
true
2022-05-23T18:39:08.163Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does a Django foreign key id __in query fail to match None?<p>When filtering a queryset on a nullable foreign key, I can filter by an ID value (<code>foo...
72,242,627
R current time in milliseconds<p>How can I get the current time in milliseconds? I tried the below without success:</p> <pre><code>&gt; strptime(Sys.time(), &quot;%Y-%m-%d %H:%M:%OS&quot;) [1] &quot;2022-05-14 19:42:53 CEST </code></pre>
<p>You do get milliseconds by default on all operating systems, and (almost as the effective resolution is just a fraction less) microseconds on Linux and macOS -- but you <em>must enable the printing of it</em>.</p> <h4>Default R behaviour</h4> <pre><code>&gt; options(digits.secs=0) &gt; Sys.time() [1] &...
R current time in milliseconds
r
3
50
2
72,242,768
72,242,768
5
true
2022-05-14T17:43:28.427Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R current time in milliseconds<p>How can I get the current time in milliseconds? I tried the below without success:</p> <pre><code>&gt; strptime(Sys.time(), ...
72,296,686
How do I return a string with variables and characters in c++?<p>I have a string function that I would like to output the following cout lines.</p> <pre><code> string print_ticket(void){ if(sold_status == true){ cout&lt;&lt;seat_number&lt;&lt;&quot; &quot;&lt;&lt;seat_number&lt;&lt;&quot;sold&quot;;...
<p>Use <code>ostringstream</code>, available when including <code>&lt;sstream&gt;</code>:</p> <pre class="lang-cpp prettyprint-override"><code>string print_ticket(void){ std::ostringstream sout; if (sold_status) { sout &lt;&lt; seat_number &lt;&lt; &quot; &quot; &lt;&lt; seat_number &lt;&lt; &quot;sold&...
How do I return a string with variables and characters in c++?
c++|string|function|return|cout
0
50
2
72,296,722
72,296,722
6
true
2022-05-18T22:30:50.433Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I return a string with variables and characters in c++?<p>I have a string function that I would like to output the following cout lines.</p> <pre><cod...
72,356,949
How to call GET Api with input param use JQuery and JavaScript in Asp.net view when a special tag load<p>Hi I want to load count of orders in my view (in a special tag), I wrote a SP in Sql which return count of order according to input type. I design several box in my form to show all types order count. So I give &quo...
<p><strong>Update</strong></p> <pre><code> &lt;div class=&quot;inner&quot;&gt; &lt;h3 id=&quot;Orders1&quot;&gt;&lt;sup style=&quot;font-size: 20px&quot;&gt;&lt;/sup&gt;&lt;/h3&gt; &lt;p&gt;New Orders &lt;/p&gt; &lt;span id=&quot;result2&quot;&gt;&lt;/span&gt;//add the id to put the...
How to call GET Api with input param use JQuery and JavaScript in Asp.net view when a special tag load
javascript|jquery|ajax|api|asp.net-core
0
50
1
72,357,257
72,357,257
-1
true
2022-05-24T03:38:14.070Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to call GET Api with input param use JQuery and JavaScript in Asp.net view when a special tag load<p>Hi I want to load count of orders in my view (in a s...
72,776,903
MFMessageComposeViewController: Cannot Style "Cancel" Button in Dark Mode<p>I'm currently trying to style the &quot;cancel&quot; button that is in the top right corner (the navigation bar and the button are both grey) and I am having no luck. I've tried calling several different methods and none have worked. My project...
<p>The gray color for the button is likely coming from the global tint color for your application. This is by default AccentColor that comes within Assets (this is mapped via Build Settings). Note that you can define separate global accent colors for <code>Any, Light, Dark</code> <a href="https://i.stack.imgur.com/Swev...
MFMessageComposeViewController: Cannot Style "Cancel" Button in Dark Mode
objective-c|ios-darkmode|mfmessagecomposeviewcontroller
1
50
1
72,777,587
72,777,587
1
true
2022-06-27T18:36:59.790Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MFMessageComposeViewController: Cannot Style "Cancel" Button in Dark Mode<p>I'm currently trying to style the &quot;cancel&quot; button that is in the top ri...
72,925,195
How do I append a div container to a specific area of a webpage?<p>I am asking this question because all of the other answers that I found are dealing with JQuery. I am not using JQuery, just pure JS.</p> <p>Currently I create a div and add content into the div using Create Element and innerHTML. I then use appendChild...
<p>You can use the <code>prepend</code> function to prepend the element to your div. Prepending is like appending but it adds to the start instead of the end.</p> <p>For example:</p> <pre class="lang-js prettyprint-override"><code>const element = document.createElement(&quot;img&quot;); document.body.prepend(element); ...
How do I append a div container to a specific area of a webpage?
javascript|html|google-chrome-extension
0
50
2
72,925,213
72,925,213
1
true
2022-07-09T23:12:51.980Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I append a div container to a specific area of a webpage?<p>I am asking this question because all of the other answers that I found are dealing with J...
72,925,581
How is a channel's output-buffer content deleted without writing it to the channel?<p>I don't know much about PHP or Tcl; but I am trying to learn both concurrently. In PHP, I read that every script should start with <code>ob_start</code> and, therefore, have been using the following.</p> <pre><code>ob_start(NULL, 0, P...
<p>Sounds like you want to only output text written to a channel if no error happens in the middle of writing?</p> <p>One way is to use a <a href="https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/tcllib/files/modules/virtchannel_base/tcllib_variable.md" rel="nofollow noreferrer">variable channel</a> from <a href=...
How is a channel's output-buffer content deleted without writing it to the channel?
tcl
0
50
2
72,928,410
72,928,410
1
true
2022-07-10T01:17:56.310Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How is a channel's output-buffer content deleted without writing it to the channel?<p>I don't know much about PHP or Tcl; but I am trying to learn both concu...
73,015,518
Rock Paper Scissors not working properly JS<p>I can only seem to get 2 outcomes when player selects rock or scissors. Wont always run on click. Very buggy and slow. Check out the site and the code and let me know what yall think is up. My first script project so it ain't pretty.</p> <p>Edit: changed num === from 123 to...
<p>This</p> <pre><code>function genCompChoice() { let num = Math.floor(Math.random() * 3) if (num === 1) { compChoice = 'rock' } if (num === 2) { compChoice = 'paper' } if (num === 3) { compChoice === 'scissors' } } </code></pre> <p>is a problem. <code>Math.random</code> generates a random num...
Rock Paper Scissors not working properly JS
javascript|html
0
50
1
73,015,548
73,015,548
1
true
2022-07-17T21:33:29.037Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rock Paper Scissors not working properly JS<p>I can only seem to get 2 outcomes when player selects rock or scissors. Wont always run on click. Very buggy an...
72,812,017
JPA method increases version field of searching entity<p>I'm using Spring boot 2.7.0</p> <p>And have the next entities in simple:</p> <pre class="lang-java prettyprint-override"><code>@Getter @Setter @Entity public class Account { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; ...
<p>It looks like hibernate is deriving lockMode type as either of <code>WRITE</code> or <code>OPTIMISTIC_FORCE_INCREMENT</code> or <code>PESSIMISTIC_FORCE_INCREMENT</code> based on isolation level of your database. As per <a href="https://docs.jboss.org/hibernate/core/3.3/api/org/hibernate/LockMode.html" rel="nofollow ...
JPA method increases version field of searching entity
java|spring-boot|spring-data-jpa
0
50
3
72,813,319
72,813,319
1
true
2022-06-30T07:43:16.447Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JPA method increases version field of searching entity<p>I'm using Spring boot 2.7.0</p> <p>And have the next entities in simple:</p> <pre class="lang-java p...
72,952,372
R Create a data frame summarising per column unique values from another data frame and sort<p>This question follows on from a discussion began <a href="https://stackoverflow.com/questions/72939176/r-order-list-based-on-multiple-characters-from-each-item/72939262?noredirect=1#comment128830081_72939262">here</a>. I felt ...
<p>You could wrap <a href="https://stackoverflow.com/a/72939262/6574038"><em>@Allan Cameron</em>'s logic</a> in a function, that extends it to sort the columns' <code>unique</code> values. <code>if</code> there are numbers included, which <code>grepl</code> will tell us, we apply the logic. I called it <code>makeLevels...
R Create a data frame summarising per column unique values from another data frame and sort
r
3
50
2
72,954,853
72,954,853
1
true
2022-07-12T12:31:33.310Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R Create a data frame summarising per column unique values from another data frame and sort<p>This question follows on from a discussion began <a href="https...
73,009,144
When does Node garbage collect?<p>I have a NodeJS server running on a small VM with 256MB of RAM and I notice the memory usage keeps growing as the server receives new requests. I read that an issue on small environments is that Node doesn't know about the memory constraints and therefore doesn't try to garbage collect...
<p>This might not be a complete answer, but it's coming from experience and might provide some pointers. Memory leak in NodeJS is one of the most challenging bugs that most developers could ever face.</p> <p>But before we talk about memory leak, to answer your question - unless you explicitly configure <code>--max-old...
When does Node garbage collect?
node.js|memory-management
0
50
1
73,009,728
73,009,728
1
true
2022-07-17T03:52:10.880Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: When does Node garbage collect?<p>I have a NodeJS server running on a small VM with 256MB of RAM and I notice the memory usage keeps growing as the server re...
72,946,143
Is there a way to make 'xsl:for-each' create one output file for every found instance?<p>I have three files: '1b.xml', '2b.xml' and 'try.xcl'.</p> <p>What I want to create is a number of xml and/or html files, each consisting of one of the instances found by the 'xsl:for-each', named after the @date and @id. I also nee...
<p><em><strong>--- edited in response to clariifcation ---</strong></em></p> <p>In <strong>XSLT 2.0</strong> or higher, you can do:</p> <pre><code>&lt;xsl:stylesheet version=&quot;2.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt; &lt;xsl:output method=&quot;xml&quot; version=&quot;1.0&quot; enco...
Is there a way to make 'xsl:for-each' create one output file for every found instance?
xml|xslt
0
50
1
72,947,110
72,947,110
1
true
2022-07-12T01:29:36.117Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to make 'xsl:for-each' create one output file for every found instance?<p>I have three files: '1b.xml', '2b.xml' and 'try.xcl'.</p> <p>What I ...
72,911,681
Manipulating another cell when a cell changes value in VBA<p>This is the whole thing. Like I said, they both work when only one is in there at a time. I tried placing it at the end, the beginning. Sorry, still trying to learn so I wanted to see if I could trouble shoot first. No luck.</p> <pre><code>Option Explicit ...
<p>Please, copy the next code in the sheet module where to be triggered:</p> <pre><code>Option Explicit Private prevVal Private Sub Worksheet_Activate() If ActiveCell.Column = 6 Then prevVal = ActiveCell.value 'memorize the value of the active cell End If End Sub Private Sub Worksheet_SelectionChange(By...
Manipulating another cell when a cell changes value in VBA
excel|vba|automation
2
50
1
72,911,865
72,911,865
1
true
2022-07-08T12:48:59.533Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Manipulating another cell when a cell changes value in VBA<p>This is the whole thing. Like I said, they both work when only one is in there at a time. I tri...
72,904,216
How to execute directives in sequence order with async in Angular 13?<p>I build a standard register form with Angular and I want to validate if the email is already taken with an async directive (UserExistsDirective), then manage the error message with a second directive (ValidityStyleDirective). The second directive i...
<p>I found my answer. I share it in case it could help someone else.</p> <p>I got the result I wanted by removing/adding the IS-INVALID class from appUserExists directive</p> <pre><code>@Directive({ selector: '[appUserExists]', providers: [{ provide: NG_ASYNC_VALIDATORS, useExisting: UserExistsDirective, ...
How to execute directives in sequence order with async in Angular 13?
angular|typescript|angular-directive
1
50
1
72,906,145
72,906,145
1
true
2022-07-07T21:06:40.937Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to execute directives in sequence order with async in Angular 13?<p>I build a standard register form with Angular and I want to validate if the email is ...
72,802,602
Snmp translate for CommonObjs?<p>Tring to go through new mib i added to mibs file, i have run this command as a test</p> <pre><code>snmpwalk -v3 -u $USER-l authPriv -a SHA -A &quot;$PASS&quot; -x AES -X $PASS 10.x.x.x panCommonMib </code></pre> <p>and i think it made the walk on the entire PAN-COMMON-MIB which is good...
<p>Maybe your MIBs are outdated.</p> <pre><code>snmptranslate -IR -Td -OS PAN-COMMON-MIB::panCommonObjs.7.4.4.1.6.6 PAN-COMMON-MIB::panDeviceLoggingExtFwdStatsTable1minAvgSendRate.6 panDeviceLoggingExtFwdStatsTable1minAvgSendRate OBJECT-TYPE -- FROM PAN-COMMON-MIB SYNTAX Unsigned32 MAX-ACCESS read-only ...
Snmp translate for CommonObjs?
snmp|net-snmp|mib|snmpd
0
50
1
72,845,352
72,845,352
1
true
2022-06-29T13:52:40.837Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Snmp translate for CommonObjs?<p>Tring to go through new mib i added to mibs file, i have run this command as a test</p> <pre><code>snmpwalk -v3 -u $USER-l ...
72,779,257
Is there a best practice ("right way") for inspecting fetch response object in vanilla html/css/js app?<p><strong>Background</strong></p> <p>I cooked up a very basic (inline js in the <code>&lt;script&gt;</code> tag!) web app that makes a rest API request of an API I also implemented.</p> <p>I'm a novice to webdev and ...
<p>If you want access to elements of the response besides just the parsed JSON, then by all means, you can create your own function that calls <code>fetch()</code> and uses some logic and then returns multiple pieces of the response data. I would personally probably not repackage the <code>response</code> data structu...
Is there a best practice ("right way") for inspecting fetch response object in vanilla html/css/js app?
javascript|design-patterns|ecmascript-6|async-await
1
50
1
72,780,214
72,780,214
1
true
2022-06-27T23:28:20.320Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a best practice ("right way") for inspecting fetch response object in vanilla html/css/js app?<p><strong>Background</strong></p> <p>I cooked up a ve...
73,004,492
How to update an existing column of a dataframe based on values in another column?<p>In python, I'm dealing with a sales data of about 21,000 houses. Each house (row) has columns 'sqft_living' (int64), and 'grade' (int64) among others. I want to increase the 'grade' of every house by 2 if its sqft_living &gt; 400, or b...
<pre><code>df = pd.DataFrame() df['sqft_living'] = range(396, 405) df['grade'] = range(9) df </code></pre> <p>So we have:</p> <pre><code>sqft_living grade 0 396 0 1 397 1 2 398 2 3 399 3 4 400 4 5 401 5 6 402 6 7 403 7 8 404 8 </code></pre> <p>We apply the condi...
How to update an existing column of a dataframe based on values in another column?
python|pandas|dataframe
0
50
1
73,004,569
73,004,569
1
true
2022-07-16T13:08:44.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to update an existing column of a dataframe based on values in another column?<p>In python, I'm dealing with a sales data of about 21,000 houses. Each ho...
72,979,594
Scrolling the page up in React<p>In my component, i wanna scroll the page up when the user click on <code>Link</code> Component witch will change the url and therefore what user sees.</p> <pre><code>import { Link } from &quot;react-router-dom&quot;; const RelatedMovieItem = props =&gt; { const movie = props.movie;...
<p>if every route changes you want to scroll top you can do it using <code>&lt;ScrollToTop&gt;</code> passing children down the tree like that.</p> <pre><code>&lt;BrowserRouter&gt; &lt;ScrollToTop&gt; &lt;Switch&gt; // your route &lt;/Switch&gt; &lt;/ScrollToTop&gt; &lt;/BrowserRouter&gt;; </code></p...
Scrolling the page up in React
reactjs
-1
50
3
72,979,729
72,979,729
1
true
2022-07-14T11:13:25.527Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scrolling the page up in React<p>In my component, i wanna scroll the page up when the user click on <code>Link</code> Component witch will change the url and...
72,999,588
Tree-Structure does not inherit generics<p>My goal is to create a tree-like object structure.</p> <p>For this i created a class named Node (I removed the implementation because the problem still persists without it):</p> <pre><code>public class Node&lt;S&gt; { public Node&lt;S&gt; addChild(Node&lt;S&gt; node) { ...
<p>The use of <code>&lt;&gt;</code> requires type inference, and the argument of the first <code>addChild</code> must be a Node, and just passing <code>new Node&lt;&gt;()</code> would do - infering from the return type. But chaining to <code>.addChild(new Node&lt;&gt;())</code> cannot infer anything, can only provide <...
Tree-Structure does not inherit generics
java|generics
1
50
2
73,000,535
73,000,535
1
true
2022-07-15T21:05:23.623Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Tree-Structure does not inherit generics<p>My goal is to create a tree-like object structure.</p> <p>For this i created a class named Node (I removed the imp...
72,957,871
How can I solve pandas error tokenizing data?<p>I have a .tsv file displayed below and I want to make dataframe of it using pandas. I am getting error tokenizing data. How can I overcome this error ?</p> <p>Tsv file (data):</p> <p><a href="https://i.stack.imgur.com/PNYtn.png" rel="nofollow noreferrer"><img src="https:/...
<p><code>read_csv</code> is by default taking your first line as a header. <code>append</code> and <code>6.0</code> become your two headers. Then it looks for two columns in subsequent rows. In line 3 it finds 4 values and vomits.</p> <p>You need another approach to handle this data where each line is a key-value pa...
How can I solve pandas error tokenizing data?
python|pandas|dataframe|csv
0
50
1
72,957,976
72,957,976
1
true
2022-07-12T20:09:16.853Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I solve pandas error tokenizing data?<p>I have a .tsv file displayed below and I want to make dataframe of it using pandas. I am getting error tokeni...
72,977,379
How to use ElemMatch to compare List<DataTime> in C#?<p>How to deal with <code>{Document} is not supported.</code> exception in C#?</p> <p>Want to convert below MongoDB query to C# code:</p> <pre><code>db.Data.find({ &quot;searchData&quot;: &quot;Abc&quot;, &quot;modifyDates&quot;: { $elemMatch:{ ...
<p>The error says that you can't use expression income argument <code>d</code> for this particular case. I think this case is just not implemented yet in the driver. You can use a raw bson document form instead typed:</p> <pre><code> var builder = Builders&lt;MyData&gt;.Filter; var filter = builder.ElemM...
How to use ElemMatch to compare List<DataTime> in C#?
c#|mongodb
0
50
1
73,022,229
73,022,229
1
true
2022-07-14T08:19:36.230Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use ElemMatch to compare List<DataTime> in C#?<p>How to deal with <code>{Document} is not supported.</code> exception in C#?</p> <p>Want to convert be...
73,010,628
Trouble generating subtypes: Resulting Pick<T, never> becomes any instead of never. How to avoid?<p>Edit:<br /> I believe the real problem is that there isn't / I don't know a type for an empty object?! The following, surprisingly, is not an error:</p> <pre class="lang-js prettyprint-override"><code>const empty = {} as...
<p>I found <a href="https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492" rel="nofollow noreferrer">this Github issue</a> helpful.</p> <blockquote> <p>The type {} doesn't mean &quot;any empty object&quot;, it means &quot;any non-nullish value&quot;.</p> </blockquote> <p>Since the <c...
Trouble generating subtypes: Resulting Pick<T, never> becomes any instead of never. How to avoid?
typescript
1
50
1
73,011,629
73,011,629
1
true
2022-07-17T09:23:26.913Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trouble generating subtypes: Resulting Pick<T, never> becomes any instead of never. How to avoid?<p>Edit:<br /> I believe the real problem is that there isn'...
72,783,849
Configuration usage inside an Entity class<p>Imagine, we have an entity like this:</p> <pre><code>public class Entity { public int Id { get; set; } public Dictionary&lt;int, string&gt; Data { get; set; } public Dictionary&lt;int, string&gt; RestirctedData { ...
<p>Since you're talking of injection, I assume you're using .NET Core, right?</p> <p>You'd better be injecting your configuration file in the <code>Entity</code> class constructor:</p> <pre><code>public class Entity { IConfiguration Configuration; int restriction; public Dictionary&lt;int, string&gt; D...
Configuration usage inside an Entity class
c#
0
50
2
72,784,572
72,784,572
1
true
2022-06-28T09:21:54.590Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Configuration usage inside an Entity class<p>Imagine, we have an entity like this:</p> <pre><code>public class Entity { public int Id { g...
72,798,930
How can I read Json as Map[String,String]?<p>I got the problem when parsing JSON to Map[String, String]. The idea is to parse the nested object to a key separate by &quot;.&quot;</p> <p>Can we format this input JSON:</p> <pre><code>{ &quot;key-1&quot;:{ &quot;sub-key-1-1&quot;:{ &quot;sub-key-1-1-1...
<p>You can think about it this way, if the JsValue is a JsObject, you need to extract the key values and append them to the current state of your function, if it's anything else, you can just add them to the state of your function, and then return them. Thinking recursively:</p> <pre class="lang-scala prettyprint-overr...
How can I read Json as Map[String,String]?
json|scala|play-json
0
50
1
72,800,914
72,800,914
1
true
2022-06-29T09:22:16.097Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I read Json as Map[String,String]?<p>I got the problem when parsing JSON to Map[String, String]. The idea is to parse the nested object to a key sepa...
72,777,844
BufferedReader unexpected behavior<p>I have an unusual problem with BufferedReader in Java 11. I have a simple command-line student tracker application, that reads input from <code>System.in</code>, transforms it into the appropriate implementation of <code>Command</code> interface, and executes it.</p> <pre><code>void...
<p>This issue only occurs when you run your program in the IDE. If you run it from the command line, using the command <code>java [ClassName]</code>, it should work just fine.</p> <p>The problem is a <a href="https://youtrack.jetbrains.com/issue/IDEA-293951" rel="nofollow noreferrer">bug in IntelliJ IDEA</a> which was ...
BufferedReader unexpected behavior
java|bufferedreader
1
50
1
72,778,139
72,778,139
2
true
2022-06-27T20:16:21.693Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: BufferedReader unexpected behavior<p>I have an unusual problem with BufferedReader in Java 11. I have a simple command-line student tracker application, that...
72,779,914
How to create a dictionary out of weird list format?<p>So I used SQL to try to describe a table and got a weird output because my function returns a list so I have this weird format that I want to make into a list of dictionaries. But not sure how I would go about it. And was wondering if someone could point me in the ...
<p>Try this:</p> <pre><code># This is the info you provided in the original question: data = [['Field', 'Type', 'Null', 'Key', 'Default', 'Extra'], (('_id', 'bigint(20) unsigned', 'NO', 'PRI', None, ''), ('_load_dt', 'date', 'NO', '', None, ''), ('_load_dt_time', 'timestamp', 'YES', 'MUL', 'current_timestamp()', ''),...
How to create a dictionary out of weird list format?
python|loops|dictionary|iteration
1
50
3
72,779,976
72,779,976
2
true
2022-06-28T01:51:56Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create a dictionary out of weird list format?<p>So I used SQL to try to describe a table and got a weird output because my function returns a list so ...
72,780,053
Mongodb how to search by regex OR on many fields?<p>I want to make a search on many fields of mongodb.</p> <p>Here is what I did so far</p> <pre><code>var filter bson.D filter = append(filter, bson.E{&quot;title&quot;, primitive.Regex{Pattern: &quot;input&quot;, Options: &quot;i&quot;}}) filter = append(filter, bson.E{...
<p>maybe you can use <code>$or</code> and <code>$regex</code> directly</p> <pre class="lang-golang prettyprint-override"><code>filter := bson.M{ &quot;$or&quot;: bson.A{ bson.M{&quot;title&quot;: bson.M{&quot;$regex&quot;: &quot;input&quot;}}, bson.M{&quot;author&quot;: bson.M{&quot;$regex&quot;: &q...
Mongodb how to search by regex OR on many fields?
mongodb|go
1
50
1
72,780,187
72,780,187
2
true
2022-06-28T02:15:12.443Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mongodb how to search by regex OR on many fields?<p>I want to make a search on many fields of mongodb.</p> <p>Here is what I did so far</p> <pre><code>var fi...
72,781,114
Why i am not able to see output for 100 times in the javascript console even if i am successfully looping through 100 times and printing console.log?<p><a href="https://i.stack.imgur.com/uEY3v.png" rel="nofollow noreferrer">enter image description here</a>This is my output image:</p> <p><div class="snippet" data-lang="...
<p>In your last console log:</p> <pre><code>console.log( i + &quot; bottles of beer on the wall, &quot; + i + &quot; bottles of beer.\nTake one down and pass it around, &quot; + i - 1 + &quot; bottles of beer on the wall.&quot; ); </code></pre> <p>Everything before the <code>-1...
Why i am not able to see output for 100 times in the javascript console even if i am successfully looping through 100 times and printing console.log?
javascript|loops
0
50
2
72,781,186
72,781,186
2
true
2022-06-28T05:26:00.540Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why i am not able to see output for 100 times in the javascript console even if i am successfully looping through 100 times and printing console.log?<p><a hr...
72,784,995
Pytest raises exception but assert doesn't catch it, although they are the same type and same value<p>I am writing test for this function:</p> <pre class="lang-py prettyprint-override"><code>def get_current_active_user(current_user: models.User = Depends(get_current_user)) -&gt; models.User: if not current_user.is_...
<p><code>==</code> in python might just compare the objects's ids, which is why the equality fails here.</p> <p>Maybe you should try something like:</p> <pre class="lang-py prettyprint-override"><code>assert exc_info.value.status_code == 400 assert exc_info.detail == 'Inactive user' </code></pre>
Pytest raises exception but assert doesn't catch it, although they are the same type and same value
python|pytest|fastapi
0
50
4
72,785,108
72,785,108
2
true
2022-06-28T10:41:25.743Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pytest raises exception but assert doesn't catch it, although they are the same type and same value<p>I am writing test for this function:</p> <pre class="la...
72,801,870
Is it possible to get instance of a class 2 where constructor of class 1 was called?<p>Lets imagine this situation: we have Class1 and Class2</p> <pre><code>public class Class1 { private Class2 field; public Class1() {} public doStuff() { this.field = new Class2(); } } public class Class2 { ...
<p>Since your <code>Class2</code> always seems to require a <code>Class1</code> object, this might be a pretty good case for an inner class.</p> <pre><code>public class Class1 { private Class2 field; public doStuff() { this.field = new Class2(); } // Class2 is an inner class of Class1 publ...
Is it possible to get instance of a class 2 where constructor of class 1 was called?
java|oop
0
50
2
72,802,008
72,802,008
2
true
2022-06-29T13:01:30.547Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to get instance of a class 2 where constructor of class 1 was called?<p>Lets imagine this situation: we have Class1 and Class2</p> <pre><code>...
72,803,429
Can't just take a face when doing face detection<p>I'm trying to make a face detection program using OpenCV from an open source tutorial. The goal is to detect face from a video which result is used to be a model for each face. Each face will be saved in folder, i have 2 problems when i try the program:</p> <ol> <li><p...
<ol> <li>To take only faces, it is necessary to take variables that are taken from the face only (It is in the image2 variable). What you do when it detects the video will blur the detected face so that it can pick up the blurred part.</li> </ol> <pre><code>image2 = image[y:(y+h),x:(x+w)] cv2.imwrite(&quot;../output_mo...
Can't just take a face when doing face detection
opencv|machine-learning|computer-vision|artificial-intelligence
0
50
1
72,803,711
72,803,711
2
true
2022-06-29T14:48:30.073Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't just take a face when doing face detection<p>I'm trying to make a face detection program using OpenCV from an open source tutorial. The goal is to dete...
72,821,401
Child Markdown printing unknown NULL value<p>Im doing survey reporting and I need to produce the same likert scale question analysis repeatedly. I am doing this using a Child Markdown turned into a function and pmap. The child markdown produces a frequency response table, and a plot with tool tips made using ggiraph.</...
<p>You could make <code>pmap</code> output <code>invisible</code>:</p> <pre><code>```{r, results = 'asis', echo = FALSE} invisible(pmap(questions_list, Child_function)) ``` </code></pre>
Child Markdown printing unknown NULL value
r|r-markdown|knitr|purrr
0
50
1
72,821,998
72,821,998
2
true
2022-06-30T20:00:55.267Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Child Markdown printing unknown NULL value<p>Im doing survey reporting and I need to produce the same likert scale question analysis repeatedly. I am doing t...
72,822,698
Merging two dataframes when none of the columns are an exact match<p>I have two panda large dataframes that I would like to merge using the second column. The issue is that the first dataframe is longer than the second dataframe, so there are some names that won't be found in the second column. I would like to merge th...
<p>If you don't need that specific row order in the output dataframe, you can just do this:</p> <pre><code>import pandas as pd df1 = pd.DataFrame( {'col1': [1,7,4,2,33,83,78], 'col2': ['Johnny', 'Cathy', 'Becky', 'Sarah', 'Courtney', 'Avery', 'Adam']} ) df2 = pd.DataFrame( {'col1': [12,3,13,15,55], 'co...
Merging two dataframes when none of the columns are an exact match
python|pandas|dataframe|merge|data-cleaning
0
50
1
72,822,864
72,822,864
2
true
2022-06-30T22:37:41.160Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Merging two dataframes when none of the columns are an exact match<p>I have two panda large dataframes that I would like to merge using the second column. Th...
72,822,951
Scanning and Replacing Values of Rows in R<p>I have this dataset:</p> <pre><code>sample_data = data.frame(col1 = c(&quot;james&quot;, &quot;john&quot;, &quot;henry&quot;), col2 = c(&quot;123 forest road&quot;, &quot;jason&quot;, &quot;tim&quot;), col3 = c(&quot;NA&quot;, &quot;124 valley street&quot;, &quot;peter&quot;...
<p>This should work:</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) library(tidyr) library(stringr) sample_data = data.frame(col1 = c(&quot;james&quot;, &quot;john&quot;, &quot;henry&quot;), col2 = c(&quot;123 forest road&quot;, &quot;jason&quot;, &quot;tim&quot;), col3 = c(&quot;NA&quot;, &quot;124 ...
Scanning and Replacing Values of Rows in R
r|data-manipulation
1
50
2
72,823,079
72,823,079
2
true
2022-06-30T23:20:39.807Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scanning and Replacing Values of Rows in R<p>I have this dataset:</p> <pre><code>sample_data = data.frame(col1 = c(&quot;james&quot;, &quot;john&quot;, &quot...
72,825,915
what can I pass [SomeType] to "paramName: SomeType = []" swift?<p>I'm pretty new to swift, trying to get authorization from user.</p> <p>to request multiple auth at once, I gathered multiple options as array, and trying to request.</p> <pre><code>let variableArray = [UNAuthorizationOptions.badge, UNAuthorizationOptions...
<p>This is because <code>UNAuthorizationOptions</code> conforms to the protocol <code>OptionSet</code> and an <code>OptionSet</code> can be initialised using an array literal, that is [...] which is something different than your <code>variableArray</code> which is an <code>Array</code> object.</p> <p>So this is why you...
what can I pass [SomeType] to "paramName: SomeType = []" swift?
ios|swift|iphone
1
50
2
72,826,080
72,826,080
2
true
2022-07-01T07:40:24.127Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: what can I pass [SomeType] to "paramName: SomeType = []" swift?<p>I'm pretty new to swift, trying to get authorization from user.</p> <p>to request multiple ...
72,827,343
How to remove the index column after flattening MultiIndex columns and apply styling to the DataFrame?<p>I have a sample pandas dataframe with 3 columns.</p> <p>Here's the sample dataset -</p> <pre><code>In [3]: df = pd.DataFrame({ ...: 'mode': ['car'] * 4 + ['train'] * 3 + ['truck'] * 5, ...:...
<p><code>mode</code> is the index name, you can assign the index name to column header name</p> <pre class="lang-py prettyprint-override"><code>pivot1.columns.name, pivot1.index.name = pivot1.index.name, None </code></pre> <pre><code>print(pivot1) mode qty1 qty2 car 22 16 train 13 20 truck 20 24...
How to remove the index column after flattening MultiIndex columns and apply styling to the DataFrame?
python|pandas|dataframe|pivot-table|pandas-styles
2
50
1
72,827,634
72,827,634
2
true
2022-07-01T09:41:21.867Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to remove the index column after flattening MultiIndex columns and apply styling to the DataFrame?<p>I have a sample pandas dataframe with 3 columns.</p>...
72,825,868
Solving this equation in sympy<p>I'm playing with rotational matrices and similar concepts using sympy. I'm trying to extract alpha, beta, gamma from the following matrix:</p> <pre><code>⎡ α - γ⋅sin(θ) ⎤ ⎢ ⎥ ⎢β⋅cos(φ) + γ⋅sin(φ)⋅cos(θ) ⎥ ⎢ ⎥ ⎣-β⋅sin(φ) + ...
<p>You can use SymPy's <code>linear_eq_to_matrix</code> function:</p> <pre><code>In [6]: a, b, g = symbols(&quot;α β γ&quot;, positive=True) ...: t, p = symbols(&quot;θ φ&quot;, positive=True, nonzero=True) In [7]: bres = Matrix([[a - g*sin(t)], ...: [b*cos(p) + g*sin(p)*cos(t)], ...: ...
Solving this equation in sympy
python|sympy
0
50
2
72,833,300
72,833,300
2
true
2022-07-01T07:36:30.860Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Solving this equation in sympy<p>I'm playing with rotational matrices and similar concepts using sympy. I'm trying to extract alpha, beta, gamma from the fol...
72,835,639
How do I properly sort this array?<p>I've created a couple arrays. arrLocations holds a series of 2-digit country names, arrResults counts how many times each occurs and holds the country name with it's count as see here:</p> <pre><code>[ FR: 40, US: 1511, AU: 82, CN: 151, IE: 170, SG: 108, GB: 66, KR: 52, J...
<p>OK, so first of all I'm assuming this</p> <pre class="lang-js prettyprint-override"><code>[ FR: 40, US: 1511, AU: 82, CN: 151, IE: 170, SG: 108, GB: 66, KR: 52, JP: 137, IN: 45, BR: 68, SE: 39, ZA: 19, NL: 19, BH: 19, LU: 3, CA: 41, DE: 79, ID: 1, HK: 1 ] </code></pre> <p>Is actually t...
How do I properly sort this array?
javascript|node.js
-2
50
1
72,835,884
72,835,884
2
true
2022-07-02T00:23:30.767Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I properly sort this array?<p>I've created a couple arrays. arrLocations holds a series of 2-digit country names, arrResults counts how many times eac...
72,839,565
Databases Folder Empty In Device File Explorer-ROOM Database<p><strong>When the app is ran, no errors occur however, the databases folder in device file explorer is empty. I have tried to fix the issue myself but since I'm new to android studio and kotlin I haven't been able to I just want to ensure the database is wor...
<blockquote> <p>I just want to ensure the database is working before I carry on with the rest of the code.</p> </blockquote> <p>Then I would suggest testing that in isolation (there are some issues).</p> <p>I would suggest temporarily adding <code>.allowMainThreadQueries</code> to the databaseBuilder in the <strong>Tod...
Databases Folder Empty In Device File Explorer-ROOM Database
android|android-studio|android-room
2
50
1
72,842,581
72,842,581
2
true
2022-07-02T13:53:24.310Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Databases Folder Empty In Device File Explorer-ROOM Database<p><strong>When the app is ran, no errors occur however, the databases folder in device file expl...
72,842,430
Ramda - How to sort array with nested object with string to number conversion<p>I am trying to sort the array which looks like this:</p> <pre><code>const testArray = [ { &quot;id&quot;: &quot;1&quot;, &quot;nodeLayout&quot;: { &quot;x&quot;: &quot;12.0&quot;, &quot;y&quot;: &quot;1.0&quot;, ...
<p>If you combine your two approaches, you should be able to achieve what you're wanting.</p> <p>The main thing being that you can <code>R.pipe</code> the call to <code>parseFloat</code> after obtaining the value you'd like to sort with <code>R.path</code>. This piped function can be provided as the argument to <code>R...
Ramda - How to sort array with nested object with string to number conversion
ramda.js
1
50
1
72,843,179
72,843,179
2
true
2022-07-02T21:08:55.797Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ramda - How to sort array with nested object with string to number conversion<p>I am trying to sort the array which looks like this:</p> <pre><code>const tes...
72,843,300
How to create a dictionary value for each given key?<p>I have a list <code>l=['a','b','c']</code> and I want to create a dict that takes these items as keys and then adds a value to it. Such as:</p> <pre><code>d={ 'a':0, 'b':1, 'c':2 } </code></pre> <p>How would I be able to this?</p>
<p>There are many ways to create this dictionary. Here is just a few:</p> <pre><code>&gt;&gt;&gt; dc = dict(zip(ls, range(3))) &gt;&gt;&gt; dc2 = {v: k for k, v in enumerate(ls)} &gt;&gt;&gt; dc2 {'a': 0, 'b': 1, 'c': 2} &gt;&gt;&gt; assert dc == dc2 &gt;&gt;&gt; # silence because they're same </code></pre>
How to create a dictionary value for each given key?
python
-3
50
3
72,843,317
72,843,317
2
true
2022-07-03T00:44:39.047Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create a dictionary value for each given key?<p>I have a list <code>l=['a','b','c']</code> and I want to create a dict that takes these items as keys ...
72,843,889
pyqt5 connecting button press to a stackedWidget<p>I just converted my .ui file into the py file and tried to link a <code>QPushButton</code> to a <code>QStackedWidget</code> using the signals and slots system. This is what I attempted to do:</p> <pre><code>self.createButton.clicked.connect(self.stackedWidget.setCurren...
<p>the the connect function takes as a parameter a function to call when the click event is emited so you should wrap your statment in a lambda function as follows :</p> <pre class="lang-py prettyprint-override"><code>self.createButton.clicked.connect(lambda: self.stackedWidget.setCurrentIndex(2)) </code></pre>
pyqt5 connecting button press to a stackedWidget
python|pyqt5|qt-signals
0
50
1
72,843,923
72,843,923
2
true
2022-07-03T04:21:00.793Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: pyqt5 connecting button press to a stackedWidget<p>I just converted my .ui file into the py file and tried to link a <code>QPushButton</code> to a <code>QSta...
72,845,900
How to print table in looping pyhton console<p>I want to print a table on my console. From now am using pandas how to print using tabulate</p> <p>Here is my Source code:</p> <pre><code>from numpy import average import pandas as pd z = 10119011 a = 17 c = 43 m = 499 for i in range(0, 21): LCG = ((a*z)+c) % m z...
<p>If you use tabulate, you need to pass your dataframe <code>df</code> as main argument and specify its keys:</p> <pre><code>from numpy import average import pandas as pd from tabulate import tabulate z = 10119011 a = 17 c = 43 m = 499 for i in range(0, 21): LCG = ((a*z)+c) % m z = LCG u = z/m hasil ...
How to print table in looping pyhton console
python|pandas|tabulate|lcg
1
50
1
72,845,921
72,845,921
2
true
2022-07-03T10:56:28.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to print table in looping pyhton console<p>I want to print a table on my console. From now am using pandas how to print using tabulate</p> <p>Here is my ...
72,857,582
HelloWorld.exe (process 12192) exited with code 0 issue<p>I'm a beginner in learning C++ programming and just started to use IDE VS Community 2022. I've created the new project corresponding to tutorial and when i run it i get the messege in the console:</p> <pre><code>C:\Users\??????\source\repos\HelloWorld\x64\Debug\...
<p>This is a feature of the IDE you are using. Try to run your program using the command line prompt directly and the message will not be displayed.</p>
HelloWorld.exe (process 12192) exited with code 0 issue
c++|visual-studio-2022
0
50
1
72,857,620
72,857,620
2
true
2022-07-04T13:32:10.633Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: HelloWorld.exe (process 12192) exited with code 0 issue<p>I'm a beginner in learning C++ programming and just started to use IDE VS Community 2022. I've crea...
72,865,285
Function that expects u16 return type errors, mismatched types even though I am using return to get values early out of function<p>I am getting an error</p> <blockquote> <p>mismatched types error, expected u16, found ()</p> </blockquote> <p>from this function (code below) and I can't seem to find why because it is guar...
<p>What if <code>self.fields</code> is empty? In this case, the loop won't be executed at all. What will be returned?</p> <p>In general, all loop kinds except <code>loop</code> without <code>break</code> cannot affect whether the function will return, because they can not run.</p>
Function that expects u16 return type errors, mismatched types even though I am using return to get values early out of function
rust|compiler-errors
1
50
1
72,865,311
72,865,311
2
true
2022-07-05T07:10:18.800Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Function that expects u16 return type errors, mismatched types even though I am using return to get values early out of function<p>I am getting an error</p> ...
72,877,247
One row time lag using R<p>I have a data <code>df</code> as follows:</p> <pre><code>df &lt;- data.frame(id = c(1,1,1,2,2,2,2,3,3), year=c(2011,2012,2013,2010,2011,2012,2013,2012,2013), points=c(45,69,79,53,13,12,11,89,91), result = c(2,3,5,4,6,1,2,3,4)) </code></pre> ...
<p>Tidyverse solution:</p> <pre><code>library(tidyverse) df %&gt;% group_by(id) %&gt;% mutate(lead_result = lead(result)) %&gt;% na.exclude # A tibble: 6 x 5 # Groups: id [3] id year points result lead_result &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; 1 1 2011 45 2 ...
One row time lag using R
r|dataframe|time
0
50
2
72,877,280
72,877,280
2
true
2022-07-06T02:14:45.263Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: One row time lag using R<p>I have a data <code>df</code> as follows:</p> <pre><code>df &lt;- data.frame(id = c(1,1,1,2,2,2,2,3,3), year=c(2...
72,879,240
How to make the default selection of a value in sql out of multiple choices?<p>I have a column in my SQL table i.e. <code>Gender</code> and there can be one of two possible values for it, 'M' and 'F'.</p> <p>For those values, I am able to pass two values by using a check constraint as option when creating the table:</p...
<p>Both can be used as part of the <em>create table</em> syntax:</p> <pre><code>create table t(gender char(1) default('M') check(gender in ('M','F'))); </code></pre> <p><a href="https://dbfiddle.uk/?rdbms=sqlserver_2019&amp;fiddle=03a2d5c7a244c07c355b2fdd66b794a1" rel="nofollow noreferrer">Demo Fiddle</a></p>
How to make the default selection of a value in sql out of multiple choices?
sql|sql-server
0
50
2
72,879,603
72,879,603
2
true
2022-07-06T07:08:34.817Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make the default selection of a value in sql out of multiple choices?<p>I have a column in my SQL table i.e. <code>Gender</code> and there can be one ...
72,875,696
Pass the whole grouped data frame to a function in summarise<p>With the new <code>summarise</code> from dplyr 1.0.0 it is possible to pass a function to summarise than returns a tibble</p> <pre><code>library(tidyverse) df &lt;- tibble( grp = rep(1:2, each = 5), x = c(rnorm(5, -0.25, 1), rnorm(5, 0, 1.5)), y = c...
<pre><code>tibble(gr=c(1,1,2), a=c(1,2,10), b=c(1,2,10)) %&gt;% print() %&gt;% # A tibble: 3 x 3 # gr a b # &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; # 1 1 1 1 # 2 1 2 2 # 3 2 10 10 group_by(gr) %&gt;% summarise(r=sum(cur_data())) # A tibble: 2 x 2 # gr ...
Pass the whole grouped data frame to a function in summarise
r|dplyr|purrr
-1
50
1
72,880,148
72,880,148
2
true
2022-07-05T21:24:24.080Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pass the whole grouped data frame to a function in summarise<p>With the new <code>summarise</code> from dplyr 1.0.0 it is possible to pass a function to summ...
72,877,676
Issue trying to read and filter columns using pd.read_csv when columns have same names<p>I have imported data from Yfinance using</p> <p><code>historicaldata = pdr.get_data_yahoo(tickers, period='1mo', interval='5m', prepost=True, group_by='ticker')</code> <code>historicaldata.to_csv('./store/historicaldata.csv')</code...
<p>Since you're reading a csv-file that was produced from a dataframe with multi-index columns, you have to take that into account when reading it back into a dataframe.</p> <p>Try something like the following:</p> <pre><code>from pandas_datareader import data as pdr import yfinance as yf yf.pdr_override() tickers = &...
Issue trying to read and filter columns using pd.read_csv when columns have same names
python|pandas|csv
1
50
1
72,884,758
72,884,758
2
true
2022-07-06T03:34:16.327Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Issue trying to read and filter columns using pd.read_csv when columns have same names<p>I have imported data from Yfinance using</p> <p><code>historicaldata...
72,905,061
Algorithm for grouping non-transitive pairs of items into maximal (overlapping) subsets<p>I'm working on an algorithm to combine matching pairs of items into larger groups. The problem is that these pairs are <strong>not</strong> transitive; 1=2 and 2=3 does not necessarily mean that 1=3. They are, however, commutative...
<p>If you want ALL maximal groups, then there is no subexponential algorithm for this problem. As <a href="https://cstheory.stackexchange.com/questions/8390/the-number-of-cliques-in-a-graph-the-moon-and-moser-1965-result">https://cstheory.stackexchange.com/questions/8390/the-number-of-cliques-in-a-graph-the-moon-and-m...
Algorithm for grouping non-transitive pairs of items into maximal (overlapping) subsets
algorithm|grouping|cluster-analysis
1
50
1
72,905,919
72,905,919
2
true
2022-07-07T23:01:12.643Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Algorithm for grouping non-transitive pairs of items into maximal (overlapping) subsets<p>I'm working on an algorithm to combine matching pairs of items into...
72,911,232
Why I cannot use boolean values in $match pipeline aggregate mongose?<pre><code>const GambitSchema: Schema = new Schema({ _id: { type: String, required: true, default: v4 }, shortCode: { type: String, required: true, default: () =&gt; uid(), unique: true, }, question: { t...
<p>There are issues submitted in GitHub and your problem is related to <a href="https://github.com/Automattic/mongoose/issues/11980" rel="nofollow noreferrer">issue-11980</a>,</p> <p>It is <a href="https://github.com/Automattic/mongoose/pull/11969" rel="nofollow noreferrer">fixed</a> in mongoose latest version above 6....
Why I cannot use boolean values in $match pipeline aggregate mongose?
mongodb|mongoose
1
50
1
72,911,535
72,911,535
2
true
2022-07-08T12:13:06.307Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why I cannot use boolean values in $match pipeline aggregate mongose?<pre><code>const GambitSchema: Schema = new Schema({ _id: { type: String, required: ...
72,913,390
How to reduce the use of viewBinding, to call (text,edit)views From layout<p>I want to decrease the use of binding in my code</p> <pre><code>fun setVisibility() { binding.tvFact.visibility = View.VISIBLE binding.tvTimeStamp.visibility = View.VISIBLE binding.pr...
<p>If you do not like the syntax try this:</p> <pre><code>binding.apply{ tvFact.visibility = View.VISIBLE tvTimeStamp.visibility = View.VISIBLE progressBar.visibility = View.GONE } </code></pre>
How to reduce the use of viewBinding, to call (text,edit)views From layout
android|kotlin|binding
0
50
2
72,913,447
72,913,447
2
true
2022-07-08T15:04:01.257Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to reduce the use of viewBinding, to call (text,edit)views From layout<p>I want to decrease the use of binding in my code</p> <pre><code>fun setVisibilit...
72,925,310
ping test is always returning False<p>I am running the following ping test and it always returns False. from the cli on the same machine I ping the host and it replies, but when I run the python script it doesnt work. Not sure what I am missing? I have tried to set the number of pings higher and it has no effect. T...
<p>You need to actually inspect your response and <code>return</code> a value based on whether it indicates that the operation was a success.</p> <p>As with all Python functions, the default return value is <code>None</code>, which is treated as <code>False</code> when evaluated as a boolean.</p> <pre><code>def myping(...
ping test is always returning False
python
-2
50
1
72,925,446
72,925,446
2
true
2022-07-09T23:44:09.630Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ping test is always returning False<p>I am running the following ping test and it always returns False. from the cli on the same machine I ping the host and...
72,927,883
Why is unity compressing my button image so much?<p>I want to make a simple button in unity with an image. The image is a 800x800 png and looks fine when i open it in any image viewer. When i place the image in a asset folder and add it to my button however, it looks awful! It is supposed to look like this:</p> <p><a h...
<p>Setting the <strong>Filter Mode</strong> to <strong>Point</strong> should fix this</p> <p><a href="https://i.stack.imgur.com/lCxBI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lCxBI.png" alt="enter image description here" /></a></p> <hr /> <p>If the above method doesn't work, try tweaking <stro...
Why is unity compressing my button image so much?
unity3d|assets|image-compression
1
50
1
72,927,943
72,927,943
2
true
2022-07-10T10:45:37.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is unity compressing my button image so much?<p>I want to make a simple button in unity with an image. The image is a 800x800 png and looks fine when i o...
72,927,510
SwiftUI: .listRowBackground is not updated when new item added to the List<p>I'm trying to find the reason why <code>.listRowBackground</code> is not updated when a new item has been added to the list. Here is my code sample:</p> <pre><code> @main struct BGtestApp: App { @ObservedObject var viewModel...
<p>You can force the list to refresh when you cone back to the list. You can tag an id for your list by using <code>.id()</code>. Here is my solution:</p> <pre class="lang-swift prettyprint-override"><code>struct ContentView: View { @EnvironmentObject var vm: ViewModel @State private var viewID = UUID() ...
SwiftUI: .listRowBackground is not updated when new item added to the List
swiftui|swiftui-list
0
50
2
72,929,587
72,929,587
2
true
2022-07-10T09:37:31.050Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SwiftUI: .listRowBackground is not updated when new item added to the List<p>I'm trying to find the reason why <code>.listRowBackground</code> is not updated...
72,930,752
Python: Remove substrings from string starting and ending with certain words<p>I have a string of this kind of type:</p> <pre><code>import re s = 'T [90] Call: proof(([temp(p∨q∨r), p, ¬q], [])⊢q, _41226, _41228, proof{ \ -5: [&quot;assumptions([p,¬q,p∨q∨r])&quot;,&quot;premisses_origin([q,¬q])&quot;,&quot;premiss...
<p>I think I found it:</p> <pre><code>re.sub(&quot;proof{.*?}&quot;,'', s) </code></pre>
Python: Remove substrings from string starting and ending with certain words
python|string|substring
0
50
1
72,930,864
72,930,864
2
true
2022-07-10T18:06:51.653Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python: Remove substrings from string starting and ending with certain words<p>I have a string of this kind of type:</p> <pre><code>import re s = 'T [90] C...
72,930,308
How do I deploy my firebase functions into a specific region?<pre><code>const functions = require('firebase-functions') const admin = require('firebase-admin') admin.initializeApp() exports.sendChatMsgNotification = functions.region('europe-west1') firestore .document('chats/{idChat}/messages/{idMessage}') .onCrea...
<p>Before</p> <pre><code>exports.sendChatMsgNotification = functions.region('europe-west1') firestore </code></pre> <p>After (working)</p> <pre><code>exports.sendChatMsgNotification = functions.region('europe-west1'). firestore </code></pre> <p>I was only missing a dot (.) before &quot;firestore&quot;. Thanks @Jason Be...
How do I deploy my firebase functions into a specific region?
javascript|firebase|google-cloud-firestore|google-cloud-functions
1
50
1
72,932,211
72,932,211
2
true
2022-07-10T16:56:42.230Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I deploy my firebase functions into a specific region?<pre><code>const functions = require('firebase-functions') const admin = require('firebase-admin...
72,939,948
Kubernetes pod wont start and get CrashLoopBackOff<p>When i try to run <code>kubectl apply -f frontend.yaml</code> i get the following response from <code>kubectl get pods</code> and <code>kubectl describe pods</code></p> <pre><code>// frontend.yaml apiVersion: apps/v1 kind: Deployment metadata: name: malvacom-fronte...
<p>You're explicitly telling Kubernetes to not run its normal server</p> <pre class="lang-yaml prettyprint-override"><code>command: [ &quot;sleep&quot; ] args: [ &quot;infinity&quot; ] </code></pre> <p>but then it should pass an HTTP health check</p> <pre class="lang-yaml prettyprint-override"><code>livenessProbe: ht...
Kubernetes pod wont start and get CrashLoopBackOff
reactjs|docker|nginx|kubernetes|networking
0
50
1
72,940,634
72,940,634
2
true
2022-07-11T14:12:20.417Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kubernetes pod wont start and get CrashLoopBackOff<p>When i try to run <code>kubectl apply -f frontend.yaml</code> i get the following response from <code>ku...
72,948,210
Is there any way to remove html element by context?<p>i have this following html code</p> <pre class="lang-html prettyprint-override"><code>&lt;ui id=&quot;fruits&quot;&gt; &lt;li&gt;apple&lt;/li&gt; &lt;li&gt;orange&lt;/li&gt; &lt;li&gt;banana&lt;/li&gt; &lt;li&gt;lemon&lt;/li&gt; &lt;li&gt;melon&l...
<p>To achieve your goal you can use a combination of <code>:contains</code> and <code>remove()</code>, like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$('#fruits li:...
Is there any way to remove html element by context?
javascript|html|jquery
1
50
4
72,948,369
72,948,369
2
true
2022-07-12T06:58:03.957Z
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 remove html element by context?<p>i have this following html code</p> <pre class="lang-html prettyprint-override"><code>&lt;ui id=&quot;f...
72,948,890
JSON Schema to validate a JSON Schema<p>We are using JSON Schema to validate the editing of some business objects, and the Schema itself is editable (it rarely changes but we wanted to allow admins to amend via the product itself).</p> <p>Validating the amendments of business objects via the schema itself is working we...
<p>The schema for the schema is called the &quot;meta-schema&quot; and is identified by the <code>$schema</code> keyword in your schema. The Draft 2020-12 meta-schema can be found <a href="https://json-schema.org/draft/2020-12/schema" rel="nofollow noreferrer">here</a>.</p> <p>Implementations should be able to validat...
JSON Schema to validate a JSON Schema
json|jsonschema|json-schema-validator
0
50
1
72,950,436
72,950,436
2
true
2022-07-12T08:01:00.473Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JSON Schema to validate a JSON Schema<p>We are using JSON Schema to validate the editing of some business objects, and the Schema itself is editable (it rare...