question_id int64 37.6M 73.2M | input_text stringlengths 88 52.4k | output_text stringlengths 37 35.6k | title stringlengths 15 150 | tags stringlengths 1 107 | q_score int64 -19 397 | view_count int64 3 879k | answer_count int64 1 21 | accepted_answer_id int64 37.6M 73.8M | answer_id int64 37.6M 73.8M | a_score int64 -5 1.29k | is_accepted bool 1
class | creation_date stringlengths 20 24 | input_text_instruct stringlengths 251 52.6k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
72,897,522 | how to update/assigning new values to elements of a DatasetDict outside the loop (for cycle) in python?<p>I have a dataset of images, I resize every image of the dataset and then re-assign the i-th element of the dataset with the resized_image. I'm doing this with the following code:</p>
<pre><code>for i in range(0,len... | <p>Alas, you can't change it inplace.</p>
<p><a href="https://huggingface.co/docs/datasets/v2.3.2/en/package_reference/main_classes#datasets.DatasetDict" rel="nofollow noreferrer"><code>DatasetDict</code></a> is backed by <a href="https://arrow.apache.org/docs/cpp/tables.html" rel="nofollow noreferrer">Arrow tables</a>... | how to update/assigning new values to elements of a DatasetDict outside the loop (for cycle) in python? | python|python-3.x|list|tensorflow|arraylist | 0 | 46 | 1 | 72,897,809 | 72,897,809 | 2 | true | 2022-07-07T12:04:40.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to update/assigning new values to elements of a DatasetDict outside the loop (for cycle) in python?<p>I have a dataset of images, I resize every image of... |
72,900,480 | WARNING:tensorflow:Model was constructed with shape (None, 188) for input, but it was called on an input with incompatible shape (188,)<p>Can someone help me to fix this? tensorflow is really annoying.</p>
<p>WARNING:tensorflow:Model was constructed with shape (None, 188) for input KerasTensor(type_spec=TensorSpec(shap... | <p>You seem to be missing a dimension. Try batching your data:</p>
<pre><code>train_set = train_set.batch(32)
</code></pre> | WARNING:tensorflow:Model was constructed with shape (None, 188) for input, but it was called on an input with incompatible shape (188,) | python|tensorflow|keras | 1 | 46 | 1 | 72,900,519 | 72,900,519 | 2 | true | 2022-07-07T15:25:17.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WARNING:tensorflow:Model was constructed with shape (None, 188) for input, but it was called on an input with incompatible shape (188,)<p>Can someone help me... |
72,902,139 | Identify the cell type and replace entry with default text/value<p>I have a spreadsheet where the user enters loads of data in a column.</p>
<p>I want to run a script that resets the user-entered data to defaults.</p>
<p>However, they need a different default value depending on the type of data that can be entered:</p>... | <p><strong>Description</strong></p>
<p>This may not be all inclusive for DataValidation but it will handle the items you mention above. Note that the check for Date has to be done before number.</p>
<p>I've created a small test sheet with each value type.</p>
<p>I leave it up to you to put the values back.</p>
<p><a h... | Identify the cell type and replace entry with default text/value | javascript|google-apps-script | -2 | 46 | 1 | 72,902,842 | 72,902,842 | 2 | true | 2022-07-07T17:39:17.427Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Identify the cell type and replace entry with default text/value<p>I have a spreadsheet where the user enters loads of data in a column.</p>
<p>I want to run... |
72,905,243 | Failing to scrape a webpage<p>I have problems trying to scrape a web with multiple pages with Spyder: the web has 1 to 6 pages and also a next button. Also, each of one the six pages has 30 results. I've tried two solutions without success.</p>
<p>This is the first one:</p>
<pre><code>#SOLUTION 1#
from selenium import ... | <p>The data you see is loaded from external URL via javascript. You can simulate these calls with <code>requests</code> module. For example:</p>
<pre class="lang-py prettyprint-override"><code>import requests
import pandas as pd
from bs4 import BeautifulSoup
from urllib.parse import urlparse, parse_qs
url = "http... | Failing to scrape a webpage | python|selenium|web-scraping|beautifulsoup|spyder | 2 | 46 | 1 | 72,905,386 | 72,905,386 | 2 | true | 2022-07-07T23:33:07.237Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Failing to scrape a webpage<p>I have problems trying to scrape a web with multiple pages with Spyder: the web has 1 to 6 pages and also a next button. Also, ... |
72,906,223 | Why the concurrent.futures solution differs from the serial solution? nump.dot(unit64,float64)<p>Can you help me understand why the concurrent solution differs from the serial solution? How do I fix this issue?</p>
<p><strong>Serial:</strong> Use <code>numpy.dot()</code> method on 1d array <code>a</code> and 2d array <... | <p>I will refer you to the classic <a href="https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html" rel="nofollow noreferrer"><em>What Every Computer Scientist Should Know About Floating-Point Arithmetic</em></a>. In particular for your issue, floating point arithmetic is <em>not</em> associative nor distribut... | Why the concurrent.futures solution differs from the serial solution? nump.dot(unit64,float64) | python|numpy|types|concurrent.futures|dot-product | 0 | 46 | 1 | 72,909,205 | 72,909,205 | 2 | true | 2022-07-08T03:05:17.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why the concurrent.futures solution differs from the serial solution? nump.dot(unit64,float64)<p>Can you help me understand why the concurrent solution diffe... |
72,888,549 | Passing large string to Pipelinebuffer (C# and SSIS)<p>I'm trying to load a large string (over 8000 characters) into a SQL Server database. (from a file)</p>
<p>I'm using <code>PipelineBuffer</code> to add a row and populate the output.</p>
<p>Using a script would return an error saying that it can't process more than ... | <p>Blob columns have a method called AddBlobData() for setting the value. In the example below, Column1 is NText data type:</p>
<pre><code>public override void CreateNewOutputRows()
{
using (var sr = new StreamReader(@"<path to file>"))
{
string line;
while (... | Passing large string to Pipelinebuffer (C# and SSIS) | c#|sql-server|ssis | 1 | 46 | 1 | 72,911,267 | 72,911,267 | 2 | true | 2022-07-06T18:49:06.643Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing large string to Pipelinebuffer (C# and SSIS)<p>I'm trying to load a large string (over 8000 characters) into a SQL Server database. (from a file)</p>... |
72,912,553 | Save the state of the calendar and entered data<p>I have a sidebar with filters on my site. One of the filters is datetime (I am using the library react-advanced-datetimerange-picker).</p>
<p>If the browser screen size is changed, the sidebar disappears, but a button appears that can open it again.
As soon as the scree... | <p>You need move your state to the parent of the sidebar component.</p>
<p>Please check.</p>
<p><a href="https://codesandbox.io/s/wild-tdd-mztg0q" rel="nofollow noreferrer">https://codesandbox.io/s/wild-tdd-mztg0q</a></p> | Save the state of the calendar and entered data | javascript|reactjs | 1 | 46 | 1 | 72,912,691 | 72,912,691 | 2 | true | 2022-07-08T13:59:38.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Save the state of the calendar and entered data<p>I have a sidebar with filters on my site. One of the filters is datetime (I am using the library react-adva... |
72,912,783 | Why my code runs up to point A and crashes when I give B coordinates?<p>I am new at C pointers and I'm trying to find the error.
Any help is appreciated.
The code compiles without any errors. When it runs, it accepts point A coordinates but crashes when I input B coordinates.
The output I get is this:</p>
<pre><code>Gi... | <p>It is because you allocate space for the triangle, but not for the <code>point</code> pointers.</p>
<p>You could either allocate memory (here on the stack) :</p>
<pre><code>int main()
{
system("clear");
struct triangle triangle1, *trianglePtr;
struct point pointA, pointB, pointC;
triangle1... | Why my code runs up to point A and crashes when I give B coordinates? | c|pointers | 1 | 46 | 1 | 72,912,899 | 72,912,899 | 2 | true | 2022-07-08T14:18:34.150Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why my code runs up to point A and crashes when I give B coordinates?<p>I am new at C pointers and I'm trying to find the error.
Any help is appreciated.
The... |
72,913,976 | Efficiently using the OpenElevation API using Python<p>I have a large set of latitude/longitude coordinates and would like to get the elevation for each. I want to use the OpenElevation API. According to their API Docs, I can get elevation data through the URL: <a href="https://api.open-elevation.com/api/v1/lookup?loca... | <p>After taking a quick look at the <a href="https://github.com/Jorl17/open-elevation/blob/master/docs/api.md#parameters-1" rel="nofollow noreferrer">documentation</a>. The POST endpoint requires the parameters be sent in the request body in JSON format with the appropriate headers</p>
<p>Here is a working example:</p>... | Efficiently using the OpenElevation API using Python | python|api|python-requests|elevation | 1 | 46 | 1 | 72,914,207 | 72,914,207 | 2 | true | 2022-07-08T15:52:44.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Efficiently using the OpenElevation API using Python<p>I have a large set of latitude/longitude coordinates and would like to get the elevation for each. I w... |
72,917,625 | Columns Nested in columns<p>I'm trying to make three new columns inside the my center column. But when I nest, they do go inside the centered column, but they also stack at the bottom of it. I'm interested in the center column can work as a background kind of like a container for the other three columns.</p>
<p>Maybe t... | <p>For what you want, you need to use <a href="https://getbootstrap.com/docs/4.1/utilities/flex/" rel="nofollow noreferrer">flex utility</a> classes</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 prett... | Columns Nested in columns | html|css|twitter-bootstrap|bootstrap-4 | 1 | 46 | 1 | 72,917,797 | 72,917,797 | 2 | true | 2022-07-08T22:35:51.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Columns Nested in columns<p>I'm trying to make three new columns inside the my center column. But when I nest, they do go inside the centered column, but the... |
72,921,074 | Can I set the SCIP constraint handler to work only after a feasible solution is found?<p>I read the <strong>SCIP</strong> constraint handler documentation, and reads that <strong>CONSHDLR_CHECKPRIORITY= -1</strong> makes that the constraint handler only works when the solution is integral. However, my handler is still ... | <p>You simply need to give your constraint handler the lowest Priority out of all the constraint handlers (both for checking and enforcing). That way your constraint handler will only be called when all other constraint handlers have acted.</p>
<p>You can see all the default priorities by typing <code>disp conshdlrs</c... | Can I set the SCIP constraint handler to work only after a feasible solution is found? | python|mathematical-optimization|scip|operations-research|pyscipopt | 0 | 46 | 1 | 72,921,183 | 72,921,183 | 2 | true | 2022-07-09T11:43:17.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can I set the SCIP constraint handler to work only after a feasible solution is found?<p>I read the <strong>SCIP</strong> constraint handler documentation, a... |
72,921,755 | display information from localStorage<p>I am having trouble wrapping my head around how to use localStorage (since it is the first time I use it) to store an array of objects in localStorage, but mainly how to get that information and display it even after refreshing the page . right now I can see it is being stored bu... | <p>Your code seems to work</p>
<p>Here is a version that will run here at SO using try</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 saveLibrary = () => {
try {
... | display information from localStorage | javascript | 1 | 46 | 2 | 72,922,761 | 72,922,761 | 2 | true | 2022-07-09T13:28:59.623Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
display information from localStorage<p>I am having trouble wrapping my head around how to use localStorage (since it is the first time I use it) to store an... |
72,928,528 | Building an API to send random numbers to my website<p>I am trying to make a custom API which uploads random numbers generated to my website page (to learn how API works). And whenever I want to see the page, I use my API key to do so. Can you help me in this? I am new to API stuff.</p> | <p>When creating APIs, there are lots of decisions to make. You could render your structure on the client-side and query your application server via <a href="https://www.techtarget.com/searchapparchitecture/definition/RESTful-API" rel="nofollow noreferrer">RESTful</a> API calls. Or you could have a server-side renderin... | Building an API to send random numbers to my website | api | -3 | 46 | 1 | 72,928,727 | 72,928,727 | 2 | true | 2022-07-10T12:39:09.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Building an API to send random numbers to my website<p>I am trying to make a custom API which uploads random numbers generated to my website page (to learn h... |
72,939,734 | The problem of using the try exception dynamically<p>I have a function called <code>transform_exceptions()</code> that takes a list of functions, then calls each of the functions <strong>(functions are without arguments)</strong> and the exceptions that occur with the above convention to an object of <code>ExceptionPro... | <p>You should do this when calling the function name in the list</p>
<pre><code>func()
</code></pre>
<p>Also modified code:</p>
<pre><code>class ExceptionProxy(Exception):
def __init__(self,msg,function):
self.msg = msg
self.function = function
def transform_exceptions(func_ls):
out = []
f... | The problem of using the try exception dynamically | python|try-except | 2 | 46 | 1 | 72,939,805 | 72,939,805 | 2 | true | 2022-07-11T13:55:24.593Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The problem of using the try exception dynamically<p>I have a function called <code>transform_exceptions()</code> that takes a list of functions, then calls ... |
72,940,070 | I cant make the asterisk operator overloading it does nothing on the code below it should repeat my string 5 times but it doesnot<p>I can't make the asterisk operator overloading work. It does nothing on the code below. It should repeat my string 5 times, but it doesn't.</p>
<p><strong>.h file</strong></p>
<pre><code>c... | <p>Your <code>operator*</code> will repeat the string, but you throw away the result of <code>s3*5</code>.</p>
<p>Try <code>cout << s3*5 << endl;</code>.</p> | I cant make the asterisk operator overloading it does nothing on the code below it should repeat my string 5 times but it doesnot | c++|operator-overloading | -1 | 46 | 1 | 72,940,120 | 72,940,120 | 2 | true | 2022-07-11T14:21:46.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I cant make the asterisk operator overloading it does nothing on the code below it should repeat my string 5 times but it doesnot<p>I can't make the asterisk... |
72,946,270 | Mapping Structs in Swift<p>I have an array of a custom struct that has a INT variable that I would like to get the sum of conditionally based on another variable of the struct. Here is example of what the code looks like:</p>
<pre><code>struct Point {
var amount: Int
var add: Bool
}
let arr = [Point(amount: 9,... | <p>You are looking for <code>reduce</code>, not <code>compactMap</code>. <code>reduce</code> takes an array and transforms it to a single value.</p>
<p>What you're looking for could done like this:</p>
<pre><code>let sum: Int = arr.reduce(0, { acc, point in
acc + (point.add ? point.amount : 0)
})
</code></pre>
<p>O... | Mapping Structs in Swift | ios|arrays|swift|struct | -1 | 46 | 1 | 72,946,299 | 72,946,299 | 2 | true | 2022-07-12T01:54:10.197Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mapping Structs in Swift<p>I have an array of a custom struct that has a INT variable that I would like to get the sum of conditionally based on another vari... |
72,941,954 | Wrong credentials approved by git<p>So I needed to add my personal GitHub account to my office laptop in which I was already using my work github account. So I created a separate ssh key and stored that into a separate file. I added that newly created ssh to my personal github account.</p>
<p>Then I added a config file... | <blockquote>
<p>But shouldn't in such a case there should be an authorization error as the repository was private in the personal git hub account.<br />
How did GitHub allowed access?</p>
</blockquote>
<p>No, commit authorship has nothing to do with authentication/access.</p>
<p>It is better to use a <a href="https://s... | Wrong credentials approved by git | git|github|ssh | 2 | 46 | 2 | 72,946,971 | 72,946,971 | 2 | true | 2022-07-11T16:47:02.210Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wrong credentials approved by git<p>So I needed to add my personal GitHub account to my office laptop in which I was already using my work github account. So... |
72,943,970 | Binance is there a way to sell the small balances in python?<p>I am trying to use the binance api and would like to use dust to bnb conversion?
We can do this on the binance website and I would like to automate this</p>
<p>I searched the binance api but couldn't find anything.</p>
<p>Thanks for yours answers!</p> | <p>Actually Binance has this in API document:</p>
<p><a href="https://i.stack.imgur.com/IayIw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IayIw.png" alt="enter image description here" /></a></p>
<p>Btw, this question is not appropriate for stackoverflow, since you're trying to find a resource or ... | Binance is there a way to sell the small balances in python? | python|binance|binance-smart-chain | -1 | 46 | 1 | 72,948,002 | 72,948,002 | 2 | true | 2022-07-11T19:54:16.237Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Binance is there a way to sell the small balances in python?<p>I am trying to use the binance api and would like to use dust to bnb conversion?
We can do thi... |
72,949,955 | How to update global var in all components<p>I would like to be able to set up an automatic page title change system according to my loaded view.</p>
<p>First thought of using a global variable since the main.js :</p>
<pre class="lang-js prettyprint-override"><code>// MAIN.JS FILE
const App = createApp(AppVue).use(rout... | <p>You can use a reactive state in a composable.</p>
<pre><code>const title = ref(''); // <=== outside of function scope
export function useTitle() {
const setTitle = (newTitle) => {
title.value = newTitle;
};
return { title, setTitle };
}
</code></pre>
<p>You can use it by <code>title</code> or updat... | How to update global var in all components | vue.js|vuejs3|vite | 0 | 46 | 1 | 72,950,220 | 72,950,220 | 2 | true | 2022-07-12T09:22:00.243Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to update global var in all components<p>I would like to be able to set up an automatic page title change system according to my loaded view.</p>
<p>Firs... |
72,950,292 | How to disable a button in flutter untill all Text feilds are filled<p>I have a registration form with multiple text feilds and a Radio button and a birthdate picker. I want to disable the submit button untill the user key in all the required feilds.
I managed to do something but it only validates one text feild.</p>
<... | <p>Have a variable that enables/disables the button:</p>
<pre><code>bool _disabled = true;
</code></pre>
<p>Use <code>IgnorePointer</code> and <code>Opacity</code> for the button:</p>
<pre><code>IgnorePointer(
ignoring: _disabled;
child: Opacity(
opacity: _disabled ? 0.5 : 1.0,
child: YourButton(...),
)
)... | How to disable a button in flutter untill all Text feilds are filled | flutter|android-studio|dart|flutter-layout|dart-ui | 0 | 46 | 3 | 72,950,474 | 72,950,474 | 2 | true | 2022-07-12T09:47:42.317Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to disable a button in flutter untill all Text feilds are filled<p>I have a registration form with multiple text feilds and a Radio button and a birthdat... |
72,947,853 | How to make RethinkDB to call a java function whenever new insertion happens?<p><strong>Hello all,</strong>
I am new to <strong>Rethink-db</strong> can anyone help me with this as i mentioned in above query.
I am creating one <strong>java service</strong> with <strong>Rethink-db</strong> so whenever new entries inserte... | <p>I hope you have proper dependency set, below code may help you.</p>
<pre><code>static Connection con = r.connection().hostname("localhost").port(28015).db("db_name").connect();
public static final RethinkDB r = RethinkDB.r;
public static void getChangeEffect() {
Result<Object> changes =... | How to make RethinkDB to call a java function whenever new insertion happens? | java|spring-boot|rethinkdb | 2 | 46 | 1 | 72,951,183 | 72,951,183 | 2 | true | 2022-07-12T06:22:49.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make RethinkDB to call a java function whenever new insertion happens?<p><strong>Hello all,</strong>
I am new to <strong>Rethink-db</strong> can anyon... |
72,951,513 | How to stop the execution of a bash command after N seconds?<p>I am writing a simple bash script that analyses the contents of a directory and invokes a specific command for each file, however, in some cases, the execution takes longer than expected, and I would like to stop it after a certain number of seconds (or min... | <p>Besides just backgrounding the tasks, you may also be interested in the <code>timeout</code> command. For example <code>timeout 5s qark --java $f</code> will run your qark application and signal it to exit after 5 seconds if it hasn't already exited.</p>
<p>You can combine the two answers as well (<code>timeout 5s q... | How to stop the execution of a bash command after N seconds? | bash | 0 | 46 | 2 | 72,952,475 | 72,952,475 | 2 | true | 2022-07-12T11:23:11.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to stop the execution of a bash command after N seconds?<p>I am writing a simple bash script that analyses the contents of a directory and invokes a spec... |
72,950,689 | bson.M filter for db.collection.find( {}, {your_key:1, _id:0})<p>I want to get the entire <code>list_atttributes</code> field from my mongo document:</p>
<pre><code>db.config.find({},{list_attributes:1, _id:0});
[
{
list_attributes: {
'0': { field: 'LASTNAME', field_key: 'lastname', dataType: 'text' },
'1':... | <p>Something like this should work</p>
<pre class="lang-golang prettyprint-override"><code>import (
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
func find(ctx context.Context) error {
// ...
cursor... | bson.M filter for db.collection.find( {}, {your_key:1, _id:0}) | mongodb|go | 1 | 46 | 1 | 72,954,411 | 72,954,411 | 2 | true | 2022-07-12T10:18:07.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
bson.M filter for db.collection.find( {}, {your_key:1, _id:0})<p>I want to get the entire <code>list_atttributes</code> field from my mongo document:</p>
<pr... |
72,936,460 | How to write this python snippet in functional programming style?<p>How can I write the line below in functional python using e.g. <a href="https://toolz.readthedocs.io/en/latest/api.html" rel="nofollow noreferrer">toolz</a>?</p>
<pre class="lang-py prettyprint-override"><code>dct1 = {1: 1, 2: 2}
dct2 = {2:2}
dct3 = {2... | <p>If you want to try to write this in a <em>functional</em> style:</p>
<pre><code>from functools import reduce
dct1 = {1: 1, 2: 2}
dct2 = {2: 2}
dct3 = {2: 2, 3: 3}
shared_keys = reduce(set.intersection, map(set, map(dict.keys, [dct1, dct2, dct3])))
</code></pre>
<p>First we create a list of the dictionaries.</p>
<p... | How to write this python snippet in functional programming style? | python|functional-programming|toolz | 0 | 46 | 2 | 72,959,760 | 72,959,760 | 2 | true | 2022-07-11T09:38:00.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to write this python snippet in functional programming style?<p>How can I write the line below in functional python using e.g. <a href="https://toolz.rea... |
72,960,219 | How to remove the numbers at the beginning of each line in python?<p>I have a block of code that has to manipulate a .txt file. I'm trying to remove the first three numbers and '.', in order to use the code without having to manually deleting each number.</p>
<p>recieving error:</p>
<pre class="lang-none prettyprint-ov... | <p>As the part to be removed is of fixed-length, you can simply use slicing:</p>
<pre class="lang-py prettyprint-override"><code>with open("text.txt") as f:
for line in f:
print(line[5:], end='')
</code></pre>
<p>Output:</p>
<pre><code>"""Birthday Paradox Simulation, by Al Sweigart ... | How to remove the numbers at the beginning of each line in python? | python | 0 | 46 | 2 | 72,960,248 | 72,960,248 | 2 | true | 2022-07-13T02:23:26.930Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove the numbers at the beginning of each line in python?<p>I have a block of code that has to manipulate a .txt file. I'm trying to remove the firs... |
72,961,864 | Pandas GroupBy, to compare the new column of list of numbers, to another column of list of numbers<p>A data frame is as the left of screenshot below.</p>
<p>I want to GroupBy the names, and find out which numbers (compared to [1,2,3,4,5]) are missing.</p>
<p>The ideal output is as the right of screenshot.</p>
<p>I've t... | <p>Let us group the dataframe by <code>Name</code> and aggregate <code>Number of stars</code> with custom lambda function that returns the required set difference:</p>
<pre><code>s = set(range(1, 6))
df.groupby('Name')['Number of stars']\
.agg(lambda x: s - set(int(z) for y in x for z in y.split(',')))
</code></pre>
... | Pandas GroupBy, to compare the new column of list of numbers, to another column of list of numbers | python|pandas|dataframe|group-by | 2 | 46 | 3 | 72,962,064 | 72,962,064 | 2 | true | 2022-07-13T06:34:12.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas GroupBy, to compare the new column of list of numbers, to another column of list of numbers<p>A data frame is as the left of screenshot below.</p>
<p>... |
72,973,531 | Alternatives to using "having" clause for alias fields<p>I have this somewhat complex sql query that works ok without the final where clause. I'm looking to filter some records using the column <code>unreviewed_records</code> which is an alias</p>
<p>Problem is that I get an error saying <code>unreviewed_records</code>... | <p>The reason aliases are not allowed in a WHERE clause is that the expressions in the SELECT list are not evaluated until after the rows are filtered by the WHERE clause. So it's a chicken-and-egg problem.</p>
<p>The easiest and most common alternative is a derived table:</p>
<pre><code>SELECT a, b, c
FROM (
SELEC... | Alternatives to using "having" clause for alias fields | mysql|sql | -1 | 46 | 2 | 72,974,133 | 72,974,133 | 2 | true | 2022-07-13T23:01:42.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Alternatives to using "having" clause for alias fields<p>I have this somewhat complex sql query that works ok without the final where clause. I'm looking to ... |
72,973,946 | What is the difference between model([states, actions]) and model.predict([states, actions])?<p>I have seen code with <code>model([states, moves])</code> and with <code>model.predict([states, moves])</code>. I think both of them are Q-learning. But when I exchange <code>model([states, moves])</code> with <code>model.pr... | <p>Most of your question can be answered from this <a href="https://stackoverflow.com/questions/60837962/confusion-about-keras-model-call-vs-call-vs-predict-methods">StackOverflow question</a>. The answers there go over the minute differences between <code>model()</code> and <code>model.predict</code>.</p>
<p>As regard... | What is the difference between model([states, actions]) and model.predict([states, actions])? | tensorflow|keras | 0 | 46 | 1 | 72,974,894 | 72,974,894 | 2 | true | 2022-07-14T00:15:35.803Z | 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 model([states, actions]) and model.predict([states, actions])?<p>I have seen code with <code>model([states, moves])</code> and... |
72,978,861 | Shopware 6: How to forbid products with an app<p>Is it possible with a Shopware App (not a plugin!), to forbid certain products?</p>
<p>Example:
I'm selling stuff with shipment in small stuff (DHL/UPS) and big stuff, with "your own truck" and I don't want to mix this in one order.</p>
<p>There is no event &qu... | <p>This should be doable with App Scripts. Here is the documentation about removing line items from the cart.</p>
<p><a href="https://developer.shopware.com/docs/guides/plugins/apps/app-scripts/cart-manipulation#remove-a-line-item" rel="nofollow noreferrer">https://developer.shopware.com/docs/guides/plugins/apps/app-sc... | Shopware 6: How to forbid products with an app | shopware|shopware6|shopware6-app | 0 | 46 | 2 | 72,979,331 | 72,979,331 | 2 | true | 2022-07-14T10:14:15.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Shopware 6: How to forbid products with an app<p>Is it possible with a Shopware App (not a plugin!), to forbid certain products?</p>
<p>Example:
I'm selling ... |
72,979,470 | Lambda function timeout<p>I have the following Lambda function set in AWS which have to return the params of
AWS Network Firewall:</p>
<pre><code>import boto3
import json
session = boto3.session.Session()
nf_client = session.client(
service_name = "network-firewall",
endpoint_url= "https://netwo... | <p>Lambda functions in a VPC never get assigned a public IP address, so they can't use an Internet Gateway directly. A Lambda function in a VPC has to be deployed in a private subnet, with a route to a NAT Gateway, in order to access things outside the VPC.</p>
<p>If your Lambda function doesn't need to access any VPC ... | Lambda function timeout | python-3.x|amazon-web-services|aws-lambda|boto3 | -1 | 46 | 1 | 72,980,236 | 72,980,236 | 2 | true | 2022-07-14T11:04:38.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Lambda function timeout<p>I have the following Lambda function set in AWS which have to return the params of
AWS Network Firewall:</p>
<pre><code>import boto... |
72,982,317 | unable to access req.socket.getPeerCertificate when using express on heroku<p>My issue is as follows:
I am working with self-signed server/client certificates in my nodejs app, and it's working fine when running the server locally (using the node https module) but it does not work when I deploy my app to heroku (using ... | <p>According to the <a href="https://help.heroku.com/3NTWIMNK/does-heroku-support-client-side-ssl-connections-a-k-a-two-way-authentication" rel="nofollow noreferrer">Heroku web page</a>, this is not supported.</p> | unable to access req.socket.getPeerCertificate when using express on heroku | node.js|express|heroku|https|tls1.2 | 0 | 46 | 1 | 72,982,378 | 72,982,378 | 2 | true | 2022-07-14T14:37:05.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
unable to access req.socket.getPeerCertificate when using express on heroku<p>My issue is as follows:
I am working with self-signed server/client certificate... |
72,978,963 | Use global positions to mutate list, in list of lists<p>I need to keep my data in a list of lists, but want to edit elements in the lists based on their overall position.</p>
<p>For instance:</p>
<pre><code>mylist = [['h','e','l','l','o'], ['w','o','r','l','d']]
</code></pre>
<p>I want to change position 5 as if it was... | <p>Here is the solution of your's question</p>
<pre><code># initializing list
input_list = [['h', 'e', 'l', 'l', 'o'], ['w', 'o', 'r', 'l', 'd']]
print("The initial list is : " + str(input_list))
length: int = 0
# define position(global index) where you want to update items in list
change_index = 5
## glo... | Use global positions to mutate list, in list of lists | python|list | 0 | 46 | 1 | 72,983,177 | 72,983,177 | 2 | true | 2022-07-14T10:21:41.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use global positions to mutate list, in list of lists<p>I need to keep my data in a list of lists, but want to edit elements in the lists based on their over... |
72,985,122 | Count the assocations in a list of lists<p>I have a list of lists in python:</p>
<pre><code>x=[['apple', 'banana', 'carrot'],['apple', 'banana'],['banana', 'carrot']]
</code></pre>
<p>I want to know the number of times two items are associated in an array.</p>
<p>My output would be like:</p>
<pre><code>{['apple', 'bana... | <p>You can accomplish this with itertools and collections (both of which are in the standard library):</p>
<pre><code>from collections import Counter
from itertools import combinations
x=[['apple', 'banana', 'carrot'],['apple', 'banana'],['banana', 'carrot']]
print(Counter(combo for sublist in x for combo in combinati... | Count the assocations in a list of lists | python | 0 | 46 | 1 | 72,985,240 | 72,985,240 | 2 | true | 2022-07-14T18:25:41.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Count the assocations in a list of lists<p>I have a list of lists in python:</p>
<pre><code>x=[['apple', 'banana', 'carrot'],['apple', 'banana'],['banana', '... |
72,982,728 | Index/Match formula: Differentiating rows with same values?<p>I have a table in sheet 1 which consists of customer referral dates, names, and referral statuses:</p>
<p><a href="https://i.stack.imgur.com/HML9Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HML9Y.png" alt="Sheet1" /></a></p>
<p>I then... | <p>If the data on <code>Sheet1</code> are always sorted in date order then the formula below will yield the correct name:</p>
<pre><code>=INDEX(Sheet1!$B$2:$B$8,MATCH(Sheet2!B3&"Open",Sheet1!$A$2:$A$8&Sheet1!$C$2:$C$8,0)-1+COUNTIF($B$3:B3,B3))
</code></pre>
<p>(this assumes that the dates are in colum... | Index/Match formula: Differentiating rows with same values? | excel|excel-formula | 1 | 46 | 1 | 72,988,050 | 72,988,050 | 2 | true | 2022-07-14T15:05:12.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Index/Match formula: Differentiating rows with same values?<p>I have a table in sheet 1 which consists of customer referral dates, names, and referral status... |
72,993,049 | adjust values which are associated with a string from a different column<p>I have a dataframe which I'd like to adjust the values which are associated with a string from a different column. Example, all values in column 'wgt' that is associated with 'joe' in the 'name' column to multiply 1.10.</p>
<p>original df</p>
<d... | <pre><code>df['wgt'] = np.where(df.name == "joe", df.wgt * 1.1, df.wgt)
</code></pre>
<p>or</p>
<pre><code>df.loc[df.name == "joe", "wgt"] *= 1.1
</code></pre> | adjust values which are associated with a string from a different column | python|pandas | 0 | 46 | 1 | 72,993,195 | 72,993,195 | 2 | true | 2022-07-15T11:07:26.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
adjust values which are associated with a string from a different column<p>I have a dataframe which I'd like to adjust the values which are associated with a... |
72,993,598 | How to subtract the last value from the first value for the same time<p>I have a csv file that looks like</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Time</th>
<th>OpenIA</th>
</tr>
</thead>
<tbody>
<tr>
<td>2022-07-15 10:00:23</td>
<td>1</td>
</tr>
<tr>
<td>2022-07-15 10:01:11</td>
<td... | <p>You can use <code>groupby</code>.<a href="https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.GroupBy.first.html" rel="nofollow noreferrer"><code>first</code></a>/<a href="https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.GroupBy.last.html" rel="nofollow noreferrer"><code>last</code></a>:... | How to subtract the last value from the first value for the same time | python|pandas | 1 | 46 | 2 | 72,993,668 | 72,993,668 | 2 | true | 2022-07-15T11:55:36.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to subtract the last value from the first value for the same time<p>I have a csv file that looks like</p>
<div class="s-table-container">
<table class="s... |
72,995,058 | How to count unique values on one column without double values from another column<p>My very first question as a newb in SQL.</p>
<p>I want to count unique values from one column <code>Transport</code>, group them by <code>ID</code> and delete double values in the <code>Transport</code> column that may be caused by <co... | <p>You can get a pivot by combining <code>CASE</code> with <code>MAX()</code>, as in:</p>
<pre><code>select
id,
max(case when transport = 'Plane' then 1 else 0 end) as plance,
max(case when transport = 'Train' then 1 else 0 end) as train,
max(case when transport = 'Ship' then 1 else 0 end) as ship
from t
group ... | How to count unique values on one column without double values from another column | mysql|sql | 0 | 46 | 2 | 72,995,438 | 72,995,438 | 2 | true | 2022-07-15T13:49:36.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to count unique values on one column without double values from another column<p>My very first question as a newb in SQL.</p>
<p>I want to count unique v... |
72,998,077 | Unable to unpack values in Python<p>I have a dictionary say</p>
<pre><code>a = { 'a': 'abc',
'b': 'xyz',
'c': 'yyy'
}
</code></pre>
<p>and another list of dictionaries say</p>
<pre><code>list_dict = [{'id': 5903032523805, 'value': 'aaa'}, {'id': 5903031568925, 'value': 'bbb'}, {'id': 5902976332061, 'value': 'ccc'}]
<... | <p>Please try using zip.</p>
<pre class="lang-py prettyprint-override"><code>for (i, j) in zip(list_dict, a.values()):
print(i['id'], j)
</code></pre>
<p>Output:</p>
<pre><code>5903032523805 abc
5903031568925 xyz
5902976332061 yyy
</code></pre> | Unable to unpack values in Python | python|python-3.x|python-2.7 | 0 | 46 | 1 | 72,998,125 | 72,998,125 | 2 | true | 2022-07-15T18:04:09.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to unpack values in Python<p>I have a dictionary say</p>
<pre><code>a = { 'a': 'abc',
'b': 'xyz',
'c': 'yyy'
}
</code></pre>
<p>and another list of d... |
73,006,727 | How to append subdirectories to a list in python<p>I would like to know how I can only append sub-directories of a given directory to a list in Python.</p>
<p>Something like this is not what I'm searching for as it outputs the files:</p>
<pre class="lang-py prettyprint-override"><code>filelist = []
for root, dirs, file... | <p>Just use the dirs variable instead the files variable, like this:</p>
<pre class="lang-py prettyprint-override"><code>dirs_list = []
for root, dirs, files in os.walk('test'):
for dir in dirs:
dirs_list.append(os.path.join(root, dir))
print(dirs_list)
</code></pre> | How to append subdirectories to a list in python | python | 0 | 46 | 1 | 73,006,780 | 73,006,780 | 2 | true | 2022-07-16T18:27:51.827Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to append subdirectories to a list in python<p>I would like to know how I can only append sub-directories of a given directory to a list in Python.</p>
<... |
73,009,684 | What is causing the Node.js "MaxListenersExceededWarning" warning?<p>I have this simple <code>Express.js</code> back-end server:</p>
<pre class="lang-js prettyprint-override"><code>const app = require("express")();
const dotenv = require("dotenv");
const bodyParser = require("body-parser")... | <p>That specific error means that your code (or the modules you are using) have added 11 handlers for the <code>process.on('uncaughtException', ...)</code> event.</p>
<p>This is typically an indication that some code is repeatedly adding the same event handler over and over again (in some other event handler such as in... | What is causing the Node.js "MaxListenersExceededWarning" warning? | javascript|node.js|express | 1 | 46 | 2 | 73,009,780 | 73,009,780 | 2 | true | 2022-07-17T06:37:35.220Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is causing the Node.js "MaxListenersExceededWarning" warning?<p>I have this simple <code>Express.js</code> back-end server:</p>
<pre class="lang-js pret... |
73,016,979 | JS MAY (behave differently on different runtime) not catch the rejected promise in setTimeout<p>In the following code.</p>
<pre class="lang-js prettyprint-override"><code>const p = Promise.reject();;
setTimeout(() => {
p.catch(() => console.log("Error caught"));
}, 0);
</code></pre>
<p>I expected <c... | <p>There must be at least one rejection handler attached to a Promise <em>at the moment that the Promise rejects</em> to avoid unhandled rejections. The Promise will have rejected (and the error will have been generated) by the time the timeout callback runs.</p>
<p>Your code produces an unhandled rejection in Chrome a... | JS MAY (behave differently on different runtime) not catch the rejected promise in setTimeout | javascript|node.js|google-chrome | 0 | 46 | 1 | 73,017,003 | 73,017,003 | 2 | true | 2022-07-18T03:18:21.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JS MAY (behave differently on different runtime) not catch the rejected promise in setTimeout<p>In the following code.</p>
<pre class="lang-js prettyprint-ov... |
73,018,651 | SQL sum up records with similar id<p>I have this table and I require to sum the payments and balance of the same id.</p>
<pre><code>ID BALANCE PAYMENT DATE
1 157 3 1/3/2021
1 157 4 3/3/2021
1 157 7 4/3/2021
1 157 8 9/3/2021
2 304 9 21/2/2021... | <p>I guess the tricky bit is getting 1 balance</p>
<pre><code>SELECT ID, MAX(BALANCE) BALANCE,MAX(BALANCE) + SUM(PAYMENT) TOTAL
FROM T
GROUP BY ID
</code></pre> | SQL sum up records with similar id | mysql|sql | 0 | 46 | 2 | 73,018,777 | 73,018,777 | 2 | true | 2022-07-18T07:27:59.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL sum up records with similar id<p>I have this table and I require to sum the payments and balance of the same id.</p>
<pre><code>ID BALANCE PAYMENT DA... |
72,997,221 | AWS CLI rm folder with a special character<p>I'm trying to delete an empty folder structure using the cli and noting seems to be working. The root folder is /+7000/ and I'm positive it's because of the "+"</p>
<p>My rm commands are working on other folders without special characters and the cli isn't returnin... | <p>If <code>aws s3 rm</code> isn't working, you can try the 'lower-level' API call:</p>
<pre><code>aws s3api delete-object --bucket namespace --key %2B7000/
</code></pre>
<p>Given that you said that <code>%2B</code> is plus, and based on your comment, you can use:</p>
<pre><code>aws s3api delete-object --bucket namespa... | AWS CLI rm folder with a special character | amazon-web-services|amazon-s3|special-characters|aws-cli | 0 | 46 | 1 | 73,029,903 | 73,029,903 | 2 | true | 2022-07-15T16:41:48.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AWS CLI rm folder with a special character<p>I'm trying to delete an empty folder structure using the cli and noting seems to be working. The root folder is ... |
73,030,999 | Python: Iterating through string with a for loop returns two lines when printing<p>I have written this little program to change camelCase function descriptions into snake_case descriptions.</p>
<pre><code>def main():
#Get input and pass it to function
string = input("Camelcase: ")
make_snake(strin... | <p>You need to wait till all letters have processed to print the converted string.</p>
<pre><code>>>> def make_snake(string):
... for char in string:
... if char.isupper():
... string = string.replace(char, "_"+ (char))
... string_new = string.lower()
... print("s... | Python: Iterating through string with a for loop returns two lines when printing | python|for-loop|replace|iteration | 0 | 46 | 1 | 73,031,042 | 73,031,042 | 2 | true | 2022-07-19T04:06:30.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Iterating through string with a for loop returns two lines when printing<p>I have written this little program to change camelCase function descriptio... |
72,978,850 | Can the remove button gap in vis-timelne be suppressed?<p>In vis-timeline, if stacking is not enabled (default), there seems to be an enforced gap between two items on the same line, such that two items can never touch. It appears to me, that this gap is enforced to have always enough space for the remove button, which... | <p>You can adjust the horizontal item margin in vis-timeline using the <code>margin.item.horizontal</code> option described in the documentation at <a href="https://visjs.github.io/vis-timeline/docs/timeline/#Configuration_Options" rel="nofollow noreferrer">https://visjs.github.io/vis-timeline/docs/timeline/#Configurat... | Can the remove button gap in vis-timelne be suppressed? | javascript|vis-timeline | 2 | 46 | 1 | 73,040,373 | 73,040,373 | 2 | true | 2022-07-14T10:12:57.413Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can the remove button gap in vis-timelne be suppressed?<p>In vis-timeline, if stacking is not enabled (default), there seems to be an enforced gap between tw... |
73,012,325 | How to animate in OpenModelica 1.19.0 using DynamicSelect<p>Per the documentation for <a href="https://www.openmodelica.org/" rel="nofollow noreferrer">OpenModelica</a> , <a href="https://build.openmodelica.org/Documentation/ModelicaReference.Annotations.DynamicSelect.html" rel="nofollow noreferrer">DynamicSelect</a>,<... | <p>Changing the size of the rectangle works in Dymola:</p>
<p><a href="https://i.stack.imgur.com/9UvX0.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9UvX0.gif" alt="enter image description here" /></a></p>
<p>But it seems like the current version of OMEdit (v1.19.2) does not fully support DynamicSe... | How to animate in OpenModelica 1.19.0 using DynamicSelect | animation|visualization|system|modelica|openmodelica | 0 | 46 | 1 | 73,048,658 | 73,048,658 | 2 | true | 2022-07-17T13:48:31.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to animate in OpenModelica 1.19.0 using DynamicSelect<p>Per the documentation for <a href="https://www.openmodelica.org/" rel="nofollow noreferrer">OpenM... |
72,863,825 | Assign unique id inside of groups (with duplicated records)<p>I have a DataFrame looks like this:</p>
<pre><code>df = pd.DataFrame({'type': ['A', 'A', 'A', 'B', 'B', 'B', 'B', 'B','C','C','C','D','D'],
'value': [1, 1, 2, 3, 4, 5, 5, 5, 6, 6, 7, 7, 8],
})
</code></pre>
<p>I would lik... | <p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.DataFrameGroupBy.rank.html" rel="nofollow noreferrer"><code>DataFrameGroupBy.rank</code></a>:</p>
<pre><code>df['id'] = df.groupby('type')['value'].rank('dense').astype(int)
print (df)
type value id
0 A 1 1
1 ... | Assign unique id inside of groups (with duplicated records) | python|pandas | 1 | 46 | 2 | 72,863,880 | 72,863,880 | 2 | true | 2022-07-05T03:53:12.723Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Assign unique id inside of groups (with duplicated records)<p>I have a DataFrame looks like this:</p>
<pre><code>df = pd.DataFrame({'type': ['A', 'A', 'A', '... |
72,789,924 | Check for objects in JSON other than the one mentioned in a condition<p>I need to check if there are exit codes other than <code>0</code> in the JSON file below.</p>
<pre class="lang-json prettyprint-override"><code>{
"domains": {
"app1": {
"status": "Running&q... | <p>You do have multiple issues in your failing condition:</p>
<ol>
<li><code>when</code> and its <code>*_when</code> derivates should never be templated — so you should get rid of the expressions delimiters <code>{{ ... }}</code></li>
<li>you are using a property <code>stdout</code> on your <code>jsondata</code> fact, ... | Check for objects in JSON other than the one mentioned in a condition | json|ansible|jmespath|json-query | 2 | 46 | 1 | 72,791,983 | 72,791,983 | 2 | true | 2022-06-28T16:13:39.210Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check for objects in JSON other than the one mentioned in a condition<p>I need to check if there are exit codes other than <code>0</code> in the JSON file be... |
72,829,613 | I have 3 lists of numbers, how do I make a list which will contain all the numbers by their indexes?<p>I have 3 lists:</p>
<pre><code>list1 = [1, 2, 3]
list2 = [4, 5, 6]
list3 = [7, 8, 9]
</code></pre>
<p>And I need to write a function that will return this list:
[1, 4, 7, 2, 5, 8, 3 ,6 ,9]
How can I do that?</p> | <pre><code># Your lists
list1 = [1, 2, 3]
list2 = [4, 5, 6]
list3 = [7, 8, 9]
new_list = [list1, list2, list3]
new_list = list(map(list, zip(*new_list)))
print(sum(new_list,[])) # Output: [1, 4, 7, 2, 5, 8, 3 ,6 ,9]
</code></pre>
<blockquote>
<p>Expalnation:</p>
</blockquote>
<p><strong>Map:</strong></p>
<p>The <cod... | I have 3 lists of numbers, how do I make a list which will contain all the numbers by their indexes? | python | -3 | 46 | 2 | 72,829,791 | 72,829,791 | 2 | true | 2022-07-01T12:56:32.107Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I have 3 lists of numbers, how do I make a list which will contain all the numbers by their indexes?<p>I have 3 lists:</p>
<pre><code>list1 = [1, 2, 3]
list2... |
72,832,859 | add days to given timestamp (YYYY-mm-dd HH:MM:SS.sss) in lua script<h3>Summary</h3>
<p>I would like to add 1 day to given timestamp in lua script.</p>
<h3>My try</h3>
<pre><code>local creation_date = "2016-01-01 00:00:00.000"
local y, m, d, Hr, Min, Sec, Milli = creation_date:match '(%d+)-(%d+)-(%d+) (%d+):... | <p>The closest you may be able to get is something like this:</p>
<pre class="lang-lua prettyprint-override"><code>local creation_date = "2016-01-01 00:00:00.000"
local y, m, d, Hr, Min, Sec, Milli = creation_date:match '(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+).(%d+)'
local dt = y .. '-' .. m .. '-'..d.. ' '..Hr... | add days to given timestamp (YYYY-mm-dd HH:MM:SS.sss) in lua script | lua | 0 | 46 | 1 | 72,833,012 | 72,833,012 | 2 | true | 2022-07-01T17:35:56.400Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
add days to given timestamp (YYYY-mm-dd HH:MM:SS.sss) in lua script<h3>Summary</h3>
<p>I would like to add 1 day to given timestamp in lua script.</p>
<h3>My... |
73,014,635 | Split tuple / collection into instances of pattern<p>I have a tuple [but it can be any collection] that contains elements:</p>
<pre><code>tple = (1.02, 'a', 'b', 1.02, 'a', 'b')
</code></pre>
<p>I'm trying to find a way to count the number of times the pattern <code>(1.02, 'a', 'b')</code> occurs within the tuple. The... | <p>One approach using <a href="https://docs.python.org/3/library/itertools.html#module-itertools" rel="nofollow noreferrer">itertools</a>:</p>
<pre><code>from itertools import tee
def wise(iterable):
"""Iterate over contiguous overlapping chunks"""
a, b, c = tee(iterable, 3)
... | Split tuple / collection into instances of pattern | python | -1 | 46 | 3 | 73,014,675 | 73,014,675 | 2 | true | 2022-07-17T19:11:56.887Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Split tuple / collection into instances of pattern<p>I have a tuple [but it can be any collection] that contains elements:</p>
<pre><code>tple = (1.02, 'a', ... |
72,855,315 | What is the gradient of d^2f/dxdy on image<p>On my knowledge, 1st gradient of the image pixel on <code>x</code> can be approximated by <code>df/dx = f(x-1, y) - f(x+1, y)</code>, and <code>df/dy = f(x, y-1) - f(x, y+1)</code></p>
<p>Question is, how can I compute the 2st gradient of <code>d^2f/dxdy</code>?</p> | <p>Just go deeper (Leonardo Dicaprio pic):</p>
<pre><code>G = df/dx = f(x+1, y) - f(x-1,y)
Result = d^2f/dxdy
= dG/dy
= (f(x+1, y+1) - f(x-1,y+1)) - (f(x+1, y-1) - f(x-1,y+1))
</code></pre> | What is the gradient of d^2f/dxdy on image | image-processing | 0 | 46 | 2 | 72,855,702 | 72,855,702 | 2 | true | 2022-07-04T10:29:24.517Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the gradient of d^2f/dxdy on image<p>On my knowledge, 1st gradient of the image pixel on <code>x</code> can be approximated by <code>df/dx = f(x-1, y... |
72,799,042 | How can I use a show more posts button<p>I just wan't to hide show more posts button if there aren't any posts. so I created showLoad function and isLoad state but I have no idea how to use this.</p>
<p>the show button is on the isLoad ? section. thank you for your help!</p>
<p>posts.tsx</p>
<pre class="lang-js prettyp... | <p>you don't need to use <code>isLoad</code> state, you can check if the <code>filteredList.length > 4</code> and <code>loadMore <= filteredList.length)</code>, so your <code>loadMore</code> icon will be showed otherwise hidden.</p>
<pre><code>{((filteredList.length > 4) && (loadMore <= filteredList... | How can I use a show more posts button | reactjs|typescript|next.js | 0 | 46 | 1 | 72,799,256 | 72,799,256 | 2 | true | 2022-06-29T09:30:35.357Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I use a show more posts button<p>I just wan't to hide show more posts button if there aren't any posts. so I created showLoad function and isLoad sta... |
72,861,363 | How do I make my calculator this to calculate in degrees rather than radians<p>I have been stuck on this for a very long bit of time. How do I make my calculator calculate in degrees rather than radians. I tried Math.toDegrees but it did not work. Thank you if you decide to help.</p>
<p>import java.util.Scanner;</p>
<p... | <p>use <code>Math.toRadians()</code>, You want to convert the degrees to radians because the Math trigonometric functions parameters should be in radians:</p>
<pre><code>public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// END USER INPUT VALUE IN DEGR... | How do I make my calculator this to calculate in degrees rather than radians | java|android|calculator|degrees|radians | -1 | 46 | 2 | 72,861,384 | 72,861,384 | 2 | true | 2022-07-04T19:42:27.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I make my calculator this to calculate in degrees rather than radians<p>I have been stuck on this for a very long bit of time. How do I make my calcul... |
72,992,655 | Summing command return codes<p>I have the following powershell script that runs our unit tests:</p>
<pre><code>Get-ChildItem -Path . -Recurse -Include *.Tests.csproj |
%{dotnet test $PSItem.FullName}
</code></pre>
<p>However, since we started using a for loop, it no longer returns a non zero value on a failed test. I s... | <p>I assume that by <em>return code</em> you mean process <em>exit codes</em>.</p>
<p>PowerShell reflects the exit code of the most recently executed external program (such as <code>dotnet</code> in this case) in the <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_Autom... | Summing command return codes | .net|powershell | 1 | 46 | 2 | 72,993,774 | 72,993,774 | 2 | true | 2022-07-15T10:33:07.237Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Summing command return codes<p>I have the following powershell script that runs our unit tests:</p>
<pre><code>Get-ChildItem -Path . -Recurse -Include *.Test... |
73,009,147 | How were MSIs created originally?<p>I can't find a single thing online that describes an old tool created by Microsoft for creating MSI files. How did MS expect people to make MSIs when the feature was added to Windows?</p> | <p>If you are asking about the very first tool the Windows Installer team used to create MSI databases, that would be <code>msidb.exe</code>. <code>msidb.exe</code> was used to import tables into the MSI using the tab-delimited text archive file format known as <code>.idt</code> files. The <a href="https://docs.microso... | How were MSIs created originally? | windows-installer | 0 | 46 | 2 | 73,016,425 | 73,016,425 | 2 | true | 2022-07-17T03:52:45.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How were MSIs created originally?<p>I can't find a single thing online that describes an old tool created by Microsoft for creating MSI files. How did MS exp... |
72,913,816 | Substitute certain values in vector conditionally, based on run-length-encoding [R]<p>I have some numeric vectors of various lengths. Each of them may contain three types of values: 0s, 1s and -1s, but mostly 0s. I would like to replace 0s with neighboring values based on 2 conditions (both of them must be met for repl... | <p>Try this:</p>
<pre class="lang-r prettyprint-override"><code>fun <- function(z) {
r <- rle(z)
ind <- r$lengths < 3 & r$values == 0 & c(Inf, r$values[-length(r$values)]) == c(r$values[-1], Inf)
if (any(ind)) r$values[ind] <- r$values[which(ind)-1]
inverse.rle(r)
}
### in a list here ju... | Substitute certain values in vector conditionally, based on run-length-encoding [R] | r|substitution|run-length-encoding | 0 | 46 | 2 | 72,914,415 | 72,914,415 | 2 | true | 2022-07-08T15:38:01.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Substitute certain values in vector conditionally, based on run-length-encoding [R]<p>I have some numeric vectors of various lengths. Each of them may contai... |
72,988,178 | Encoding Hash in javascript gives different result compared to python<p>I am trying to convert a javascript program into python but I am getting different results, after creating the hash they are the same but after encoding the results they are way off the python one as it is much longer then the javascript version.<... | <p>You encoded two different things between the Node.js and Python. In Node.js you directly used the raw (bytes value of the) hash, while in Python you used the hex encoded value of the same hash. Depending on which output you desire, you will need to either stringify the hex output in Node.js, or base64 encode the r... | Encoding Hash in javascript gives different result compared to python | javascript|python|base64|encode | 0 | 46 | 1 | 72,988,791 | 72,988,791 | 2 | true | 2022-07-15T01:27:46.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Encoding Hash in javascript gives different result compared to python<p>I am trying to convert a javascript program into python but I am getting different re... |
72,803,139 | Why doesn't RabbitMQ need a schema registry, when Kafka needs it?<p>If Kafka needs, because there may be a lot of messages in the queue. The same can happen to Rabbit if you don’t read it.</p>
<p>Required this registry for Kafka, if you are using Arvo or Protobuf. So, the Java class can be generated from Arvo or Protob... | <p>Kafka doesn't require it, and there's nothing preventing you from serializing your own byte arrays with a schema registry client before sending/after consuming from any other message queue.</p>
<p>The benefit of the Registry is for allowing compatibility between decoupled clients , not a limitation or requirement of... | Why doesn't RabbitMQ need a schema registry, when Kafka needs it? | apache-kafka|rabbitmq | 0 | 46 | 1 | 72,803,599 | 72,803,599 | 2 | true | 2022-06-29T14:29:56.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why doesn't RabbitMQ need a schema registry, when Kafka needs it?<p>If Kafka needs, because there may be a lot of messages in the queue. The same can happen ... |
72,959,289 | Remove data frame rows if keys contain a case-insensitve substring<p>I have a dataset like the following:</p>
<pre><code>FirstName Letter
Alexsmith A1
ThegreatAlex A6
AlexBobJones1 A7
Bobsmiles222 A1
Christopher A9
Christofer A6
</code></pre>
<p>I want to remove all rows that contain, for... | <pre><code>dat <- structure(list(FirstName = c("Alexsmith", "ThegreatAlex", "AlexBobJones1",
"Bobsmiles222", "Christopher", "Christofer"), Letter = c("A1",
"A6", "A7", "A1", "A9", "A6")), class =... | Remove data frame rows if keys contain a case-insensitve substring | r|string|dataframe|substring | 1 | 46 | 2 | 72,959,307 | 72,959,307 | 2 | true | 2022-07-12T23:17:08.570Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove data frame rows if keys contain a case-insensitve substring<p>I have a dataset like the following:</p>
<pre><code>FirstName Letter
Alexsmith A1... |
73,028,939 | Matching value with column to retrieve index value<p>Please see example dataframe below:
I'm trying match values of columns X with column names and retrieve value from that matched column</p>
<p>so that:</p>
<pre><code>A B C X result
1 2 3 B 2
5 6 7 A 5
8 9 1 C 1
</code></pre>
<p>Any ideas?</p> | <p>Here are a couple of methods:</p>
<pre><code># Apply Method:
df['result'] = df.apply(lambda x: df.loc[x.name, x['X']], axis=1)
# List comprehension Method:
df['result'] = [df.loc[i, x] for i, x in enumerate(df.X)]
# Pure Pandas Method:
df['result'] = (df.melt('X', ignore_index=False)
.loc[lambda ... | Matching value with column to retrieve index value | python|pandas | 1 | 46 | 2 | 73,029,961 | 73,029,961 | 2 | true | 2022-07-18T21:43:52.917Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Matching value with column to retrieve index value<p>Please see example dataframe below:
I'm trying match values of columns X with column names and retrieve ... |
72,903,624 | replace a partial substring in notepad++<p>I need to find a certain pattern in notepad++ and delete all of it. So the lines might be something like:</p>
<pre><code>1,2,c(0,9,3),5,7,9,2
2,3,c(4,7,2),5,4,3,1
</code></pre>
<p>and I want to get back:</p>
<pre><code>1,2,5,7,9,2
2,3,5,4,3,1
</code></pre>
<p>how should I do t... | <ol>
<li>Open the replace dialog</li>
<li>Select the radio button for regular expressions</li>
<li>Use the search pattern</li>
</ol>
<pre><code>^(.*?),c\(.*?\)(.*?$)
</code></pre>
<ol start="4">
<li>Replace it by</li>
</ol>
<pre><code>$1$2
</code></pre>
<p>This should match your lines and the both capture groups captur... | replace a partial substring in notepad++ | regex|notepad++ | -1 | 46 | 1 | 72,903,688 | 72,903,688 | 2 | true | 2022-07-07T20:03:40.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
replace a partial substring in notepad++<p>I need to find a certain pattern in notepad++ and delete all of it. So the lines might be something like:</p>
<pre... |
72,913,705 | Why can't I get the task number from this HTML table when clicking on a button in the same row?<p>I've been trying to adjust this <a href="https://stackoverflow.com/a/63242115/11832197">solution</a> to my situation, but I don't seem to be able to get the column containing the task numbers.</p>
<p>Here's the <a href="ht... | <p>You can find the solution for your problem <a href="https://jsfiddle.net/puwc9nLo/1/" rel="nofollow noreferrer">here</a>. In your example, the value of event.target.parentNode would be the td within which the button is placed. To obtain the tr of the button, you need to get the parent of td and then get innerText to... | Why can't I get the task number from this HTML table when clicking on a button in the same row? | javascript | 0 | 46 | 2 | 72,913,919 | 72,913,919 | 2 | true | 2022-07-08T15:28:27.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can't I get the task number from this HTML table when clicking on a button in the same row?<p>I've been trying to adjust this <a href="https://stackoverf... |
72,874,847 | Can an anonymous function be used with a null coalescing operator?<p>I'm trying to supply a function as the false choice with a null coalescing operator.</p>
<p>Example:</p>
<pre><code>$a = [0 => 'x'];
$value = $a[1] ?? (function () { return 'z'; });
</code></pre>
<p>What I receive as a return is {closure} containin... | <p>Your code will work. You probably have an error when using <em>$value</em> later in code. You need to check if <em>$value</em> contains a closure, and if yes, it needs to be executed to get the string:</p>
<pre><code>$a = [0 => 'x'];
$value = $a[1] ?? fn() => 'z';
// fn() => 'z'
// ... is the arrow notation... | Can an anonymous function be used with a null coalescing operator? | php|anonymous-function|null-coalescing-operator | -1 | 46 | 2 | 72,875,053 | 72,875,053 | 2 | true | 2022-07-05T19:52:43.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can an anonymous function be used with a null coalescing operator?<p>I'm trying to supply a function as the false choice with a null coalescing operator.</p>... |
72,847,637 | How do you get all of the top N types within an ordered MongoDB collection?<p>Assume I have a collection that looks something like this:</p>
<pre class="lang-js prettyprint-override"><code>[{
_id: new ObjectId(),
type: 'foo',
value: 123,
date: '2022-06-30',
}, {
_id: new ObjectId(),
type: 'bar',... | <p>Since mongoDB version 5.0 you can use <code>$setWindowFields</code> for this:</p>
<ol>
<li>The <code>$setWindowFields</code> allows to sort according to the <code>date</code> and add a new field to each document, with a set of the <code>type</code>s "so far".</li>
<li>Now we just need to match only documen... | How do you get all of the top N types within an ordered MongoDB collection? | mongodb|aggregation-framework | 0 | 46 | 1 | 72,852,763 | 72,852,763 | 2 | true | 2022-07-03T15:15:09.617Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do you get all of the top N types within an ordered MongoDB collection?<p>Assume I have a collection that looks something like this:</p>
<pre class="lang... |
72,830,336 | debounce closure shared by two functions<p>i am implementing debounce function. and i was able to successfully write the function then a confusing thought came to mind.</p>
<pre><code> function debounce(fn, timeout) {
let timeoutRef;
return function (...args) {
const context = this;
... | <blockquote>
<p>in the above code, don't debouncedFoo and debouncedBar share same
closure variable timeoutRef ?</p>
</blockquote>
<p>No they not sharing the same closure. in fact function parameters "fn" and "timeout" are also bounded in closure scope it means there are there parameter which is boun... | debounce closure shared by two functions | javascript|closures|debounce | 0 | 46 | 1 | 72,830,707 | 72,830,707 | 2 | true | 2022-07-01T13:52:22.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
debounce closure shared by two functions<p>i am implementing debounce function. and i was able to successfully write the function then a confusing thought ca... |
72,986,691 | Pass multiples values as single parameter - Oracle SQL query<p>I have this query that I'm passing 2 parameters, COUNTRY_REGION parameter and COST_CENTER parameter</p>
<p>I have the possibility to pass both parameters at the same time COST_CENTER and COUNTRY_REGION..... Or pass one or the other... This part is OK.</p>
<... | <p>You cannot pass multiple values with a single bind variable.</p>
<p>What you can do is pass in a single string that contains a delimited list and match a sub-string of the list to the value:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT *
FROM table_name
WHERE ', ' || :country_region_list || ', ' LI... | Pass multiples values as single parameter - Oracle SQL query | sql|oracle|plsql | 0 | 46 | 1 | 72,986,772 | 72,986,772 | 2 | true | 2022-07-14T21:09:16.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pass multiples values as single parameter - Oracle SQL query<p>I have this query that I'm passing 2 parameters, COUNTRY_REGION parameter and COST_CENTER para... |
72,852,243 | why my sessiosn are not working in codeigniter 3?<p>I am using codeigniter-3 for developing the web part, i am using sessions for maintaining the user data once the user login if i click on any page or button the page is redirect to the login page.</p>
<p>i have two projects of codeigniter-3 if i launch the project-1 i... | <p>In order to resolve your issue we have to dive in to the project,anyway I was thinking in your project might be some checks like is_logged_in or user_logged_in as true because of this the page is return back to the login screen.</p>
<p>You have to add one more key value pair in $userdata array.before that you must ... | why my sessiosn are not working in codeigniter 3? | php|codeigniter|session|codeigniter-3|session-cookies | 1 | 46 | 1 | 72,852,523 | 72,852,523 | 2 | true | 2022-07-04T05:49:28.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why my sessiosn are not working in codeigniter 3?<p>I am using codeigniter-3 for developing the web part, i am using sessions for maintaining the user data o... |
72,839,314 | Why my set approach works in some cases and failed in others?<p><a href="https://leetcode.com/problems/keyboard-row/" rel="nofollow noreferrer">Leetcode 500</a></p>
<p>I tried to solve with set in python .
for most case my code works.</p>
<pre><code>class Solution:
def findWords(self, words: List[str]) -> List[str]:... | <p>You're removing items from the same list you're iterating over.</p>
<p>Better would be to only collect the ones that do match, and return those:</p>
<pre class="lang-py prettyprint-override"><code>def answer():
...
valid_words = []
for word in words:
if ...:
valid_words.append(word)
... | Why my set approach works in some cases and failed in others? | python|set | -1 | 46 | 2 | 72,839,360 | 72,839,360 | 2 | true | 2022-07-02T13:12:39.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why my set approach works in some cases and failed in others?<p><a href="https://leetcode.com/problems/keyboard-row/" rel="nofollow noreferrer">Leetcode 500<... |
72,894,477 | Sum individual elements in a list<p>I am trying to sum a list of "individual" elements in a list. I have seen a lot of posts using sum but these only sum the entire list not the individual numbers within the list. This is typically used in numerology and therefore needs to sum and resolve each element to it's... | <p>It looks like you want to sum the <strong>digits</strong> of each number.</p>
<p>You could use an intermediate conversion to string within a list comprehension:</p>
<pre><code>numsum = [1, 23, 45, 76, 123]
out = [sum(map(int, str(n))) for n in numsum]
</code></pre>
<p>A more numerical approach might be to use a rep... | Sum individual elements in a list | python|python-3.x | -2 | 46 | 2 | 72,894,492 | 72,894,492 | 2 | true | 2022-07-07T08:18:45.837Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sum individual elements in a list<p>I am trying to sum a list of "individual" elements in a list. I have seen a lot of posts using sum but these on... |
72,952,543 | Python Pandas merge list of keys on separate dataframe<p>Im new to pandas and having trouble trying to merge data on specific 'keys'. I have a dataframe that contains rows, each row contains a column that has a list of keys. Im trying to merge each key if it matches to the column header of a different data frame.</p>
... | <p>We can convert the DataFrame <code>df2</code> to a dictionary using <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_dict.html" rel="nofollow noreferrer"><code>pandas.DataFrame.to_dict</code></a>. And then using <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.map.html" re... | Python Pandas merge list of keys on separate dataframe | python|pandas|dataframe | 2 | 46 | 1 | 72,952,799 | 72,952,799 | 2 | true | 2022-07-12T12:43:49.317Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Pandas merge list of keys on separate dataframe<p>Im new to pandas and having trouble trying to merge data on specific 'keys'. I have a dataframe that... |
72,790,827 | Appending items in a nested python dictionary<p>I have a nested python dictionary in the following format</p>
<pre><code>{"exist":{"name":["a","b"],"country":["US"],"team":["SP","FR"]}, "not_exist":{}}
</code></pre>
<p>I... | <p>You can also use <code>|</code> operator (for python 3.9+) between dicts:</p>
<pre class="lang-py prettyprint-override"><code>dct1 = {"exist":{"name":["a","b"],"country":["US"],"team":["SP","FR"]}, "not_exist":{}}
dct... | Appending items in a nested python dictionary | python | -3 | 46 | 3 | 72,790,876 | 72,790,876 | 2 | true | 2022-06-28T17:28:01.917Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Appending items in a nested python dictionary<p>I have a nested python dictionary in the following format</p>
<pre><code>{"exist":{"name"... |
72,970,565 | Printing and replacing multiple lines<p>I have a list with some numbers, for example:</p>
<p><code>list = [0, 1, 2, 3, 4]</code></p>
<p>And need my output to be:</p>
<pre><code>0
1
2
</code></pre>
<p>And then replace the output in the terminal to be:</p>
<pre><code>1
2
3
</code></pre>
<p>And so on. I tried using <code>... | <p>If your terminal supports it, you can use the <a href="https://www.cse.psu.edu/%7Ekxc104/class/cse472/09s/hw/hw7/vt100ansi.htm" rel="nofollow noreferrer">VT100 escape sequence</a> <code><ESC>[{COUNT}A</code>, for example:</p>
<pre><code>n = 3
move_cursor_vt100 = f'\x1b[{n+1}A'
L = [0, 1, 2, 3, 4]
for i in ra... | Printing and replacing multiple lines | python|list | 0 | 46 | 2 | 72,970,919 | 72,970,919 | 2 | true | 2022-07-13T17:48:04.713Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Printing and replacing multiple lines<p>I have a list with some numbers, for example:</p>
<p><code>list = [0, 1, 2, 3, 4]</code></p>
<p>And need my output to... |
72,950,989 | Range by using array of booleans<p>hey guys I'm working a the range function for grades in the existing system that was already built,
the grades are stored as an array of booleans so for example:</p>
<pre><code>[true, true, true, true, true, true, false, false, false...]
</code></pre>
<p>grade number is <code>element ... | <p>Looping is obviously the most simplest way. There is no more efficient way unless we get to know more strict constraints or any modifications being done while storing the data itself.</p>
<p>There sure is a one liner for this where you can get the size of the range. So, the range is obviously <code>1 - size</code>. ... | Range by using array of booleans | php|arrays|boolean|range | 0 | 46 | 2 | 72,951,432 | 72,951,432 | 2 | true | 2022-07-12T10:40:43.440Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Range by using array of booleans<p>hey guys I'm working a the range function for grades in the existing system that was already built,
the grades are stored ... |
72,882,808 | Django sequentially link tables through ForeignKey<p>I have a User Following Django Models system based on one posted <a href="https://stackoverflow.com/questions/58794639/how-to-make-follower-following-system-with-django-model">here</a>.</p>
<p>How can I get all Post objects of that a user follows, having two models: ... | <p>This will return all posts that a user follows</p>
<pre><code>user_instance = User.objects.only('id').get(pk=num)
following_users = UserFollowing.objects.filter(
user_id=user_instance
).values('following_user_id')
posts = Posts.objects.filter(user__in=following_users)
</code></pre> | Django sequentially link tables through ForeignKey | python|django|django-queryset|django-related-manager | 0 | 46 | 1 | 72,883,224 | 72,883,224 | 2 | true | 2022-07-06T11:28:04.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django sequentially link tables through ForeignKey<p>I have a User Following Django Models system based on one posted <a href="https://stackoverflow.com/ques... |
72,919,710 | c# how to use ProgressChanged event of BackgroundWorker to do UI actions in the middle of thread<p>Here is simple code which has UI actions in the middle of backgroundworker.
There is a form and a label "lbProgress" on it.
When ProgressPercentage = 2, label is not changed but the action does.</p>
<pre><code> ... | <p>This is my answer to your question "Why do I see this behaviour?":</p>
<p>From the documentation of <a href="https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.backgroundworker.reportprogress" rel="nofollow noreferrer">ReportProgress</a>:</p>
<blockquote>
<p>The call to the ReportProgress me... | c# how to use ProgressChanged event of BackgroundWorker to do UI actions in the middle of thread | c#|backgroundworker|reportprogress | 0 | 46 | 1 | 72,929,132 | 72,929,132 | 2 | true | 2022-07-09T07:30:49.113Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
c# how to use ProgressChanged event of BackgroundWorker to do UI actions in the middle of thread<p>Here is simple code which has UI actions in the middle of ... |
72,962,939 | Anonymous pulls: is Docker Hub rate limit counted separately for two repositories?<p>.. or do all <em>anonymous</em> pulls made from the same IP address (e.g. corporate NAT) get aggregated and collectively count towards that single limit, regardless of the fact that the two Hub repo names are distinct? By that I mean D... | <p>Anonymous pulls are limited to 100 pulls per 6 hours per IP address. These are pulls and API requests that are not authenticated with username and password.</p>
<p>For authenticated users, it is 200 pulls per 6 hour period and is separate from IP address rate limits, and is separate for every user. However, <strong>... | Anonymous pulls: is Docker Hub rate limit counted separately for two repositories? | docker|authentication|rate-limiting|dockerhub|quota | 0 | 46 | 1 | 72,963,368 | 72,963,368 | 2 | true | 2022-07-13T08:12:47.360Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Anonymous pulls: is Docker Hub rate limit counted separately for two repositories?<p>.. or do all <em>anonymous</em> pulls made from the same IP address (e.g... |
72,984,358 | Javascript 2d array select around from single point<p>Say I have a 15x15 2d array</p>
<pre class="lang-js prettyprint-override"><code> [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0... | <p>One way is with a somewhat <a href="https://www.google.com/search?q=spiral+matrix" rel="nofollow noreferrer">spiral matrix walk</a>, but instead of a "square" walk, yours will be diagonal / "diamond" shape. Additionally, we don't really care about the "connectiveness" of the path, so I'... | Javascript 2d array select around from single point | javascript|arrays|multidimensional-array | 1 | 46 | 1 | 72,985,040 | 72,985,040 | 2 | true | 2022-07-14T17:17:53.057Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript 2d array select around from single point<p>Say I have a 15x15 2d array</p>
<pre class="lang-js prettyprint-override"><code> [0, 0, 0, 0, 0, 0, ... |
72,874,925 | Is it possible to make a column plot using ggplot in which the column fill is controlled by a third variable?<p>I have a data frame with three continuous variables (x,y,z). I want a column plot in which x defines the x-axis position of the columns, y defines the length of the columns, and the column colors (function o... | <p>It looks like you have 3 X values that each appear 5, 10, or 15 times. Do you want the bars to be overlaid on top of one another, as they are now? If you add an alpha = 0.5 to the geom_col call you'll see the overlapping bars.</p>
<p>Alternatively, you might use dodging to show the bars next to one another instead o... | Is it possible to make a column plot using ggplot in which the column fill is controlled by a third variable? | r|ggplot2|fill|geom-col | 0 | 46 | 2 | 72,875,026 | 72,875,026 | 2 | true | 2022-07-05T20:00:16.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to make a column plot using ggplot in which the column fill is controlled by a third variable?<p>I have a data frame with three continuous var... |
72,789,104 | Why can’t back ticks be used to extract type defination in Typescript<p>I ran in to the following situation and I couldn't find the possible reason the caused error (<code>TS1005: ']' expected.</code>).</p>
<pre><code>interface IconProps0 {
size: string,
type: string
}
interface IconProps {
iconType?: Icon... | <p><a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#template-literal-types" rel="nofollow noreferrer">Template literal types</a> of the form <code>`foo${Bar}`</code> were introduced in TypeScript 4.1 and cannot be used in earlier versions. They are useful for string interpolation... | Why can’t back ticks be used to extract type defination in Typescript | reactjs|typescript | 0 | 46 | 1 | 72,789,430 | 72,789,430 | 3 | true | 2022-06-28T15:16:21.170Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can’t back ticks be used to extract type defination in Typescript<p>I ran in to the following situation and I couldn't find the possible reason the cause... |
72,792,272 | Rust lifetime of string slices within a vector within a struct<p>While writing a program of mine, I came across a structure containing a vector of strings. My (basic) knowledge of Rust led me to wonder whether a <code>Vec<&str></code> within a structure like this:</p>
<pre class="lang-rust prettyprint-overrid... | <p>A <code>&str</code> takes up two <code>usize</code>s of memory (not including the string data its referencing) while a <code>String</code> takes up three <code>usize</code>s. But if this matters to you, then you can replace <code>String</code> with <code>Box<str></code> to get the same size as a <code>&... | Rust lifetime of string slices within a vector within a struct | string|memory|vector|rust | 0 | 46 | 2 | 72,792,695 | 72,792,695 | 3 | true | 2022-06-28T19:39:53.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rust lifetime of string slices within a vector within a struct<p>While writing a program of mine, I came across a structure containing a vector of strings. M... |
72,797,639 | How I can solve this error in setValues function "The parameters (number[]) don't match the method signature for SpreadsheetApp.Range.setValues"<p>I'm pre-filling a Google form with AppScript, finally I'm saving the urls in an array.</p>
<pre><code>var formCol = SpreadsheetApp.getActive().getRangeByName('FORM');
var fo... | <h3>Modification points:</h3>
<ul>
<li>In your script, <code>urls</code> of <code>formCol.setValues(urls)</code> is 1 dimensional array. The argument of <code>setValues(value)</code> is required to be 2 dimensional array.</li>
<li>When your range of <code>var formCol = SpreadsheetApp.getActive().getRangeByName('FORM');... | How I can solve this error in setValues function "The parameters (number[]) don't match the method signature for SpreadsheetApp.Range.setValues" | javascript|forms|google-apps-script|google-forms | 0 | 46 | 2 | 72,797,772 | 72,797,772 | 3 | true | 2022-06-29T07:48:24.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How I can solve this error in setValues function "The parameters (number[]) don't match the method signature for SpreadsheetApp.Range.setValues"<p>I'm pre-fi... |
72,801,304 | suppress print() function in python modules<p>I'm building a multi module python program</p>
<p>in each module i have some function where i used to print some output during debugging of each individual module</p>
<p>while calling modules's functions in the main program body those print function issues output</p>
<p>Ho... | <p>One solution is to use the <code>Logging</code> class (<a href="https://docs.python.org/3/library/logging.html" rel="nofollow noreferrer">https://docs.python.org/3/library/logging.html</a>) provided by python. By using <code>logging.debug</code> instead of <code>print</code> for class debug messages, if the logging ... | suppress print() function in python modules | python|python-module | 1 | 46 | 1 | 72,801,754 | 72,801,754 | 3 | true | 2022-06-29T12:17:35.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
suppress print() function in python modules<p>I'm building a multi module python program</p>
<p>in each module i have some function where i used to print som... |
72,809,034 | In Python, what's the purpose of giving an alias with the same name as the imported lib?<p>When I was reading the source code of <code>aiohttp</code>, I found the code below:
<a href="https://github.com/aio-libs/aiohttp/blob/f922c1985d74509366f68152ddd940f121fc40e5/aiohttp/web.py#L25" rel="nofollow noreferrer">click he... | <p>Following the Git blame to the <a href="https://github.com/aio-libs/aiohttp/commit/4a2fba9ff13ef90ca751c5d1055ad0f87b856268" rel="nofollow noreferrer">original commit</a>, and following that to the <a href="https://github.com/aio-libs/aiohttp/pull/3872" rel="nofollow noreferrer">pull request</a> and <a href="https:/... | In Python, what's the purpose of giving an alias with the same name as the imported lib? | python|import|python-import | 0 | 46 | 1 | 72,809,064 | 72,809,064 | 3 | true | 2022-06-30T00:03:25.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In Python, what's the purpose of giving an alias with the same name as the imported lib?<p>When I was reading the source code of <code>aiohttp</code>, I foun... |
72,813,046 | getLine() does't seem to work after first input - C++<p>I'm currently new to C++ and learning the basic syntax.</p>
<p>I'm exploring how getLine() works and I'm trying to compare the standard input and a getline().</p>
<pre><code>#include <iostream>
#include <string>
using namespace std;
int main(){
strin... | <p>As you can see <code>cin >> name1;</code> reads only up to the first whitespace. What remains in the input buffer is <code> Doe\n</code>. (Notice the first character is a space).</p>
<p>Now <code>cin.ignore();</code> will ignore 1 character (the white space in this case). The input buffer now contains <code>Do... | getLine() does't seem to work after first input - C++ | c++|string|user-input|cin|cout | 0 | 46 | 2 | 72,813,148 | 72,813,148 | 3 | true | 2022-06-30T09:01:00.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
getLine() does't seem to work after first input - C++<p>I'm currently new to C++ and learning the basic syntax.</p>
<p>I'm exploring how getLine() works and ... |
72,827,247 | I tried to work with Cancellationtoken but it wont work<p>So basically I tried following some Tutorials und examples on how to cancel an Task.</p>
<ul>
<li>I understand, that you need a <code>CancellationTokenSource token</code> out of which you can extract a token that you need as an parameter (<code>CancellationToken... | <p>This won´t work because you check your token only once. By the time you press the stop button the code has stepped over your if clause.</p>
<p>You would need to check the token more often while you do <code>//Here is a really long Api and Saving in Database process</code> or pass it to functions that support <code>C... | I tried to work with Cancellationtoken but it wont work | c#|razor|blazor|cancellationtokensource|cancellation-token | 1 | 46 | 1 | 72,827,344 | 72,827,344 | 3 | true | 2022-07-01T09:33:00.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I tried to work with Cancellationtoken but it wont work<p>So basically I tried following some Tutorials und examples on how to cancel an Task.</p>
<ul>
<li>I... |
72,831,687 | Appending lists to a list<p>I have a list <code>I3</code>. I am performing an index operation through <code>I4</code> and appending based on the length of <code>I3</code>. The current and expected outputs are presented.</p>
<pre><code>I3 = [[(0, 0), (0, 1)], [(0, 0), (1, 0)], [(0, 1), (1, 1)], [(1, 0), (1, 1)]]
for t ... | <p>Note <code>I4.append(I4)</code> and <code>I4 = [(0, 0), (1, 0), [...]]</code>. You're appending a list to the end of itself. That's recursive. Try to append it to an empty list.</p>
<pre class="lang-py prettyprint-override"><code>I3 = [[(0, 0), (0, 1)], [(0, 0), (1, 0)], [(0, 1), (1, 1)], [(1, 0), (1, 1)]]
temp = [... | Appending lists to a list | python|list | 1 | 46 | 2 | 72,831,755 | 72,831,755 | 3 | true | 2022-07-01T15:43:36.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Appending lists to a list<p>I have a list <code>I3</code>. I am performing an index operation through <code>I4</code> and appending based on the length of <c... |
72,858,667 | Class code coverage is 100% but unit test file is not<p>I have a class object (<em>my_object</em>), the methods within that class are all covered by my unittesting. However the unit test file itself has some lines of codes which are <em>missed</em>. These lines of code are exception handlers.</p>
<p>So for example for ... | <p>Just let the exception raised by <code>my_object.check_file_exists</code> cause the failure, instead of capturing it and raising an <code>AssertionError</code> in its place.</p>
<pre><code>def test_remove_file(self):
my_object.put_file(my_file)
my_object.check_file_exists(my_file)
assert my_object.remove... | Class code coverage is 100% but unit test file is not | python|pytest|code-coverage | 1 | 46 | 1 | 72,859,061 | 72,859,061 | 3 | true | 2022-07-04T14:57:36.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Class code coverage is 100% but unit test file is not<p>I have a class object (<em>my_object</em>), the methods within that class are all covered by my unitt... |
72,869,338 | Is it allowed to put ActivityContext/ApplicationContext in a variable?<p>Please tell me is it allowed to put <strong>ActivityContext/ApplicationContext</strong> in a variable as shown in the code below?</p>
<pre><code>class MainActivity : Activity() {
private val context = applicationContext
override fun onC... | <p>Those are properties, not variables. It's important to understand the distinction, although not for this particular question.</p>
<p>Your very first code block is fine because the application context reference will be cleared when the Activity instance is released, and Activities have shorter lifetimes than the Appl... | Is it allowed to put ActivityContext/ApplicationContext in a variable? | android|kotlin|memory-leaks|static | 0 | 46 | 1 | 72,869,645 | 72,869,645 | 3 | true | 2022-07-05T12:20:19.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it allowed to put ActivityContext/ApplicationContext in a variable?<p>Please tell me is it allowed to put <strong>ActivityContext/ApplicationContext</stro... |
72,882,861 | How to copy rows by POSIXct interval and past it on top of the same dataframe?<p>My dataframe looks like this:</p>
<pre><code> dput(head(sAUR,50))
structure(list(date = structure(c(1475315922, 1475660422, 1475920222,
1476179992, 1476524422, 1476784232, 1477044062, 1477388482, 1477648302,
1477911722, 1478256142, 14785... | <p>Option using <code>rbind</code>:</p>
<pre class="lang-r prettyprint-override"><code>sAUR_copy <- subset(sAUR, date %in% 1487415671:1490007451)
rbind(sAUR_copy, sAUR)
#> date layer
#> 40 2017-02-18 12:01:11 AUR
#> 41 2017-02-22 11:40:31 AUR
#> 42 2017-02-25 11:50:21 AUR
#>... | How to copy rows by POSIXct interval and past it on top of the same dataframe? | r|dataframe|rows|add|posixct | 3 | 46 | 4 | 72,883,230 | 72,883,230 | 3 | true | 2022-07-06T11:31:24.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to copy rows by POSIXct interval and past it on top of the same dataframe?<p>My dataframe looks like this:</p>
<pre><code> dput(head(sAUR,50))
structure(... |
72,895,583 | Is there an ELF equivelant of PE Original Filename<p>On Windows, PE files (executable files) have a property "Original Filename", which is the filename when the executable was built. For signed files, this means you can't change "svchost.exe" to "innocent.exe" without leaving a trail, for ... | <p>I'm not aware of any standard section that would store the original filename as created by the linker.</p>
<p>However, adding your own section to an ELF is perfectly fine. You can then sign the ELF with <code>elfsign</code> which by default covers the ELF sections.</p>
<p>This is a PKI system, so you then need a cha... | Is there an ELF equivelant of PE Original Filename | x86|elf|portable-executable | 1 | 46 | 1 | 72,897,503 | 72,897,503 | 3 | true | 2022-07-07T09:40:06.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there an ELF equivelant of PE Original Filename<p>On Windows, PE files (executable files) have a property "Original Filename", which is the file... |
72,907,746 | Map Method not returning data on Nextjs<p>I'm trying to do a simple Map Method, the data 1,2,3,4,5 can be successfully shown in console.log, but not showing on the website.</p>
<pre><code>import React from 'react'
export default function secretStashScreen() {
const numbers = [1, 2, 3, 4, 5];
return (
<div>... | <p>You should remove brackets in <code>map</code> for returning values</p>
<pre><code>numbers.map((number)=><div>{number}</div>)
</code></pre>
<p>If you want to keep brackets, you should have <code>return</code> explicitly</p>
<pre><code>numbers.map((number)=>{return <div>{number}</div>})... | Map Method not returning data on Nextjs | javascript|reactjs|arrays|next.js | 1 | 46 | 2 | 72,907,794 | 72,907,794 | 3 | true | 2022-07-08T06:58:42.687Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Map Method not returning data on Nextjs<p>I'm trying to do a simple Map Method, the data 1,2,3,4,5 can be successfully shown in console.log, but not showing ... |
72,910,517 | React: after load page state is true, although useState is false<p>In the application, by clicking on the button, I want to do 2 things: play an audio file, show 2 pictures. After clicking the button again, I want to turn off the audio and hide 2 pictures. The audio works, but the pictures go crazy. Why? I set useState... | <p><code>useEffect</code> runs during the first render and all subsequent updates.</p>
<p>I believe you might need to explicitly perform setLadyDancing to true or false depending on the state that you want them to be, otherwise it will keep getting toggled based on its previous state.</p>
<p>Maybe this might work:</p>
... | React: after load page state is true, although useState is false | reactjs|react-hooks|use-effect|use-state | 0 | 46 | 3 | 72,910,606 | 72,910,606 | 3 | true | 2022-07-08T11:09:07.523Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React: after load page state is true, although useState is false<p>In the application, by clicking on the button, I want to do 2 things: play an audio file, ... |
72,913,708 | ToDictionary how can i find the duplicate key<p>I want to correct the database but I can't find the duplicate object. Is there a way for me to find the key that is having problems?</p>
<blockquote>
<p>"An item with the same key has already been added."}</p>
</blockquote>
<pre><code> try
{
var d... | <p>use GroupBy and inspect groups larger than 1:</p>
<pre><code>var dupes = ReturnGetReviewTemplates
.GroupBy(t => t.Item1.Id)
.Where(g => g.Count() > 1)
.Select(g => g.Key)
.ToArray();
</code></pre>
<p>set breakpoint or write a string to Output</p... | ToDictionary how can i find the duplicate key | c# | -1 | 46 | 1 | 72,915,531 | 72,915,531 | 3 | true | 2022-07-08T15:28:30.537Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ToDictionary how can i find the duplicate key<p>I want to correct the database but I can't find the duplicate object. Is there a way for me to find the key t... |
72,937,924 | Read .txt file with columns seperated by quotation marks with rows over several lines in R<p>I am having problems reading a .txt file to R. It should contain one id column and one text column in the end. The structure of the file is as follows:</p>
<pre><code>"", "textOriginal"
"1," "... | <p>Try this hack, starting with a text file:</p>
<pre><code>"", "textOriginal"
"1," "some text"
"2," "some text"
"3," "some text"
"4," "some
more
text"
</code></pre>
<p>The code:</p>
<pre class="lang-r pretty... | Read .txt file with columns seperated by quotation marks with rows over several lines in R | r|read.table | 2 | 46 | 3 | 72,938,330 | 72,938,330 | 3 | true | 2022-07-11T11:34:29.463Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Read .txt file with columns seperated by quotation marks with rows over several lines in R<p>I am having problems reading a .txt file to R. It should contain... |
72,944,408 | Need help understanding Spring Boot REST interface<p>I am writing a simple Java Spring Boot test application to call a REST API. The main purpose at this point is to quickly get something working and to also help refresh my memory/knowledge on making REST calls from a Java application.</p>
<p>I've worked with Spring Bo... | <p>You're misunderstanding the purpose of a <code>@RestController</code> vs <code>RestTemplate</code>.</p>
<p>Annotating a class with <code>@RestController</code> and <code>@GetMapping</code> annotations provides a REST interface which can service HTTP requests.</p>
<p>Inside the implementation of <code>getAllGroups</c... | Need help understanding Spring Boot REST interface | java|spring-boot|rest | 0 | 46 | 1 | 72,945,400 | 72,945,400 | 3 | true | 2022-07-11T20:38:29.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need help understanding Spring Boot REST interface<p>I am writing a simple Java Spring Boot test application to call a REST API. The main purpose at this poi... |
72,968,353 | How to print concatenated iterations across a range in python?<p>Trying to make a program that outputs the sum of integers within a range of integers inclusively. This works, but I am trying to find a way for it to print out the output the way I want it to.</p>
<pre><code>numOne = int(input('enter a number: '))
numTwo ... | <p>I suggest using <code>str.join</code> and the builtin <code>sum</code> function (note that if you name a variable <code>sum</code>, it shadows that function):</p>
<pre><code>numOne = int(input('enter a number: '))
numTwo = int(input('enter a second number: '))
nums = range(numOne, numTwo+1)
print(" + ".joi... | How to print concatenated iterations across a range in python? | python|loops|for-loop | 0 | 46 | 3 | 72,968,449 | 72,968,449 | 3 | true | 2022-07-13T14:53:52.103Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to print concatenated iterations across a range in python?<p>Trying to make a program that outputs the sum of integers within a range of integers inclusi... |
72,969,278 | Converting list into pandas dataframe using values that matches the conditions<p>I got data using API with below code and trying to select the ones that are necessary and make it into a dataframe.</p>
<pre><code>import requests
import pandas as pd
trait_type_responses= []
for t_id in range(1,10):
url=f"htt... | <p>You could rebuild your list of dictionaries using <code>trait_type</code> as a key and <code>value</code> as a value for every dict in your response.</p>
<p><code>pd.DataFrame([{x['trait_type']:x['value'] for x in d} for d in trait_type_responses])</code></p> | Converting list into pandas dataframe using values that matches the conditions | python|json|pandas|dataframe|api | 1 | 46 | 1 | 72,969,390 | 72,969,390 | 3 | true | 2022-07-13T15:59:32.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting list into pandas dataframe using values that matches the conditions<p>I got data using API with below code and trying to select the ones that are ... |
72,983,922 | How to get an image from an API response with content type "mime: image/jpg" in Python?<p>I did a request to an API and obtain characters from an image. I want to put those characters into a 'jpg' file to be able to visualize the image. The content-type is 'mime: image/jpg' and the data is the following one (it's not t... | <p>A quick bit of research indicates <code>/9j/</code> is a <em>magic number</em> likely indicating the binary representation of a JPEG file that's been Base64-encoded. (<a href="https://stackoverflow.com/questions/38783884/jpeg-image-in-base64-format">Source</a>).</p>
<p>Thus it should be possible to use the <code>bas... | How to get an image from an API response with content type "mime: image/jpg" in Python? | python|python-3.x|image|mime-types | 0 | 46 | 1 | 72,984,038 | 72,984,038 | 3 | true | 2022-07-14T16:38:44.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get an image from an API response with content type "mime: image/jpg" in Python?<p>I did a request to an API and obtain characters from an image. I wa... |
73,015,225 | Can the python compiler optimize two consecutive function calls with identical arguments?<p>In my code, I have a line like:</p>
<pre><code>result = len([x for x in otherList if func(x) is not None and func(x).weekday == 3])
</code></pre>
<p>Written in a for loop, I would just define a variable like <code>fx = func(x)</... | <blockquote>
<p>Is there some reasonably easy way to know whether the compiler would optimize such a statement and only evaluate the function once?</p>
</blockquote>
<p>Yes, there is, you can look at the generated bytecode:</p>
<pre><code>import dis
otherList = []
def func(x):
pass
def main():
result = len([x... | Can the python compiler optimize two consecutive function calls with identical arguments? | python|list-comprehension|compiler-optimization | 1 | 46 | 2 | 73,015,270 | 73,015,270 | 3 | true | 2022-07-17T20:43:14.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can the python compiler optimize two consecutive function calls with identical arguments?<p>In my code, I have a line like:</p>
<pre><code>result = len([x fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.