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,284,172 | How to keep the typing on callback function in typescript?<p><code>foo</code> function returns an object. typescript is know about the typing that return <code>prop1</code> and <code>prop2</code> wrap in promise:</p>
<pre><code>const foo: ({ a, b }: {
a: any;
b: any;
}) => Promise<{
prop1: string;
... | <p>if I understand you question correctly you can do something like this</p>
<pre><code>const fn = <T>(cb: ({a, b}: any) => Promise<T>) => {
return async (a = null, b = null, c:() => T | null = null) => {
const results = cb({ a, b });
if (results) {
return c();
}
};
};
</c... | How to keep the typing on callback function in typescript? | javascript|typescript | 0 | 48 | 1 | 72,284,259 | 72,284,259 | 1 | true | 2022-05-18T06:31:28.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to keep the typing on callback function in typescript?<p><code>foo</code> function returns an object. typescript is know about the typing that return <co... |
72,311,970 | How to dynamically cut filtered data from two columns and paste them into new columns in pandas<p>I have numerous data structures that take the form of following table:</p>
<pre><code> traces length
0 domain 10
1 length1 1
2 length2 2
3 length3 3
4 width1 4
5 width2 5... | <p>Is this what you are looking for?:</p>
<pre><code>df = df.set_index(df['traces'].str.extract('(\d+)',expand = False))
mask = df['traces'].str.contains('width')
df = df.loc[~mask].join(df.loc[mask],rsuffix='_new').rename(lambda x: '_'.join(x.split('_')[::-1]),axis=1).reset_index(drop=True)
</code></pre>
<p>Output:</p... | How to dynamically cut filtered data from two columns and paste them into new columns in pandas | python|pandas | 0 | 48 | 2 | 72,322,197 | 72,322,197 | 1 | true | 2022-05-19T23:08:56.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to dynamically cut filtered data from two columns and paste them into new columns in pandas<p>I have numerous data structures that take the form of follo... |
72,301,318 | SQL get rows being not in JOIN<p>I have three tables :</p>
<p>field:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>f_id</th>
<th>f_start</th>
<th>f_end</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>10</td>
<td>20</td>
</tr>
<tr>
<td>2</td>
<td>15</td>
<td>25</td>
</tr>
<tr>
<td>3</td>
<... | <p>You need to use <code>LEFT JOIN</code> instead of <code>INNER JOIN</code> and also need to specify the condition in the <code>LEFT JOIN</code> itself. The condition in <code>WHERE</code> clause is given to get your expected result. I.e. to include person which either matches with the <em>field</em> table or doesn't ... | SQL get rows being not in JOIN | mysql|sql|database|join|select | 0 | 48 | 2 | 72,301,720 | 72,301,720 | 1 | true | 2022-05-19T08:42:58.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL get rows being not in JOIN<p>I have three tables :</p>
<p>field:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>f_id</th>
<... |
72,370,675 | How to modify the text displayed on Buttons created in a loop?<p>I need to do a tic tac toe game, but I am stuck on how to change the value of a cell from "-" to "X" or "O",</p>
<p>I have been looking on internet since yesterday of how to tell the program "The user click on the cell [... | <p>Here's how to do what you want. It's similar to the top rated <a href="https://stackoverflow.com/a/10865170/355230">answer</a> to the question @Bryan Oakley mentioned in a comment, but does things in a more readable way and goes further by showing the modifications needed to your <code>value_change()</code> function... | How to modify the text displayed on Buttons created in a loop? | python|tkinter | 0 | 48 | 1 | 72,371,079 | 72,371,079 | 1 | true | 2022-05-25T00:02:48.963Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to modify the text displayed on Buttons created in a loop?<p>I need to do a tic tac toe game, but I am stuck on how to change the value of a cell from &q... |
72,308,109 | Why can't I update an input element inside click event?<p>Why does the input element not get updated?</p>
<pre><code>function route() {
let textfield = {
inputEl: document.querySelector('#textfield'),
setValue: function(str) {
this.inputEl.value = str;
}
};
textfield.inputEl.addEventLi... | <p><strong>UPDATED</strong></p>
<p>I have updated the code below - hopefully this is closer to what you are trying to achieve.</p>
<p>I needed to add a container where to place the button (instead of adding it to the <code>body</code>) - so added a wrapper container like this:</p>
<pre><code><div id="container&... | Why can't I update an input element inside click event? | javascript|html | 0 | 48 | 1 | 72,308,426 | 72,308,426 | 1 | true | 2022-05-19T16:32:38.267Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can't I update an input element inside click event?<p>Why does the input element not get updated?</p>
<pre><code>function route() {
let textfield = {... |
72,237,784 | Android UI broken when run<p>I am facing very strange problem, though I am beginner level on Android. after designed my layout file, when i run this android project by using physical device then i actually not find expected UI.
Here is the Layout UI and it's XML code:-</p>
<p>Design:-</p>
<p><a href="https://i.stack.im... | <p>Since your <code>CardView</code> is not constrained by the buttons at the bottom the <code>CardView</code> will take space beyond those buttons. In the screenshot provided from a real device, it is clear that there is not much space to completely accommodate the contents in the <code>CardView</code> hence it will be... | Android UI broken when run | java|android|android-studio | 0 | 48 | 1 | 72,237,835 | 72,237,835 | 1 | true | 2022-05-14T06:12:41.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Android UI broken when run<p>I am facing very strange problem, though I am beginner level on Android. after designed my layout file, when i run this android ... |
72,371,593 | Print the pair i,j of a matrix whose value is 1 in matlab<p>I'm working on a Matlab program that creates 2 n*n matrices, where n and each of the terms of the matrix (these will just be 0 or 1) are keyboard input values. The idea is that at the end the positions i,j in which the terms of the matrix are 1 are printed.</p... | <p>You can use <a href="https://www.mathworks.com/help/matlab/ref/find.html" rel="nofollow noreferrer"><code>find()</code></a> to find all non-zero values. use <code>~A</code> to reverse the booleanness and find the zeros afterwards. Then concatenate everything and use <a href="https://www.mathworks.com/help/matlab/ref... | Print the pair i,j of a matrix whose value is 1 in matlab | matlab|matrix | 2 | 48 | 1 | 72,375,577 | 72,375,577 | 1 | true | 2022-05-25T03:12:57.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Print the pair i,j of a matrix whose value is 1 in matlab<p>I'm working on a Matlab program that creates 2 n*n matrices, where n and each of the terms of the... |
72,353,083 | Swift 5: Is there a default implementation of creationDate and lastEditDate for CoreData Entities?<p>I am working with <code>CoreData</code> and am just implementing <code>creationDate</code> and <code>lastEditDate</code> properties for all my entities.</p>
<hr />
<p>Are there default implementations for this by <code>... | <p>You can use <code>awakeFromInsert</code> and <code>willSave</code>. By extending your entity</p>
<pre><code>extension YourEntity{
public override func awakeFromInsert() {
if creationDate == nil{
self.creationDate = Date()
}
super.awakeFromInsert()
}
public overrid... | Swift 5: Is there a default implementation of creationDate and lastEditDate for CoreData Entities? | ios|swift|xcode|core-data | 0 | 48 | 1 | 72,353,312 | 72,353,312 | 1 | true | 2022-05-23T18:11:38.923Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift 5: Is there a default implementation of creationDate and lastEditDate for CoreData Entities?<p>I am working with <code>CoreData</code> and am just impl... |
72,303,297 | C# difference between ref and complex object as parameter<p>I'm curious what happens if I do not use the <code>ref</code> declaration for a parameter, instead pass the object it self and manipulate it within the function.</p>
<p>E.g:</p>
<pre><code>public void DoStuff(DataPackage context)
{
context.IsAValue = fals... | <p>In your second example <code>var context = new DataPackage();</code> will be ignored and this is intended behavior.</p>
<p>In both examples <code>context.IsAValue</code> is false unless its initialized as true</p>
<p>Your second example is an incorrect usage of <code>ref</code></p>
<p>example as per the <a href="htt... | C# difference between ref and complex object as parameter | c#|pointers|parameters|ref|out | 0 | 48 | 1 | 72,303,433 | 72,303,433 | 1 | true | 2022-05-19T10:56:27.077Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# difference between ref and complex object as parameter<p>I'm curious what happens if I do not use the <code>ref</code> declaration for a parameter, instea... |
72,390,695 | Element-wise rbind lists of dataframes in R<p>I have a list of 3 lists, each with an equal number of dataframes, 32, to be precise, and I wish to <code>rbind</code> them across the lists element-wise. To give a simpler example, suppose you have one list with 2 lists, each with 2 dataframes, like this:</p>
<pre><code>[... | <p>One could just use <code>transpose</code> from <code>purrr</code>:</p>
<pre class="lang-r prettyprint-override"><code>output <- lapply(purrr::transpose(L),
function(l) do.call(rbind, args = l))
output
</code></pre> | Element-wise rbind lists of dataframes in R | r|list|dataframe|rbind | 1 | 48 | 4 | 72,390,886 | 72,390,886 | 1 | true | 2022-05-26T10:56:53.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Element-wise rbind lists of dataframes in R<p>I have a list of 3 lists, each with an equal number of dataframes, 32, to be precise, and I wish to <code>rbind... |
72,354,731 | How to use function from class Python in Pandas?<p>I have a Python class with methods inside. One of them is public.</p>
<p>How to apply this method in filtering rows data in Pandas?</p>
<p>I meaan something like this:</p>
<pre><code>class Math:
def isTrue(value):
return True
</code></pre>
<p>Pandas rule:</p>
<... | <pre class="lang-py prettyprint-override"><code>import re
class Matcher:
pattern = re.compile('^(?P<num_pair>\d\d)(?(num_pair)(?P=num_pair))$')
@classmethod
def has_num_pair(cls, n: int) -> bool:
if cls.pattern.match(str(n)) is None:
return False
return True
</code... | How to use function from class Python in Pandas? | python|pandas | 1 | 48 | 1 | 72,359,695 | 72,359,695 | 1 | true | 2022-05-23T20:56:42.283Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use function from class Python in Pandas?<p>I have a Python class with methods inside. One of them is public.</p>
<p>How to apply this method in filte... |
72,388,229 | How can I add a column of "ID" to an already created csv but without the actual "ID" header?<p>Say I have:</p>
<pre><code>john,32,male
josh,10,male
sylvia,92,female
</code></pre>
<p>I need to edit it for some database manipulation later on and have a unique ID for each (preferably in order), such as:</p>
<pre><code>0,j... | <p>Using Python Pandas:</p>
<pre><code>import pandas as pd
pd.read_csv('file.csv', header = None).to_csv('file2.csv', header = False)
</code></pre>
<p><strong>Explanation</strong></p>
<p>Read CSV file without header into a dataframe</p>
<pre><code>df = pd.read_csv('file.csv', header = None)
</code></pre>
<p>Write Data... | How can I add a column of "ID" to an already created csv but without the actual "ID" header? | python|csv | 0 | 48 | 2 | 72,388,653 | 72,388,653 | 1 | true | 2022-05-26T07:24:07.213Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I add a column of "ID" to an already created csv but without the actual "ID" header?<p>Say I have:</p>
<pre><code>john,32,male
josh,10,male
sylvia,92... |
72,335,973 | Dependent dropdown, second dropdown not populated, Codeigniter<p>I have a dependent drop down that get the category on the first drop down and should get the subcategory on the second drop down but the subcategory drop down isn't populated. I have something like this in my Model:</p>
<pre><code>public function category... | <p>The result from <code>$this->Admin_model->sub_category(...)</code> is an array.
<code>echo</code> works on string values only, which is why you're getting the error. You'll need to loop over the result array (in admin/get_subcategory) and print the values one by one. Also surround each value with an <code><... | Dependent dropdown, second dropdown not populated, Codeigniter | ajax|codeigniter | 0 | 48 | 1 | 72,338,882 | 72,338,882 | 1 | true | 2022-05-22T08:36:33.570Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dependent dropdown, second dropdown not populated, Codeigniter<p>I have a dependent drop down that get the category on the first drop down and should get the... |
72,301,307 | Generating new column with list of other column values<p>I have a Data Frame as below</p>
<pre><code>+-----+---+------+-----+
| id |age|height| score
+-----+---+------+-----+
|1001| 5| 80| 12
|1002| 9| 95| 189
|1003| 10| 82| 345
+-----+---+------+-----+
</code></pre>
<p>and want to create new column which co... | <p>You can do it using <code>to_json</code> and <code>struct</code> functions.</p>
<pre><code>df = df.select(
'id',
F.to_json(F.struct('*')).alias('property'),
'score'
)
df.show(truncate=False)
</code></pre> | Generating new column with list of other column values | apache-spark|pyspark | 0 | 48 | 1 | 72,301,428 | 72,301,428 | 1 | true | 2022-05-19T08:41:56.873Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Generating new column with list of other column values<p>I have a Data Frame as below</p>
<pre><code>+-----+---+------+-----+
| id |age|height| score
+-----+... |
72,252,227 | Javascript - Generate random small intervals in a range<p>I am trying to generate random intervals between the range: 2,5k - 10M.</p>
<p>Currently, I am doing the following:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippe... | <p>What about first choosing random size of interval within the size you wish - so you get the value of INTERVAL_SIZE. As second step you randomly find the minimum between MIN_NUMBER_OF_LIKES and MAX_NUMBER_OF_LIKES - INTERVAL so you get STARTPOINT.
So final INTERVAL will have STARTPOINT and ENDPOINT = STARTPOINT + INT... | Javascript - Generate random small intervals in a range | javascript|algorithm|math | 0 | 48 | 2 | 72,252,288 | 72,252,288 | 2 | true | 2022-05-15T21:13:21.587Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript - Generate random small intervals in a range<p>I am trying to generate random intervals between the range: 2,5k - 10M.</p>
<p>Currently, I am doin... |
72,248,569 | Images links not updated after pushing site from staging to primary domain<p>I have pushed site from staging <a href="http://copy.fbmgusa.com" rel="nofollow noreferrer">http://copy.fbmgusa.com</a> to primary domain <a href="https://fbmgusa.com" rel="nofollow noreferrer">https://fbmgusa.com</a> but images links are not ... | <p>Elementor have built-in tool for this:
Go to <strong>Elementor > Tools</strong> then open <strong>Replace URL</strong> tab, input <a href="http://copy.fbmgusa.com" rel="nofollow noreferrer">http://copy.fbmgusa.com</a> in the <strong>Old URL</strong> and <a href="https://fbmgusa.com" rel="nofollow noreferrer">ht... | Images links not updated after pushing site from staging to primary domain | wordpress|elementor | 0 | 48 | 1 | 72,254,010 | 72,254,010 | 2 | true | 2022-05-15T13:11:16.307Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Images links not updated after pushing site from staging to primary domain<p>I have pushed site from staging <a href="http://copy.fbmgusa.com" rel="nofollow ... |
72,256,176 | Mysql Putting it inside a select will make it slower<p>I had a question while writing a query using mysql.
So I searched it, but couldn't find an answer, so I write a question.</p>
<pre><code>
SELECT CAT.ID, CAT2.BIRTH, CAT.NAME
FROM CAT
INNER JOIN CAT2 ON CAT.ID = CAT2.CATID
GROUP BY CAT.ID, CAT2.BIRTH, CAT.NAME
</cod... | <p>In the second query, MySQL will place the result of the subquery into memory. It then must query that data again, which takes more time. You would likely see an even larger split in performance if you were filtering in the outer query. Note that any index can only be used inside the subquery, but not on the outer... | Mysql Putting it inside a select will make it slower | mysql|performance | 0 | 48 | 1 | 72,256,219 | 72,256,219 | 2 | true | 2022-05-16T08:25:25.360Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mysql Putting it inside a select will make it slower<p>I had a question while writing a query using mysql.
So I searched it, but couldn't find an answer, so ... |
72,259,286 | How to "override" an exception in scala?<p>so I have a method which already has a try block that throws ExceptionA. Now I need to put another try block where this method is being called and needs to throw an exception with some added details. Something like this:</p>
<pre><code>method inner():
try{
//some logic... | <p>What you have in your snippet would work as written (if you correct the syntax), with a caveat, that exceptions are immutable (and even they weren't, it's still not a good idea to mutate them), so, instead of "appending" to exception, you'd need to create a new one, and set the original as <code>cause</cod... | How to "override" an exception in scala? | scala|exception|error-handling | 0 | 48 | 2 | 72,259,629 | 72,259,629 | 2 | true | 2022-05-16T12:33:35.123Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to "override" an exception in scala?<p>so I have a method which already has a try block that throws ExceptionA. Now I need to put another try block where... |
72,292,516 | python regex findall returns two groups instead of just one<p>I'm working with a dataframe with some medicines and I want extract the dosage from a full sentence taken from the product description.</p>
<p>some examples:</p>
<pre><code>'Anakinra 100 g, gentechnologisch hergestellt aus E. coli.'
'Anakinra 100 mg, gentech... | <p>You can capture the necessary details and then join the two groups:</p>
<pre class="lang-py prettyprint-override"><code>import re
a_string = "Anakinra 100 mg, gentechnologisch hergestellt aus E. coli."
pattern = 'Anakinra'
print ( [f"{x}{y}" for x,y in re.findall(rf"(?:{pattern})\s*(\d+(?:[.... | python regex findall returns two groups instead of just one | python|regex|string | 1 | 48 | 2 | 72,292,678 | 72,292,678 | 2 | true | 2022-05-18T16:03:40.097Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
python regex findall returns two groups instead of just one<p>I'm working with a dataframe with some medicines and I want extract the dosage from a full sent... |
72,291,476 | Why is the difference of my two images blank?<p>I tried to get the difference of two images. Here are my two images.</p>
<p><a href="https://i.stack.imgur.com/rybih.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rybih.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.img... | <p>This works fine for me in Python/OpenCV using cv2.absdiff(). I suggest you use cv2.imshow() to view your results and cv2.imwrite() to save your results.</p>
<pre><code>import cv2
import numpy as np
image1 = cv2.imread('image1.png')
image2 = cv2.imread('image2.png')
diff = cv2.absdiff(image1, image2)
print(np.amin(... | Why is the difference of my two images blank? | python|opencv|matplotlib|image-processing | 0 | 48 | 1 | 72,292,919 | 72,292,919 | 2 | true | 2022-05-18T14:54:34.260Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is the difference of my two images blank?<p>I tried to get the difference of two images. Here are my two images.</p>
<p><a href="https://i.stack.imgur.co... |
72,303,583 | Is there a function in Ruby to traverse dynamic multi level hashes where all that is known is the required key?<p>Is there a way to access <code>my_key</code> value without knowing the path to where the key value is stored
using out the box ruby methods?</p>
<p>You will see that the two scenarios below store the <code>... | <p>The <a href="https://github.com/hszeto/dig-deep" rel="nofollow noreferrer">dig-deep gem</a> seems to be what you are looking for:</p>
<pre><code>require 'dig-deep'
scenario_1.dig_deep(:my_key)
=> "here"
scenario_2.dig_deep(:my_key)
=> "here"
</code></pre> | Is there a function in Ruby to traverse dynamic multi level hashes where all that is known is the required key? | ruby-on-rails|ruby|hash | 0 | 48 | 1 | 72,304,071 | 72,304,071 | 2 | true | 2022-05-19T11:17:47.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a function in Ruby to traverse dynamic multi level hashes where all that is known is the required key?<p>Is there a way to access <code>my_key</code... |
72,304,001 | cliick event not happening<p>this is my function:</p>
<pre><code>function bind_click_user_pages()
{
$(".card-pages-own").click(function () {
debugger;
})
}
</code></pre>
<p>the site isnt entering break mode, thing that it should be doing <br>
and this is my function call</p>
<pre><code> api.p... | <p>First thing, it looks like your missing something in your binding selector: $(".card card-pages")
"card-pages" is probably a class or an ID, not an element.</p>
<p>Secondly, the binding function is outside the asynchronous api.post , so your div is probably created after the binding, it will not ... | cliick event not happening | javascript|jquery|click | -3 | 48 | 1 | 72,304,129 | 72,304,129 | 2 | true | 2022-05-19T11:47:50.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cliick event not happening<p>this is my function:</p>
<pre><code>function bind_click_user_pages()
{
$(".card-pages-own").click(function () {
... |
72,304,189 | Set the focus to input after submitting the form<p>After clicking on Enter, the focus returns to the input. If I press the button, the focus does not return. Please tell me how to make the focus return to the input after pressing the submit button.</p>
<pre><code> const setTodo = (event) => {
setNewTodo(event.t... | <p>I think you can use <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus" rel="nofollow noreferrer">DOM.focus()</a> and useRef() to <code>handle</code> what you looking for:</p>
<pre><code>const inputRef = useRef()
const setTodo = (event) => {
setNewTodo(event.target.value)
}
cons... | Set the focus to input after submitting the form | reactjs | 1 | 48 | 1 | 72,304,308 | 72,304,308 | 2 | true | 2022-05-19T12:00:59.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Set the focus to input after submitting the form<p>After clicking on Enter, the focus returns to the input. If I press the button, the focus does not return.... |
72,306,985 | Post data to json api using flutter<p>I'm working on a flutter project and I want to add data to json api using this code :</p>
<pre><code>save() async {
try{
var sendString =
{
'userId': userId,
'userEmail': userEmail,
};
final response = await http.post(
Uri.parse('http... | <p>Encode body to JSON.</p>
<pre><code>body: jsonEncode(sendString),
</code></pre>
<p>See <a href="https://docs.flutter.dev/cookbook/networking/send-data" rel="nofollow noreferrer">Sending data to server</a> for details.</p> | Post data to json api using flutter | json|flutter|dart | 0 | 48 | 1 | 72,307,054 | 72,307,054 | 2 | true | 2022-05-19T15:08:34.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Post data to json api using flutter<p>I'm working on a flutter project and I want to add data to json api using this code :</p>
<pre><code>save() async {
... |
72,307,096 | IWriterConfiguration.ReferenceHeaderPrefix equivalent in newer versions of CsvHelper<p>What is the equivalent of csvWriter.Configuration.ReferenceHeaderPrefix in the newer version of CsvHelper? Trying this</p>
<p><code>csvWriter.Configuration.ReferenceHeaderPrefix = (memberType, memberName) => $"{memberName}_&q... | <p>The usual workflow is to construct an instance of the <a href="https://github.com/JoshClose/CsvHelper/blob/master/src/CsvHelper/Configuration/CsvConfiguration.cs" rel="nofollow noreferrer"><code>CsvConfiguration</code></a> class and pass that into the constructor for the reader or writer. And <a href="https://githu... | IWriterConfiguration.ReferenceHeaderPrefix equivalent in newer versions of CsvHelper | c#|.net-6.0|csvhelper | 2 | 48 | 1 | 72,307,541 | 72,307,541 | 2 | true | 2022-05-19T15:16:47.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
IWriterConfiguration.ReferenceHeaderPrefix equivalent in newer versions of CsvHelper<p>What is the equivalent of csvWriter.Configuration.ReferenceHeaderPrefi... |
72,313,150 | How to create variables by substracting elements from group? e.g., value of each row of each group - first row of group value<p>In the following example, what would be the best to group so that there could be a new column that is formed by taking first year in each group and subtracting by current year. For example in ... | <p>Transform <code>Year</code> with <code>first</code> to get the first year per <code>id</code>, then subtract this from <code>Year</code> column to get difference, finally <code>mask</code> the values where difference is <code>0</code>:</p>
<pre><code>s = df['Year'] - df.groupby('id')['Year'].transform('first')
df['c... | How to create variables by substracting elements from group? e.g., value of each row of each group - first row of group value | python|pandas|dataframe | 2 | 48 | 2 | 72,313,262 | 72,313,262 | 2 | true | 2022-05-20T03:06:31.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create variables by substracting elements from group? e.g., value of each row of each group - first row of group value<p>In the following example, wha... |
72,299,971 | How does C++ parallel_reduce use the inital value parameter?<p>I expect the following code snippet to produce the sum of all the elements and the initial value but it doesn't:</p>
<pre><code> vector<long> a;
a.resize(10);
generate(a.begin(), a.end(), [n = 1]() mutable { return n++; });
#ifdef _MSC_VER
... | <p>You did not really provide a MCVE as the code snippet in question does not compile, but one problem is still apparent: you assume the last argument to <code>parallel_reduce</code> is the initial value, while according to documentation it's identity value.</p>
<p>Identity for addition is 0 and if you pass that, you w... | How does C++ parallel_reduce use the inital value parameter? | parallel-processing|c++17|tbb | 2 | 48 | 1 | 72,316,583 | 72,316,583 | 2 | true | 2022-05-19T07:00:20.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does C++ parallel_reduce use the inital value parameter?<p>I expect the following code snippet to produce the sum of all the elements and the initial val... |
72,330,776 | How should I resolve ASP.NET Core multiple endpoints error<p>My controller is:</p>
<pre><code>[Route("api/[controller]")]
[ApiController]
public class SubjectController : ControllerBase
{
private TourActivityExpenseContext tourActivityExpenseContext = new TourActivityExpenseContext();
[HttpGet]... | <p>Try to give them a specific route :</p>
<pre><code> [HttpGet("GetSubject/{subject}")]
public int GetSubjectId(String subject)
{
var subjects = tourActivityExpenseContext.SubjectTos.ToList();
var isSub = subjects.FirstOrDefault(x => x.Subject == subject);
... | How should I resolve ASP.NET Core multiple endpoints error | asp.net-core|asp.net-core-webapi | 0 | 48 | 1 | 72,330,839 | 72,330,839 | 2 | true | 2022-05-21T15:10:14.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How should I resolve ASP.NET Core multiple endpoints error<p>My controller is:</p>
<pre><code>[Route("api/[controller]")]
[ApiController]
public cl... |
72,367,377 | Scraping images and changin its name with python<p>I have a project which scrapes images from Tumblr using Python.
I want to download the images found on the links I get scraping.</p>
<p>This is the entire code:</p>
<pre><code>import requests
from bs4 import BeautifulSoup
import shutil
search_term = "landscape/rec... | <p>you have to make <code>request</code> again with the image URL. Then you can get the response in raw form and save the image</p>
<p>replace the code with this below -</p>
<pre><code>for source, image_urls in data.items():
for url in image_urls:
# make request with image url
img_scrape = requests... | Scraping images and changin its name with python | python|web-scraping | 2 | 48 | 1 | 72,374,010 | 72,374,010 | 2 | true | 2022-05-24T17:53:55.543Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scraping images and changin its name with python<p>I have a project which scrapes images from Tumblr using Python.
I want to download the images found on the... |
72,377,026 | Hey i try to build a game in UWP(c#) and i cant make my player move<p>i search in the internt and only found WPF tutorials to how make objects move and it is diffrent from UWP.</p>
<p>e.VirtualKey == Windows.System.VirtualKey.Up)</p>
<p>tried to do use this with if statment to change position of the object but coudlnt ... | <p>So you can use the CoreWindow.KeyDown event to handle keys:</p>
<pre><code>public MainPage()
{
this.InitializeComponent();
Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown;
}
private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
{
switch (args.Virtu... | Hey i try to build a game in UWP(c#) and i cant make my player move | c#|uwp | 0 | 48 | 1 | 72,379,150 | 72,379,150 | 2 | true | 2022-05-25T11:45:18.033Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hey i try to build a game in UWP(c#) and i cant make my player move<p>i search in the internt and only found WPF tutorials to how make objects move and it is... |
72,388,313 | linux command pipe with python "-c" flag<p>I am trying to do a string printing with python -c flag, e.g.
<code>python3 -c "print('Hello World')"</code></p>
<p>So now I wanna substitute an argument with pipe, e.g. <code>echo "Hello World" | python3 -c "print($1)"</code></p>
<p>the pipe is t... | <p>If your input is always single line then you should be able to harness <a href="https://docs.python.org/3/library/functions.html#input" rel="nofollow noreferrer"><code>input</code></a> function for example</p>
<pre><code>echo "Hello World" | python3 -c "print(input().upper())"
</code></pre>
<p>wo... | linux command pipe with python "-c" flag | python|linux|shell|ubuntu | 0 | 48 | 1 | 72,388,382 | 72,388,382 | 2 | true | 2022-05-26T07:33:18.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
linux command pipe with python "-c" flag<p>I am trying to do a string printing with python -c flag, e.g.
<code>python3 -c "print('Hello World')"</c... |
72,390,221 | How to get the value as an array of strings from powershell hashtable<p>I have an array of hash table containing key value pairs, like below :</p>
<pre><code>$myTest = @{};
$test1 = @{
Name = "Food1"
Value = "Sandwich"
}
$test2 = @{
Name = "Food2"
Value = "Sala... | <p>The issue with this is how you are sending the object to the <code>ConvertTo-Json</code> cmdlet.</p>
<p>I managed to get this working by changing</p>
<pre><code>$myUpdatedTest = $myTest.Values | ConvertTo-Json -Compress
</code></pre>
<p>to</p>
<pre><code>$myUpdatedTest = ConvertTo-Json -Compress -InputObject $myTest... | How to get the value as an array of strings from powershell hashtable | arrays|powershell|hashtable|key-value|script | 1 | 48 | 2 | 72,390,409 | 72,390,409 | 2 | true | 2022-05-26T10:16:38.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get the value as an array of strings from powershell hashtable<p>I have an array of hash table containing key value pairs, like below :</p>
<pre><code... |
72,389,744 | Bash - command or script for printing only file names that NOT contain specific string in the first line in current catalog<p>I'm trying to write script or command that will go through all files in the current catalog and print only those file names that NOT contain lines starting with specific string only in the first... | <p>Using GNU grep:</p>
<pre><code>grep -LD skip -d skip -i '^echo' *
</code></pre>
<p><code>-L</code> lists <em>non</em> matching files, <code>-D skip</code> skips device, FIFO and socket files, <code>-d skip</code> skips directories.</p> | Bash - command or script for printing only file names that NOT contain specific string in the first line in current catalog | string|bash|fetch|command|script | 0 | 48 | 2 | 72,390,993 | 72,390,993 | 2 | true | 2022-05-26T09:37:47.463Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bash - command or script for printing only file names that NOT contain specific string in the first line in current catalog<p>I'm trying to write script or c... |
72,391,266 | Why does my program for the Chudnovsky algorithm give the wrong result?<p>I am trying to code the Chudnovsky algorithm in python. However, when I run my code, it gives me a very small number (-5.051212624421025e-55) which is not pi. I am in middle school, and I don't know anybody that can help me. What am I doing wrong... | <p>I see two mistakes:</p>
<ol>
<li><p>When comparing with the formula shown on <a href="https://en.wikipedia.org/wiki/Chudnovsky_algorithm" rel="nofollow noreferrer">Wikipedia</a>, it looks like you should use the iteration variable <code>i</code> (named <em>q</em> in the formula) where you currently use <code>k</code... | Why does my program for the Chudnovsky algorithm give the wrong result? | python|pi | 0 | 48 | 1 | 72,391,352 | 72,391,352 | 2 | true | 2022-05-26T11:43:18.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does my program for the Chudnovsky algorithm give the wrong result?<p>I am trying to code the Chudnovsky algorithm in python. However, when I run my code... |
72,398,851 | How to get coefficients from a model in R?<p>I am trying to store coefficients from a mle model just like a normally do for other models. Surprisingly, it throws an error. Any other methods to store it?</p>
<pre><code>set.seed(111)
y.size <- rnorm(100,4,1)
p <- rnorm(100,5,1)
df <- data.frame(p, y.size)
glae... | <p>You can access this "mle" S4 object contents using the <code>@</code> operator, e.g.</p>
<pre class="lang-r prettyprint-override"><code>library(bbmle)
#> Loading required package: stats4
set.seed(111)
y.size <- rnorm(100,4,1)
p <- rnorm(100,5,1)
df <- data.frame(p, y.size)
glae <- functio... | How to get coefficients from a model in R? | r|curve-fitting|log-likelihood | 1 | 48 | 1 | 72,398,918 | 72,398,918 | 2 | true | 2022-05-26T23:00:58.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get coefficients from a model in R?<p>I am trying to store coefficients from a mle model just like a normally do for other models. Surprisingly, it th... |
72,398,393 | How to add a class to latest post on Wordpress homepage?<p>I use the following function in Wordpress to show the latest three posts on the homepage.
Is it possible to add the class <code>class="latest-posts-right"</code> to the last div so I can give it another style? How can I do this?</p>
<pre><code><?ph... | <p>CSS selector :last-child could work for you</p>
<pre><code>div.latest-posts:last-child{
/* css rules */
}
</code></pre>
<p>or</p>
<pre><code>div.latest-posts:nth-child(3){
/* css rules */
}
</code></pre> | How to add a class to latest post on Wordpress homepage? | php|wordpress | 0 | 48 | 1 | 72,399,081 | 72,399,081 | 2 | true | 2022-05-26T21:50:47.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add a class to latest post on Wordpress homepage?<p>I use the following function in Wordpress to show the latest three posts on the homepage.
Is it po... |
72,397,960 | Change Key Name in nested JSON mysql<p>I want to change the Key Name of the first and second level of the JSON in mysql.
For this I have a table called <code>content</code> and a column called <code>attribs</code> and the data stored is as follows:</p>
<pre><code>{"author": "Nika", "link_url&qu... | <p>To update the nested keys, you need to match the backslashes as well.</p>
<pre><code>UPDATE adneit_content
SET attribs = REPLACE(
REPLACE(attribs, '"author":', '"post_author":'),
'\\"gallery_images\\":', '\\"post_gallery_images\\":')
</code></... | Change Key Name in nested JSON mysql | mysql|json | 0 | 48 | 1 | 72,399,101 | 72,399,101 | 2 | true | 2022-05-26T21:00:07.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change Key Name in nested JSON mysql<p>I want to change the Key Name of the first and second level of the JSON in mysql.
For this I have a table called <code... |
72,393,666 | I want to draw one element out from a tibble variable in R<p>I have a dataframe that consist of multiple variables, and some of them are tibbles.
i have variables like:</p>
<blockquote>
<p>[ID, name, symbol, category, urls,....,slug]</p>
</blockquote>
<p>In this case slug is a tibble and consist of multiple urls of int... | <pre><code>urls <- c()
for(i in 1:length(data$urls)){
urls[i] <- data$urls[[i]][1,2]
}
data$Website <- urls
</code></pre>
<p>Thanks to Bensstats send me in the right direction</p> | I want to draw one element out from a tibble variable in R | r|dataframe|variables|tibble | 1 | 48 | 3 | 72,406,845 | 72,406,845 | 2 | true | 2022-05-26T14:43:32.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I want to draw one element out from a tibble variable in R<p>I have a dataframe that consist of multiple variables, and some of them are tibbles.
i have vari... |
72,311,672 | How to keep a variable if it exists<p>Say that I have these two datasets: <code>data1</code> and <code>data2</code>. They are the same, except that <code>data1</code> includes the <code>make</code> variable while <code>data2</code> does not.</p>
<pre><code>sysuse auto2, clear
*create first dataset
preserve
tempfile dat... | <p>Here is one approach: get a list of the variables that are present and look for the intersection of those and the set of variables that are wanted.</p>
<p>Your tentative code does nothing to <code>save</code> the results. Here I have overwritten the dataset just read in; your application may (indeed should) wish to ... | How to keep a variable if it exists | variables|stata | 1 | 48 | 1 | 72,312,032 | 72,312,032 | 2 | true | 2022-05-19T22:22:47.877Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to keep a variable if it exists<p>Say that I have these two datasets: <code>data1</code> and <code>data2</code>. They are the same, except that <code>dat... |
72,375,360 | Dropping multiple file formats in Snowflake at once<p>I need to drop multiple file formats (around 70) of a particular schema in Snowflake. I went through the documentation and also tried some work arounds but couldn't find any way to do it automatically.</p>
<p>Example:</p>
<pre><code>schema - work
file formats - wor... | <p>It can be fully automated with Snowflake Scripting:</p>
<pre><code>DECLARE
SCHEMA_NAME STRING := 'WORK';
FORMAT_NAME_PATTERN STRING := '%';
QUERY STRING;
BEGIN
SELECT CONCAT('BEGIN', CHAR(10)
,LISTAGG(CONCAT('DROP FILE FORMAT IF EXISTS '
,FILE_FORMAT_SCHEMA, '.', FI... | Dropping multiple file formats in Snowflake at once | snowflake-cloud-data-platform|snowflake-schema | 1 | 48 | 2 | 72,380,811 | 72,380,811 | 2 | true | 2022-05-25T09:47:27.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dropping multiple file formats in Snowflake at once<p>I need to drop multiple file formats (around 70) of a particular schema in Snowflake. I went through th... |
72,309,387 | php's mysqli::commit has a $name param - what does it do<p><a href="https://www.php.net/manual/en/mysqli.commit.php" rel="nofollow noreferrer">https://www.php.net/manual/en/mysqli.commit.php</a></p>
<blockquote>
<p><code>public mysqli::commit(int $flags = 0, ?string $name = null): bool</code></p>
<p><strong>Parameters<... | <p>So I turned on query logging</p>
<p>and this is what was logged</p>
<p><strong>passing name to commit():</strong></p>
<pre><code>Query START TRANSACTION
Query INSERT INTO `bob` (`t`) VALUES ("test 1")
Query SAVEPOINT `foo`
Query INSERT INTO `bob` (`t`) VALUES ("test 2")
Query COMMIT /*... | php's mysqli::commit has a $name param - what does it do | php|mysql|mysqli | 1 | 48 | 2 | 72,310,535 | 72,310,535 | 2 | true | 2022-05-19T18:19:24.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
php's mysqli::commit has a $name param - what does it do<p><a href="https://www.php.net/manual/en/mysqli.commit.php" rel="nofollow noreferrer">https://www.ph... |
72,285,279 | Portforwarding a kubernetes pod using partial pod-name<p>I am working with a test environment that has around 10 kubernetes pods that I need to interact with a lot, especially port forwarding.</p>
<p>It takes me a lot of time every day to list pods, get pod name and use that in a command.</p>
<p>Since all my pods start... | <p>You can do a port-forward on a service or controller, i.e. deployment, instead, which should be sufficient, given the assumption that you have a service or controller.</p>
<pre><code>kubectl port-forward svc/planning-api 8081:80
# or
kubectl port-forward deploy/planning-api 8081:8081
</code></pre>
<p>That removes th... | Portforwarding a kubernetes pod using partial pod-name | kubernetes|kubectl | 1 | 48 | 1 | 72,285,384 | 72,285,384 | 2 | true | 2022-05-18T07:59:05.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Portforwarding a kubernetes pod using partial pod-name<p>I am working with a test environment that has around 10 kubernetes pods that I need to interact with... |
72,342,219 | How do I connect three or more windows in PyQt<p>I have a complex program in which I need to connect multiple windows. Unfortunately, I seem to be not fully understanding the concept/steps necessary to do this so bonus points if anyone can explain the steps/process well. In my current program, I have a list of items. O... | <p>The main issue with your code is that <code>secondWindowConnections</code> is never called so the button actually does nothing. I corrected that and fixed a few other issues I found in my example below. I left out the bits where I made no changes and all the changes I did make I made inline notes explaining them:<... | How do I connect three or more windows in PyQt | python|pyqt5|signals-slots | 2 | 48 | 1 | 72,342,457 | 72,342,457 | 2 | true | 2022-05-23T00:38:01.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I connect three or more windows in PyQt<p>I have a complex program in which I need to connect multiple windows. Unfortunately, I seem to be not fully ... |
72,344,051 | How to decode URI string using javascript?<p>So I'm trying to decode this string <code>%21%22%23%C2%A4%25%26%2F</code> to <code>!"#¤%&/</code> inside my <code>confirm</code> so it doesn't say the encoded string in the <code>confirm</code>, but the actual string. But how can I do this?</p>
<p>I tried something ... | <p>Did you try?</p>
<pre><code>decodeURI(strVal)
</code></pre>
<p>or</p>
<pre><code>decodeURIComponent(strVal)
</code></pre> | How to decode URI string using javascript? | javascript | 0 | 48 | 1 | 72,344,077 | 72,344,077 | 2 | true | 2022-05-23T06:22:54.173Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to decode URI string using javascript?<p>So I'm trying to decode this string <code>%21%22%23%C2%A4%25%26%2F</code> to <code>!"#¤%&/</code> insid... |
72,261,058 | How to get all tables owned by one user but not by others, one by one<p>It's being assumed that two users own the same table when both of them own a table with the same name each.</p>
<p>In my Oracle Database, I have N users called MAIN, USR_1, USR_2, ..., USR_N. The user MAIN owns all tables that others users have. Ho... | <p>I would do it like this:</p>
<pre><code>SELECT m.TABLE_NAME, usr_count, owner_list
FROM DBA_TABLES m
LEFT JOIN (SELECT TABLE_NAME, count(*) as usr_count, listagg(OWNER, ',') within group (order by OWNER) as owner_list
FROM DBA_TABLES
WHERE OWNER LIKE 'USR_%'
GROUP BY TABLE_NAME... | How to get all tables owned by one user but not by others, one by one | sql|database|oracle | 1 | 48 | 1 | 72,262,534 | 72,262,534 | 2 | true | 2022-05-16T14:44:01.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get all tables owned by one user but not by others, one by one<p>It's being assumed that two users own the same table when both of them own a table wi... |
72,380,780 | Multi-level list of rasters - performing algebra in R<p>I have a multi level list of rasters and it always gives me a headache how to operate on such structures efficiently. I want to take averages from the rasters in 3rd level of the list, going by the indexes. For example:</p>
<pre><code># make some dummy rasters
a &... | <p>Your example data</p>
<pre><code>library(raster)
r <- raster(xmn=0,xmx=5,ymn=0,ymx=5,res=1)
set.seed(123)
list_abcd <- replicate(4, setValues(r, sample(1:5,25,replace=T)))
list_efgh <- replicate(4, setValues(r, sample(1:5,25,replace=T)))
list_ijkl <- replicate(4, setValues(r, sample(1:5,25,replace=T))) ... | Multi-level list of rasters - performing algebra in R | r|list|stack|lapply|raster | 0 | 48 | 1 | 72,381,960 | 72,381,960 | 2 | true | 2022-05-25T15:53:07.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multi-level list of rasters - performing algebra in R<p>I have a multi level list of rasters and it always gives me a headache how to operate on such structu... |
72,329,408 | Reorder "interesting" pieces of text using sed<p>I have a file named <code>file</code>, whose content is</p>
<pre><code>noise
noise
X noise STUFF1 noise STUFF2 noise
noise
Y noise STUFF3 noise
noise
</code></pre>
<p>and I assert that <code>X</code> and <code>Y</code> are distinct, that each occur once in <code>file</co... | <p>Using <code>sed</code></p>
<pre><code>$ sed -n '/^X/{s/.[^[:upper:]]*\([[:alnum:]]*\)/\1 /g;h};/^Y/{s/.[^[:upper:]]*\([[:alnum:]]*\)/\1 /g;G;s/\n//p}' file
STUFF3 STUFF1 STUFF2
</code></pre>
<pre><code>$ cat script.sed
/^X/{ #Match line beginning with X
s/.[^[:upper:]]*\(... | Reorder "interesting" pieces of text using sed | sed | 1 | 48 | 3 | 72,329,524 | 72,329,524 | 2 | true | 2022-05-21T12:08:49.520Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reorder "interesting" pieces of text using sed<p>I have a file named <code>file</code>, whose content is</p>
<pre><code>noise
noise
X noise STUFF1 noise STUF... |
72,245,489 | Why Maven or Gradle come into picture?<p>I know core Java, I want to learn Maven/Gradle. But I want to know why maven or gradle is required. is there any way to understand the problem we would face without maven or gradle. I want to know the procedure to build it without using build tools. A technology emerges for solv... | <blockquote>
<p>Why Maven or Gradle come into picture?</p>
</blockquote>
<p>Because building non-trivial applications by running <code>javac</code> from the command line leads to mistakes, non-reproducible builds and so on.</p>
<p>The history is roughly as follows</p>
<ul>
<li>Running <code>javac</code> by hand is tedi... | Why Maven or Gradle come into picture? | java|maven|gradle | -1 | 48 | 1 | 72,245,533 | 72,245,533 | 2 | true | 2022-05-15T04:21:44.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why Maven or Gradle come into picture?<p>I know core Java, I want to learn Maven/Gradle. But I want to know why maven or gradle is required. is there any way... |
72,301,607 | Shake camera on current position Unity3D<p>I made script where camera follows the player and camera shaker for effects. But the problem is that camera starts shaking on it's default <code>(0, 0, 0)</code> position. It jumps to that position starts shaking and returns to player. How can I make camera shake on it's curre... | <p>Simple Solve, The initial location must be added to the position during shake, So Put this part:</p>
<pre class="lang-cs prettyprint-override"><code>_mainCamera.transform.position = _initCamPos + new Vector3(x, y);
</code></pre>
<p>Instead of:</p>
<pre class="lang-cs prettyprint-override"><code>_mainCamera.transform... | Shake camera on current position Unity3D | c#|unity3d | 1 | 48 | 2 | 72,302,161 | 72,302,161 | 2 | true | 2022-05-19T09:02:20.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Shake camera on current position Unity3D<p>I made script where camera follows the player and camera shaker for effects. But the problem is that camera starts... |
72,245,867 | How can I convert a dict of arrays into a 'flattened' dataframe?<p>Let's say I had a dictionary of arrays, eg:</p>
<pre><code>favourite_icecreams = {
'Josh': ['vanilla', 'banana'],
'Greg': ['chocolate'],
'Sarah': ['mint', 'vanilla', 'mango']
}
</code></pre>
<p>I want to convert it to a pandas dataframe, wit... | <p>Another solution, using <code>.explode()</code>:</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame(
{
"Person": favourite_icecreams.keys(),
"Flavour": favourite_icecreams.values(),
}
).explode("Flavour")
print(df)
</code></pre>
<p>Prints:</p... | How can I convert a dict of arrays into a 'flattened' dataframe? | python|pandas|dataframe|dictionary | 1 | 48 | 4 | 72,246,884 | 72,246,884 | 3 | true | 2022-05-15T06:00:20.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I convert a dict of arrays into a 'flattened' dataframe?<p>Let's say I had a dictionary of arrays, eg:</p>
<pre><code>favourite_icecreams = {
'Jo... |
72,255,315 | Get all possible partitions of a set using Bell's number in R<p>I want to find all the possible ways a number of categories can be similar to each other in R. The total number of combinations is calculated as Bell's number. E.g. there are 15 ways to organise 4 categories.</p>
<p>I am trying to write some R code that sh... | <p>You can use the R package <code>partitions</code> to get all possible partitions of a set of categories.</p>
<pre class="lang-r prettyprint-override"><code>library(partitions)
# the set to be partitioned
categories <- letters[1:4]
# the clusters defining the partition
clusters <- LETTERS[1:4]
categories |&g... | Get all possible partitions of a set using Bell's number in R | r|combinations | 1 | 48 | 1 | 72,255,521 | 72,255,521 | 3 | true | 2022-05-16T07:06:59.650Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get all possible partitions of a set using Bell's number in R<p>I want to find all the possible ways a number of categories can be similar to each other in R... |
72,302,713 | ClojureDart: Execution error at cljd.compiler/load-libs-info (compiler.cljc:126). EOF while reading<p>While translating a flutter cookbook into ClojureDart, I encoutered this error.
I initialized the project that way:</p>
<pre class="lang-sh prettyprint-override"><code>$ mkdir -p src/samples && touch src/sample... | <p>My <code>.clojuredart/libs-info.edn</code> file was empty, that is why it causes EOF.
The mistake here is not from the code itself, but from the way I initialized the project.
Instead of doing:</p>
<pre class="lang-sh prettyprint-override"><code>$ clj -M -m cljd.build init --dart samples.tabs
</code></pre>
<p>I shou... | ClojureDart: Execution error at cljd.compiler/load-libs-info (compiler.cljc:126). EOF while reading | flutter|dart|clojure | 2 | 48 | 1 | 72,302,714 | 72,302,714 | 3 | true | 2022-05-19T10:12:24.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ClojureDart: Execution error at cljd.compiler/load-libs-info (compiler.cljc:126). EOF while reading<p>While translating a flutter cookbook into ClojureDart, ... |
72,306,246 | How to retrieve real-time data from an existing Java application without access to source code?<h2>Update: Jun 10, 2022</h2>
<p>I have successfully been able to create a demo application with AspectJ integration that could extract variables from the demo application. It was quite a hassle since there's a bit of trouble... | <p>This is big challenge obviously. If you can glean enough understanding of how the program works from decompiling and reading log files to target some methods where you suspect there's data of interest to your API, then I would read up about Aspect Oriented Programming [AOP] and use those tools.</p>
<p>With AOP you c... | How to retrieve real-time data from an existing Java application without access to source code? | java|decompiling|data-retrieval | 1 | 48 | 1 | 72,308,656 | 72,308,656 | 3 | true | 2022-05-19T14:18:50.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to retrieve real-time data from an existing Java application without access to source code?<h2>Update: Jun 10, 2022</h2>
<p>I have successfully been able... |
72,315,368 | How do you use a variable declared inside a function in another function? (C#) UnassignedReferenceException: The variable inRay has not ben assigned<p><img src="https://i.stack.imgur.com/fpkNr.png" alt="Represents wat i want" /></p>
<p>So i'm playing around in Unity MLAgents, and wanted to add the position off objects ... | <p><code>var inRay = rayHit.transform;</code></p>
<p>You're creating a new local variable instead of assigning your member variable here. Remove the <code>var</code>.</p>
<p>You should still check that your member variable is assigned before using it, maybe <code>if (inRayr != null)</code> could help.</p> | How do you use a variable declared inside a function in another function? (C#) UnassignedReferenceException: The variable inRay has not ben assigned | c#|unity3d|nullreferenceexception|raycasting|ml-agent | -1 | 48 | 2 | 72,315,434 | 72,315,434 | 3 | true | 2022-05-20T07:52:31.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do you use a variable declared inside a function in another function? (C#) UnassignedReferenceException: The variable inRay has not ben assigned<p><img s... |
72,351,828 | T-SQL Command not entering CATCH<p>I have a sql agent job that runs a job step to import an xml file into a table. This is working fine. I want to have a running log file to record info and errors along the way. Currently, the first insert into my Logs table works. If my OPENROWSET command fails, i.e. 1Events.xml w... | <p>This is, as Stu has (just) alluded to, one of those errors that can't be "caught" easily. One method you could use, however, is to use a defered statement and execute it inside <code>sys.sp_executesql</code>; this'll result in the behaviour you want:</p>
<pre class="lang-sql prettyprint-override"><code>BEG... | T-SQL Command not entering CATCH | sql|sql-server|tsql|sql-agent-job | 0 | 48 | 1 | 72,352,083 | 72,352,083 | 3 | true | 2022-05-23T16:23:20.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
T-SQL Command not entering CATCH<p>I have a sql agent job that runs a job step to import an xml file into a table. This is working fine. I want to have a r... |
72,353,980 | how to have type dependent on additional type<p>Consider I have names a object storing some object used as interface</p>
<pre class="lang-js prettyprint-override"><code>const items = [{name: "drop", value:"1"}, {name: "push", value:"2"}, {name: "increment", value:3}];
<... | <p>First, in order to preserve type information about the string <a href="https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types" rel="nofollow noreferrer">literal types</a> of the <code>name</code> properties of the <code>items</code> elements, you need to change how it's declared. Right now... | how to have type dependent on additional type | typescript|typescript-generics | 0 | 48 | 1 | 72,356,781 | 72,356,781 | 3 | true | 2022-05-23T19:38:44.917Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to have type dependent on additional type<p>Consider I have names a object storing some object used as interface</p>
<pre class="lang-js prettyprint-over... |
72,389,513 | Nested item in json array is not being deserialized<p>I am trying to deserialize a json string from an api.</p>
<p>All works except for a nested item - Location which always ends up null</p>
<p>This is the string structure:</p>
<pre class="lang-json prettyprint-override"><code>[
{
"CompanyProfile"... | <p>Remove the internal access modifier in the setter of Location.</p>
<pre><code>public Location? Location { get; set; }
</code></pre> | Nested item in json array is not being deserialized | c#|.net-core|json.net | 3 | 48 | 1 | 72,389,651 | 72,389,651 | 3 | true | 2022-05-26T09:18:46.127Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Nested item in json array is not being deserialized<p>I am trying to deserialize a json string from an api.</p>
<p>All works except for a nested item - Locat... |
72,385,584 | C++ Linked list, program stuck when calling the next pointer in the list<p>I have made a linked list with c++.
I have no idea when trying to point to the next element of the list, the program stops.</p>
<p>My Node Class as follows:</p>
<pre><code>class Node {
friend class List;
private :
Node* next;
public:
int value;
... | <p>in erase you never assign a value to 'before'</p>
<pre><code> Node* before;
</code></pre>
<p>then you do</p>
<pre><code> before->next = ptr;
</code></pre>
<blockquote>
<p>Error C4703 potentially uninitialized local pointer variable 'before' used ConsoleApplication1 C:\work\ConsoleApplication1\Console... | C++ Linked list, program stuck when calling the next pointer in the list | c++ | 0 | 48 | 1 | 72,385,656 | 72,385,656 | 3 | true | 2022-05-26T01:00:42.230Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ Linked list, program stuck when calling the next pointer in the list<p>I have made a linked list with c++.
I have no idea when trying to point to the nex... |
72,292,126 | not able to concatenate two dataframes by multiple columns in pandas<p>I am getting NA values when tried to merge two dataframes by common columns; I think it is straightforward to merge two dataframe by using <code>pandas.merge</code> and I should expect correct output; but I am not getting correct output. Here is wha... | <p>There is space in your df2 <code>County_Name</code> column</p>
<p><a href="https://i.stack.imgur.com/xeunO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xeunO.png" alt="enter image description here" /></a></p>
<pre class="lang-py prettyprint-override"><code>df2['County_Name'] = df2['County_Name'... | not able to concatenate two dataframes by multiple columns in pandas | python|pandas | 0 | 48 | 1 | 72,292,352 | 72,292,352 | 3 | true | 2022-05-18T15:37:14.193Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
not able to concatenate two dataframes by multiple columns in pandas<p>I am getting NA values when tried to merge two dataframes by common columns; I think i... |
72,242,507 | SQL query to get data if fields match or null if they dont<p>I need to get a list of users with their corresponding <code>bed_id</code> in case user has <code>bed_id</code> and fill with <code>null</code> if user doesn't have <code>bed_id</code> since there will always been more users than beds.</p>
<p>When I try this:... | <p>Use <code>LEFT OUTER JOIN</code>:</p>
<pre class="lang-sql prettyprint-override"><code>select users.*,
beds.bed_id
from users
LEFT OUTER JOIN beds
ON (users.user_id = beds.user_id);
</code></pre> | SQL query to get data if fields match or null if they dont | sql | 0 | 48 | 1 | 72,242,520 | 72,242,520 | 4 | true | 2022-05-14T17:23:20.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL query to get data if fields match or null if they dont<p>I need to get a list of users with their corresponding <code>bed_id</code> in case user has <cod... |
72,244,098 | Using R to decrypt messages encrypted in PHP<p>my brain hurts, I can't figure it out, I would be tremendously thankful for your help. I have a database that gets encrypted at storage using PHP. I need to decrypt it in R. I feel like I am close, but I just can't get there.</p>
<p>Here's the PHP code used to encrypt:</p>... | <p>Yes, you were incredibly close. If you look carefully at <code>y</code>:</p>
<pre class="lang-r prettyprint-override"><code>y
#> [1] 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21
</code></pre>
<p>You will see these are the ascii values of your original message as a raw vector. So you need only do:</p>
<pre class="lang-r... | Using R to decrypt messages encrypted in PHP | r|encryption | 2 | 48 | 1 | 72,244,149 | 72,244,149 | 4 | true | 2022-05-14T21:50:56.113Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using R to decrypt messages encrypted in PHP<p>my brain hurts, I can't figure it out, I would be tremendously thankful for your help. I have a database that ... |
72,331,395 | Sum 1 column based from date selection in Pandas<p>I am trying to figure out a way to do this sum in one line, or without having to create another dataframe in memory.</p>
<p>I have a DF with 3 columns. ['DateCreated', 'InvoiceNumber', 'InvoiceAmount']</p>
<p>I am trying to SUM the invoice amount during certain date ra... | <p>You can try with <code>loc</code></p>
<pre class="lang-py prettyprint-override"><code>yesterday_sales_total = df.loc[(df['DateCreated'] > yesterday_date) & (df['DateCreated'] < tomorrow_date), 'InvoiceAmount'].sum()
</code></pre> | Sum 1 column based from date selection in Pandas | python|python-3.x|pandas|dataframe | 1 | 48 | 3 | 72,331,407 | 72,331,407 | 4 | true | 2022-05-21T16:29:45.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sum 1 column based from date selection in Pandas<p>I am trying to figure out a way to do this sum in one line, or without having to create another dataframe ... |
72,362,824 | How to get all names for a sql table?<p>I am having issue getting all of the names of people and whether they play rugby or not.</p>
<p>If they play then display <code>Yes</code> otherwise <code>No</code>. At the moment I am just getting a single result of a person who plays rugby not others who did not. Can anyone hel... | <p>In my opinion you are using a wrong approach. You want to select persons, so select from the persons table. You want to know whether a person plays rugby, so look up persons in the rugby table. Lookups can be done with <code>IN</code> or <code>EXISTS</code>.</p>
<pre><code>select
name,
case when exists
(
... | How to get all names for a sql table? | mysql|sql | 1 | 48 | 1 | 72,363,070 | 72,363,070 | 4 | true | 2022-05-24T12:22:31.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get all names for a sql table?<p>I am having issue getting all of the names of people and whether they play rugby or not.</p>
<p>If they play then dis... |
72,388,064 | array_push() not working with session in PHP<p>i am working with PHP, I want to store more than two products in SESSION using array_push(). But problem is that after array_push only 2 products is showing in the cart. When i add more than two product then it is not added into the cart.</p>
<p>Here is my Code:</p>
<pre><... | <p>You can directly assign values to an array like the below mention.</p>
<pre><code>$_SESSION['shopping_cart'][] = $dataArray;
</code></pre>
<p>It will create a 2-d array for "shopping_cart" and every time you add $dataArray</p>
<p>it will store in new key so you can get the "shopping_cart" array h... | array_push() not working with session in PHP | php|session | 0 | 48 | 2 | 72,388,185 | 72,388,185 | 4 | true | 2022-05-26T07:08:33.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
array_push() not working with session in PHP<p>i am working with PHP, I want to store more than two products in SESSION using array_push(). But problem is th... |
72,990,387 | Syslog doesn't send messages over UDP<p>I want to send logs to a remote server using rsyslog. Somehow rsyslog doesn't send any messages.</p>
<p>This is my config (I am using the new syntax):</p>
<pre><code>template(name="myTemplate"
type="string"
string="%timegenerated% %HOSTNAME% %sysl... | <p>You forgot to include the <em>message</em> in your template. I am not sure though, if it would be sent anyways - just without a message - or if it would be discarded.</p>
<p>To solve that, just append <strong>%msg%</strong> to the template string:</p>
<pre><code>template(name="myTemplate"
type="st... | Syslog doesn't send messages over UDP | logging|syslog|rsyslog | 1 | 48 | 1 | 72,990,536 | 72,990,536 | 1 | true | 2022-07-15T07:22:16.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Syslog doesn't send messages over UDP<p>I want to send logs to a remote server using rsyslog. Somehow rsyslog doesn't send any messages.</p>
<p>This is my co... |
72,848,716 | C | Passing a function that has multiple parameters as a parameter<p>I have the following code:</p>
<pre class="lang-c prettyprint-override"><code>typedef struct ll_node linked_list_node;
struct ll_node {
int value;
linked_list_node* next;
};
typedef struct ll linked_list;
struct ll {
size_t size;
linked_list_... | <p>If you are under <code>gcc</code> you can achieve that using statement expressions and nested functions, here an <a href="https://stackoverflow.com/questions/10405436/anonymous-functions-using-gcc-statement-expressions">example of somtehing similar to a lambda</a>.</p>
<p>In plain c is much more difficult and you wo... | C | Passing a function that has multiple parameters as a parameter | c|function|arguments | -1 | 48 | 2 | 72,849,234 | 72,849,234 | 1 | true | 2022-07-03T17:50:30.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C | Passing a function that has multiple parameters as a parameter<p>I have the following code:</p>
<pre class="lang-c prettyprint-override"><code>typedef st... |
72,807,696 | How to delete a text in a string?<p>How to delete a text in a string?</p>
<p>I need to delete a certain text in a string that the backend sends me (client name)</p>
<p>The string is one of the following:</p>
<pre><code>Mr. Alan Turing (DNI: 012345678901234)
Mr. Charles Babbage (DNI: 97845565)
Mr. Stephen Wozniak (DNI: ... | <p>You can use <code>customer_name.innerHTML.split(" (DNI: ")[0]</code></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const customer_name = document.querySelector("... | How to delete a text in a string? | javascript | 1 | 48 | 1 | 72,807,764 | 72,807,764 | 1 | true | 2022-06-29T20:49:05.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to delete a text in a string?<p>How to delete a text in a string?</p>
<p>I need to delete a certain text in a string that the backend sends me (client na... |
73,004,123 | Javascript Redirect Modal in Laravel<p>When the user likes a story on the card, users saves it with the "save" button. I do this as a savePost in my .js file. But if the user is not registered I am redirecting as "location.replace(APP_URL + "/login")".</p>
<h4>I want to redirect to a modal... | <p><strong>Your current JS:</strong></p>
<pre><code> function savePost(t) {
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content")
}
});
$(this);
$.ajax({
url: APP_URL + "... | Javascript Redirect Modal in Laravel | javascript|php|ajax|laravel|laravel-8 | 0 | 48 | 1 | 73,005,127 | 73,005,127 | 1 | true | 2022-07-16T12:16:29.197Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript Redirect Modal in Laravel<p>When the user likes a story on the card, users saves it with the "save" button. I do this as a savePost in m... |
72,778,574 | How to get Percentage of Total counts for each item in the Map/Dict column?<p>I have a PySpark dataframe which looks like this, I have a map datatype column Map<Str,Int></p>
<pre class="lang-none prettyprint-override"><code> Date Item (Map<Str,int>) Total Items
202... | <ul>
<li><p><strong>Spark 3.0+</strong></p>
<p>Making use of <a href="https://spark.apache.org/docs/latest/api/sql/index.html#transform_values" rel="nofollow noreferrer"><code>transform_values</code></a></p>
<pre class="lang-py prettyprint-override"><code>from pyspark.sql import functions as F
df = df.withColumn(
... | How to get Percentage of Total counts for each item in the Map/Dict column? | apache-spark|dictionary|pyspark|apache-spark-sql|percentage | 1 | 48 | 1 | 72,778,828 | 72,778,828 | 1 | true | 2022-06-27T21:40:07.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get Percentage of Total counts for each item in the Map/Dict column?<p>I have a PySpark dataframe which looks like this, I have a map datatype column ... |
72,907,433 | How to extract only wanted property from JSON object<p>When I run the code:</p>
<pre><code>import requests
import json
def get_fact():
catFact = requests.get("https://catfact.ninja/fact?max_length=140")
json_data = json.loads(catFact.text)
return json_data
print(get_fact())
</code></pre>
<p>The output ... | <p>What you want is to access the key in the python dict you made with the <code>json.loads</code> call. We actually don't need the <code>json</code> library as requests can read and deserialize JSON itself.</p>
<p>This code also checks if the response was OK and fails with informative error message. It follows <a href... | How to extract only wanted property from JSON object | python|json|properties | 0 | 48 | 4 | 72,907,556 | 72,907,556 | 1 | true | 2022-07-08T06:25:27.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to extract only wanted property from JSON object<p>When I run the code:</p>
<pre><code>import requests
import json
def get_fact():
catFact = requests.g... |
73,029,164 | get first occurrence of last different row in a group of rows in MySQL table<p>environment:
Server version: 10.7.3-MariaDB-log</p>
<h1>tables:</h1>
<h2>user location history:</h2>
<pre><code>CREATE TABLE `location_history` (
`id` int(10) UNSIGNED NOT NULL,
`userId` int(10) UNSIGNED DEFAULT NULL,
`latitude` double... | <p>@danblack commented above that this is a window function problem, but there's a catch: MySQL 8 does not support nested window functions.</p>
<p>What window functions do is take the result of your query, partition it by rules you state, then allow you to add extra columns to the result with information based on that ... | get first occurrence of last different row in a group of rows in MySQL table | mysql|sql|mariadb | 0 | 48 | 2 | 73,040,422 | 73,040,422 | 1 | true | 2022-07-18T22:14:34.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
get first occurrence of last different row in a group of rows in MySQL table<p>environment:
Server version: 10.7.3-MariaDB-log</p>
<h1>tables:</h1>
<h2>user ... |
72,942,296 | MySQL DROP TABLE and TRUNCATE not fully resetting AUTO-INCREMENT<p>I have a table in a MySQL database called Events that is defined like this:</p>
<pre><code>CREATE TABLE IF NOT EXISTS `TrackIt`.`Events` (
`id` INT NOT NULL AUTO_INCREMENT,
`EventType` INT NULL,
`timestamp` TIMESTAMP NULL,
`Comment` TEXT NULL,
... | <p>I'm guessing <code>INSERT...SELECT</code> is batching the incrementing of the auto increment column somehow, resulting in the auto_increment value being higher than the number of rows. mysql is not designed to guarantee sequential ids from auto_increment, so I don't find this surprising. I strongly suggest you rec... | MySQL DROP TABLE and TRUNCATE not fully resetting AUTO-INCREMENT | mysql | 0 | 48 | 1 | 72,942,574 | 72,942,574 | 1 | true | 2022-07-11T17:14:43.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL DROP TABLE and TRUNCATE not fully resetting AUTO-INCREMENT<p>I have a table in a MySQL database called Events that is defined like this:</p>
<pre><code... |
72,939,290 | Get Jenkins filtered job param value using xpath<p>I have the below xml from the jenkins job data. I am trying extract the value for the selected name <strong>yaml_data</strong> inside the paramters..</p>
<p>I am using below url to filter the data but it still lists all the name and value of the parameters.</p>
<pre><... | <p>@ycr has provided the correct answer, this just expands a bit more information based on the above question</p>
<p>You were nearly there, but your request is asking to display the tree: <code>/xml?tree=</code></p>
<p>What you actually want to request is the parameter tag with its values from the xml api where the par... | Get Jenkins filtered job param value using xpath | jenkins | 0 | 48 | 2 | 72,940,145 | 72,940,145 | 1 | true | 2022-07-11T13:23:38.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get Jenkins filtered job param value using xpath<p>I have the below xml from the jenkins job data. I am trying extract the value for the selected name <stro... |
73,014,380 | How to merge two files based on 2 columns using awk?<p>I have two files with different row numbers. I would like to merge file1 with file2, similar to how I would do with left_join in R:</p>
<pre><code>Denisovan_EAS_4 <- left_join(file1,file2,by = "SNP", "pval")%>% distinct(SNP, pval, .keep_al... | <p>Okay, you say <em>"only SNPs with pval that are present in file 1)"</em>, and it appears that existence in file1 is sufficient to determine that something has a pval, yes? So the following may be sufficient:</p>
<pre><code>$ awk 'NR==FNR{f1[$1];next} $1 in f1' file1 file2
</code></pre>
<p>This reads throu... | How to merge two files based on 2 columns using awk? | unix|awk | 0 | 48 | 1 | 73,014,455 | 73,014,455 | 1 | true | 2022-07-17T18:33:59.393Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to merge two files based on 2 columns using awk?<p>I have two files with different row numbers. I would like to merge file1 with file2, similar to how I ... |
72,778,171 | Canvas gradient is diagonal when it should be vertical<p>I have some javascript code to generate a gradient from 14 colors:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var ... | <p><code>createLinearGradient</code> generate a gradient from two points, (x0,y0) and (x1, y1). This is why it takes four parameters.</p>
<p><code>fillStyle</code> defines the color, gradiant or pattern used by <code>fillRect</code> to fill your rectangle. You are using gradiant here.</p>
<p><code>fillRect</code> takes... | Canvas gradient is diagonal when it should be vertical | javascript|html|canvas|html5-canvas|gradient | -1 | 48 | 2 | 72,778,560 | 72,778,560 | 1 | true | 2022-06-27T20:51:58.487Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Canvas gradient is diagonal when it should be vertical<p>I have some javascript code to generate a gradient from 14 colors:</p>
<p><div class="snippet" data-... |
73,013,486 | LARAVEL count with conditions<p>I have a table called <code>transactions</code> I get data from it as statistics
grouped by year and month and total but I need get also <code>success</code> and <code>failed</code> depend on <code>state</code> field.</p>
<p>the issue here is that the <strong><code>success and field</cod... | <p>you can use this :</p>
<pre><code>$this->transactions()
->select(
DB::raw('count(state) as count'),
DB::raw('SUM(case when state = "success" then 1 else 0 end) as success'),
DB::raw('SUM(case when state != "success" then 1 else 0 end) as failed'),
DB::... | LARAVEL count with conditions | laravel|eloquent|laravel-query-builder | 0 | 48 | 1 | 73,013,864 | 73,013,864 | 1 | true | 2022-07-17T16:24:45.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
LARAVEL count with conditions<p>I have a table called <code>transactions</code> I get data from it as statistics
grouped by year and month and total but I ne... |
72,865,620 | Redis Timeseries - Representing the numberic value as a list of values<p>I'm new to Redis Timeseries and I'd like to know if it is possible to add data to a TS as <strong>a list of values</strong> instead of a single numeric value.</p>
<p>Here my specific example about representing <strong>trading candles</strong>:</p>... | <p>No. RedisTimeSeries is currently (v1.X) a single-column time series database, which means that a time series is a set of (timestamp, value) pairs. You are asking about multi-column (or multi-metric) capability.</p>
<p>Nevertheless, by creating multiple time series you are not loosing any capabilities. You gain simpl... | Redis Timeseries - Representing the numberic value as a list of values | redis|redistimeseries | 0 | 48 | 1 | 72,865,867 | 72,865,867 | 1 | true | 2022-07-05T07:35:48.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Redis Timeseries - Representing the numberic value as a list of values<p>I'm new to Redis Timeseries and I'd like to know if it is possible to add data to a ... |
72,769,901 | KafkaController required a bean of type 'org.springframework.kafka.requestreply.ReplyingKafkaTemplate' that could not be found?<p>I am trying to use the <code>RepliyngKafkaTemplate</code> like I managed to use the <code>KafkaTemplate</code> in a REST controller.</p>
<pre><code>@RestController
public class TestControlle... | <blockquote>
<p>Do I really have to define beans? Seems unnecessary.</p>
</blockquote>
<p>Yes, you have to declare a beans for the replying template (including the reply container); Spring Boot only auto configures a simple <code>KafkaTemplate</code>.</p> | KafkaController required a bean of type 'org.springframework.kafka.requestreply.ReplyingKafkaTemplate' that could not be found? | java|spring|apache-kafka|spring-kafka | 1 | 48 | 2 | 72,773,280 | 72,773,280 | 2 | true | 2022-06-27T09:33:51.473Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
KafkaController required a bean of type 'org.springframework.kafka.requestreply.ReplyingKafkaTemplate' that could not be found?<p>I am trying to use the <cod... |
72,773,359 | Python - Create list of dictionaries from multiple lists of values<p>I have multiple lists of data, for example: age, name, gender, etc. All of them in order, meaning that the <em>x</em> record of every list belongs to the same person.</p>
<p>What I'm trying to create is a list of dictionaries from these lists in the b... | <p>You need to <a href="https://docs.python.org/3/library/functions.html#zip" rel="nofollow noreferrer"><code>zip</code></a>:</p>
<pre><code>ages = [20, 21, 30]
names = ["Jhon", "Daniel", "Rob"]
list_of_dicts = [{"age": value, 'name': name}
for value, name in zip... | Python - Create list of dictionaries from multiple lists of values | python|list|dictionary | 0 | 48 | 2 | 72,773,374 | 72,773,374 | 2 | true | 2022-06-27T13:59:28.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python - Create list of dictionaries from multiple lists of values<p>I have multiple lists of data, for example: age, name, gender, etc. All of them in order... |
72,775,403 | JavaScript object array new values<p>This is my first question post :)
I have the following array object:</p>
<pre><code><script>
var tratamentos = {
"Sr": ["Casado", "Solteiro"],
"Sra": ["Casada", "Solteira"],}
</script>
</code></pre>
... | <p>You can acces items from the nested array using dots (".") and then use .push operator to add items to the array.</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>v... | JavaScript object array new values | javascript | 0 | 48 | 1 | 72,775,862 | 72,775,862 | 2 | true | 2022-06-27T16:25:56.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaScript object array new values<p>This is my first question post :)
I have the following array object:</p>
<pre><code><script>
var tratamentos = {
... |
72,782,056 | Couchbase unable to retrieve document No index available Code 4000<p>I have a bucket in Couchbase called <code>mybucket</code>. When I select Documents and then choose my bucket, It has an option to retrieve the documents. When I choose the first one, the web platform of Couchbase shows the content of that document to ... | <p>Bucket Retrieve documents uses DCP stream vs Query Editor uses N1QL which required the secondary index or primary index</p>
<p>Option 1) CREATE INDEX ix1 ON mybuckte(type);</p>
<p>OR</p>
<p>Option 2) CREATE PRIMARY INDEX on mybucket;</p> | Couchbase unable to retrieve document No index available Code 4000 | couchbase | 1 | 48 | 1 | 72,787,489 | 72,787,489 | 2 | true | 2022-06-28T07:06:50.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Couchbase unable to retrieve document No index available Code 4000<p>I have a bucket in Couchbase called <code>mybucket</code>. When I select Documents and t... |
72,809,498 | Enable tab auto completion for kubectl in bash function<p>Given a bash function in .bashrc such as</p>
<pre><code>kgp () {
kubectl get po -n $1 $2
}
</code></pre>
<p>Is it possible to have kubectl auto complete work for k8s resources such as namespaces/pods? As an example if I use</p>
<pre><code>kubectl get po -n nsp... | <p>Yes, that's because bash-completion only understands <em>known commands</em>, not aliases or new functions that you have made up. You will experience the same thing with a trivial example of <code>alias whee=/bin/ls</code> and then <code>whee <TAB></code> will do nothing because it doesn't "recurse" ... | Enable tab auto completion for kubectl in bash function | bash|kubernetes|kubectl|bash-completion | 0 | 48 | 1 | 72,809,792 | 72,809,792 | 2 | true | 2022-06-30T01:47:35.523Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Enable tab auto completion for kubectl in bash function<p>Given a bash function in .bashrc such as</p>
<pre><code>kgp () {
kubectl get po -n $1 $2
}
</code... |
72,804,032 | Symfony 5 doctrine flush slows down<p>I was just wondering why updating a record (flush) slows down over time.
For example, if i want to check mulitple records and compare them with eachother and after comparisation update a column like setCompared(true);. The first 1000 records are fine and fast but after that, the fl... | <p>You should do something like this according to the <a href="https://www.doctrine-project.org/projects/doctrine-orm/en/2.11/reference/batch-processing.html#bulk-inserts" rel="nofollow noreferrer">Doctrine documentation)</a> :</p>
<pre><code><?php
$batchSize = 20;
for ($i = 1; $i <= 10000; ++$i) {
$user = n... | Symfony 5 doctrine flush slows down | database|symfony|doctrine|flush | 0 | 48 | 1 | 72,813,827 | 72,813,827 | 2 | true | 2022-06-29T15:25:59.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Symfony 5 doctrine flush slows down<p>I was just wondering why updating a record (flush) slows down over time.
For example, if i want to check mulitple recor... |
72,810,412 | Linkerd authorization policy without ingress<p>I am newbie to service mesh and k8 in general.</p>
<p>From my understanding Linkerd does not provide it's own ingress controller. In that case, in my understanding Linkerd does not have reverse-proxy in itself. However, it can still do authorization of the request. How is ... | <p>You are correct that Linkerd does not provide its own ingress controller, instead pairing with whichever existing ingress controller you want. Linkerd's mTLS, authn, authz features are used for internal service-to-service / pod-to-pod communication in the cluster. So the ingress handles the first contact with out-of... | Linkerd authorization policy without ingress | kubernetes|servicemesh|linkerd | 0 | 48 | 1 | 72,817,868 | 72,817,868 | 2 | true | 2022-06-30T04:46:36.640Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Linkerd authorization policy without ingress<p>I am newbie to service mesh and k8 in general.</p>
<p>From my understanding Linkerd does not provide it's own ... |
72,825,377 | Display every keyboard character pressed Python tkinter<p>When I watched ecnerwala videos on competitive programming, I found something interesting in his video.</p>
<p>This running text
<a href="https://i.stack.imgur.com/VHENk.png" rel="nofollow noreferrer">ecnerwala running text</a></p>
<p>Here is the link of the vid... | <p>Given that you use only one line in the text widget, you can use an entry in read-only mode instead.</p>
<p>No matter whether you use an entry or a text widget, you can use the method <code>text.xview_moveto(<fraction>)</code> to set which part of the content is visible, <code><fraction></code> being the... | Display every keyboard character pressed Python tkinter | python|tkinter | 3 | 48 | 2 | 72,825,664 | 72,825,664 | 2 | true | 2022-07-01T06:52:33.440Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Display every keyboard character pressed Python tkinter<p>When I watched ecnerwala videos on competitive programming, I found something interesting in his vi... |
72,825,821 | JavaScript Why does an inner setTimeout of a Promise runs after an outside setTimeout<p>When run the below code snippet, it outputs <code>2,1</code>. Since Promise is a micro-task and everything inside a promise should run before a macro-task (setTimeout), I expect that the output will be <code>1,2</code>. So even if t... | <p>The promise is a micro task and will get executed before <code>timeout1</code>, but <code>timeout1</code> is already scheduled as a macro task.</p>
<p>When the promise resolves, <code>timeout2</code> will get scheduled, but the macrotask Q already has <code>timeout1</code> and as such this is already scheduled and w... | JavaScript Why does an inner setTimeout of a Promise runs after an outside setTimeout | javascript|promise|settimeout|es6-promise | 0 | 48 | 3 | 72,825,916 | 72,825,916 | 2 | true | 2022-07-01T07:33:21.943Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaScript Why does an inner setTimeout of a Promise runs after an outside setTimeout<p>When run the below code snippet, it outputs <code>2,1</code>. Since P... |
72,829,703 | how do i use react router in if/else condition in a function called by button click<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 handleStartClick = () => {
const ema... | <p>You can't.</p>
<hr />
<p>If you want to trigger navigation from a callback:</p>
<ol>
<li>Define your route with your other routes, giving it a path</li>
<li>Navigate to that path with the <code>navigate</code> function returned by the <a href="https://reactrouter.com/docs/en/v6/hooks/use-navigate" rel="nofollow nore... | how do i use react router in if/else condition in a function called by button click | javascript|reactjs | -1 | 48 | 2 | 72,829,787 | 72,829,787 | 2 | true | 2022-07-01T13:03:44.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how do i use react router in if/else condition in a function called by button click<p><div class="snippet" data-lang="js" data-hide="false" data-console="tru... |
72,832,936 | Removing text from a fasta gene name between two characters<p>I have a large codon alignment that has a variety of gene names in the headers. The headers are in the following format:</p>
<pre><code>>ENST00000357033.DMD.-1 | CODON | REFERENC
</code></pre>
<p>I want to modify all of the headers in the fasta to exclude... | <pre><code>sed '/^>/s/\.[^ ]* / /'
</code></pre>
<p>for each line starting with a '>' replace 'dot' followed by some char different from spaces followed by a space, by a space.</p> | Removing text from a fasta gene name between two characters | bioinformatics|fasta|sequence-alignment | 0 | 48 | 2 | 72,835,139 | 72,835,139 | 2 | true | 2022-07-01T17:44:27.317Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Removing text from a fasta gene name between two characters<p>I have a large codon alignment that has a variety of gene names in the headers. The headers are... |
72,835,876 | Is possible to change the Javascript in the clients browser?<p>on a webform I'm using JQuery Validator to check my form data, however I don't add any validation on the server side.
I would like to know if is possible for a user to alter the code and remove my validations from their browser. If that is possible, how cou... | <p>The code on the browser can be tempered maliciously, you must always include validations on your server/backend/api</p> | Is possible to change the Javascript in the clients browser? | javascript|html|jquery | 1 | 48 | 1 | 72,835,920 | 72,835,920 | 2 | true | 2022-07-02T01:35:12.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is possible to change the Javascript in the clients browser?<p>on a webform I'm using JQuery Validator to check my form data, however I don't add any validat... |
72,844,259 | MutableStatOf Data Class not creating re-composition in Composable<p>I am struggling to understand what is the best way to get this to work.
I have some input fields and I created a TextFieldState to keep all the state in one place.
But it is not triggering a re-composition of the composable so the state never updates.... | <p>You don't change instance of nameState's value with</p>
<pre><code> nameState.value.value = name
</code></pre>
<p>It's the same object which State checks by default with</p>
<pre><code>fun <T> structuralEqualityPolicy(): SnapshotMutationPolicy<T> =
StructuralEqualityPolicy as SnapshotMutationPolicy&l... | MutableStatOf Data Class not creating re-composition in Composable | android|kotlin|android-jetpack-compose|android-viewmodel | 1 | 48 | 1 | 72,844,289 | 72,844,289 | 2 | true | 2022-07-03T06:04:57.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MutableStatOf Data Class not creating re-composition in Composable<p>I am struggling to understand what is the best way to get this to work.
I have some inpu... |
72,848,726 | How to use mergeWith with Subjects in Angular<p><strong>Goal:</strong> A Combined Filter with 3 Inputs to filter some list</p>
<p><strong>Restrictions:</strong></p>
<ul>
<li>The User should not be forced to complete all available filters to submit</li>
<li>The first submit should happen once the user inputs</li>
<li>Di... | <p><code>mergeWith</code>, like <code>merge</code> works seamlessly with Subjects.</p>
<p>Example :</p>
<pre><code>import { Subject } from 'rxjs';
import { mergeWith } from 'rxjs/operators';
const s1 = new Subject<string>();
const s2 = new Subject<string>();
const s3 = new Subject<string>();
s1.pipe... | How to use mergeWith with Subjects in Angular | angular|typescript|service|rxjs | 1 | 48 | 1 | 72,848,797 | 72,848,797 | 2 | true | 2022-07-03T17:52:25.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use mergeWith with Subjects in Angular<p><strong>Goal:</strong> A Combined Filter with 3 Inputs to filter some list</p>
<p><strong>Restrictions:</stro... |
72,855,754 | Break in switch case<p>I'm coding a little tic tac toe game in java and I'm adding a functionnnality that asking if the player wants to continue to play or not.
The problem is that in my switch, the break is not understood and don't break the program when we say that we want to stop.
Can someone help me find the proble... | <p>That is not the way the <code>break</code> keyword works. It ends the <code>switch</code> statement, not the program.</p>
<p>In your code, if the option is <code>yes</code>, both <code>yes</code> and <code>no</code> codes will be executed because there is no <code>break</code> before the <code>no</code>.</p>
<p>You ... | Break in switch case | java|switch-statement | -4 | 48 | 1 | 72,855,868 | 72,855,868 | 2 | true | 2022-07-04T11:06:58.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Break in switch case<p>I'm coding a little tic tac toe game in java and I'm adding a functionnnality that asking if the player wants to continue to play or n... |
72,875,467 | How to add new activities to an existing brightway2 database?<p>I loaded the ecoinvent database as shown below. I would like to calculate the impact of a created activity that takes in cotton fibre and polyester fibre as input and produces a mixed fibre as output. How do I do it?</p>
<pre><code>eidb = bw.Database('ecoi... | <p>As a new <code>Database</code>:</p>
<pre class="lang-py prettyprint-override"><code>db_name = "ecoinvent_3_8_cutoff"
bw2data.Database("another db").write(
[{
("another db", "test_product"): {
'activity': 'test_process_00001',
'activity type'... | How to add new activities to an existing brightway2 database? | brightway | 1 | 48 | 1 | 72,875,740 | 72,875,740 | 2 | true | 2022-07-05T20:59:22.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add new activities to an existing brightway2 database?<p>I loaded the ecoinvent database as shown below. I would like to calculate the impact of a cre... |
72,877,425 | Loop question for Small project to add rows based on count<p>Been trying to find information on loops but not really sure where to start to figure out this logic. I want to understand the logic of a loop that achieves the following:</p>
<p>I have a spreadsheet with two columns, column 1 has Work Order #s and Column 2 h... | <p>In your situation, how about the following sample script?</p>
<h3>Sample script:</h3>
<p>Please copy and paste the following script to the script editor of Spreadsheet and save the script. When you use this script, please put a custom function of <code>=SAMPLE(A2:B)</code> to a cell.</p>
<pre class="lang-js prettypr... | Loop question for Small project to add rows based on count | google-apps-script|google-sheets | -1 | 48 | 1 | 72,878,333 | 72,878,333 | 2 | true | 2022-07-06T02:45:47.973Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Loop question for Small project to add rows based on count<p>Been trying to find information on loops but not really sure where to start to figure out this l... |
72,879,623 | How to run p4 console command if I use p4v client<p>I installed Client p4v from oficial site. I can use only Gui. But I can not use p4 console application. How can I run p4 from console?</p> | <p>The P4V installer should have installed the p4 command line tool but if it didn't, you can install the CLI tool itself by downloading from here:
<a href="https://www.perforce.com/downloads/helix-command-line-client-p4" rel="nofollow noreferrer">https://www.perforce.com/downloads/helix-command-line-client-p4</a></p> | How to run p4 console command if I use p4v client | version-control|perforce|p4v | -1 | 48 | 1 | 72,881,287 | 72,881,287 | 2 | true | 2022-07-06T07:42:48.580Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to run p4 console command if I use p4v client<p>I installed Client p4v from oficial site. I can use only Gui. But I can not use p4 console application. H... |
72,882,064 | I need to delete rows that are newer than 2019<p>I am sending files from 12 years back to the server. For some reason, 2019 did not transfer in full and I have to remove it from DB.
How to delete rows younger than 2018-12-30?</p>
<p>I try code below but i get error:</p>
<pre><code>ERROR: syntax error at or near "... | <p>It is not <code>DELETE * FROM</code>, but <code>DELETE FROM</code>.</p>
<pre><code>DELETE FROM mlode WHERE kd >= DATE '2019-01-01';
</code></pre> | I need to delete rows that are newer than 2019 | sql|postgresql | 0 | 48 | 2 | 72,882,866 | 72,882,866 | 2 | true | 2022-07-06T10:38:54.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I need to delete rows that are newer than 2019<p>I am sending files from 12 years back to the server. For some reason, 2019 did not transfer in full and I ha... |
72,882,944 | delete a specific line in txt file if it consist a special word<p>i ask for a input, if that input was in a line of my txt file, delete just that line</p>
<pre><code>w = input("Enter STnumber: ")
with open("student.txt ", "r") as f:
lines = f.readlines()
with open('student.txt','... | <p>If you want to remove lines from a text file that contain a certain pattern then you could do this:</p>
<pre><code>with open('foo.txt', 'r+') as foo:
lines = foo.readlines()
foo.seek(0)
for line in lines:
if not 'Pattern' in line:
foo.write(line)
foo.truncate()
</code></pre> | delete a specific line in txt file if it consist a special word | python|txt | 0 | 48 | 2 | 72,883,099 | 72,883,099 | 2 | true | 2022-07-06T11:37:43.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
delete a specific line in txt file if it consist a special word<p>i ask for a input, if that input was in a line of my txt file, delete just that line</p>
<p... |
72,883,822 | Must I use arrow functions in this.setState in React?<p>As I am following <a href="https://codepen.io/gaearon/pen/xEmzGg?editors=0010" rel="nofollow noreferrer">an example</a> in React's documentation on using <code>this.setState</code> to toggle an on/off button.</p>
<p>I am experimenting with non-arrow functions in t... | <p>Arrow functions are purely syntax sugar and can <em>always</em> be rewritten using ordinary <code>function</code>.</p>
<pre class="lang-js prettyprint-override"><code>this.setState(
prevState => ({ isToggleOn: !prevState.isToggleOn})
)
</code></pre>
<p><code>this</code> doesn't appear inside the function so tha... | Must I use arrow functions in this.setState in React? | javascript|reactjs | -1 | 48 | 1 | 72,884,235 | 72,884,235 | 2 | true | 2022-07-06T12:46:40.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Must I use arrow functions in this.setState in React?<p>As I am following <a href="https://codepen.io/gaearon/pen/xEmzGg?editors=0010" rel="nofollow noreferr... |
72,885,469 | Pivot wider a column containing lists<p>I have this dataset:</p>
<pre><code>col1 col2
a c(1,2)
b 5
</code></pre>
<p>I want this dataset:</p>
<pre><code>col1 col2_1 col2_2 col2_5
a TRUE TRUE FALSE
b FALSE FALSE TRUE
</code></pre>
<p>I know I have to use pivot wider. But I don't... | <p>You could unnest <code>col2</code> and then reshape data to wide.</p>
<pre class="lang-r prettyprint-override"><code>library(tidyr)
df %>%
unnest(col2) %>%
pivot_wider(col1, names_from = col2, names_prefix = "col2_",
values_from = col2, values_fn = Negate(is.na), values_fill = FALS... | Pivot wider a column containing lists | r|pivot | 3 | 48 | 3 | 72,885,900 | 72,885,900 | 2 | true | 2022-07-06T14:37:55.317Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pivot wider a column containing lists<p>I have this dataset:</p>
<pre><code>col1 col2
a c(1,2)
b 5
</code></pre>
<p>I want this dataset:</p>
<pr... |
72,849,993 | How to add a pause/wait in the middle of a nested SCNTransaction chain<p>This question must have a very simple answer, but I couldn't find it after searching for hours. Unless I just need to manually add some timer to wait.</p>
<p>Basically, I have an animation sequence to move a node to a certain place, <em>here I wan... | <p>Using <code>asyncAfter</code> to wait is fine. That is the purpose of this method, after all.</p>
<p>Creating an empty transaction with the duration of 5 seconds doesn't work because SceneKit can easily see that you haven't changed anything, and knows that the animation can complete immediately. You can hide a node ... | How to add a pause/wait in the middle of a nested SCNTransaction chain | ios|swift|scenekit | 1 | 48 | 1 | 72,887,104 | 72,887,104 | 2 | true | 2022-07-03T21:20:17.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add a pause/wait in the middle of a nested SCNTransaction chain<p>This question must have a very simple answer, but I couldn't find it after searching... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.