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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
71,944,724 | Pandas / openpyxl - Use regex to move specific columns to a new sheet<p>Is there a function in Pandas or openpyxl to select columns to move to a new sheet via regex? For example, I want to move all columns under headings ending in the word "Background" moved to a new sheet named "Background subtracted&qu... | <p>I've figured out how to do this. In my case, I selected columns ending with 'd' since those were the only ones I wanted.</p>
<pre><code>import pandas
path = r'yourpath'
df = pandas.read_excel(path)
writer = pandas.ExcelWriter(file_path, engine = 'openpyxl', mode = 'a')
df.loc[:, df.columns.str.endswith('d')].to_exc... | Pandas / openpyxl - Use regex to move specific columns to a new sheet | pandas|dataframe|openpyxl | -1 | 22 | 1 | 71,945,207 | 71,945,207 | 0 | true | 2022-04-20T18:44:07.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas / openpyxl - Use regex to move specific columns to a new sheet<p>Is there a function in Pandas or openpyxl to select columns to move to a new sheet vi... |
71,946,045 | JSON with locations to a dataframe<p>I have this json file that contains the distance and the travel duration between one point to another one. For instance, below I have the distances from the depot to the depot, and then the depot to A. And again, from A to the depot, and then from A to A.</p>
<pre class="lang-json p... | <p>IIUC your distance matrix should be symetric.
You can use <code>json_normalize</code> on your dictionary values:</p>
<pre><code>import pandas as pd
import json
data = json.loads(json_data)
locs = data.keys()
df = pd.concat([pd.json_normalize(val)['travelDistance'] for val in data.values()], axis=1)
df.index = locs
... | JSON with locations to a dataframe | python|json | -1 | 30 | 1 | 71,946,491 | 71,946,491 | 0 | true | 2022-04-20T20:48:40.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JSON with locations to a dataframe<p>I have this json file that contains the distance and the travel duration between one point to another one. For instance,... |
71,950,644 | how to only accept two user inputs, and break loop using one of the inputs<p>I am trying to ask the user 'would you like to add another store' by giving them a yes(y) or no(n) option, however, I don't know how to loop the code back once an error message has been thrown. I am trying to make it so that only 'y' and 'n' a... | <p>I would try to write something like this.</p>
<pre><code>def need_another_store():
correct_answers = ['y', 'n']
print('Would you like to add a new store?')
while True:
answer = input("If YES(y), If NO(n): ")
if answer not in correct_answers:
print("Please ente... | how to only accept two user inputs, and break loop using one of the inputs | python|python-3.x | -1 | 32 | 1 | 71,950,891 | 71,950,891 | 0 | true | 2022-04-21T07:43:04.550Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to only accept two user inputs, and break loop using one of the inputs<p>I am trying to ask the user 'would you like to add another store' by giving them... |
71,819,991 | Command 'Solidity: Compile Contract' resulted in an error (Cannot read properties of undefined(reading 'uri'))<p>Good day everyone, I am working on a lottery smart contract. I am currently done with the remix VM tests and proceeded with the unit tests with JavaScript. The test.js file is shown below.</p>
<pre><code>con... | <p>I am currently debugging the same error as well for a NFT I am publishing... I imported the local directory into my Remix workspace and it compiled just fine... this leads me to believe the issue is a mismatch between compiler versions... not sure. VS Code was irritating me, so I just published through Remix and cal... | Command 'Solidity: Compile Contract' resulted in an error (Cannot read properties of undefined(reading 'uri')) | javascript|node.js|mocha.js|solidity|web3js | -1 | 289 | 1 | 71,961,424 | 71,961,424 | 0 | true | 2022-04-10T19:42:43.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Command 'Solidity: Compile Contract' resulted in an error (Cannot read properties of undefined(reading 'uri'))<p>Good day everyone, I am working on a lottery... |
71,963,411 | Without using panda or numpy, how would I separate my data into even columns? Then sum up the last column<p>I am trying to align the year, model, and price. Then sum up the cost.</p>
<p>Saved as 'car.dat' data below without converting to csv or using panda and numpy.</p>
<blockquote>
<p>2018,Alfa Romeo Stelvio Ti,$28,9... | <p>Perhaps something similar to this:</p>
<pre class="lang-py prettyprint-override"><code>def main():
total = 0
print("Year".ljust(6), "Make/Model".ljust(10), "Price")
print("-" * 35)
with open('car.dat') as f:
for line in f:
year, make_model, ... | Without using panda or numpy, how would I separate my data into even columns? Then sum up the last column | python|arrays|format | -1 | 26 | 1 | 71,963,593 | 71,963,593 | 0 | true | 2022-04-22T04:13:08.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Without using panda or numpy, how would I separate my data into even columns? Then sum up the last column<p>I am trying to align the year, model, and price. ... |
71,864,328 | How to force calibration before measuring a DWG file in Forge Viewer?<p>After checking the documentation of Forge Viewer, I found that there is an option to force the calibration before taking measurements in PDF sheets.</p>
<p>But is there a similar option to force calibration on other types of files, like DWG? Or is ... | <p>I guess you mean the <code>forcePDFCalibration</code> option mentioned <a href="https://forge.autodesk.com/en/docs/viewer/v7/reference/globals/TypeDefs/Settings/" rel="nofollow noreferrer">here</a>.</p>
<p>For <strong>DWG</strong> one option could be setting <code>forceCalibrate</code> to <code>true</code> after loa... | How to force calibration before measuring a DWG file in Forge Viewer? | autodesk-viewer | -1 | 25 | 1 | 71,969,668 | 71,969,668 | 0 | true | 2022-04-13T22:10:33.103Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to force calibration before measuring a DWG file in Forge Viewer?<p>After checking the documentation of Forge Viewer, I found that there is an option to ... |
71,947,371 | How to stop the Api icon keep adding when click the buttons?<p><a href="https://i.stack.imgur.com/vy616.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vy616.png" alt="enter image description here" /></a>I have to create a web with two buttons to show each city's information.
When I clicked the butto... | <p>This is what I did:</p>
<pre><code>var iconUrl = "https://openweathermap.org/img/wn/" + data.weather[0].icon + "@2x.png";
out_icon.innerHTML = `<img src='${iconUrl}'/>`;
</code></pre> | How to stop the Api icon keep adding when click the buttons? | javascript|html | -1 | 28 | 2 | 71,969,776 | 71,969,776 | 0 | true | 2022-04-20T23:51:57.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to stop the Api icon keep adding when click the buttons?<p><a href="https://i.stack.imgur.com/vy616.png" rel="nofollow noreferrer"><img src="https://i.st... |
71,976,880 | Unpacking nested list attributes in different formats<p>I am looking for some guidance on how to work with nested lists and unpacking them. Previously, I had created 4 separate lists to store the responses from users in a survey with one lists storing gender, another a Y/N question, the age and BMI of the survey user.<... | <p>Here is a solution with while loops.</p>
<pre><code>import sys
i = 0
sample = [["M", "N", 37, 34.67], ["F", "Y", 22, 29.01], ["F", "Y", 88, 24.00]]
while i < len(sample):
sys.stdout.write(str(sample[i]) + "\n") # 1st form needed
j = 0... | Unpacking nested list attributes in different formats | python|list|nested-lists | -1 | 33 | 1 | 71,977,004 | 71,977,004 | 0 | true | 2022-04-23T04:44:55.267Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unpacking nested list attributes in different formats<p>I am looking for some guidance on how to work with nested lists and unpacking them. Previously, I had... |
71,977,818 | zsh command not found [ nvm command not found after install successfully in macOs ]<pre><code>brew install nvm
</code></pre>
<p>I am installed successfully NVM in my macOs. But also then after I got NVM command not found error.</p> | <p>Reinstall nvm again.</p>
<pre><code>brew reinstall nvm
</code></pre>
<p>create the .zshrc file.</p>
<pre><code>vi ~/.zshrc
</code></pre>
<p>Paste code which I am write here</p>
<pre><code># NVM Akash Stuff
export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"
</code></pre> | zsh command not found [ nvm command not found after install successfully in macOs ] | macos|homebrew|nvm | -1 | 1,049 | 1 | 71,977,819 | 71,977,819 | 0 | true | 2022-04-23T07:48:07.597Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
zsh command not found [ nvm command not found after install successfully in macOs ]<pre><code>brew install nvm
</code></pre>
<p>I am installed successfully N... |
71,979,670 | How to pass struct as argument from one contract to another contract<p>I can pass array, uint, bool mappings from one contract to another contract. but I can not pass struct as argument,</p>
<pre><code>//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.11;
interface SampleInterface {
struct Point {
... | <p>The <code>Point</code> structure doesn't exist in the scope of your contract, only in the interface that you've declared. To fix this issue, you need to use <code>SampleInterface.Point</code> instead of <code>Point</code>.</p>
<pre><code>function setPoint(SampleInterface.Point memory point) external {
SampleInte... | How to pass struct as argument from one contract to another contract | ethereum|solidity | -1 | 778 | 1 | 71,980,056 | 71,980,056 | 0 | true | 2022-04-23T12:35:57.213Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to pass struct as argument from one contract to another contract<p>I can pass array, uint, bool mappings from one contract to another contract. but I can... |
71,988,645 | Wierd Math with arduino uno<p>I'm trying to make an alarm with my arduino, which always activates at 0:00 and deactivates at 23:59 so the variables reset and its easier to make. Right now I want to make, that the buzzer starts after 1 minute. But the maths don't really work or I'm missing something.</p>
<p><strong>Code... | <p>The <code>int</code> type on an Arduino Uno is a 16-bit integer, i.e. it's range its range is from -32,768 to 327,67. Thus, 60,000 is already outside the range resulting in seemingly strange math.</p>
<p>Instead of <code>int</code>, use <code>long</code>. Its range is from -2,147,483,648 to 2,147,483,647.</p> | Wierd Math with arduino uno | arduino|arduino-uno | -1 | 24 | 1 | 71,988,719 | 71,988,719 | 0 | true | 2022-04-24T12:59:21.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wierd Math with arduino uno<p>I'm trying to make an alarm with my arduino, which always activates at 0:00 and deactivates at 23:59 so the variables reset and... |
71,987,025 | Swap inputs on button press<p>New to JS, need to swap the 2 non-whitespace input values (text) with each other via button. This is what I've tried:</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 prettypr... | <p>Here would be my solution:</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>function switcher() {
const input1 = document.getElementById('input1');
const input2 = documen... | Swap inputs on button press | javascript|html | -1 | 33 | 1 | 71,988,884 | 71,988,884 | 0 | true | 2022-04-24T09:17:39.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swap inputs on button press<p>New to JS, need to swap the 2 non-whitespace input values (text) with each other via button. This is what I've tried:</p>
<p><d... |
71,991,488 | Get a list of companies with multiple share classes<p>I am a beginner in R, and I have a table that consists of two columns. The first column is the company name. The second one is the share class. Most of the time, companies have one class of shares. But I want get a list of companies with multiple share classes (say,... | <p>You could do:</p>
<pre><code>names(which(rowSums(table(df))>1))
[1] "3" "6" # Companies 3 and 6 have more than 1 share class
</code></pre>
<p>or even</p>
<pre><code>subset(aggregate(.~company, unique(df), length), `share class`>1)
company share class
3 3 2
5 6 ... | Get a list of companies with multiple share classes | r|list|sorting | -1 | 25 | 1 | 71,991,655 | 71,991,655 | 0 | true | 2022-04-24T19:01:53.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get a list of companies with multiple share classes<p>I am a beginner in R, and I have a table that consists of two columns. The first column is the company ... |
71,992,533 | How can I enter information in a search bar using the requests module?<p>I am trying to scrape data from this website: <a href="https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi</a></p>
<p>I have a list of scientific species name... | <p>using this url: <a href="https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?name=" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?name=</a></p>
<p>You can search things without putting things in the search bar</p>
<p>Example:</p>
<pre class="lang-py prettyprint-override"><co... | How can I enter information in a search bar using the requests module? | python|python-requests | -1 | 22 | 1 | 71,992,595 | 71,992,595 | 0 | true | 2022-04-24T21:36:44.383Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I enter information in a search bar using the requests module?<p>I am trying to scrape data from this website: <a href="https://www.ncbi.nlm.nih.gov/... |
71,993,203 | Mongoose result always empty when tring to filter<p>I'am trying to fetch by the field <strong>doctorId</strong> which is of type objectId, however it always returns an empty array. I tested it without the filter and it works fine so I don't think it's an error envolving the model or connection:
Mocha test:</p>
<pre cla... | <p>Based on the image you showed, <code>doctorId</code> is <strong>not</strong> an <code>ObjectId</code>. It's a <code>string</code>. See the difference between it and <code>_id</code> (that's an <code>ObjectId</code>).</p>
<p>It apparently has the same format as an <code>ObjectId</code>, but filtering as if it were on... | Mongoose result always empty when tring to filter | node.js|mongodb|mongoose|mocha.js | -1 | 30 | 1 | 71,993,469 | 71,993,469 | 0 | true | 2022-04-24T23:40:02.967Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mongoose result always empty when tring to filter<p>I'am trying to fetch by the field <strong>doctorId</strong> which is of type objectId, however it always ... |
71,999,598 | github desktop doesnt recognize changed files and gives error when trying to upload<p>I am learning typescript, and I am putting my different projects in folders, so I don't need to create more repos or have it all in the same place.</p>
<p>But for some reason it gives me this error when trying to upload my newest work... | <p>I managed to fix it.
Here's what I did:</p>
<ul>
<li>deleted my whole project (there goes all my progress)</li>
<li>I created a text.txt file just to fill some space</li>
<li>GitHub desktop had no problems recognizing this file for some reason</li>
<li>uploaded it</li>
<li>removed the text file and created my projec... | github desktop doesnt recognize changed files and gives error when trying to upload | github-desktop | -1 | 26 | 1 | 71,999,897 | 71,999,897 | 0 | true | 2022-04-25T12:33:14.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
github desktop doesnt recognize changed files and gives error when trying to upload<p>I am learning typescript, and I am putting my different projects in fol... |
72,001,697 | how to convert a string with floats numbers to another data type?<p>the string will be the price of some product, so it will basically come like this '1,433.10', the problem is that I need to compare it with the value that the user enters in an input that is only possible to enter integers because of the isdigit() meth... | <p>Before converting, replace the commas in the string with <code>''</code> as:</p>
<pre><code>price = results['price'][2:].replace(',', '')
print(int(float(price)))
</code></pre> | how to convert a string with floats numbers to another data type? | python|type-conversion | -1 | 20 | 1 | 72,001,802 | 72,001,802 | 0 | true | 2022-04-25T15:05:26.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to convert a string with floats numbers to another data type?<p>the string will be the price of some product, so it will basically come like this '1,433.... |
72,008,290 | How to increase version number of a xml file after each change in the file using ETree<p>I'm trying to manipulate a xml file. I use a loop and for each iteration I want the version number of the xml file to be increased. For manipulating the xml file I using ETree. Here is what I have tried so far:</p>
<pre><code>def m... | <p>It looks like you wanted to use f-strings and forgot the "f" in 2 lines.<br />
Changing <code>fileDirect="/Users/tt/sumoTracefcdfile_{version}.xml"</code> to <code>fileDirect = f"/Users/tt/sumoTracefcdfile_{version}.xml"</code> and <code>save_path_file = "/Users/tt/sumoTracefcdfile... | How to increase version number of a xml file after each change in the file using ETree | python|xml | -1 | 22 | 1 | 72,009,541 | 72,009,541 | 0 | true | 2022-04-26T04:12:03.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to increase version number of a xml file after each change in the file using ETree<p>I'm trying to manipulate a xml file. I use a loop and for each itera... |
71,881,535 | The custom view added in the WKWebview is not listed during UITesting<p>I have a UITableview with the below view hierarchy.</p>
<pre><code>UIViewController
|--UITableView
|--WKWebview
|--ScrollView
|--UIView
</code></pre>
<p>The <code>UIView</code> is added once the Webview load is completed a... | <p>The issue is fixed by adding the custom view to the accessibility elements list.</p>
<pre><code>[self.view setAccessibilityElements:@[customView]];
</code></pre> | The custom view added in the WKWebview is not listed during UITesting | ios|objective-c|uitableview|wkwebview|xcuitest | -1 | 34 | 1 | 72,009,630 | 72,009,630 | 0 | true | 2022-04-15T08:03:42.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The custom view added in the WKWebview is not listed during UITesting<p>I have a UITableview with the below view hierarchy.</p>
<pre><code>UIViewController
... |
72,015,959 | Correct way to instantiate a class member of template class with paramter<p>I have a template class with an instantiation parameter.
I have another class that has a member parameter of that class.</p>
<p>The follow does not compile because it says instantiation method is deleted...</p>
<pre><code>class MyClass {
public... | <p>No, you do not need to do anything extra here. The destructor of <code>MyClass</code> invokes the destructor of all members, regardless of how they were originally constructed.</p>
<p>(This is true even if the member is a pointer. But the destructor of a pointer does nothing, which is why you'd need a <code>delete</... | Correct way to instantiate a class member of template class with paramter | c++|class|templates|instantiation | -1 | 32 | 1 | 72,016,033 | 72,016,033 | 0 | true | 2022-04-26T14:41:52.930Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Correct way to instantiate a class member of template class with paramter<p>I have a template class with an instantiation parameter.
I have another class tha... |
72,020,133 | What is this ffmpeg call doing?<pre><code>args = {"vf": "thumbnail=100,setpts=N/TB", "r": "1", "vframes": str(max_num_frames)}
stream = ffmpeg.input(input_path)
stream = stream.output(output_format, **args).overwrite_output()
</code></pre>
<p>I know this code is trying ... | <blockquote>
<p>Looks like it says get one frame output for every 100 frames, but how exactly?</p>
</blockquote>
<p><a href="https://ffmpeg.org/ffmpeg-filters.html#thumbnail" rel="nofollow noreferrer">The <code>thumbnail</code> filter</a> is responsible for the operation.</p>
<blockquote>
<p>In particular, what is the ... | What is this ffmpeg call doing? | ffmpeg | -1 | 21 | 1 | 72,020,672 | 72,020,672 | 0 | true | 2022-04-26T20:26:24.720Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is this ffmpeg call doing?<pre><code>args = {"vf": "thumbnail=100,setpts=N/TB", "r": "1", "vframes": s... |
72,023,211 | Separating HTML tags from a javascript string into individual strings<p>I have Javascript string which is</p>
<pre><code> "<div>" +
"<h2>What color does the blackcurrant berry actually have?</h2>" +
"<img src="img_girl.jpg" alt="Girl in a jacket" width... | <p>I would render the JS string into HTML, then access it's <code>children</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>document.getElementsByTagName("body")[0].inne... | Separating HTML tags from a javascript string into individual strings | javascript|html | -1 | 20 | 1 | 72,023,311 | 72,023,311 | 0 | true | 2022-04-27T04:17:58.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Separating HTML tags from a javascript string into individual strings<p>I have Javascript string which is</p>
<pre><code> "<div>" +
"&l... |
72,023,727 | Extract part of url with dynamic form<p>I need to extract part of strings that represent urls.Its from an api response and I need to get specific part(its called ASIN)</p>
<p>Examples</p>
<ul>
<li><p><a href="https://rads.stackoverflow.com/amzn/click/com/B091JJZPCM" rel="nofollow noreferrer" rel="nofollow noreferrer">h... | <p>Solved it by</p>
<pre><code> url = "https://amazon.com/**********************"
asin = url.split("/")[-2]
if "html" in asin:
print(f"url {asin}")
parsed_url = urlparse(url)
captured_value = parse_qs(parsed_url.query)[&q... | Extract part of url with dynamic form | python-3.x | -1 | 18 | 1 | 72,029,138 | 72,029,138 | 0 | true | 2022-04-27T05:36:26.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Extract part of url with dynamic form<p>I need to extract part of strings that represent urls.Its from an api response and I need to get specific part(its ca... |
72,031,181 | Javascript loops opdracht<p>Wie kan mij helpen bij de volgende vraag Ik geraak er maar niet uit… Javascript-loops.</p>
<p>Schrijf een script waarbij je één getal ingeeft via een prompt bij het inladen van de pagina. In de console toon je het eerstvolgende cijfer dat een priemgetal is. Voorbeeld: als ik ingeef '20' dan ... | <pre class="lang-js prettyprint-override"><code>// Function that returns true if n is prime else returns false
function isPrime(n) {
// Corner cases
if (n <= 1) return false;
if (n <= 3) return true;
// This is checked so that we can skip middle five numbers in below loop
if (n%2 == 0... | Javascript loops opdracht | javascript|loops | -1 | 25 | 2 | 72,031,667 | 72,031,667 | 0 | true | 2022-04-27T15:12:23.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript loops opdracht<p>Wie kan mij helpen bij de volgende vraag Ik geraak er maar niet uit… Javascript-loops.</p>
<p>Schrijf een script waarbij je één g... |
72,031,352 | Pandas + Seaborn : compute number of 0 regarding categorical datas<p>I'm currently struggling with my dataframe in Pandas (new to this).
I have a 3 columns dataframe : Categorical_data1, Categorical_data2,Output. (2400 rows x 3 columns).</p>
<p>Both categorical data (inputs) are strings and output is depending of input... | <p>Use a seaborn countplot. It gives counts of categorical data occurrences in a certain feature. Use hue to add in the second feature to the visualization:</p>
<pre class="lang-py prettyprint-override"><code>import seaborn as sns
sns.countplot(data=dataframe, x='Categorical_Data1', hue='Categorical_Data2')
</code></pr... | Pandas + Seaborn : compute number of 0 regarding categorical datas | python|pandas|dataframe|seaborn | -1 | 35 | 1 | 72,031,720 | 72,031,720 | 0 | true | 2022-04-27T15:22:19.123Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas + Seaborn : compute number of 0 regarding categorical datas<p>I'm currently struggling with my dataframe in Pandas (new to this).
I have a 3 columns d... |
71,949,046 | how to find the par from the dict<p>how to get only the par details from below nested dict.
Requirement is to get only the par values from the below input.
expected output to have only the parent values</p>
<pre><code> a = {
'a0': {
'sub_int': {
1: {
'name': 'xe-0/0/0:1',
'par': 'xe-0/0/0',
},
2: {
'name': 'xe-1/0/0:2... | <p>Try this:</p>
<pre><code>for my_dict in a:
for my_dict_inner in a[my_dict]['sub_int']:
print(a[my_dict]['sub_int'][my_dict_inner]['par'])
</code></pre> | how to find the par from the dict | python-3.x | -1 | 17 | 1 | 71,949,073 | 71,949,073 | 0 | true | 2022-04-21T04:42:12.520Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to find the par from the dict<p>how to get only the par details from below nested dict.
Requirement is to get only the par values from the below input.
... |
71,918,318 | I have a list containes tow maps, i would to print the key and the value of map one with dart<pre class="lang-dart prettyprint-override"><code>void main() {
List users = [
{"id": 1, "name": "mike", "code": "01"},
{"id": 2, "name": "jac... | <p><strong>Loop</strong> the <code>list</code> to get access to every child <code>Map</code>. Then you can print any thing you want.</p>
<pre class="lang-dart prettyprint-override"><code>void main() {
var original = [
{"id": 1, "name": "mike", "code": "01"},
{... | I have a list containes tow maps, i would to print the key and the value of map one with dart | dart | -1 | 25 | 1 | 71,918,943 | 71,918,943 | 0 | true | 2022-04-19T00:16:21.430Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I have a list containes tow maps, i would to print the key and the value of map one with dart<pre class="lang-dart prettyprint-override"><code>void main() {
... |
71,818,237 | Delay handler inside a loop in android<p>I am trying to insert the handler to the loop but it makes it happen only once.</p>
<pre><code>for(int i = 0;i<4;i++) {
btn1.setBackgroundColor(Color.RED);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
btn1.setBac... | <p>If you want the button to change between red and green with a delay of 2 seconds you can try something like this:</p>
<pre><code>for(int i = 0;i<4;i++) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
btn1.se... | Delay handler inside a loop in android | android|loops | -1 | 36 | 1 | 71,818,360 | 71,818,360 | 0 | true | 2022-04-10T15:55:02.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Delay handler inside a loop in android<p>I am trying to insert the handler to the loop but it makes it happen only once.</p>
<pre><code>for(int i = 0;i<4;... |
71,958,044 | I have a text file which contains sets , how do i read them as sets when i load on python?<p>My text file looks like this</p>
<p>{} /n {}/n</p>
<p>When I use readline, I get it as a list , like ['{}' , '{}]</p>
<p>how do I remove the string and read them as sets?</p> | <p>This code work for you.</p>
<pre class="lang-py prettyprint-override"><code>with open('yourfile.txt','r') as file:
data = file.read().splitlines()
data = [set(a[1:-1].split(',')) for a in data]
print(data)
</code></pre>
<p>You can use <code>eval</code> also here, But using <code>eval</code> might be <a href=... | I have a text file which contains sets , how do i read them as sets when i load on python? | python|list|set | -1 | 33 | 1 | 71,958,063 | 71,958,063 | 0 | true | 2022-04-21T16:44:38.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I have a text file which contains sets , how do i read them as sets when i load on python?<p>My text file looks like this</p>
<p>{} /n {}/n</p>
<p>When I use... |
71,982,248 | Changing Iframe size by click event listener not working<p>I'm trying to change the iframe size by clicking the button by using the click event listener. But the iframe auto runs the function and I haven't even clicked the button...</p>
<p>Someone said this is a duplicate of <a href="https://stackoverflow.com/questions... | <p>change your event listener function like so</p>
<pre><code>btn.addEventListener('click', () => change(150));
</code></pre>
<p>OR</p>
<pre><code>btn.addEventListener('click', function() { change(150) });
</code></pre>
<p><code>addEventListener</code> expects a function definition and not a function call as second ... | Changing Iframe size by click event listener not working | javascript | -1 | 27 | 1 | 71,982,271 | 71,982,271 | 0 | true | 2022-04-23T17:49:48.973Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Changing Iframe size by click event listener not working<p>I'm trying to change the iframe size by clicking the button by using the click event listener. But... |
71,811,153 | How do I analyze data from two different sources with a little different structers?<p>So for example say there's a website that shows all the events available around my area in the next 2 weeks. But there's also another website that provides the same data labeled a little differently. Say the data from both websites wa... | <p>Try using <strong>Levenshtein distance</strong> to calculate the distance between 2 strings. If the distance is small, you can consider them to be the same, and different if the distance is too large. You may have to try different values before finalizing what the threshold should be to decide if the distance is too... | How do I analyze data from two different sources with a little different structers? | python|string|web-scraping|data-science|string-comparison | -1 | 25 | 1 | 71,813,420 | 71,813,420 | 0 | true | 2022-04-09T19:15:57.520Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I analyze data from two different sources with a little different structers?<p>So for example say there's a website that shows all the events availabl... |
72,029,002 | What is required to show VSS Code Remote explorer<p>I'm trying to set up a local glue environment using VSS Code as source code controller.</p>
<p>I followed the instructions given in the the link</p>
<p><a href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-libraries.html#local-dev-restrictions" ... | <p>It should be there on the left side if you installed the Remote Development extension pack</p>
<p><a href="https://i.stack.imgur.com/JdSZN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JdSZN.png" alt="enter image description here" /></a></p> | What is required to show VSS Code Remote explorer | aws-glue | -1 | 17 | 1 | 72,030,821 | 72,030,821 | 0 | true | 2022-04-27T12:44:00.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is required to show VSS Code Remote explorer<p>I'm trying to set up a local glue environment using VSS Code as source code controller.</p>
<p>I followed... |
71,889,634 | triple join issues in producing desired outputs<p>I am a student working on an SQL query to produce unreturned books based on the return date column value being NULL, however the output requires me to join 3 tables. The result obtained in incorrect, and I have tried many combinations of GROUP BY and additional WHERE co... | <p>Good effort, your query was CLOSE. You did not have any condition on how the loan was associated with a book.</p>
<p>Also, you were writing in old ANSI-SQL instead of using proper JOIN syntax. Think of the FROM clause as the section on defining all tables (and their aliases) that WILL be used in the query AND how ... | triple join issues in producing desired outputs | mysql|join | -1 | 31 | 1 | 71,890,203 | 71,890,203 | 0 | true | 2022-04-15T22:50:59.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
triple join issues in producing desired outputs<p>I am a student working on an SQL query to produce unreturned books based on the return date column value be... |
71,989,810 | Is it possible to make a custom project view in IntelliJ IDEA?<p>Can I have a custom project view in <code>IntelliJ IDEA</code>? For example in <code>Android Studio</code> we get this:</p>
<img src="https://i.stack.imgur.com/Tn8Mx.png" width="500"/>
<p>Now, I want a custom one like that to show only java files and one ... | <p>You can use custom scopes for that: <a href="https://www.jetbrains.com/help/idea/configuring-scopes-and-file-colors.html" rel="nofollow noreferrer">Configuring Scopes and File Colors</a></p> | Is it possible to make a custom project view in IntelliJ IDEA? | android-studio|intellij-idea|project-explorer | -1 | 25 | 1 | 71,993,589 | 71,993,589 | 0 | true | 2022-04-24T15:23:31.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to make a custom project view in IntelliJ IDEA?<p>Can I have a custom project view in <code>IntelliJ IDEA</code>? For example in <code>Android... |
71,849,835 | Insert array / nested table into table<p>I really apologise if answer already was given, but I could only find answers for php.</p>
<p>My problem is that I got nested table array "test_nested_table" that got values ('a','b','c'). I also got table "test_table" in the DB that got three columns col1, c... | <p>I have come up with the following solution:</p>
<pre><code>declare
type test_array is varray(3) of varchar2(10);
ta test_array := test_array ('a','b','c');
sql_txt varchar2(1000) := 'insert into test_table_1 values (''';
begin
for n in 1 .. ta.count loop
sql_txt := sql_txt || ta(n)||''',''';
... | Insert array / nested table into table | plsql|sql-insert|nested-table | -1 | 35 | 1 | 71,897,384 | 71,897,384 | 0 | true | 2022-04-12T22:35:04.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Insert array / nested table into table<p>I really apologise if answer already was given, but I could only find answers for php.</p>
<p>My problem is that I g... |
71,355,173 | NodeJS : Share a log module instance inside my app<p>I create for my project a log module and i am actually creating a new instance in all module to allow them to log in cli with the right syntax,color conf etc.</p>
<p>For example (a simplified example)</p>
<pre class="lang-js prettyprint-override"><code>// index.js
c... | <p>Like @jjsingh says i use global variable to store the object.</p>
<p>Not sure it's the better way but for the moment it resolve my issue.</p>
<pre><code> global.log = new Log({
levelIcon:true,
powerlineRoot:{
name:"root",
color:{
... | NodeJS : Share a log module instance inside my app | javascript|node.js | -1 | 35 | 2 | 71,646,928 | 71,646,928 | 0 | true | 2022-03-04T17:33:38.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NodeJS : Share a log module instance inside my app<p>I create for my project a log module and i am actually creating a new instance in all module to allow th... |
71,428,492 | Easy sort list 2D by column<p>I'm quiet new in Java data manipulation so I need some help if someone have a some good tips. Actually, I want just to find a easy way to sort a 2D list.</p>
<p>I create a list like this:</p>
<pre><code>List<int[]> A = new ArrayList<int[]>();
A.add(new int[] {0,1});
A.add(new i... | <p>Try this:</p>
<pre><code>List<Integer[]> A = new ArrayList<>();
A.add(new Integer[] {0,1});
A.add(new Integer[] {5,40});
A.add(new Integer[] {7,5});
A.sort(Comparator.comparingInt(a -> a[1]));
for (Integer[] a : A) {
System.out.println(Arrays.toString(a));
}
</code></pre> | Easy sort list 2D by column | java|list|sorting|arraylist | -1 | 44 | 3 | 71,428,639 | 71,428,639 | 1 | true | 2022-03-10T17:38:42.527Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Easy sort list 2D by column<p>I'm quiet new in Java data manipulation so I need some help if someone have a some good tips. Actually, I want just to find a e... |
71,428,155 | how do i increment a value of column with condition?<p>my table looks something like this</p>
<pre><code>id effect1(int) effect2(int) effect3(int)
1 0 1 5
2 1 0 0
</code></pre>
<p>i have a function, which return 1to3 int value representing effect1,effect2,effect3... | <p>In your implementation, you did not check if the <code>id</code> already exists or not.</p>
<p>I updated your code with an SQL statement that performs insertion/update as you mentioned-</p>
<ul>
<li>in case the <code>id</code> exists then only the specific effect needs to be increased</li>
<li>if <code>id</code> doe... | how do i increment a value of column with condition? | python|mysql|sql|database|on-duplicate-key | -1 | 264 | 2 | 71,429,257 | 71,429,257 | 1 | true | 2022-03-10T17:11:57.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how do i increment a value of column with condition?<p>my table looks something like this</p>
<pre><code>id effect1(int) effect2(int) effect3(int)
1 0 ... |
71,431,790 | Why I am getting negative result for negativeValue.abs()?<p>I have an extension like;</p>
<pre><code>extension x on num{}
</code></pre>
<p>and this extension contains below function;</p>
<pre><code>double get wP {
assert(this >= 0.0, "value.wP: value can't be lower than 0.0!");
assert(this <= 1.0, "... | <p><code>-1.0.wP</code> is in fact the same as <code>-(1.0.wP)</code></p>
<p>Instead, try with <code>(-1.0).wP</code></p> | Why I am getting negative result for negativeValue.abs()? | flutter|dart | -1 | 26 | 1 | 71,431,853 | 71,431,853 | 1 | true | 2022-03-10T23:03:54.717Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why I am getting negative result for negativeValue.abs()?<p>I have an extension like;</p>
<pre><code>extension x on num{}
</code></pre>
<p>and this extension... |
71,435,798 | Is there a way to compare multiple rows in MySQL<p>I have three tables, <code>room</code> table, <code>item</code> table and <code>user</code> table.</p>
<p>item table has column <code>room_id</code> and <code>user_id</code></p>
<p>table data example is like this:</p>
<div class="s-table-container">
<table class="s-tab... | <p>We can try the following aggregation approach. For users <code>1111</code> and <code>2222</code>:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT room_id
FROM yourTable
GROUP BY room_id
HAVING COUNT(DISTINCT user_id) = 2 AND
SUM(user_id NOT IN ('1111', '2222')) = 0;
</code></pre>
<p>The count res... | Is there a way to compare multiple rows in MySQL | mysql|sql | -1 | 24 | 2 | 71,435,881 | 71,435,881 | 1 | true | 2022-03-11T08:42:03.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to compare multiple rows in MySQL<p>I have three tables, <code>room</code> table, <code>item</code> table and <code>user</code> table.</p>
<p>... |
71,434,213 | Localize UITabBarItem in RxSwift<p>How can I localize UITabBarItem and add set images for selected and unselected case in RxSwift ?</p> | <p>You don't use Rx for something like this. Just use <code>NSLocalizedString(_:comment:)</code></p> | Localize UITabBarItem in RxSwift | rx-swift|uitabbaritem | -1 | 40 | 1 | 71,438,024 | 71,438,024 | 1 | true | 2022-03-11T05:59:58.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Localize UITabBarItem in RxSwift<p>How can I localize UITabBarItem and add set images for selected and unselected case in RxSwift ?</p> |
71,440,040 | If I expand the EBS root storage of an windows instance, do I have to pay more?<p>I want to get extra storage in my instance by expanding the EBS root volume. Will this cost me extra? and by how much?</p> | <p>You will pay for the additional storage allocated. For example, if you expand a gp3 volume from 100GB to 150GB it represents an additional monthly cost of:</p>
<p>$0.08/GB-month * 50GB = $4</p>
<p>according to <a href="https://aws.amazon.com/ebs/pricing/" rel="nofollow noreferrer">current pricing</a>.</p>
<p>It coul... | If I expand the EBS root storage of an windows instance, do I have to pay more? | amazon-web-services|amazon-ec2 | -1 | 22 | 1 | 71,440,199 | 71,440,199 | 1 | true | 2022-03-11T14:29:10.697Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
If I expand the EBS root storage of an windows instance, do I have to pay more?<p>I want to get extra storage in my instance by expanding the EBS root volume... |
71,802,625 | How do I findOndAndUpdate an item of an array?<p>This is the update statement:</p>
<pre><code>const cart = await Cart.findOneAndUpdate({
userId: userId,
'items._id': itemId,
'items.product': productId,
'items.size': size,
'items.color': color,
}, {
$set: {
... | <p>You can use <a href="https://www.mongodb.com/docs/manual/reference/operator/update/positional-filtered/" rel="nofollow noreferrer">array filters</a> to get the desired output:</p>
<p>The <code>userId</code> into find query will filter across all documents, and the array filter will find the object in the array which... | How do I findOndAndUpdate an item of an array? | mongodb | -1 | 25 | 2 | 71,803,037 | 71,803,037 | 1 | true | 2022-04-08T20:03:24.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I findOndAndUpdate an item of an array?<p>This is the update statement:</p>
<pre><code>const cart = await Cart.findOneAndUpdate({
userId: user... |
71,807,133 | making an element in center of div ,Vertically and Horizentally<p>I have this code</p>
<pre><code><div class="row">
<div class="col-12 margin-to-top">
<div class="form-account-label-upload ">
<div>
<a id="btnFileUpload" cl... | <p>First, you have to make the div that surrounding <code>#btnFileUpload</code> to 100% height, then use display: flex to make it center-aligned like</p>
<pre><code> <div class="row">
<div class="col-12 margin-to-top">
<div class="form-account-label-upload ">
... | making an element in center of div ,Vertically and Horizentally | html|css|bootstrap-4 | -1 | 34 | 1 | 71,807,206 | 71,807,206 | 1 | true | 2022-04-09T10:16:20.780Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
making an element in center of div ,Vertically and Horizentally<p>I have this code</p>
<pre><code><div class="row">
<div class="co... |
71,811,695 | Is there a way to know alle the positions of a certain part of a string?<p>I'm looking for a way to know all the positions of a certain part of a string, so for example, if I have a <code>let variable = "test"</code> and I want to know the location of all the "t"s.</p>
<p>I tried using indexOf(), bu... | <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>let x = "test"
let y = []
for (let i = 0; i < x.length; i++){
if (x[i] == "t") y.push(i)
}
console.log(y)</code></pre>
</div>
... | Is there a way to know alle the positions of a certain part of a string? | javascript | -1 | 34 | 2 | 71,811,723 | 71,811,723 | 1 | true | 2022-04-09T20:34:27.733Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to know alle the positions of a certain part of a string?<p>I'm looking for a way to know all the positions of a certain part of a string, so ... |
71,818,969 | list of working methods to scrape 4y+ historical Twitter tweets from users in 2022<p>It seems Twitter made lots of changes to API and Webapp so many methods that used to work in the past do not work anymore.</p>
<p>Which method does work as of today (April 2022) to scrape historical tweets from <strong>specific users</... | <p>There is a python based library named <a href="https://github.com/twintproject/twint" rel="nofollow noreferrer">twint</a>. It's an un-official sdk for twitter public API. you won't require twitter developer account or any access token.</p>
<p><code>Twint</code> can help you in getting previous tweets and with some a... | list of working methods to scrape 4y+ historical Twitter tweets from users in 2022 | selenium|web-scraping|twitter|twitterapi-python | -1 | 275 | 1 | 71,819,415 | 71,819,415 | 1 | true | 2022-04-10T17:24:21.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
list of working methods to scrape 4y+ historical Twitter tweets from users in 2022<p>It seems Twitter made lots of changes to API and Webapp so many methods ... |
71,831,442 | DIV that blows up between footer and other DIV?<p>So the footer is always at the bottom of the page, not at the window frame as no stick footer. Then there is content in the body and between the content and the footer there should be a div so wide/high that the footer at least touches the window frame.</p> | <p>You could use a grid system.
Your footer would be in height "auto" and your content would be 1fr</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.wrapper{
disp... | DIV that blows up between footer and other DIV? | javascript|html|css | -1 | 29 | 1 | 71,831,579 | 71,831,579 | 1 | true | 2022-04-11T16:43:40.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
DIV that blows up between footer and other DIV?<p>So the footer is always at the bottom of the page, not at the window frame as no stick footer. Then there i... |
71,836,954 | Numpy slicing with index<pre><code>x = np.array([
[0, 1],
[2, 3],
[4, 5],
[6, 7],
[8, 9]
])
end_point = [3, 4] # Slicing end point
# Want: Slicing along the row, like this
x[end_point-2 : end_point]
= np.array([[2, 5], [4, 7], [6, 9]])
</code></pre>
<p>Can I do this thing in an elegant way? Of course, the above... | <p>Here's how I went about figuring out a solution:</p>
<pre><code>In [21]: x = np.arange(10).reshape(5,2)
In [22]: x
Out[22]:
array([[0, 1],
[2, 3],
[4, 5],
[6, 7],
[8, 9]])
</code></pre>
<p>Looks like you want several 'diagonals', which we can get with pairs of indexing lists/arrays:</p>
... | Numpy slicing with index | numpy | -1 | 35 | 2 | 71,837,068 | 71,837,068 | 1 | true | 2022-04-12T04:02:32.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Numpy slicing with index<pre><code>x = np.array([
[0, 1],
[2, 3],
[4, 5],
[6, 7],
[8, 9]
])
end_point = [3, 4] # Slicing end point
# Want: Slicing alon... |
71,849,353 | How insert some data into MySQL table?<p>I am trying to write data to a table (tbl_1) as follows:</p>
<pre><code>curr.execute("""INSERT INTO tbl_1 VALUES (%s,%s,%s,%s,%s)""",
(
item['some_val_1'],
item['some_val_2'],
item['some_val_3'],
item['some_val_4'],
item['some_val_5'],
)
... | <p>It is, as has been noted above, in the documentation - but to sift through that, in case you're not great with walls of text...
If you don't specify the fields for the inserts, it will default to thinking you're referring to them in their natural order.</p>
<p>So, instead of
<code>INSERT INTO tbl_1 VALUES (%s,%s,%s,... | How insert some data into MySQL table? | mysql | -1 | 23 | 1 | 71,849,402 | 71,849,402 | 1 | true | 2022-04-12T21:30:53.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How insert some data into MySQL table?<p>I am trying to write data to a table (tbl_1) as follows:</p>
<pre><code>curr.execute("""INSERT INTO t... |
71,865,974 | Is is possible to one-hot based on a list of values being an element in a column?<p>Here's the dataframe that I'm working with:</p>
<pre><code>| Name | Vehicle Types Owned |
| -------- | -------------- |
| Bob | [Car, Bike] |
| Billy | [Car, Truck, Train] |
| Rob | [Plane, Train, Boat]... | <p>Try <code>explode</code> then <code>crosstab</code></p>
<pre class="lang-py prettyprint-override"><code>df = df.explode('Vehicle Types Owned')
df_ = pd.crosstab([df['Name']], df['Vehicle Types Owned']).reset_index().rename_axis(None, axis=1)
</code></pre>
<pre><code>print(df_)
Name Bike Boat Car Plane Trai... | Is is possible to one-hot based on a list of values being an element in a column? | python|pandas|dataframe|one-hot-encoding | -1 | 24 | 2 | 71,866,049 | 71,866,049 | 1 | true | 2022-04-14T02:54:06.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is is possible to one-hot based on a list of values being an element in a column?<p>Here's the dataframe that I'm working with:</p>
<pre><code>| Name | V... |
71,873,234 | How to create nested array Json using PHP?<p>i have a little problem, i want to make my attribut nested, so it looks like this. can someone help me?</p>
<p><a href="https://i.stack.imgur.com/b7Jl5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b7Jl5.png" alt="enter image description here" /></a></p>... | <p>You just need to declare an array within the outer array, and then another (associative) array within that as the first index of it:</p>
<pre><code> array_push($result, array(
'id' => $row['id'],
'kategori' => $row['kategori'],
'nama' => $row['nama'],
'deskripsi' => $ro... | How to create nested array Json using PHP? | php|arrays | -1 | 26 | 1 | 71,873,291 | 71,873,291 | 1 | true | 2022-04-14T14:26:10.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create nested array Json using PHP?<p>i have a little problem, i want to make my attribut nested, so it looks like this. can someone help me?</p>
<p><... |
71,881,760 | Is there a way to change the position of the ball to the centre when scored?<pre><code> if fireBall.rect.x>=690:
score_1+=1
fireBall.ballspeed[0] = -fireBall.ballspeed[0]
if fireBall.rect.x<=0:
score_2+=1
fireBall.ballspeed[0] = -fireBall.ballspeed[0]
if fireBall.rect.y>490:
... | <p>You can get the the center of the window with <code>pygame.display.get_surface().get_rect().center</code>. e.g.:</p>
<pre class="lang-py prettyprint-override"><code>if fireBall.rect.x>=690:
score_1+=1
fireBall.ballspeed[0] = -fireBall.ballspeed[0]
fireBall.rect.center = pygame.display.get_surface().ge... | Is there a way to change the position of the ball to the centre when scored? | pygame|pong | -1 | 27 | 1 | 71,881,794 | 71,881,794 | 1 | true | 2022-04-15T08:29:42.773Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to change the position of the ball to the centre when scored?<pre><code> if fireBall.rect.x>=690:
score_1+=1
fireBall.ballspee... |
71,887,188 | Stripe webhooks error "No signatures found matching the expected signature for payload"<p>Been stuck on this error for a while now and I've followed stripes documentation and express example on github, but still have no success.</p>
<p>I am using express in Firebase functions:</p>
<pre><code>export const app = express(... | <p>This is a common issue. If you're sure the secret is correct, then something is modifying the inbound request body. You need the raw body. Take a look at <a href="https://github.com/stripe/stripe-node/issues/356" rel="nofollow noreferrer">this Github issue</a> for common solutions.</p> | Stripe webhooks error "No signatures found matching the expected signature for payload" | javascript|node.js|express|stripe-payments|webhooks | -1 | 260 | 1 | 71,887,251 | 71,887,251 | 1 | true | 2022-04-15T17:38:42.553Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Stripe webhooks error "No signatures found matching the expected signature for payload"<p>Been stuck on this error for a while now and I've followed stripes ... |
71,889,285 | Join two SQL/BigQuery tables that do not contain the same columns<p>I have two queries that create two separate tables, pulling on several foreign keys.</p>
<p>Simplified and using retail food as an example, Table 1 looks like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="tex... | <p>In SQL this is called a UNION. You can union two sets if they have the same columns, such as:</p>
<pre><code>select trans_id, city, store, item, description from table1
union
select trans_id, city, 'No Store' as store, item, description from table2
</code></pre> | Join two SQL/BigQuery tables that do not contain the same columns | sql|google-bigquery | -1 | 24 | 1 | 71,889,416 | 71,889,416 | 1 | true | 2022-04-15T21:53:49.683Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Join two SQL/BigQuery tables that do not contain the same columns<p>I have two queries that create two separate tables, pulling on several foreign keys.</p>
... |
71,892,245 | Dictionary values keep changing while recursing despite not adding anything to the dictionary<p>Here is my code for the coin change problem:</p>
<pre class="lang-pt prettyprint-override"><code>class Solution:
def coinChange(self, coins: List[int], amount: int, sequence = []) -> int:
def coinChan... | <p>I'm having a hard time understanding what your code is supposed to do, but I think I can at least explain how all these values are getting into memo[0].</p>
<p>The issue with things like this is because lists are mutable, so inputing a list into a function will not create a new instance of the list.</p>
<p>Basically... | Dictionary values keep changing while recursing despite not adding anything to the dictionary | python | -1 | 33 | 1 | 71,892,513 | 71,892,513 | 1 | true | 2022-04-16T08:16:17.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dictionary values keep changing while recursing despite not adding anything to the dictionary<p>Here is my code for the coin change problem:</p>
<pre class="... |
71,894,523 | Adding macro button to trigger a specific Macro<p>Whenever I add a custom Macro button to the Quick Access Toolbar , it is a generic Macro window invocation button. What I want is that if I click on the button, a specific Macro should directly start running. As of now there are 2-3 steps before I do that. First of all ... | <p>If you don't want to configure QAT buttons manually you may consider developing a COM based add-in instead. See <a href="https://docs.microsoft.com/en-us/visualstudio/vsto/walkthrough-creating-your-first-vsto-add-in-for-outlook?view=vs-2022" rel="nofollow noreferrer">Walkthrough: Create your first VSTO Add-in for Ou... | Adding macro button to trigger a specific Macro | ms-office|office-automation|ribbonx | -1 | 32 | 1 | 71,896,438 | 71,896,438 | 1 | true | 2022-04-16T14:02:44.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding macro button to trigger a specific Macro<p>Whenever I add a custom Macro button to the Quick Access Toolbar , it is a generic Macro window invocation ... |
71,894,837 | How to I declare Global Variable in Robot Framework and use it in another robot file<p><strong>In the response
I'm getting one access token which I'm storing in ${Token} variable and want to set it as Global variable and want to use it in SendFax.robot file</strong></p>
<pre><code>**GenerateToken.robot**
*** Variables... | <p>Instead of having the generation of the token a test - consider making it a keyword which is ran on suite setup</p>
<p>Something like this:</p>
<p>GenerateToken.resource</p>
<pre><code>*** Variables ***
${base_Url}= https://pssidpdev01.modmedclouddev.com:5001
*** Keywords ***
Generator Token with valid credent... | How to I declare Global Variable in Robot Framework and use it in another robot file | python|robotframework|web-api-testing | -1 | 269 | 1 | 71,897,487 | 71,897,487 | 1 | true | 2022-04-16T14:44:17.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to I declare Global Variable in Robot Framework and use it in another robot file<p><strong>In the response
I'm getting one access token which I'm storing... |
71,910,713 | Are these two generics syntax for Promise the same?<p>I'm new to TypeScript and learning about Generics. I've tried these syntax below and they work, so I'm thinking that they are the same.</p>
<p>Is my assumption correct?</p>
<p>using generic as in <code>new Promise<number></code></p>
<pre><code>const promise = ... | <p>In short: in practice they probably act the same way</p>
<p>Long: yes there is a difference, the first example you gave passes the type number as a type to the class Promise and then the constructor returns a new instance of the type Promise, in that case the type of the variable is implicit, it's implied trough the... | Are these two generics syntax for Promise the same? | javascript|typescript | -1 | 35 | 1 | 71,918,570 | 71,918,570 | 1 | true | 2022-04-18T10:39:15.697Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Are these two generics syntax for Promise the same?<p>I'm new to TypeScript and learning about Generics. I've tried these syntax below and they work, so I'm ... |
71,920,123 | Check whether array contains array<p>Welcome,<br />
I need to find whether array contains array<br />
I tried two ways(<code>indexOf</code> and <code>includes</code>),but both returns a negative result.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snip... | <p>Use <code>some</code> and <code>Array.isArray</code>. <code>some</code> will return true if any one condition in the callback function is <code>true</code> and use <code>Array.isArray</code> to check if the element is an array</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babe... | Check whether array contains array | javascript | -1 | 29 | 1 | 71,920,137 | 71,920,137 | 1 | true | 2022-04-19T05:35:05.913Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check whether array contains array<p>Welcome,<br />
I need to find whether array contains array<br />
I tried two ways(<code>indexOf</code> and <code>include... |
71,927,783 | Create tables in SQL with foreign key<p>I want to create those tables:</p>
<pre><code>CREATE DATABASE [HEALTH CLUB Database]
Go
USE [HEALTH CLUB Database]
GO
CREATE TABLE Member
(
MemberID Integer NOT NULL IDENTITY(0,1),
AccountID Integer NULL,
FirstName Varchar(40) NOT NULL,
LastName Varchar(40) NOT ... | <p>Yes you can create your tables then add the constraints :)</p>
<pre><code>ALTER TABLE Orders
ADD CONSTRAINT FK_PersonOrder
FOREIGN KEY (PersonID) REFERENCES Persons(PersonID);
</code></pre> | Create tables in SQL with foreign key | sql-server|foreign-keys|create-table | -1 | 280 | 1 | 71,927,914 | 71,927,914 | 1 | true | 2022-04-19T15:49:35.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create tables in SQL with foreign key<p>I want to create those tables:</p>
<pre><code>CREATE DATABASE [HEALTH CLUB Database]
Go
USE [HEALTH CLUB Database]
G... |
71,928,701 | Finding all obligations in spl-token-lending program<p>If an <code>Obligation</code> becomes unhealthy, it can be liquidated by calling <code>LiquidateObligation</code> <a href="https://github.com/solana-labs/solana-program-library/blob/master/token-lending/program/src/instruction.rs#L266=" rel="nofollow noreferrer">in... | <p>The only way to get all of the <code>Obligation</code> accounts is to use the <code>getProgramAccounts</code> RPC endpoint with a filter, which fetches every account owned by the lending program that has a certain size. Since an <code>Obligation</code> has a size of 916 according to the code: <a href="https://githu... | Finding all obligations in spl-token-lending program | blockchain|solana | -1 | 27 | 1 | 71,937,994 | 71,937,994 | 1 | true | 2022-04-19T17:05:45.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Finding all obligations in spl-token-lending program<p>If an <code>Obligation</code> becomes unhealthy, it can be liquidated by calling <code>LiquidateObliga... |
71,938,225 | When was the ETH contract called?<p>I have learned about Solidity development for several days. But for now, I have one confusing thing, and I don't know whether I am right or wrong. I searched Google, but I couldn't find anything. Maybe I search with the wrong keys. If you know that, please help me. Thank you, guys.
M... | <p>The contract is "executed" when it gets accepted into a block, and when that block is accepted. The process of submitting a transaction is as follows:</p>
<ol>
<li>The transaction is generated and signed by the wallet</li>
<li>The signed transaction is sent to an Ethereum node</li>
<li>The signed transacti... | When was the ETH contract called? | ethereum|smartcontracts | -1 | 35 | 1 | 71,939,716 | 71,939,716 | 1 | true | 2022-04-20T10:39:43.497Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When was the ETH contract called?<p>I have learned about Solidity development for several days. But for now, I have one confusing thing, and I don't know whe... |
71,937,713 | How to add disable cursor pointer in config tailwind<p>how to add setting in tailwind.config.js if screen size is less than 780px then disable all cursor-pointers?</p>
<p>note <em>I'm using nextjs and tailwind</em></p> | <p>The answer from @ahmed is almost correct. In the docs there is no <code>cursor-disabled</code></p>
<p>If you look at the docs <a href="https://tailwindcss.com/docs/cursor" rel="nofollow noreferrer">here</a> you can see that Tailwind offer a <code>cursor-none</code> property.</p>
<p>The best way to set this is like A... | How to add disable cursor pointer in config tailwind | reactjs|next.js|tailwind-css | -1 | 288 | 1 | 71,940,298 | 71,940,298 | 1 | true | 2022-04-20T10:02:41.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add disable cursor pointer in config tailwind<p>how to add setting in tailwind.config.js if screen size is less than 780px then disable all cursor-poi... |
71,951,819 | PHP - Combine Two Arrays based on a key property value of the first array - improve code<p>I have <strong>two</strong> <em>associative arrays</em> below</p>
<p>The first one has information about the stock status of that day, this is store in a different database.</p>
<p>The second array has the information of the prod... | <p>Modify your second array first, so that it uses the product ID as key - that makes the look-up of the item corresponding to the product ID from the first array much easier.</p>
<pre><code>$array_two = array_combine(array_column($array_two, 'product_id'), $array_two);
$new_array = [];
foreach($array_one as $product) ... | PHP - Combine Two Arrays based on a key property value of the first array - improve code | php|arrays|associative-array | -1 | 28 | 2 | 71,952,084 | 71,952,084 | 1 | true | 2022-04-21T09:10:00.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PHP - Combine Two Arrays based on a key property value of the first array - improve code<p>I have <strong>two</strong> <em>associative arrays</em> below</p>
... |
71,978,468 | What is the best way to implement error code either by Enum or Constant<p>I need to handle error codes for the project. Previously, the enums were implemented like the following</p>
<pre><code>enum ErrorCode{
None=0,
InvalidUserName = 1,
InvalidEmail
}
</code></pre>
<p>Later, we thought to move to some user... | <p>Assign a numerical value to your error reason enum and prefix it with <code>ERR</code>.</p>
<pre class="lang-cs prettyprint-override"><code>public enum Error
{
None = 0,
Duplicate = 1,
MissingDetails = 2,
MissingFocus = 3,
NoSampleCode = 4
}
public static string GetErrorCode(Error error)
{
r... | What is the best way to implement error code either by Enum or Constant | c#|.net|asp.net-core|asp.net-web-api|enums | -1 | 290 | 1 | 71,979,026 | 71,979,026 | 1 | true | 2022-04-23T09:30:47.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the best way to implement error code either by Enum or Constant<p>I need to handle error codes for the project. Previously, the enums were implemente... |
71,983,041 | Detailed explanation on how to know what the output will be when slicing and reversing a string in Python<pre><code>a="qwerty"
</code></pre>
<p>And I want the output to be "tre". But whenever I try doing</p>
<pre><code>print(a[2:5:-1])
print(a[-4:-1:-1])
print(a[2:-1:-1])
print(a[-4:5:-1])
</code></... | <p>This because of the way <code>stepping</code> works in python. When you type <code>my_list[start:end:step]</code> python will interpret this as follows:</p>
<p>start from <code>start</code> index to <code>end</code> index value (not including <code>end</code> index itself) and each step should be <code>step</code> v... | Detailed explanation on how to know what the output will be when slicing and reversing a string in Python | python|string|slice | -1 | 30 | 2 | 71,983,202 | 71,983,202 | 1 | true | 2022-04-23T19:35:56.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Detailed explanation on how to know what the output will be when slicing and reversing a string in Python<pre><code>a="qwerty"
</code></pre>
<p>And... |
71,984,501 | how to have all the subcategories when I click on the button all using angular<p>I have two table <code>categories</code> and <code>subcategories</code>, I want to display the <code>subcategories</code> according to <code>category</code> click, I created the function <code>filterSoucategories(category)</code> which ret... | <p>Try <code><button class="btn btn-primary" (click)="souscategories = Allsouscategories">All</button>&nbsp;</code> instead of <code><button class="btn btn-primary">All</button>&nbsp;</code></p> | how to have all the subcategories when I click on the button all using angular | angular | -1 | 27 | 1 | 71,984,598 | 71,984,598 | 1 | true | 2022-04-24T00:01:55.887Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to have all the subcategories when I click on the button all using angular<p>I have two table <code>categories</code> and <code>subcategories</code>, I w... |
71,986,240 | Which whiteSpace option to use for long links?<p>I have this page: <a href="https://tikex.com/hu/buyTicket/elektik-tourist-2022" rel="nofollow noreferrer">https://tikex.com/hu/buyTicket/elektik-tourist-2022</a></p>
<p>In mobile the last Google link is not broken, so it stretch over the page. I use <code>pre-wrap</code>... | <p>You should Try</p>
<pre><code>word-break: break-all;
</code></pre>
<p>Like this:</p>
<pre><code><p className={'p_1'} style={{ wordBreak: 'break-all', maxWidth:
'80vw' }}>
{buyTicketData?.description}
</p>
</code></pre> | Which whiteSpace option to use for long links? | css|whitespace | -1 | 11 | 1 | 71,986,260 | 71,986,260 | 1 | true | 2022-04-24T07:09:46.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Which whiteSpace option to use for long links?<p>I have this page: <a href="https://tikex.com/hu/buyTicket/elektik-tourist-2022" rel="nofollow noreferrer">ht... |
71,987,187 | How to write a bunch of numbers in a column in linux?<p>When I use this code in Linux (echo {1..100} 1.txt), it writes numbers of 1 to 100 in rows like 1, 2, 3, ... 100. Something I need is a code to write these numbers vertically like below.</p>
<pre><code>1
2
3
4
.
.
100
</code></pre> | <p>You could use <code>tr</code> to convert spaces to linebreaks:</p>
<pre class="lang-sh prettyprint-override"><code>echo {1..100} | tr ' ' '\n'
</code></pre> | How to write a bunch of numbers in a column in linux? | linux|shell | -1 | 23 | 1 | 71,987,280 | 71,987,280 | 1 | true | 2022-04-24T09:42:32.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to write a bunch of numbers in a column in linux?<p>When I use this code in Linux (echo {1..100} 1.txt), it writes numbers of 1 to 100 in rows like 1, 2,... |
71,992,116 | How can I make a commmand that goes through a txt file and sends the text that i need?<p>Im trying to make an api key thingy in discord but i don't know how to go through txt files one by one for ex</p>
<ol>
<li>test</li>
<li>test2</li>
<li>test3</li>
<li>test4</li>
</ol>
<p>If the first user sends !key it would send t... | <p>I guess this ... maybe</p>
<pre><code>with open("keys.txt") as f:
keys = iter(f.readlines())
@bot.command()
async def key(ctx):
await ctx.send(next(keys))
</code></pre> | How can I make a commmand that goes through a txt file and sends the text that i need? | python|python-3.x|discord|discord.py | -1 | 34 | 1 | 71,992,184 | 71,992,184 | 1 | true | 2022-04-24T20:32:09.503Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I make a commmand that goes through a txt file and sends the text that i need?<p>Im trying to make an api key thingy in discord but i don't know how ... |
71,993,077 | how can i use nodejs to add a security group to an EC2 instance that is already running?<p>the title says almost everything, but just to make it clear, I DON'T want to</p>
<p>(1) use the console, OR
(2) use the CLI,</p>
<p>I want to add a SG dynamically using nodejs. I am shocked that there is not an obvious answer to ... | <p>You do this through <a href="https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/EC2.html" rel="nofollow noreferrer">modifyNetworkInterfaceAttribute</a> which takes <code>Groups</code> parameter:</p>
<blockquote>
<p>Changes the security groups for the network interface. The new set of groups you specify replaces... | how can i use nodejs to add a security group to an EC2 instance that is already running? | amazon-web-services|amazon-ec2|aws-security-group | -1 | 33 | 1 | 71,993,379 | 71,993,379 | 1 | true | 2022-04-24T23:13:21.803Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how can i use nodejs to add a security group to an EC2 instance that is already running?<p>the title says almost everything, but just to make it clear, I DON... |
72,011,568 | Why are strings matched to a primary key when it is set to zero (MySQL)?<p>I have encountered a strange behaviour in MySQL that I cannot understand. I have a table where I have a row where the primary key is 0 (zero). The strange thing is that any string seems to match that row.</p>
<p>The SQL commands below creates a ... | <p>When you compare "test" to id int MYSQL converts "test" to int, with a value of 0.</p>
<pre><code>select cast('test' as unsigned)
</code></pre>
<p>Gives 0</p> | Why are strings matched to a primary key when it is set to zero (MySQL)? | mysql | -1 | 30 | 2 | 72,011,969 | 72,011,969 | 1 | true | 2022-04-26T09:30:40.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why are strings matched to a primary key when it is set to zero (MySQL)?<p>I have encountered a strange behaviour in MySQL that I cannot understand. I have a... |
72,016,153 | R filtering based on part of value (character)<p>I have a data frame with the column "Role", which consists of character answers.</p>
<p>example data frame:</p>
<pre><code>N Year Name Role
1 2010 A CEO
2 2012 A CEO
3 2010 B Chairman/CEO
4 2015 B Chairman/CEO
5 2016 C CEO/CFO/Chair... | <p>You could use <code>grepl</code> and <code>ifelse</code>:</p>
<pre class="lang-r prettyprint-override"><code>df$Chairman <- ifelse(grepl('Chairman', df$Role), 1, 0)
df
#> N Year Name Role Chairman
#> 1 1 2010 A CEO 0
#> 2 2 2012 A CEO 0
#> 3... | R filtering based on part of value (character) | r | -1 | 30 | 2 | 72,016,206 | 72,016,206 | 1 | true | 2022-04-26T14:54:04.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R filtering based on part of value (character)<p>I have a data frame with the column "Role", which consists of character answers.</p>
<p>example da... |
72,019,422 | want to assign roles specific to email address with regex or any other solution for it<pre><code>r.d.fred-2021@hull.ac.uk (for student)
r.d.fred@hull.ac.uk (for teacher)
</code></pre>
<p>I want to assign roles as a student if it includes year otherwise teacher during user registration.</p>
<p>what would be the reg... | <p>Try the following regex</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 str1 = "r.d.fred-2021@hull.ac.uk";
const str2 = "r.d.fred@hull.ac.uk";
const regex = /[0-9]{4}... | want to assign roles specific to email address with regex or any other solution for it | javascript|reactjs|regex|email|logic | -1 | 28 | 1 | 72,019,489 | 72,019,489 | 1 | true | 2022-04-26T19:19:52.380Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
want to assign roles specific to email address with regex or any other solution for it<pre><code>r.d.fred-2021@hull.ac.uk (for student)
r.d.fred@hull.ac.uk ... |
71,792,833 | pivot_longer or another method to convert data from wide to long with a new column to hold the key<p>I am trying to make a table from wide to long but i need to create a new column to hold the data description.</p>
<pre><code>es0 es1 es2 es3
1 2 a b
2 3 c a
a b 1 3
</code></pre>
<p>into</p>
<pre><c... | <p><strong>date.table</strong></p>
<pre><code>library(data.table)
DT <- fread("es0 es1 es2 es3
1 2 a b
2 3 c a
a b 1 3")
melt(DT, measure.vars = names(DT))
# variable value
# 1: es0 1
# 2: es0 2
# 3: es0 a
# 4: es1 2
# 5: es1 3
# 6: ... | pivot_longer or another method to convert data from wide to long with a new column to hold the key | r|tidyverse | -1 | 32 | 1 | 71,792,858 | 71,792,858 | 1 | true | 2022-04-08T06:53:26.323Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pivot_longer or another method to convert data from wide to long with a new column to hold the key<p>I am trying to make a table from wide to long but i need... |
72,015,495 | What is the difference between Select Frame & Switch Window in RF?<p>I am new with working with RF, so my question is why i have to select frame after doing switch window and changing the main focus to the new window ,
is it necessary to do select frame when I can not use it ?</p>
<pre><code>Switch Window title:Test... | <p>You don't need to use <code>Select frame</code> after switching to another window, unless that other window has an iframe that you need to interact with. If it has an iframe, then you have to call <code>Select frame</code> just like you would in the main window.</p> | What is the difference between Select Frame & Switch Window in RF? | python|selenium|automation|robotframework|ui-automation | -1 | 31 | 1 | 72,017,215 | 72,017,215 | 1 | true | 2022-04-26T14:12:58.760Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the difference between Select Frame & Switch Window in RF?<p>I am new with working with RF, so my question is why i have to select frame after doing ... |
71,855,875 | Facing error in plsql procedure while using if else<p>I have included a snippet from my plsql procedure. In this I have an if else if lock.I am doing a string comparison in IF which is not giving an error and another string comparison in ELSE IF which is highlighted in red and giving an error.
I am unable to understand... | <p>Syntax for else if is <code>elsif</code> not <code>elseif</code>, without the 'e'.</p> | Facing error in plsql procedure while using if else | sql|oracle|if-statement|plsql | -1 | 32 | 1 | 71,855,937 | 71,855,937 | 1 | true | 2022-04-13T10:22:33.397Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Facing error in plsql procedure while using if else<p>I have included a snippet from my plsql procedure. In this I have an if else if lock.I am doing a strin... |
72,013,843 | Changing HTML if flask IF statement is true and display a nav bar<p>I have a cookie that stores an integer value, I want it: If a user is logged in show a nav bar else hide it. I also need to hide an tag if the cookie exists.</p> | <p>You can do it either way (backend or in html)</p>
<p>Html way</p>
<pre><code>{% if "cookie_name" in request.cookies %}
Code for nav show
{% else %}
Do something
{% endif %}
</code></pre>
<p>Backend</p>
<p>In case you might want to do this</p>
<pre class="lang-py prettyprint-override"><code>@app.route(... | Changing HTML if flask IF statement is true and display a nav bar | html|flask | -1 | 33 | 1 | 72,014,120 | 72,014,120 | 1 | true | 2022-04-26T12:19:14.267Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Changing HTML if flask IF statement is true and display a nav bar<p>I have a cookie that stores an integer value, I want it: If a user is logged in show a na... |
72,017,028 | Ticks ploted twice<p>I made the following code to plot a series but it does show certain tick twice dunno why.</p>
<pre><code>fig = plt.figure(figsize=(30,10))
ax1 = fig.add_subplot(111)
ax1.set_title('Company', fontdict={'fontsize': 40, 'fontweight': 'medium'})
ax1 = sns.lineplot(data=DF,x="Dates" ,y="P... | <p>I found this discussion on Github: <a href="https://github.com/matplotlib/matplotlib/issues/11575/" rel="nofollow noreferrer">Setting axis ticks in log scale produces duplicate tick labels</a>. Here, someone suggested:</p>
<blockquote>
<p>For some (maybe desired?) reason, minor ticks are labelled as well, depending ... | Ticks ploted twice | python | -1 | 35 | 1 | 72,017,202 | 72,017,202 | 1 | true | 2022-04-26T15:57:59.967Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ticks ploted twice<p>I made the following code to plot a series but it does show certain tick twice dunno why.</p>
<pre><code>fig = plt.figure(figsize=(30,10... |
71,797,331 | Print the lines between two lines that has the same pattern using bash<p>I have a text file containing with string pattern 'OG' -</p>
<pre><code>OG
ANNNFKSODJFHFJ
SSJSJKSKJSAJAS
SSSSSSSSSSSSFA
OG
FALJFNAFAFNAFJL
AFJLJSLJFLFSLFL
ASJFAJFAKFKAFKK
OG
AJSFLJASFLSFLFF
SJFLAFLAFLFLAFA
ASASFASFOFLJAJF
</code></pre>
<p>I want t... | <p>You're almost there:</p>
<pre><code>$ awk '/^OG/ {if(go) exit; go=1; next} go {print}' file.txt
ANNNFKSODJFHFJ
SSJSJKSKJSAJAS
SSSSSSSSSSSSFA
</code></pre> | Print the lines between two lines that has the same pattern using bash | linux|bash | -1 | 21 | 1 | 71,797,432 | 71,797,432 | 1 | true | 2022-04-08T12:50:29.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Print the lines between two lines that has the same pattern using bash<p>I have a text file containing with string pattern 'OG' -</p>
<pre><code>OG
ANNNFKSOD... |
71,821,944 | The best way to resize canvas with its objects<p>I have a Fabric.js canvas inside in a responsive design with boostrap.
To resize the canvas, i use <strong>canvas.setDimensions({width:w, height:h});</strong>
From the width and the height of the current window clientWidth and clientHeight. Here is my canvas and his cont... | <p>Couple of things:</p>
<ol>
<li>Fabric.js adds the <code>.canvas-container</code> wrapper automatically. You don't
have to provide it. Your code ends up creating two
<code>.canvas-container</code> elements. That disturbs the layout.</li>
<li>You can directly use <code>window.innerHeight</code>, instead of setting wid... | The best way to resize canvas with its objects | javascript|canvas|responsive-design|fabricjs | -1 | 541 | 3 | 71,870,423 | 71,870,423 | 1 | true | 2022-04-11T01:52:29.150Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The best way to resize canvas with its objects<p>I have a Fabric.js canvas inside in a responsive design with boostrap.
To resize the canvas, i use <strong>c... |
71,438,292 | MySQL: Get DISTINCT values of repeated values and GROUP CONCAT of non-repeating values which are part of the same table<p>I have this table:<br>
<a href="https://i.stack.imgur.com/861F1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/861F1.png" alt="enter image description here" /></a>
I want to get ... | <pre class="lang-sql prettyprint-override"><code>SELECT MIN(id), show_id, show_name, season_id, GROUP_CONCAT(day)
FROM table
GROUP BY 2,3,4
</code></pre> | MySQL: Get DISTINCT values of repeated values and GROUP CONCAT of non-repeating values which are part of the same table | mysql | -1 | 26 | 2 | 71,438,321 | 71,438,321 | 2 | true | 2022-03-11T12:08:20.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL: Get DISTINCT values of repeated values and GROUP CONCAT of non-repeating values which are part of the same table<p>I have this table:<br>
<a href="htt... |
71,430,626 | How do I keep my child elements stationary when expanding the navbar?<p>Currently, when I hover over the navbar, it expands its width, as desired.</p>
<p>However, I don't want my centered icons in the navbar to move along with the expansion. I want them to stay where they are originally.</p>
<p>Here's a visual of what'... | <p>Removing the <code>justify-center</code> styling from the div tag that has the id of <code>sidebarContainer</code> will solve the issue.</p>
<p>Additionally you can add <code>relative</code> <code>left-8</code> styling or <code>pl-8</code>, whatever your preference is to the div that has the id of <code>sidebarLinkC... | How do I keep my child elements stationary when expanding the navbar? | reactjs|next.js|tailwind-css | -1 | 28 | 2 | 71,439,238 | 71,439,238 | 2 | true | 2022-03-10T20:48:23.410Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I keep my child elements stationary when expanding the navbar?<p>Currently, when I hover over the navbar, it expands its width, as desired.</p>
<p>How... |
71,439,209 | How to change the druid admin default password?<p>In Druid I am using default basic authenticator</p>
<p><strong>My config look like this</strong></p>
<pre><code>druid.auth.authenticatorChain=["MyBasicMetadataAuthenticator"]
druid.auth.authenticator.MyBasicMetadataAuthenticator.type=basic
druid.auth.authentic... | <p>If the user has been previously created and you change the initialAdminPassword property it will have no affect as it is stored in the metadata.</p>
<p><a href="https://druid.apache.org/docs/latest/development/extensions-core/druid-basic-security.html#properties-for-druid-metadata-store-user-authentication" rel="nof... | How to change the druid admin default password? | apache-superset|druid | -1 | 299 | 1 | 71,484,028 | 71,484,028 | 2 | true | 2022-03-11T13:23:31.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to change the druid admin default password?<p>In Druid I am using default basic authenticator</p>
<p><strong>My config look like this</strong></p>
<pre><... |
71,819,971 | Why do .pdn files for paint.net contain a bunch of gibberish?<p>I was using paint.net (An image program) and I decided to open a .pdn file as raw text because I was curious, what I saw was a bunch of gibberish! Why is the data stored like this?</p> | <p>It is most likely stored as binary. This wont make sense to view as a human. However this makes it quick and easy for the program to understand. It also most likely reduces the amount of space the file takes up. Most programs store data like this.</p> | Why do .pdn files for paint.net contain a bunch of gibberish? | paint.net | -1 | 22 | 1 | 71,819,999 | 71,819,999 | 2 | true | 2022-04-10T19:40:04.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why do .pdn files for paint.net contain a bunch of gibberish?<p>I was using paint.net (An image program) and I decided to open a .pdn file as raw text becaus... |
71,831,830 | Calculating number bonds to value in Java<p>As part of my application, the database stores "badges" in a user's record in the database. I use the bitwise operator as (as far as I know) no two additions of them can have the same solution. Here are the values:</p>
<pre class="lang-java prettyprint-override"><co... | <p>Use an <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/EnumSet.html" rel="nofollow noreferrer"><code>EnumSet</code></a>.The EnumSet can hold each item only once (it's a set). Have a look <a href="https://stackoverflow.com/questions/2199399/storing-enumset-in-a-database">here</a> for s... | Calculating number bonds to value in Java | java|math|bitwise-operators | -1 | 35 | 2 | 71,831,909 | 71,831,909 | 2 | true | 2022-04-11T17:16:21.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculating number bonds to value in Java<p>As part of my application, the database stores "badges" in a user's record in the database. I use the b... |
71,844,513 | Replacing diagonal elements with another array in Python<p>I have two matrices, <code>A</code> and <code>P</code>. I would like to replace the diagonal elements of <code>A</code> with the elements of <code>P</code>. The desired output is attached.</p>
<pre><code>A=np.array([[0, 1, 1, 0],
[1, 0, 0, 1],
[1... | <p>Use <a href="https://numpy.org/doc/stable/reference/generated/numpy.fill_diagonal.html" rel="nofollow noreferrer"><code>fill_diagonal</code></a> with the flattened P as values for the diagonal:</p>
<pre><code>np.fill_diagonal(A, P.ravel())
</code></pre>
<p><em>NB. the operation is in place</em></p>
<p>output:</p>
<p... | Replacing diagonal elements with another array in Python | python|numpy | -1 | 33 | 1 | 71,844,554 | 71,844,554 | 2 | true | 2022-04-12T14:30:51.240Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replacing diagonal elements with another array in Python<p>I have two matrices, <code>A</code> and <code>P</code>. I would like to replace the diagonal eleme... |
71,856,304 | Concise way of writing conditional method chaining<p>Is there a more concise way to write something like the following in Python?</p>
<pre><code>if c:
x = obj.method_1()
.method_2()
.method_3()
else:
x = obj.method_1()
.method_3()
</code></pre> | <pre class="lang-py prettyprint-override"><code>x = obj.method_1()
if c:
x = x.method_2()
x = x.method_3()
</code></pre> | Concise way of writing conditional method chaining | python | -1 | 27 | 2 | 71,856,878 | 71,856,878 | 2 | true | 2022-04-13T10:55:21.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Concise way of writing conditional method chaining<p>Is there a more concise way to write something like the following in Python?</p>
<pre><code>if c:
x = ... |
71,857,816 | angular 2 does not parse correctly html code<p>Trying to HTML code to view the resulting HTML using the innerHTML property, but as you can see in the example below, it doesn't. The HTML code is viewed as the HTML tags and only, instead of creating the elements it renders them as simple text.</p>
<p><a href="https://co... | <p>an idea can be to parse the notWorking string into valid html with domparser (for sample) before inject it in innerHTML</p>
<p><a href="https://codepen.io/jeremy-denis/pen/rNpZKzO?editors=1111" rel="nofollow noreferrer">https://codepen.io/jeremy-denis/pen/rNpZKzO?editors=1111</a></p>
<pre><code>const { Component, VE... | angular 2 does not parse correctly html code | html|angular|unicode | -1 | 26 | 2 | 71,858,179 | 71,858,179 | 2 | true | 2022-04-13T12:52:02.117Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
angular 2 does not parse correctly html code<p>Trying to HTML code to view the resulting HTML using the innerHTML property, but as you can see in the example... |
71,858,751 | API error when someone deletes message reacted by bot Discord.JS<p>I'm new to the programming world and I decided to start learning JavaScript, first with Discord bots. How can I fix my bot that stops working when someone deletes or edits the message?</p>
<pre><code> if (message.channel.id === 'ChannelID') {
... | <p>Handle the promise rejection of <code>Message#react()</code></p>
<pre class="lang-js prettyprint-override"><code>message
.react(...)
.catch(console.error);
</code></pre> | API error when someone deletes message reacted by bot Discord.JS | javascript|discord.js | -1 | 35 | 1 | 71,859,172 | 71,859,172 | 2 | true | 2022-04-13T13:56:22.827Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
API error when someone deletes message reacted by bot Discord.JS<p>I'm new to the programming world and I decided to start learning JavaScript, first with Di... |
71,858,762 | How can I add a new spider arg to my own template in Scrapy/Zyte<p>I am working on a paid proxy spider template and would like the ability to pass in a new argument on the command line for a Scrapy crawler. How can I do that?</p> | <p>This is achievable by using <code>kwargs</code> in your spider's __init__-Method:</p>
<pre class="lang-py prettyprint-override"><code>import scrapy
class YourSpider(scrapy.Spider):
name = your_spider
def __init__(self, *args, **kwargs):
super(YourSpider, self).__init__(*args, **kwargs)
sel... | How can I add a new spider arg to my own template in Scrapy/Zyte | scrapy|command-line-arguments|zyte | -1 | 31 | 1 | 71,859,344 | 71,859,344 | 2 | true | 2022-04-13T13:56:57.670Z | 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 new spider arg to my own template in Scrapy/Zyte<p>I am working on a paid proxy spider template and would like the ability to pass in a new a... |
71,866,097 | Hiding the Legend in this Graph<p>I made this graph to demonstrate the progress being made by an optimization algorithm (<a href="https://rstudio-pubs-static.s3.amazonaws.com/132872_620c10f340f348b88453d75ec99960ff.html" rel="nofollow noreferrer">https://rstudio-pubs-static.s3.amazonaws.com/132872_620c10f340f348b88453d... | <p>This should work:
<code>plot(GA, legend = FALSE)</code></p>
<p>P.S, if you are not familiar with a package function I always find it helpful to look up the R-documentation in the console using <code>??GA::plot</code></p> | Hiding the Legend in this Graph | r|data-visualization|legend | -1 | 31 | 1 | 71,866,138 | 71,866,138 | 2 | true | 2022-04-14T03:15:49.687Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hiding the Legend in this Graph<p>I made this graph to demonstrate the progress being made by an optimization algorithm (<a href="https://rstudio-pubs-static... |
71,883,596 | How to stop google docs replacing parentheses?<p>Is it possible to make google docs stop replacing parentheses?
Sometimes I make there cheat sheets for myself but I noticed that when I make parentheses there it places <a href="https://i.stack.imgur.com/KFTQ8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgu... | <p>That's called smart quotes.</p>
<p>To turn them off, click <code>Tools > Preferences</code> and then unselect <code>Use smart quotes</code>:</p>
<p><a href="https://i.stack.imgur.com/71iuw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/71iuw.png" alt="enter image description here" /></a></p> | How to stop google docs replacing parentheses? | google-docs | -1 | 28 | 1 | 71,884,060 | 71,884,060 | 2 | true | 2022-04-15T11:43:09.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to stop google docs replacing parentheses?<p>Is it possible to make google docs stop replacing parentheses?
Sometimes I make there cheat sheets for mysel... |
71,898,425 | How do I get environment variables in a shell script running on an ECS FARGATE container?<p>I have an ECS Fargate instance (node-alpine base) running with some environment variables on it (unique to that instance).</p>
<p><a href="https://i.stack.imgur.com/92j6V.png" rel="nofollow noreferrer"><img src="https://i.stack.... | <p>To access an environment variable in a shell script, put a dollar sign <code>$</code> before its name, and generally make sure it's inside a double-quoted string:</p>
<pre class="lang-sh prettyprint-override"><code>TEAM_ONE_NAME="$REACT_APP_TEAM_ONE_NAME"
</code></pre>
<p>Shell variables and environment va... | How do I get environment variables in a shell script running on an ECS FARGATE container? | docker|shell|environment-variables|amazon-ecs|aws-fargate | -1 | 522 | 1 | 71,898,594 | 71,898,594 | 2 | true | 2022-04-17T00:22:12.223Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I get environment variables in a shell script running on an ECS FARGATE container?<p>I have an ECS Fargate instance (node-alpine base) running with so... |
71,902,264 | Adding js inside <head> tag is not working<p>this is working code, i found it from somewhere else.</p>
<pre><code><html lang="en">
<head>
<meta charset="utf=8">
<style type="text/css">
#posts {
width: 90%;
height: 700px;
margi... | <p>When browser execute your second script there is no element added to document yet. So You must wrap your second script code with window.onload</p>
<pre><code> <script type="text/javascript">
window.onload = () => {
$(".post").each(function() {
var color = '#'; // hexad... | Adding js inside <head> tag is not working | javascript|html | -1 | 19 | 1 | 71,902,297 | 71,902,297 | 2 | true | 2022-04-17T13:25:32.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding js inside <head> tag is not working<p>this is working code, i found it from somewhere else.</p>
<pre><code><html lang="en">
<head... |
71,915,332 | Javascript extract string from start to 0/, removing anything after 0/<p>I have a string which looks like this:</p>
<pre><code>file:///storage/emulated/0/Pictures/IMG212.jpg
</code></pre>
<p>I want to remove anything from Pictures onwards so I would get this:</p>
<pre><code>file:///storage/emulated/0/
</code></pre>
<p>... | <pre><code>var regex = /^.*0\//
var matches = str.match(regex);
console.log(matches[0]);
</code></pre> | Javascript extract string from start to 0/, removing anything after 0/ | javascript|typescript | -1 | 32 | 3 | 71,915,386 | 71,915,386 | 2 | true | 2022-04-18T17:58:41.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript extract string from start to 0/, removing anything after 0/<p>I have a string which looks like this:</p>
<pre><code>file:///storage/emulated/0/Pic... |
71,972,605 | How can I drop a row if repeated by category?<p>how would I go about dropping rows which have a duplicate and keeping another row by its category.</p>
<p>For example, let's consider a sample table</p>
<pre><code>Item | location | Status
------------------------
123 | A | done
123 | A | not_done
123 ... | <p>Identify rows with <code>done</code> if any and prioritize them.</p>
<pre><code>select * except rn
from (
select item, location, status
, row_number() over (
partition by item
order by case status when 'done' then 0 else 1 end
) as rn
from t
)
where rn = 1
</code></pre>
<p>(... | How can I drop a row if repeated by category? | sql|google-bigquery | -1 | 30 | 2 | 71,972,896 | 71,972,896 | 2 | true | 2022-04-22T17:30:59.123Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I drop a row if repeated by category?<p>how would I go about dropping rows which have a duplicate and keeping another row by its category.</p>
<p>For... |
71,948,555 | Command that can work with and without tagging someone<p>I'm looking for a way to have a command which will give different responses depending on whether you have tagged someone along with the command.</p>
<p>Here's what I got so far:</p>
<pre><code>module.exports = {
name: 'attack',
description: "uses att... | <p>Give this code a try it requires less code and will check for a target.</p>
<pre class="lang-js prettyprint-override"><code>let target
if (message.mentions.members.first() === undefined) {
target = 'the enemy.'
} else {
target = message.mentions.members.first().username
}
const newEmbed = new Discord.Message... | Command that can work with and without tagging someone | javascript|discord|discord.js|bots | -1 | 34 | 1 | 71,948,711 | 71,948,711 | 2 | true | 2022-04-21T03:21:29.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Command that can work with and without tagging someone<p>I'm looking for a way to have a command which will give different responses depending on whether you... |
71,922,029 | Create array with random numbers that contains only 1 non zero value in a row<p>Like in a topic, I want to generate an random array of shape (2x2x2) where each row can contains only one non zero value like</p>
<pre><code>x = [[[1 0]
[0 3]]
[7 0]
[0 0]]]
</code></pre>
<p>not</p>
<pre><code>x = [[[1 6]... | <p>I would suggest doing the following to achieve your result. You want an array filled with all zeros, except for one element in each row.</p>
<ol>
<li>So create an array with all zeros.</li>
<li>For each row pick a random index.</li>
<li>Set the value at the random index to a random value.</li>
</ol>
<p>Here's a snip... | Create array with random numbers that contains only 1 non zero value in a row | python|numpy | -1 | 35 | 1 | 71,922,106 | 71,922,106 | 2 | true | 2022-04-19T08:41:27.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create array with random numbers that contains only 1 non zero value in a row<p>Like in a topic, I want to generate an random array of shape (2x2x2) where ea... |
71,882,121 | Using a Subclass to use as parameter<pre><code>public class Animal {}
public class Cow: Animal {}
public class JerseyCow: Cow {}
</code></pre>
<p>Hello. So, I want to be able to pass a Subclass/Type as a parameter so that the method below works. After experimenting and researching, I can't find any that could make this... | <p>You need to use generics:</p>
<pre class="lang-cs prettyprint-override"><code>private double aveProf<TAnimal>()
where TAnimal: Animal // constrain it to only the Animal base class
// which is necessary to use .getProfit()
{
double count = 0;
double sum = 0;
double rat... | Using a Subclass to use as parameter | c#|oop|subclass | -1 | 35 | 1 | 71,882,205 | 71,882,205 | 2 | true | 2022-04-15T09:09:01.110Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using a Subclass to use as parameter<pre><code>public class Animal {}
public class Cow: Animal {}
public class JerseyCow: Cow {}
</code></pre>
<p>Hello. So, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.