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
73,026,580
Why can't I get these images with titles to flow horizontally center?<p>Previously I posed a question here<a href="https://stackoverflow.com/questions/72998066/why-wont-this-text-align-next-to-image-properly-cant-get-a-horizontal-screen/72998225#72998225">1</a>, and it was answered appropriately to solve my first issue...
<ul> <li>Here is <code>html</code> version of your code.</li> <li>Use <code>display:flex</code> to image container and then, Make one separate element for image box just like here which is <code>image-box</code> set it's <code>anchor</code> tag to <code>display:flex</code> and <code>align-items:center</code>.</li> </ul...
Why can't I get these images with titles to flow horizontally center?
javascript|css
0
44
1
73,026,758
73,026,758
1
true
2022-07-18T17:53:10.480Z
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 these images with titles to flow horizontally center?<p>Previously I posed a question here<a href="https://stackoverflow.com/questions/729980...
73,026,387
PowerShell array, loop first row<p>i have a problem with array as following with only one line:</p> <pre><code>$list = @() $list = ((&quot;ResourceGroup&quot;,&quot;Vm1&quot;)) $list | ForEach-Object -Parallel { write-output $_[0] $_[1] } </code></pre> <p>if i loop that array with one line,powershell print the...
<p><code>(&quot;ResourceGroup&quot;,&quot;Vm1&quot;)</code> is interpreted as <strong>one array with two string elements</strong>, where as <code>((&quot;ResourceGroup&quot;,&quot;Vm1&quot;), (&quot;ResourceGroup&quot;,&quot;Vm2&quot;))</code> is interpreted as <strong>one array with 2 array elements</strong>, can be a...
PowerShell array, loop first row
arrays|powershell|azure-powershell|script|jagged-arrays
1
44
1
73,026,523
73,026,523
1
true
2022-07-18T17:36:11.143Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PowerShell array, loop first row<p>i have a problem with array as following with only one line:</p> <pre><code>$list = @() $list = ((&quot;ResourceGroup&quo...
73,001,583
How to output a formatted string from a JSON model class<p>I want something like the following:</p> <pre class="lang-cs prettyprint-override"><code>using System; using System.Text; using System.Text.Json; public class Program { public static void Main() { var myArgs = new ArgClass(); ...
<p>Yes, <strong>System.Reflection</strong> is needed to achieve your required value.</p> <ol> <li><p>Get the properties of the instance which applies the <code>JsonPropertyName</code> attribute.</p> </li> <li><p>Iterate the properties.</p> <p>2.1. Get the property name from the <code>JsonPropertyName</code> attribute.<...
How to output a formatted string from a JSON model class
c#|json|reflection|system.text.json
-1
44
1
73,001,636
73,001,636
1
true
2022-07-16T04:42:16.297Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to output a formatted string from a JSON model class<p>I want something like the following:</p> <pre class="lang-cs prettyprint-override"><code>using Sys...
72,922,509
How to find the combination of a list to a list without rearrangement?<p>I am want to achieve all possible combinations (w/o rearr.) of partitioning/breaking the string by k elements.</p> <p><strong>for example,</strong> I have a string &quot;abcd&quot; and k=3, I want achieve the following,</p> <pre><code>if [a,b,c,d]...
<p>I think this could work:</p> <ol> <li>Get all possible sum partitions of the <code>len(your_list)</code>.</li> <li>Filter them by <code>len(partition) == k</code>.</li> <li>Get the <code>itertools.permutations</code> by <code>k</code> elements of all this partitions.<br /> Now you have list of lists like this: <code...
How to find the combination of a list to a list without rearrangement?
python-3.x|algorithm|combinatorics
0
44
2
72,922,710
72,922,710
1
true
2022-07-09T15:10:51.553Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to find the combination of a list to a list without rearrangement?<p>I am want to achieve all possible combinations (w/o rearr.) of partitioning/breaking...
72,804,693
JSON Post from a Webhook is null when type is string<p>I am using .NET 5 web api. I have a webhook that posts to my api. However, When I receive the POST in a string it is null. If I create a class, then .Net will parse the JSON for me, but I <strong>need</strong> a string, not an object. Any advice is greatly apprecia...
<p>you can only use JObject input parameter for example and convert it to json using ToString()</p> <pre><code>public async Task&lt;ActionResult&gt; Form([FromBody] JObject val) { ResultJsonString = val.ToString(); .... another code } </code></pre> <p>another way is to serialize twice before POST t...
JSON Post from a Webhook is null when type is string
c#|json|.net|asp.net-core-webapi|webhooks
-1
44
2
72,804,815
72,804,815
1
true
2022-06-29T16:13:37.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JSON Post from a Webhook is null when type is string<p>I am using .NET 5 web api. I have a webhook that posts to my api. However, When I receive the POST in ...
72,870,515
How to export/read data from async function that's querying firebase<p>Learning how to use react by creating a project.</p> <p>I am trying to filter the data by when it was added into the collection. Then I am trying to add all the <strong>totalCalories</strong> in a certain amount of time so i can display it in form u...
<p>Try this :</p> <p>Instead of :</p> <pre><code>await db... </code></pre> <p>=&gt;</p> <pre><code>return db... </code></pre> <p>run doesn't need to be an async function anymore</p> <pre><code>run().then(totalCalories =&gt; console.log('totalCalories :', totalCalories)); </code></pre> <p>Now run return a promise, when ...
How to export/read data from async function that's querying firebase
javascript|node.js|reactjs|firebase|promise
0
44
1
72,870,577
72,870,577
1
true
2022-07-05T13:44:53.960Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to export/read data from async function that's querying firebase<p>Learning how to use react by creating a project.</p> <p>I am trying to filter the data...
72,872,542
Can't get simple product (min) Price Wordpress Woocommerce<p>hello guys I'm trying to get create a function to get the product has the most min &amp; max Price in the woocommerce query. problem is my query not get the lowest product that has price</p> <p><strong>here example of products:</strong></p> <ol> <li>200 USD</...
<p>The Woocommerce product prices are stored in this table - wp_wc_product_meta_lookup</p> <p>So, you have to query the data from this table and get the min price. As you are using get_posts so it is getting the product from the default WordPress posts table where the price for the product isn't stored.</p> <p>Here is ...
Can't get simple product (min) Price Wordpress Woocommerce
php|wordpress|woocommerce|wordpress-theming|custom-wordpress-pages
0
44
1
72,878,690
72,878,690
1
true
2022-07-05T16:10:19.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't get simple product (min) Price Wordpress Woocommerce<p>hello guys I'm trying to get create a function to get the product has the most min &amp; max Pri...
72,934,703
Run task asynchronously: ManagedExcecutorService vs Microprofile fault tolerance @Asynchronous<p>I want to run an asynchronous task in a JavaEE openliberty environment. Ideally the task has to run at startup, but I don't want that it blocks the startup of the WAR module itself. Also, I don't want that on failure it pre...
<p>You will soon have a third option as well. Jakarta EE 10 is introducing an <code>@Asynchronous</code> annotation in the Concurrency 3.0 specification, and Open Liberty already has a beta of it,</p> <p><a href="https://openliberty.io/blog/2022/02/17/concurrency-3.0-22003-beta.html" rel="nofollow noreferrer">https://...
Run task asynchronously: ManagedExcecutorService vs Microprofile fault tolerance @Asynchronous
java|asynchronous|jakarta-ee|open-liberty|microprofile
0
44
1
72,939,216
72,939,216
1
true
2022-07-11T06:50:56.600Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Run task asynchronously: ManagedExcecutorService vs Microprofile fault tolerance @Asynchronous<p>I want to run an asynchronous task in a JavaEE openliberty e...
72,922,665
How do i delete these rows in SQLite database?<p>I have a table in a SQLite database as below:</p> <pre><code>+-------+------------+---------------+-------+------------+ | ROWID | student_id | qualification | grade | date_stamp | +-------+------------+---------------+-------+------------+ | 1 | 000001 | Mathema...
<p>You may try doing a delete with exists logic:</p> <pre class="lang-sql prettyprint-override"><code>DELETE FROM yourTable WHERE qualification IS NULL AND EXISTS ( SELECT 1 FROM yourTable t WHERE t.student_id = yourTable.student_id AND t.qualification IS NOT NULL AND...
How do i delete these rows in SQLite database?
python|sql|sqlite
0
44
1
72,922,701
72,922,701
1
true
2022-07-09T15:32:19.807Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do i delete these rows in SQLite database?<p>I have a table in a SQLite database as below:</p> <pre><code>+-------+------------+---------------+-------+-...
72,925,641
angular mat radio check if value changes<p>is there an event for a mat radio group where we can detect if a value changes ? cause I wanna trigger a method or a function only if select value from the radio changes.</p> <p>So for example I click botton A and the value is 0 and then i click button A again then it should ...
<p>You can use two-way binding <code>[(ngModel)]=&quot;binding&quot;</code> to update your variable as such:</p> <pre class="lang-html prettyprint-override"><code>&lt;mat-radio-group [(ngModel)]=&quot;selectedValue&quot;&gt; &lt;mat-radio-button [value]=&quot;0&quot;&gt;BUTTON A&lt;/mat-radio-button&gt; &lt;mat-rad...
angular mat radio check if value changes
javascript|angular|typescript
0
44
1
72,925,719
72,925,719
1
true
2022-07-10T01:37:19.797Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: angular mat radio check if value changes<p>is there an event for a mat radio group where we can detect if a value changes ? cause I wanna trigger a method or...
72,899,042
how to create all possible orders in a specific length from a list of strings<p>I have a list of strings that need to fit in 6 characters. The strings can be split but the characters in the string can't be randomized. The strings have different lengths (4 and 3 characters)</p> <p>I tried a few things with itertools and...
<p>Just use a standard double loop and check if you need/can remove zeros to get the desired length</p> <pre><code>combinations = [] for i in wordlist: for j in wordlist: if len(i) == 4 and len(j) == 4: # remove both zeros combinations.append(i[1:] + j[1:]) elif len(i) == 3 and len(j) ...
how to create all possible orders in a specific length from a list of strings
python|itertools
1
44
1
72,899,109
72,899,109
1
true
2022-07-07T13:50:23.510Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to create all possible orders in a specific length from a list of strings<p>I have a list of strings that need to fit in 6 characters. The strings can be...
72,906,185
different type of python dict<p>I'm new to python, I have created a script where expected outputs should be able to get user that has <em>globalRole = Admin</em> and user with <em>tprojectRole = Admin</em>. I am getting the values in the json file which it is a dictionary. How can I get my expected values below after m...
<p>This is one way to extract the data from the <code>projectRoles</code> field.</p> <pre><code>for admin in admins: text = admin[&quot;firstName&quot;] + &quot; &quot; + admin[&quot;lastName&quot;] + &quot; GlobalRole: &quot; grole = admin[&quot;globalRole&quot;][&quot;name&quot;] if grole == &quot;admin&q...
different type of python dict
python-3.x|dictionary
0
44
1
72,906,335
72,906,335
1
true
2022-07-08T02:57:20.420Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: different type of python dict<p>I'm new to python, I have created a script where expected outputs should be able to get user that has <em>globalRole = Admin<...
72,797,762
Executing npm install in user data<p>I am attempting to create a launch template in aws with the following in the user data</p> <pre><code>#!/bin/bash home=/home/ec2-user nodev='8.11.2' nvmv='0.33.11' #install node su - ec2-user -c &quot;curl https://raw.githubusercontent.com/creationix/nvm/v${nvmv}/install.sh | bash...
<p>First of all <code>userdata</code> is running with <code>root</code> user permissions so you don't need to have <code>sudo</code> or <code>su</code> there. In case you want <code>ec2-user</code> to be owner of that dir so simply execute <code>chown ec2-user:ec2-user /path/to/dir</code></p> <p>Next, when you run <cod...
Executing npm install in user data
amazon-web-services|npm|amazon-ec2|user-data|launch-template
0
44
1
72,798,178
72,798,178
1
true
2022-06-29T07:58:18.697Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Executing npm install in user data<p>I am attempting to create a launch template in aws with the following in the user data</p> <pre><code>#!/bin/bash home=/...
72,813,721
Custom routing via nginx - read from third party source<p>I am new to nginx, and am wondering if it can help me to solve a use-case we've encountered.</p> <p>I have n nodes,which are reading from from a kafka topic with the same group id, which means that each node has disjoint data, partitioned by some key.</p> <p>Ngi...
<blockquote> <p>Nginx has no way of knowing apriori which node has data corresponding to which keys</p> </blockquote> <p>Nginx doesn't need to know. You would need to do this in Kafka Streams RPC layer with <a href="https://docs.confluent.io/platform/current/streams/developer-guide/interactive-queries.html" rel="nofoll...
Custom routing via nginx - read from third party source
nginx|apache-kafka|url-routing|nginx-reverse-proxy
0
44
1
72,821,056
72,821,056
1
true
2022-06-30T09:51:21.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Custom routing via nginx - read from third party source<p>I am new to nginx, and am wondering if it can help me to solve a use-case we've encountered.</p> <p...
72,880,516
DAX - RT Measure calculation based on specific selected date in slicer<p>i have a problem regarding my calculation. I want to visualize the running total over time (for example 01.07 after hours rounded to the nearest half hour to reduce computing power). I have 90 days of data in my dataset. The Problem i have is that...
<p>I'm not sure what you are going to achive, but you can try this, this can work faster.</p> <pre><code>Average Sales = CALCULATE( DIVIDE('Measure Table X'[RT Sales] , 'Measure Table X'[RT Rows]) 'X'[Time rounded] &lt;= Max('X'[Time rounded] ) RT Sales = Sum('X'[Sales]) RT Rows =COUNTA('X'[...
DAX - RT Measure calculation based on specific selected date in slicer
powerbi|dax
1
44
1
72,881,314
72,881,314
1
true
2022-07-06T08:52:18.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: DAX - RT Measure calculation based on specific selected date in slicer<p>i have a problem regarding my calculation. I want to visualize the running total ove...
72,981,424
Performance when load data from file on app start<p>I have csv file with 44k lines. Each line have 3 tab separated fields. Have to load data in Flutter app, but not sure about performance.</p> <p>Data will be used to search inside. Not just showing it. Any suggestions?</p>
<p>My suggestion would be for you to <a href="https://csvjson.com" rel="nofollow noreferrer">convert your csv file into json</a>, that way you can map your data into objects more easily.</p> <pre><code>final String jsonString = await rootBundle.loadString('assets/your_file.json'); List&lt;dynamic&gt; objects = await j...
Performance when load data from file on app start
flutter|csv
0
44
1
72,981,972
72,981,972
1
true
2022-07-14T13:33:59.073Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Performance when load data from file on app start<p>I have csv file with 44k lines. Each line have 3 tab separated fields. Have to load data in Flutter app, ...
72,836,346
How do I can I get notified of an object collision and object trigger in Box2D?<p>Unity3D has the <code>OnCollisionEnter2D</code>, <code>OnCollisionExit2D</code>, <code>OnTriggerEnter2D</code> etc. However, I am using Box2D and am looking for a way to implement something similar or the same in my C++ project, but I do ...
<p>Enabling an event listener is necessary for collision events in Box2D, as explained in <a href="https://youtu.be/pJ_M_fACtB8" rel="nofollow noreferrer">this video</a>. <em>Alternatively</em>, you could implement your own collision logic. For rectangular hitboxes, that would look something like this: (<em><strong>Ple...
How do I can I get notified of an object collision and object trigger in Box2D?
c++|visual-studio|events|game-engine|box2d
0
44
2
72,836,441
72,836,441
1
true
2022-07-02T04:00:58.843Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I can I get notified of an object collision and object trigger in Box2D?<p>Unity3D has the <code>OnCollisionEnter2D</code>, <code>OnCollisionExit2D</c...
72,815,535
Parse a log file into json object<p>I have log file named <code>request.log</code> this is the content of the log file</p> <pre><code>[2022-06-30T09:56:40.146Z] ### POST https://test.csdf/auth/send_otp { &quot;method&quot;: &quot;POST&quot;, &quot;headers&quot;: { &quot;User-Agent&quot;: &quot;testing&q...
<p>You have to run some kind of script to convert them to JSON. In javascript/nodejs you could do something like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const log...
Parse a log file into json object
javascript|node.js|npm|logging|fs
1
44
1
72,816,358
72,816,358
1
true
2022-06-30T12:06:39.137Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parse a log file into json object<p>I have log file named <code>request.log</code> this is the content of the log file</p> <pre><code>[2022-06-30T09:56:40.14...
72,922,288
group-wise linear models function nest_by<p>I have a dataframe of 4 columns: Dataset, X, Y, Group.</p> <p>The task is to fit a linear model to each of the five groups (The group column contains 5 groups: a, b, c, d, e) in the dataframe and then compare the slope with the dataframe test_2. For the test_2 I have already ...
<p>Yes, you can proceed further using <code>tidy</code> from broom package which is better option than <code>summary</code> and then doing <code>unnest</code>.</p> <p>For example, for <code>mtcars</code>, for each cyl group, we can do the following,</p> <pre class="lang-r prettyprint-override"><code>library(tidyr) libr...
group-wise linear models function nest_by
r|model|regression|linear-regression
1
44
1
72,922,644
72,922,644
1
true
2022-07-09T14:42:43.730Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: group-wise linear models function nest_by<p>I have a dataframe of 4 columns: Dataset, X, Y, Group.</p> <p>The task is to fit a linear model to each of the fi...
72,919,480
Calling while loop function in main function, and won't move past after completing loop<p>So, I'm creating a program for class to take orders of cookies, and the guideline is to create separate functions. Unfortunately, when I try to get into the subsequent functions, it doesn't seem to be doing that, and I was wonderi...
<p>You need to enter the value of a variable <strong>before</strong> you use it, not afterwards. For example</p> <pre><code> for (;;) // loop until we break { // get the number of oreos cout &lt;&lt; &quot;Enter the number of Oreos (0-10): &quot;; cin &gt;&gt; numOreos; // check t...
Calling while loop function in main function, and won't move past after completing loop
c++|while-loop
-1
44
1
72,919,570
72,919,570
1
true
2022-07-09T06:41:32.510Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calling while loop function in main function, and won't move past after completing loop<p>So, I'm creating a program for class to take orders of cookies, and...
72,872,874
How to average a score in groups based on the month and year in SQL<p>I have a table called reviews. Reviews has two columns I care about: score (int) and created_at (datetime). Imagine the following data</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id</th> <th>score</th> <th>created_at<...
<p>You don't need the window function:</p> <ul> <li>use the corresponding <code>AVG</code> aggregation function</li> <li>remove the score from the <code>GROUP BY</code> clause</li> <li>remove the null scores check, as the aggregation functions skip null values</li> </ul> <pre><code>SELECT TO_CHAR(created_at, 'Mon YYYY'...
How to average a score in groups based on the month and year in SQL
sql|ruby-on-rails|postgresql|to-char
1
44
1
72,872,960
72,872,960
1
true
2022-07-05T16:39:41.370Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to average a score in groups based on the month and year in SQL<p>I have a table called reviews. Reviews has two columns I care about: score (int) and cr...
72,815,069
Group elements in a named vector by character pattern and find max per group<p>Suppose I have the following vector</p> <pre><code>test &lt;- c(&quot;x1&quot; = 0.1, &quot;x2&quot; = 0.3, &quot;x3&quot; = 0.4, &quot;y1&quot; = 0.1, &quot;y2&quot; = 0.5, &quot;y3&quot; = 0.4, &quot;z1&quot; = 0.5, &qu...
<p>Here is my solution with a verbose walk-through.</p> <pre><code>## can also use `grp &lt;- stringr::str_remove(names(test), &quot;[0-9]+&quot;)` grp &lt;- stringr::str_extract(names(test), &quot;[A-Za-z]+&quot;) #[1] &quot;x&quot; &quot;x&quot; &quot;x&quot; &quot;y&quot; &quot;y&quot; &quot;y&quot; &quot;z&quot; &q...
Group elements in a named vector by character pattern and find max per group
r|vector
1
44
1
72,815,350
72,815,350
1
true
2022-06-30T11:35:01.613Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Group elements in a named vector by character pattern and find max per group<p>Suppose I have the following vector</p> <pre><code>test &lt;- c(&quot;x1&quot;...
72,798,005
How to assign a copied jira board to project using API?<p>I'm trying automatize some processes. I create a project using Jira API and can not find possibilities to change the board's setting using API. How I am doing it using UI. Firstly I copy the board then I walk to my copied board's settings and change its locatio...
<p>It doesn't look like there are currently any API methods that would allow you to perform that change. My suggestion would be instead use the <a href="https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-post" rel="nofollow noreferrer">Create</a> method to create a new bo...
How to assign a copied jira board to project using API?
jira|jira-rest-api|jira-agile
0
44
1
72,863,236
72,863,236
1
true
2022-06-29T08:15:46.097Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to assign a copied jira board to project using API?<p>I'm trying automatize some processes. I create a project using Jira API and can not find possibili...
72,769,574
Paypal Webhook is created sufficient to imply activated<p>Paypal with active webhooks. We use a subscription plan.</p> <p>When a customer subscribes to the subscription plan PayPal's webhook sends us a <code>BILLING.SUBSCRIPTION.CREATED</code>. 

We do not get a <code>BILLING.SUBSCRIPTION.ACTIVATED</code>. Can I expect...
<p>Created means the user clicked the button to subscribe. It does not mean they entered any payment details, or finished subscribing.</p> <p>If you are not receiving a BILLING.SUBSCRIPTION.ACTIVATED event but the subscription is active, perhaps you did not subscribe to that event?</p> <p>In any case, the most useful e...
Paypal Webhook is created sufficient to imply activated
paypal|webhooks|paypal-webhooks
1
44
1
72,776,761
72,776,761
1
true
2022-06-27T09:09:27.370Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Paypal Webhook is created sufficient to imply activated<p>Paypal with active webhooks. We use a subscription plan.</p> <p>When a customer subscribes to the s...
72,905,127
What is the best way to check if a list item already exist before appending a new list item?<p>I am creating a code to add new fruits to a list of fruits but I needed to check if the fruit already exist before adding the new one. My code is below. I know there are errors because I'm still new to javascript. So I need c...
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function prependContent() { var fruit = document.getElementById("fruit").value; var list = document.getElementById("list"); va...
What is the best way to check if a list item already exist before appending a new list item?
javascript|html|for-loop|append|html-lists
0
44
2
72,905,257
72,905,257
1
true
2022-07-07T23:13:39.547Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the best way to check if a list item already exist before appending a new list item?<p>I am creating a code to add new fruits to a list of fruits but...
72,909,356
referencing the latest state in useInterval that uses useRef<p><a href="https://overreacted.io/making-setinterval-declarative-with-react-hooks/" rel="nofollow noreferrer">As Dan Abramov introduced</a>, I wrote an interval using useRef so it does not get created on every render. My code below saves the redux store into ...
<p>since closure will always capture the variable store each time it's reinitialized. use <strong>[YOUR STORE].getState().[your reducer]</strong> instead</p> <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="true"> <div class="snippet-code snippet-currently-hidden"> <pre class="sni...
referencing the latest state in useInterval that uses useRef
reactjs
0
44
2
72,910,795
72,910,795
1
true
2022-07-08T09:27:30.023Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: referencing the latest state in useInterval that uses useRef<p><a href="https://overreacted.io/making-setinterval-declarative-with-react-hooks/" rel="nofollo...
72,796,911
My Javascript code always returns 10 or 11 and never returns the other random numbers which have not been specified in the if condition<p><strong>This is my Javascript code:</strong></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre clas...
<p>Not sure maybe your if condition is wrong..</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function getRandomCard(){ randomCard = Math.floor(Math.random()*13)+1 ...
My Javascript code always returns 10 or 11 and never returns the other random numbers which have not been specified in the if condition
javascript
0
44
1
72,796,951
72,796,951
1
true
2022-06-29T06:48:07.893Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: My Javascript code always returns 10 or 11 and never returns the other random numbers which have not been specified in the if condition<p><strong>This is my ...
72,901,404
Create chart in APEX and add the average function considering hours, minutes and seconds<p>This is connected to the question here: <a href="https://stackoverflow.com/questions/72881720/oracle-apex-before-insert-trigger-issue/72881887?noredirect=1#comment128762456_72881887">Oracle APEX before insert trigger issue</a></p...
<p>In the query, sum up the columns containing seconds/minutes/hours/days. So, suppose you want to see the data in minutes then you'd do</p> <pre><code>SELECT NVL(minutes,0) + NVL(hours,0)*60 + NVL(days,0)*24*60) AS total_minutes, ... FROM yourtable </code></pre> <p>Then in the chart, take the total_minutes al...
Create chart in APEX and add the average function considering hours, minutes and seconds
oracle|oracle-apex|apexcharts
0
44
1
72,903,845
72,903,845
1
true
2022-07-07T16:34:23.660Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create chart in APEX and add the average function considering hours, minutes and seconds<p>This is connected to the question here: <a href="https://stackover...
73,013,840
Determine if array is in order AND the last element is 0<p>how can I determine when the first X numbers of an array is in order AND the last element in 0? i.e the array is</p> <pre><code>1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0 </code></pre> <p>I currently have this, but this relies on the array always being the same, whi...
<p>You could do something as simple as this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const checkArray = (arr) =&gt; { if(arr[arr.length-1] != 0){ return fal...
Determine if array is in order AND the last element is 0
javascript|arrays|sorting|ecmascript-6
0
44
3
73,013,928
73,013,928
1
true
2022-07-17T17:15:25.257Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Determine if array is in order AND the last element is 0<p>how can I determine when the first X numbers of an array is in order AND the last element in 0? i....
72,773,172
Dataframe append dataframe to excel with sheet names?<p>I desire to append multiple dataframes to a blank dataframe, and then export them to excel file with sheet name. I am stuck with it now. I simplify my code and look like this</p> <pre><code> import pandas as pd import numpy as np def calculate_file(): sheet_d...
<p>You need to save the sheet name somewhere, for instance in the index:</p> <pre><code>def calculate_file(): sheet_df = pd.DataFrame() for i in range(1, 41): random_data = np.random.randint(10, 25, size=(5,3)) df = pd.DataFrame(random_data, columns=['Column_1', 'Column...
Dataframe append dataframe to excel with sheet names?
python|excel|pandas
1
44
1
72,773,460
72,773,460
1
true
2022-06-27T13:46:38.710Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dataframe append dataframe to excel with sheet names?<p>I desire to append multiple dataframes to a blank dataframe, and then export them to excel file with ...
72,792,316
How to return Dates between in format year-months?<p>Is there a way to return dates between in format year-months in Cognos reports?</p> <p>Example: I've been using the following to figure out &quot;age&quot;</p> <ul> <li><p>_years_between (current_date, [DateOfBirth]).</p> </li> <li><p>Result comes out as just the age...
<p>A simple expression should do:</p> <pre><code>cast(floor (_months_between (current_date, [DateOfBirth]) / 12), int) || ' years, ' || mod(_months_between (current_date, [DateOfBirth]), 12) || ' months' </code></pre> <p>You can even get fancy and omit the &quot;s&quot; in &quot;years&quot; or &quot;months&quot; if th...
How to return Dates between in format year-months?
between|cognos|yearmonth|difference-between-rows
1
44
2
72,794,162
72,794,162
1
true
2022-06-28T19:43:57.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to return Dates between in format year-months?<p>Is there a way to return dates between in format year-months in Cognos reports?</p> <p>Example: I've bee...
72,868,942
Missing optional dependency in PyCharm<p>I have encountered this error yesterday which I've already resolved by installing the missing optional dependency. But today as I started another Python file in PyCharm I'm getting the same error again.</p> <pre><code>ImportError: Missing optional dependency 'xlrd'. Install xlrd...
<p>I think what's going on here is that <code>xlrd</code> is installed in your user wide <code>site-packages</code> but pycham uses different virtual environments for every project. This probably means that <code>xlrd</code> isn't installed in your project's virtual environment. You can try doing the following in your ...
Missing optional dependency in PyCharm
python|pip|pycharm
0
44
1
72,869,467
72,869,467
1
true
2022-07-05T11:50:21.513Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Missing optional dependency in PyCharm<p>I have encountered this error yesterday which I've already resolved by installing the missing optional dependency. B...
72,907,931
Why can a multiline comment appear between "import" and ImportSpec, but not between PackageName and ImportPath?<p>This is the Go spec for an import declaration:</p> <pre><code>ImportDecl = &quot;import&quot; ( ImportSpec | &quot;(&quot; { ImportSpec &quot;;&quot; } &quot;)&quot; ) . ImportSpec = [ &quot;.&q...
<blockquote> <p><a href="https://go.dev/ref/spec" rel="nofollow noreferrer">The Go Programming Language Specification</a></p> <p><a href="https://go.dev/ref/spec#Comments" rel="nofollow noreferrer">Comments</a></p> <p>General comments start with the character sequence /* and stop with the first subsequent character seq...
Why can a multiline comment appear between "import" and ImportSpec, but not between PackageName and ImportPath?
go|language-lawyer|specifications
3
44
1
72,908,097
72,908,097
1
true
2022-07-08T07:13:49.623Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why can a multiline comment appear between "import" and ImportSpec, but not between PackageName and ImportPath?<p>This is the Go spec for an import declarati...
72,947,953
Confused with reference count of objects in Python<p>I'm a little confused with the reference counts I see from my test code</p> <pre><code> 1 import sys 2 3 class Square(): 4 def __init__(self, width, color): 5 self.width = width 6 self.color = color 7 8 oSquare1 = Square(5...
<p>Did you look at the source code or the <a href="https://docs.python.org/3/library/sys.html#sys.getrefcount" rel="nofollow noreferrer">docs</a> for <code>getrefcount()</code></p> <pre><code>def getrefcount(): # real signature unknown; restored from __doc__ &quot;&quot;&quot; Return the reference count of obje...
Confused with reference count of objects in Python
python|reference
0
44
2
72,947,979
72,947,979
1
true
2022-07-12T06:34:19.650Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Confused with reference count of objects in Python<p>I'm a little confused with the reference counts I see from my test code</p> <pre><code> 1 import sys ...
72,854,080
Align JLabel using SwingConstants<p>Why is my <code>JLabel</code> text not aligned to the left or center? Is the <code>FlowLayout</code> the issue? Both of the texts are just appearing at the top, next to each other and I can't fix this.</p> <p>Main Class</p> <pre class="lang-java prettyprint-override"><code>public sta...
<p>Refer to <a href="https://docs.oracle.com/javase/tutorial/uiswing/layout/index.html" rel="nofollow noreferrer">Laying Out Components Within a Container</a> which is a lesson in the <em>Creating a GUI With Swing</em> trail of Oracle's Java tutorials.</p> <p>The <em>javadoc</em> for method <code>setVerticalTextPositio...
Align JLabel using SwingConstants
java|swing
0
44
3
72,855,830
72,855,830
1
true
2022-07-04T08:53:24.017Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Align JLabel using SwingConstants<p>Why is my <code>JLabel</code> text not aligned to the left or center? Is the <code>FlowLayout</code> the issue? Both of t...
72,968,773
python - how do I transfer values from one df to another<p>These are the two dfs</p> <pre><code>Rating = ['A', 'AAA', 'AA', 'BBB', 'BB', 'B'] val = [4560.0, 64.0, 456.0, 34.0, 534.0, 54.0] df = pd.DataFrame(dict(zip(Rating,val)),index=[0]).T df.columns = ['values'] df1 = pd.DataFrame(['AA','AA','AA','AA','A','A'],colum...
<pre><code>df = pd.DataFrame({ 'Rating' : ['A', 'AAA', 'AA', 'BBB', 'BB', 'B'], 'val' : [4560.0, 64.0, 456.0, 34.0, 534.0, 54.0] }) df ### Rating val 0 A 4560.0 1 AAA 64.0 2 AA 456.0 3 BBB 34.0 4 BB 534.0 5 B 54.0 </code></pre> <p>Keeping <code>df1</code> as yours, bu...
python - how do I transfer values from one df to another
python|pandas|merge
1
44
2
72,969,130
72,969,130
1
true
2022-07-13T15:22:21.827Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: python - how do I transfer values from one df to another<p>These are the two dfs</p> <pre><code>Rating = ['A', 'AAA', 'AA', 'BBB', 'BB', 'B'] val = [4560.0, ...
72,922,519
Splitting a dataframe when NaN rows are found<p>I'm trying to split a dataframe when NaN rows are found using <code>grps = dfs.isnull().all(axis=1).cumsum()</code>.</p> <p>But this is not working when some of the rows have NaN entry in a single column.</p> <pre><code>import pandas as pd from pprint import pprint import...
<h2>Setup</h2> <pre><code>df = pd.DataFrame(d) print(df) t input type value 0 0 2 A 0.1 1 1 2 A 0.2 2 2 2 A 0.3 3 0 2 B NaN 4 2 2 B 2.0 5 0 2 B 3.0 6 1 4 A 1.0 </code></pre> <h2>Simplify your approach</h2> <pre><code># assign name...
Splitting a dataframe when NaN rows are found
python-3.x|pandas|dataframe|group-by
1
44
1
72,922,834
72,922,834
1
true
2022-07-09T15:12:39.383Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Splitting a dataframe when NaN rows are found<p>I'm trying to split a dataframe when NaN rows are found using <code>grps = dfs.isnull().all(axis=1).cumsum()<...
72,807,226
looping over test files and plotting for each one<p>I want to loop over two files and plot the first column versus the second column of each file next to each other. I write the script below to do that, but after running, the two diagrams are plotted in one figure, while I want to plot them in two separate diagrams nex...
<p>What about the following, i.e. calling the function just once and provide a list having the name of the two files of interest:</p> <pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt import numpy as np def plot_en(filename): data_1 = np.loadtxt(f&quot;{filename[0]}.en&quot;) da...
looping over test files and plotting for each one
python|matplotlib
2
44
1
72,808,565
72,808,565
1
true
2022-06-29T20:05:06.023Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: looping over test files and plotting for each one<p>I want to loop over two files and plot the first column versus the second column of each file next to eac...
72,952,571
Invalid value for field 'resource.managed.domains[0]<pre><code>gcloud compute ssl-certificates create flytime-google-cert --domains=flytime.io,api.flytime.io,socket.flytime.io --global </code></pre> <p>Above commands give the error of</p> <pre><code>ERROR: (gcloud.compute.ssl-certificates.create) Could not fetch resour...
<p>It will work if you put it inside the quote:</p> <pre><code>gcloud compute ssl-certificates create flytime-google-cert --domains=&quot;flytime.io,api.flytime.io,socket.flytime.io&quot; --global </code></pre>
Invalid value for field 'resource.managed.domains[0]
kubernetes|google-cloud-platform|ssl-certificate|google-kubernetes-engine|gke-networking
0
44
1
72,952,983
72,952,983
1
true
2022-07-12T12:46:22.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Invalid value for field 'resource.managed.domains[0]<pre><code>gcloud compute ssl-certificates create flytime-google-cert --domains=flytime.io,api.flytime.io...
73,003,157
CSS full height doesn't work in all browsers<p>I try to make a view fill 100vh in every device at every browser. I found the solution to do like this.</p> <pre><code>html { height: 100vh; height: -moz-available; height: -webkit-fill-available; /* WebKit-based browsers will ignore this. */ } body { hei...
<p>Safari uses a WebKit engine; remove <code>height: -webkit-fill-available;</code></p>
CSS full height doesn't work in all browsers
html|css
0
44
1
73,003,180
73,003,180
1
true
2022-07-16T09:44:30.940Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CSS full height doesn't work in all browsers<p>I try to make a view fill 100vh in every device at every browser. I found the solution to do like this.</p> <p...
72,997,046
I want to know how to use the onclick() function and symbol in highcharts Iam using it in angular.Tell me please<p>I need two things to be done I have tried every way to my knowledge. Don't mistake me if I am asking small questions. I just wanna know</p> <p>below is my custom button in highcharts</p> <p><strong>MY COMP...
<p>You can use the arrow function to refer to the context of this some properties above.</p> <pre><code> counter = 0; constructor() { this.chartOptions = { exporting: { buttons: { change: { symbol: 'triangle', onclick: () =&gt; { this.counter += 1; ...
I want to know how to use the onclick() function and symbol in highcharts Iam using it in angular.Tell me please
javascript|angular|highcharts
0
44
1
73,019,841
73,019,841
1
true
2022-07-15T16:27:17.847Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I want to know how to use the onclick() function and symbol in highcharts Iam using it in angular.Tell me please<p>I need two things to be done I have tried ...
72,930,507
Pandas calculate max for every day per id<p>I have a dataframe with three columns: ID, Date, Value reporting temperature records (Value) day by day for a month (in datetime-format) from different weather stations (ID). What I need is to 'group by' every weather station and every single day and calculate the maximum tem...
<p>IUUC, you can do</p> <pre class="lang-py prettyprint-override"><code>df['Date'] = pd.to_datetime(df['Date']) out = df.groupby(['ID', df['Date'].dt.date])['Value'].max() </code></pre> <pre><code>print(out) ID Date 1 2022-05-12 18.3 2 2022-05-12 18.0 Name: Value, dtype: float64 </code></pre>
Pandas calculate max for every day per id
python|pandas|max|group
0
44
2
72,930,561
72,930,561
1
true
2022-07-10T17:27:58.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas calculate max for every day per id<p>I have a dataframe with three columns: ID, Date, Value reporting temperature records (Value) day by day for a mon...
72,882,365
MapStruct not working in service class while running Test cases<p>I am creating test cases, in one of my service class method I am using <code>mapStruct</code> to map entity into dto class.</p> <p>This is my mapper class</p> <pre><code>@Mapper(componentModel = &quot;spring&quot;) public interface UserMapper { ...
<p>You have annotated your UserMapper with a @Mock annotation, without writing the mockito configuration for this mock. Then the blank array is expected. Remove the @Mock annotation, or specify what should be returned by the mock. <br /> For example :</p> <pre><code>@RunWith(MockitoJUnitRunner.class) @SpringBootTest(cl...
MapStruct not working in service class while running Test cases
java|spring-boot|junit|mockito|mapstruct
0
44
1
72,883,961
72,883,961
1
true
2022-07-06T10:57:35.660Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MapStruct not working in service class while running Test cases<p>I am creating test cases, in one of my service class method I am using <code>mapStruct</cod...
73,029,069
How to print nested table using recursion in lua?<p>I want to print this table using recursion and not by using for loop. I am trying to avoid repeating code.</p> <pre><code>local t = {x=0, y=5, other={10,10,10,11}} function DeepPrint (t) local request_headers_all = &quot;&quot; for k, v in pairs(t) do if type...
<p>You can simply remove the inner loop and make a call to DeepPrint again using the value of v - the table:</p> <pre><code>local t = {x=0, y=5, other={10,10,10,11}} function DeepPrint (t) local request_headers_all = &quot;&quot; for k, v in pairs(t) do if type(v) == &quot;table&quot; then request_header...
How to print nested table using recursion in lua?
lua
0
44
1
73,029,151
73,029,151
1
true
2022-07-18T22:01:28.647Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to print nested table using recursion in lua?<p>I want to print this table using recursion and not by using for loop. I am trying to avoid repeating code...
72,938,944
Change CASE in WHERE?<p>I'm trying to find a way to change the following statement in something more performance-wise:</p> <pre><code>DECLARE @ID_1 int = -1, @ID_2 int = 123, @ID_3 int = -1 SELECT ... FROM... where tblA.ID1 = case when @ID_1 = -1 THEN tblA.ID1 ELSE @ID_1 end AND tblB.ID2 = case whe...
<p>Don't use <code>CASE</code> on a column, it's not SARGable. Use <code>AND</code> and <code>OR</code> logic:</p> <pre class="lang-sql prettyprint-override"><code>SELECT ... FROM ... WHERE (tblA.ID1 = @ID_1 OR @ID_1 = -1) --I would recommend uses NULL for your &quot;catch-all&quot; AND (tblB.ID2 = @ID_2 OR @ID_2 = -...
Change CASE in WHERE?
sql|sql-server|case|query-optimization
1
44
1
72,938,988
72,938,988
1
true
2022-07-11T12:54:18.840Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change CASE in WHERE?<p>I'm trying to find a way to change the following statement in something more performance-wise:</p> <pre><code>DECLARE @ID_1 int = -1,...
72,971,875
Generating four complementary intervals between 0 and 1<p>How do I generate a list that contains four tuples and each tuple is compose by two numbers between 0.0 and 1.0 following this rules:</p> <ul> <li>The first and the second number of each tuple cannot be the samecov</li> <li>The second number must be bigger than ...
<p>Based on the discussion in the comments, this solution uses ints from 0 to 100 rather than floats, and gives non-overlapping ranges whose widths sum to 100.</p> <p>This uses <code>itertools.pairwise</code> which is new in Python 3.10.</p> <pre><code>import random import itertools cuts = random.sample(range(1, 100),...
Generating four complementary intervals between 0 and 1
python|math
0
44
1
72,972,583
72,972,583
1
true
2022-07-13T19:50:47.447Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generating four complementary intervals between 0 and 1<p>How do I generate a list that contains four tuples and each tuple is compose by two numbers between...
73,026,553
How to filter a pandas dataframe till it finds a value in NaN column?<p>I have a data frame like this:</p> <pre><code>df: number score 12 NaN 13 NaN 14 NaN 15 NaN 16 10 17 NaN 18 NaN </code></pre> <ol> <li>I want to filter this data frame from the start to the row where it finds a num...
<p>You can use a reverse <code>cummax</code> and boolean slicing:</p> <pre><code>new_df = df[df['score'].notna()[::-1].cummax()] </code></pre> <p>Output:</p> <pre><code> number score 0 12 NaN 1 13 NaN 2 14 NaN 3 15 NaN 4 16 10.0 </code></pre> <p>For the second one, a simple <co...
How to filter a pandas dataframe till it finds a value in NaN column?
python|python-3.x|pandas|dataframe
0
44
2
73,026,599
73,026,599
1
true
2022-07-18T17:50:40.643Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to filter a pandas dataframe till it finds a value in NaN column?<p>I have a data frame like this:</p> <pre><code>df: number score 12 NaN 13 Na...
72,831,933
MacOS-Drag String onto NSStatusItem<p>I am trying to detect when a string is getting dragged onto the NSStatusItem. Here is the implementation of my code in AppDelegate:</p> <pre><code>func applicationDidFinishLaunching(_ aNotification: Notification) { if let button = statusItem.button { button.ima...
<p><code>draggingEntered</code> and <code>performDragOperation</code> are methods of protocol <code>NSDraggingDestination</code>. Swift doesn't call a protocol method if the class doesn't adopt the protocol. <code>AppDelegate</code> must adopt <code>NSDraggingDestination</code>.</p> <pre><code>extension AppDelegate: NS...
MacOS-Drag String onto NSStatusItem
swift|macos|cocoa|nsstatusitem
0
44
1
72,835,017
72,835,017
1
true
2022-07-01T16:03:43.260Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MacOS-Drag String onto NSStatusItem<p>I am trying to detect when a string is getting dragged onto the NSStatusItem. Here is the implementation of my code in ...
72,393,901
Passing 2D array as class parameter<p> I am trying to set up a class that initializes with a 2d array of an unknown size at compile time. I figured the best way to do this would be to pass the array as a pointer. This works as expected with a 1d array, but when I try to do the same with a 2d array. I get an error that ...
<p>You can pass a 2D array by passing the address of the first element:</p> <pre><code>TestClass Test(&quot;TestName&quot;, &amp;TestArray[0][0]); </code></pre> <p>But how is <code>TestClass</code> supposed to know the dimensions of the array? There is no way to query the data or to guess. You have to also pass <code>n...
Passing 2D array as class parameter
c++|arrays|class|pointers
-1
44
2
72,394,038
72,394,038
1
true
2022-05-26T15:01:07.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passing 2D array as class parameter<p> I am trying to set up a class that initializes with a 2d array of an unknown size at compile time. I figured the best ...
72,396,139
Text is overlapping div with using overflow:hidden<p>Hi my flexboxes div text is overlapping to an other flex container, how would I be able to fix this, I already tried adding overflow:hidden which do not seem to work. So this is my problem and this is extra text for stackoverflow's &quot;It looks like your post is mo...
<p>Try removing <code>position: absolute;</code> from <code>.gigtitle</code> class.</p>
Text is overlapping div with using overflow:hidden
html|css|flexbox
0
44
2
72,396,272
72,396,272
1
true
2022-05-26T18:00:11.900Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Text is overlapping div with using overflow:hidden<p>Hi my flexboxes div text is overlapping to an other flex container, how would I be able to fix this, I a...
72,367,000
How to retrieve old tweets (beyond the most recent 3,200 tweets) from a specific user account on Twitter?<p>I have access to the Academic Research API. I am trying to retrieve old tweets from political candidates’ accounts during certain election campaigns (i.e., I would ideally specify begin and end dates). The timeli...
<p>Apparently the best way to do this is to use the Archive Search API. It is part of the premium API, so you first need to be granted an application with connection to the Academic Research API, and then opening a premium environment that lets you access the Archive Search API.</p> <p>Once in the Archive Search API, y...
How to retrieve old tweets (beyond the most recent 3,200 tweets) from a specific user account on Twitter?
api|rest|twitter|rtweet
0
44
1
72,398,718
72,398,718
1
true
2022-05-24T17:20:38.203Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to retrieve old tweets (beyond the most recent 3,200 tweets) from a specific user account on Twitter?<p>I have access to the Academic Research API. I am ...
72,290,378
Read websites with request parallel?<p>i would like to read the html-content of websites in parallel and try to use the following code - which generally works fine -</p> <pre><code>resultText = {} start = timeit.default_timer() async def main(): loop = asyncio.get_event_loop() futures = [ loop.run_in_...
<p>You can use httpx instead:</p> <pre><code>import httpx async def get_stock_price_data(stock): client = httpx.AsyncClient() stock_page = await client.get( 'https://finance.yahoo.com/quote/TSLA') </code></pre> <p>There's a full article that describes await/async in detail here: <a href="https://pythonhowtoprogra...
Read websites with request parallel?
python|python-requests|python-asyncio
1
44
1
72,450,890
72,450,890
1
true
2022-05-18T13:45:10.973Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Read websites with request parallel?<p>i would like to read the html-content of websites in parallel and try to use the following code - which generally work...
72,260,623
how to align this page contnet without horizontal scroll bar?<p>Hi I am creating simple website using CSS flexbox, but from some reasons my layout in <code>About.vue</code> stretch out with this horizontal bar only this component is in <code>mainLayout.vue</code>, and I can't figure out what is wrong making this proble...
<p>Try adding this:</p> <pre><code>html, body ... max-width: 2000px width: 100vw overflow-x: hidden </code></pre> <p>Although the <code>overflow-x</code> should be a last-resort if the method above fails.</p> <p><strong>An explanation of why it works</strong></p> <p>Well, the <code>max-width</code> prop...
how to align this page contnet without horizontal scroll bar?
javascript|vue.js
0
44
1
72,263,389
72,263,389
1
true
2022-05-16T14:13:32.330Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to align this page contnet without horizontal scroll bar?<p>Hi I am creating simple website using CSS flexbox, but from some reasons my layout in <code>A...
72,276,656
Filter recursive array<p>I am trying to find the best way (minimal code) to filter a recursive list of items based on some condition. The list describes some navigation that contains multiple sections and each section contains navigation items (where each navigation item can contain a recursive amount of navigation ite...
<p>Check this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const navSections = [{title: 'Section A',items: [{title: 'A1',permission: 'Moderator',},{title: 'A2',permission: ...
Filter recursive array
javascript|typescript
2
44
1
72,277,206
72,277,206
1
true
2022-05-17T15:20:47.623Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Filter recursive array<p>I am trying to find the best way (minimal code) to filter a recursive list of items based on some condition. The list describes some...
72,373,136
Without built-in functions how to find differences in two arrays<p>I have to find the <code>difference</code> for both array, i have tried but i am not getting my expected.can you please help here.</p> <pre><code>&lt;?php $firstArray = array(3,4,5,6); $secondArray = array(4, 5); $outputArray = array()...
<p>a) Use a boolean value to check it:</p> <pre><code>&lt;?php $firstArray = array(3,4,5,6); $secondArray = array(4, 5); $outputArray = array(); foreach($firstArray as $firstArrayItem) { $found = false; foreach($secondArray as $secondArrayItem) { if($firstArrayItem == $secondArrayItem) { $fou...
Without built-in functions how to find differences in two arrays
php
-1
44
3
72,373,178
72,373,178
1
true
2022-05-25T06:57:48.677Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Without built-in functions how to find differences in two arrays<p>I have to find the <code>difference</code> for both array, i have tried but i am not getti...
72,257,609
IOB format merge<p>I have a dataframe in IOB format as below:-</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Name</th> <th>Label</th> </tr> </thead> <tbody> <tr> <td>Alan</td> <td>B-PERSON</td> </tr> <tr> <td>Smith</td> <td>I-PERSON</td> </tr> <tr> <td>is</td> <td>O</td> </tr> <tr> <td>Al...
<p>You can create groups by compare values <code>O</code>, remove <code>IO-</code> values in <code>Label</code> column and with helper groups created by cumulative sum aggregate <code>join</code>:</p> <pre><code>m = df['Label'].eq('O') df = (df[~m].assign(Label=lambda x: x['Label'].str.replace('^[IB]-', '')) ...
IOB format merge
python|pandas
1
44
1
72,257,686
72,257,686
1
true
2022-05-16T10:17:02.913Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: IOB format merge<p>I have a dataframe in IOB format as below:-</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Name</th> <th>Lab...
72,313,259
Python, Pandas: Faster File Search than os.path?<p>I have a pandas df with file names that need to be searched/matched in a directory tree.</p> <p>I've been using the following but it crashes with larger directory structures. I record whether or not they are present in 2 lists.</p> <pre><code>found = [] missed = [] fo...
<p>Scan your directories only once and convert it to a dataframe.</p> <p>Example on my <code>venv</code> directory:</p> <pre><code>import pandas as pd import pathlib DIRECTORY_TREE = pathlib.Path('./venv').resolve() data = [(str(pth.parent), pth.name) for pth in DIRECTORY_TREE.glob('**/*') if pth.is_file()] df_path = ...
Python, Pandas: Faster File Search than os.path?
python|pandas|file
1
44
1
72,313,521
72,313,521
1
true
2022-05-20T03:25:30.643Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python, Pandas: Faster File Search than os.path?<p>I have a pandas df with file names that need to be searched/matched in a directory tree.</p> <p>I've been ...
72,239,188
Django: The QuerySet value for an exact lookup must be limited to one result using slicing<p>i am tring to access a page using a slug url, but i keep getting this error <code>The QuerySet value for an exact lookup must be limited to one result using slicing.</code> i thought it would be a <code>filter</code> or <code>g...
<p>In your topic view you are using a filter to get tutorial topic category. This returns a queryset rather than a single item. When you then use it to get 'topic' you are querying based on this set rather than a single equivalent, raising the error. So, instead, to only use the first of the filtered set you could sa...
Django: The QuerySet value for an exact lookup must be limited to one result using slicing
python|django|django-rest-framework|django-views
0
44
1
72,239,443
72,239,443
1
true
2022-05-14T10:07:00.443Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django: The QuerySet value for an exact lookup must be limited to one result using slicing<p>i am tring to access a page using a slug url, but i keep getting...
72,237,789
REGEX_String between strings in a list<p>From this list:</p> <pre><code>['AUSTRALIA\nBELMONT PARK (WA', '\nR3\n1/5/4/2\n2/3/1/5\nEAGLE FARM (QLD'] </code></pre> <p>I would like to reduce it to this list:</p> <pre><code>['BELMONT PARK', 'EAGLE FARM'] </code></pre> <p>You can see from the first list that the desired word...
<p>You’re getting an error because the <code>(</code> is unescaped. Regardless, it will not work, as you’ll get the following matches:</p> <ul> <li><code>\nBELMONT PARK (</code></li> <li><code>\nR3\n1/5/4/2\n2/3/1/5\nEAGLE FARM (</code></li> </ul> <p>You can try the following:</p> <pre><code>(?&lt;=\\n)(?!.*\\n)(.*)(?=...
REGEX_String between strings in a list
python|regex|search|group
0
44
2
72,237,888
72,237,888
1
true
2022-05-14T06:13:31.017Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: REGEX_String between strings in a list<p>From this list:</p> <pre><code>['AUSTRALIA\nBELMONT PARK (WA', '\nR3\n1/5/4/2\n2/3/1/5\nEAGLE FARM (QLD'] </code></p...
72,322,957
What is the best possible way to pass data between child components in React?<p>I am curious to know if the performance of a React app will be affected if we have multiple nested components and we pass a callback function to the lowest-level component and then the entire component tree is rendered from an event in the ...
<p>There are plenty of ways to pass data, but less so for functions.</p> <p>Redux could be used, or useContext, or some other external solution like <a href="https://jotai.org" rel="nofollow noreferrer">jotai</a>.</p> <p>Actually, the recommended official way is useContext: <a href="https://reactjs.org/docs/hooks-faq.h...
What is the best possible way to pass data between child components in React?
reactjs
1
44
1
72,323,057
72,323,057
1
true
2022-05-20T17:48:57.417Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the best possible way to pass data between child components in React?<p>I am curious to know if the performance of a React app will be affected if we...
72,350,155
Loop a merge+sum function on a set of dataframes in R<p>I have the following list of dataset :</p> <pre><code>dflist &lt;- list(df1_A, df1_B, df1_C, df1_D, df1_E, df2_A, df2_B, df2_C, df2_D, df2_E, df3_A, df3_B, df3_C, df3_D, df3_E, df4_A, df4_B, df4_C, df4_D, df4_E) names(...
<p><code>bind_rows</code> can combine list of dataframes together. You can combine them with the <code>id</code> column so that the name of the list is added as a new column, extract the dataframe name (<code>df1</code> from <code>df1_A</code>, <code>df2</code> from <code>df2_A</code> and so on) and take the sum of <co...
Loop a merge+sum function on a set of dataframes in R
r|dataframe|for-loop|merge
0
44
1
72,350,218
72,350,218
1
true
2022-05-23T14:20:40.650Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Loop a merge+sum function on a set of dataframes in R<p>I have the following list of dataset :</p> <pre><code>dflist &lt;- list(df1_A, df1_B, df1_C, df1_D, d...
72,306,868
Column Based Row Slices<p>The question is as follows. I have a dataframe like below. And I would like to slice based on row</p> <pre><code>Index A B 0 0 1 1 0 1 2 1 0 3 1 0 4 1 0 5 1 0 6 0 1 7 0 1 8 1 0 9 1 0 10 0 1 </code></pre> <p>And I would like to slice rows based on a particular combinations of rows. For example,...
<p>try this</p> <pre class="lang-py prettyprint-override"><code>import pandas as pd d = {'A' : [0,0,1,1,1,1,0,0,1,1,0], 'B' : [1,1,0,0,0,0,1,1,0,0,1] } df = pd.DataFrame(data = d) print(df) list_a = [] list_b = [] test = 1 for x in range(0, len(df['A'])): if (df['A'][x] == 1 and test == 1): list_a += [1]...
Column Based Row Slices
python|pandas|slice
0
44
1
72,308,176
72,308,176
1
true
2022-05-19T15:00:02.560Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Column Based Row Slices<p>The question is as follows. I have a dataframe like below. And I would like to slice based on row</p> <pre><code>Index A B 0 0 1 1 ...
72,242,788
Determine the exact error of a long python line<p>I have long lines in my code such as:</p> <pre><code>if (currentExcelDep[excelPackageName]== depDataCollection[depDataCollectionSet][depDataCollectionSetElement][excelPath] and currentExcelDep[excelPath].split(&quot;/&quot;)[1] == depDataCollection[depDataCollectionSet]...
<p>Split the hell out of this spaghetti:</p> <pre><code>if currentExcelDep[excelPackageName] == \ depDataCollection[depDataCollectionSet][depDataCollectionSetElement][excelPath] and \ currentExcelDep[excelPath].split(&quot;/&quot;)[1] == \ depDataCollection[depDataCollectionSet][depDataCollectionSetElement]...
Determine the exact error of a long python line
python|python-3.10
-1
44
2
72,242,841
72,242,841
1
true
2022-05-14T18:06:17.643Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Determine the exact error of a long python line<p>I have long lines in my code such as:</p> <pre><code>if (currentExcelDep[excelPackageName]== depDataCollect...
72,387,417
Python functions not running correctly<p>I've written this code to convert a string to uppercase and lowercase, however when I call my functions, it doesn't run.</p> <pre><code># take the input for the string string = input(&quot;Enter any string: &quot;) def string_upper(up): return up.upper() print(&quot;U...
<p>In your code, you are calling <code>string_upper(up)</code> but <code>up</code> is not defined anywhere and that is why you got the error. Same problem is for <code>string_lower()</code>.</p> <p>Another problem is you are returning from <code>string_upper()</code> and <code>string_lower()</code> but not using the re...
Python functions not running correctly
python|python-3.x
0
44
3
72,387,488
72,387,488
1
true
2022-05-26T06:07:32.277Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python functions not running correctly<p>I've written this code to convert a string to uppercase and lowercase, however when I call my functions, it doesn't ...
72,328,774
Null check operator used on a null value but I did not use "!"<p>I am a beginner flutter developer. While writing the code, I encountered the following problem. You can see the code attached below, I've never used the null check operator, but the IDE is pointing out that that's the problem. I have no idea if this is a ...
<p>I believe that this variable does not exist (or is not set correctly) and thus is NULL:</p> <p><code>context.currentUserImage</code>.</p> <p>This triggers an internal NULL-check when trying to set it as the URL in line 40, because the URL is not allowed to be NULL:</p> <p><code>url: context.currentUserImage</code>.<...
Null check operator used on a null value but I did not use "!"
flutter
0
44
1
72,328,998
72,328,998
1
true
2022-05-21T10:38:24.807Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Null check operator used on a null value but I did not use "!"<p>I am a beginner flutter developer. While writing the code, I encountered the following probl...
72,321,746
Removing element from an array of arrays of arrays using the splice method in javascript<p>I have an array of arrays of arrays and I'm trying to remove an element from a sub-sub array. The problem is the element is removed from all my sub-sub arrays. See code below:</p> <pre><code>let list = Array(9).fill(Array(9).fill...
<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill" rel="nofollow noreferrer">Array.prototype.fill</a> fills the array with the exact same value that was provided to it. This is <em>not</em> a problem when filling the array with immutable values (<em>like numbers, st...
Removing element from an array of arrays of arrays using the splice method in javascript
javascript|arrays|splice
0
44
1
72,321,870
72,321,870
1
true
2022-05-20T15:57:33.720Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Removing element from an array of arrays of arrays using the splice method in javascript<p>I have an array of arrays of arrays and I'm trying to remove an el...
72,317,015
How can I extract text from a flex container?<p>I'm a beginner in Java and I'm attempting to extract some text from a website. The text however is between two tags and when I use getByXPath to extract the text I get everything except the text I need.</p> <p>This is the layout of the website I'm scraping from: <a href="...
<p>The simplest way is using Stream API:</p> <pre class="lang-java prettyprint-override"><code> List&lt;HTMLElement&gt; htmlElementList = new ArrayList&lt;&gt;();//get your list in needed way List&lt;String&gt; listOfTitles = htmlElementList.stream() .map(HTMLElement::getTitle) ...
How can I extract text from a flex container?
java
2
44
1
72,317,908
72,317,908
1
true
2022-05-20T10:00:19.620Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I extract text from a flex container?<p>I'm a beginner in Java and I'm attempting to extract some text from a website. The text however is between tw...
72,317,378
Usin Regex, find any text inside square brackets, ignoring the ones with a preceding backlash ("\")<p>I'm trying to find a regular expression that will match all groups of text inside square brackets, <strong>except the ones with a preceding backlash</strong>. To ilustrate my point, given this text:</p> <p><code>[#5C92...
<p>In your pattern you are matching a character <code>([^\\])</code> at the start of the string which is expected to be present.</p> <p>You can exclude a preceding backslash using a negative lookbehind (which is non consuming). Then in the character class exclude matching <code>[</code> and <code>]</code> instead of <c...
Usin Regex, find any text inside square brackets, ignoring the ones with a preceding backlash ("\")
c#|regex
0
44
1
72,317,609
72,317,609
1
true
2022-05-20T10:27:55.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Usin Regex, find any text inside square brackets, ignoring the ones with a preceding backlash ("\")<p>I'm trying to find a regular expression that will match...
72,285,173
How to link a subfolder with gcc in C?<p>I have the below tree:</p> <pre><code>├── cminpack │   ├── hybrd.c │   ├── hybrd.o │   ├── hybrj1.c │   ├── hybrj1.o │   ├── hybrj.c │   ├── hybrj.o │   ├── libminpack.a │   ├── Makefile │   ├── minpack.h │   ├── minpack.h.gch │   ├── readmeC.txt │   ├── readme.txt ├── greeter.c...
<p>In addition to <code>-L cminpack</code>, you should add <code>-lminpack</code> to the <code>gcc</code> command line.</p> <p>There should be no reason to use <code>sudo</code> for the compilation of this program, if you cannot invoke <code>gcc</code> directly, your system is misconfigured and should be fixed. Running...
How to link a subfolder with gcc in C?
c|linux|gcc|linker|subdirectory
1
44
1
72,285,413
72,285,413
1
true
2022-05-18T07:52:44.650Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to link a subfolder with gcc in C?<p>I have the below tree:</p> <pre><code>├── cminpack │   ├── hybrd.c │   ├── hybrd.o │   ├── hybrj1.c │   ├── hybrj1.o...
72,290,626
MongoDB: Need to match two fields in a lookup<p>I've indexed <code>nuit</code>, <code>regNumber</code> and <code>_id</code> for a faster query.</p> <p>You can find sample data and a solution which i'm not happy with because using <code>$unwind</code> and <code>$lookup</code> makes it iterate a million documents: <a hre...
<p>From the data you gave us, you can do something like:</p> <pre><code>db.collection.aggregate([ { $match: { nuit: '400400400', regNumber: 'aha-720-mp' } }, { $sort: { _id: -1 } }, { $limit: 1 }, { $lookup: { from: &quot;parks&quot;, localField: &quot;nuit&quot;, ...
MongoDB: Need to match two fields in a lookup
database|mongodb|mongodb-query
-1
44
2
72,292,595
72,292,595
1
true
2022-05-18T14:01:03.403Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MongoDB: Need to match two fields in a lookup<p>I've indexed <code>nuit</code>, <code>regNumber</code> and <code>_id</code> for a faster query.</p> <p>You ca...
72,329,551
How to make List<List<List<String>>> based on two List<Map> dart<p>I have a <code>List&lt;Map&gt;</code> with key values:</p> <pre><code> &quot;column-data&quot;: [ { &quot;label&quot;: &quot;Title&quot;, &quot;align&quot;: &quot;right&quot;, ...
<p>You could do what basically constitutes to a sql join to join the entries of each row item to the different columns and build up your lists.</p> <pre><code>const columnData = [ { &quot;label&quot;: &quot;Title&quot;, &quot;align&quot;: &quot;right&quot;, &quot;width&quot;: 50, }, { &quot;label&...
How to make List<List<List<String>>> based on two List<Map> dart
dart
0
44
1
72,329,862
72,329,862
1
true
2022-05-21T12:27:56.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make List<List<List<String>>> based on two List<Map> dart<p>I have a <code>List&lt;Map&gt;</code> with key values:</p> <pre><code> &quot;...
72,268,069
Merging hundreds excel file with path reference into one pandas dataframe<p>I have probably hundreds or thousands small excel file with bracket into one pandas dataframe</p> <p>Here's my table of reference <code>df</code></p> <pre><code> Dataframe_name Path Sheet 45 finance_audi...
<p>You can use list comprehension to iterate over the pairs of path and sheet and read the corresponding excel file, finally <code>concat</code> all the excel files:</p> <pre><code>pd.concat([pd.read_excel(path, sheet_name=sheet) for path, sheet in zip(df.Path, df.Sheet)]) </code></pre>
Merging hundreds excel file with path reference into one pandas dataframe
python|pandas|dataframe
1
44
1
72,268,161
72,268,161
1
true
2022-05-17T04:03:12.060Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Merging hundreds excel file with path reference into one pandas dataframe<p>I have probably hundreds or thousands small excel file with bracket into one pand...
72,394,267
Labeling future object in threading<p>I have a for loop in which i make call to db to get some values of a student. Now for loop takes a lot of time. So thought to replace that with executor service with future objects. At the start of function i made calls to db using <code>executor.submit()</code> method. I am just n...
<p>The main problem is that your return value on your task is <code>void</code>. Instead you should be defining a <code>Callable</code> that returns a value.</p> <p>A rough draft of some untested code:</p> <pre class="lang-java prettyprint-override"><code>public class StudentNameLookup implements Callable &lt; String &...
Labeling future object in threading
java|multithreading|future|executorservice
1
44
1
72,394,899
72,394,899
1
true
2022-05-26T15:27:16.270Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Labeling future object in threading<p>I have a for loop in which i make call to db to get some values of a student. Now for loop takes a lot of time. So thou...
72,245,201
Choose the rows with special conditions in dataframe<p>I have a dataframe, I want to choose the rows which their average value for column <strong>val1</strong> until <strong>val4</strong> is greater than 1 and the number of zeros for the row is not greater than 1. For example, in the following df:</p> <pre><code> id...
<p>IUUC, you can use <code>df.filter(regex='val[1-4]')</code> to filter the columns that contians <code>val1-4</code> and use <code>mean(axis=1)</code> and <code>sum(axis=1)</code> to operate on columns.</p> <pre class="lang-py prettyprint-override"><code>val = df.filter(regex='val[1-4]') df = df[val.mean(axis=1).gt(1)...
Choose the rows with special conditions in dataframe
python|pandas|dataframe
0
44
2
72,245,221
72,245,221
1
true
2022-05-15T02:42:17.477Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Choose the rows with special conditions in dataframe<p>I have a dataframe, I want to choose the rows which their average value for column <strong>val1</stron...
72,247,950
Parse the output of a script and process the last line only before printing<p>I have a simple CLI tool asking for a master password, and printing a string <code>$USER $PASSWORD</code> only if the master password is correct.</p> <h3>How to reproduce?</h3> <p><strong>Here is a script just for demonstrating my use-case</s...
<p>I've simply modified your answer a little bit -</p> <pre class="lang-sh prettyprint-override"><code>./my-cli-tool | { x=$(dd bs=1 count=1 2&gt;/dev/null) while [ &quot;$x&quot; != : ]; do printf %c &quot;$x&quot;; x=$(dd bs=1 count=1 2&gt;/dev/null) done printf %s &quot;: &quot; w...
Parse the output of a script and process the last line only before printing
bash|shell|sh
0
44
1
72,249,071
72,249,071
1
true
2022-05-15T11:45:22.913Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parse the output of a script and process the last line only before printing<p>I have a simple CLI tool asking for a master password, and printing a string <c...
72,362,224
How to export data frame rows based on group data with specific formatting in R<p>I have a data frame that includes all employee data (1000 employees, nested in 50 groups). For each group, I want R to export each group data participants in a seperate excel file (or docx if possible). The formatting should be as follows...
<p>I have not tested it, but the approach below should work:</p> <pre><code>library(randomNames) library(dplyr) library(openxlsx) df %&gt;% group_by(id_group, country, region, section) %&gt;% mutate(grp_id = cur_group_id()) %&gt;% # iterate over every group with walk which will have side effects only group_wa...
How to export data frame rows based on group data with specific formatting in R
r
0
44
1
72,362,556
72,362,556
1
true
2022-05-24T11:37:39.403Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to export data frame rows based on group data with specific formatting in R<p>I have a data frame that includes all employee data (1000 employees, nested...
72,386,827
Batch Complete Tasks in DRF<p>I have my Django website where i can have tasks created and subtasks under tasks i have mark complete option which is working fine i need them to be completed in batch like selecting multiple tasks at once and complete them.</p> <p><strong>serializers.py</strong>:</p> <pre><code>class Task...
<p>I think you need to create a function API view to implement this easily.</p> <pre><code>class TaskBulkUpdateSerializer(serializers.Serializer): task_ids = serializers.ListField( child = serializers.IntegerField()) is_done = serializers.BooleanField() </code></pre> <p>And in views.py, you need to crea...
Batch Complete Tasks in DRF
django|django-models|django-rest-framework|django-views
0
44
1
72,387,144
72,387,144
1
true
2022-05-26T04:48:15.173Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Batch Complete Tasks in DRF<p>I have my Django website where i can have tasks created and subtasks under tasks i have mark complete option which is working f...
72,264,371
Problem creating a table with dynamic column cells<p>I'm creating a table component with dynamic cells and columns, the header works fine, but I'm having trouble with the rows, I can't get them to render correctly.</p> <p>I want to be able to do this so that I can reuse this component in different places in my applicat...
<p><code>&lt;Td&gt;</code> needs a key prop.</p> <pre><code>{Headers.map((head) =&gt; ( &lt;Td&gt;{row[head]}&lt;/Td&gt; // key here. ))} </code></pre> <p>I have created a <a href="https://codesandbox.io/s/priceless-cache-3hb4g5?file=/src/DataTable.js" rel="nofollow noreferrer">sandbox</a> with your code (normal html...
Problem creating a table with dynamic column cells
javascript|reactjs|html-table
1
44
1
72,264,588
72,264,588
1
true
2022-05-16T19:04:17.970Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Problem creating a table with dynamic column cells<p>I'm creating a table component with dynamic cells and columns, the header works fine, but I'm having tro...
72,284,492
I want to create new type of simple operator class kotlin<p>What I want to do is save operator with number in list and evaluate it after pushing it to list</p> <p>need 2 types of operator Add and Multiply</p> <pre><code>Plus(x) (x is number) Multiply(x) (x is number) lis = [ Plus(3), Multiply(3), Plus(4), Multiply(2) ]...
<p>In order to allow the distinction whether to use a 0 or a 1 depending on the first element, you could define your operation with an <code>identity</code> element:</p> <pre><code>open class Operation( val op: (Double) -&gt; Double, val identity: Double, ) class Plus(operand: Double) : Operation({ it + operan...
I want to create new type of simple operator class kotlin
class|kotlin|types
0
44
1
72,285,322
72,285,322
1
true
2022-05-18T06:58:48.903Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I want to create new type of simple operator class kotlin<p>What I want to do is save operator with number in list and evaluate it after pushing it to list</...
72,344,900
How to identify top 30% salary in python dataframe<p>I have dataframe as follows:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th style="text-align: left;">Employee</th> <th style="text-align: center;">Salary</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">Tony</td> <td style...
<p>Calculate the boundaries.</p> <pre><code># Bound of top 30% bound1 = (df[&quot;salary&quot;].max()-df[&quot;salary&quot;].min())*(70/100) + df[&quot;salary&quot;].min() # Bound of bottom 30% bound2 = (df[&quot;salary&quot;].max()-df[&quot;salary&quot;].min())*(30/100) + df[&quot;salary&quot;].min() </code></pre> <p...
How to identify top 30% salary in python dataframe
python
0
44
2
72,344,994
72,344,994
1
true
2022-05-23T07:43:02.093Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to identify top 30% salary in python dataframe<p>I have dataframe as follows:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <t...
72,371,384
History data update<p>We have requirement to check the Auto Parking Membership activity. When an individual becomes member the details will stored initially with MemberID, MemberShipDate, ActivityDate, ActivityMonthEnd, IsActive, ActiveYTD. This data will be stored into DW table. This is <strong>daily</strong> data ...
<p>You can do that using Window Function.</p> <p>The idea is to find the last IsActive value with 'Y' of that year sorted by ActivityDateKey.</p> <p>Any row previous to that should have ActiveYTD as 'Y'. If there is any record with IsActive='N' after last 'Y', mark those as 'N'.</p> <p>Below Window Function will give t...
History data update
sql|sql-server-2012
0
44
1
72,378,491
72,378,491
1
true
2022-05-25T02:30:09.307Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: History data update<p>We have requirement to check the Auto Parking Membership activity. When an individual becomes member the details will stored initially...
72,338,092
selecting out even number only once without repeating the same number in python list<p><code>list1 = [2,4,6,8,3,4,2,]</code> From the above list I need to obtain the following result <code>[2,4,6,8]</code></p> <p>Here is the way that how I tried. But it resulted an error without giving the expected result.</p> <pre cl...
<p>I've made minor modification to your code, and simply apply <code>set()</code> to get only the unique values, and <code>list()</code> to convert it to a list, and <code>sorted()</code> to get the values in ascending order</p> <pre><code>list1 = [2,4,6,8,3,4,2,1] x=[] for num in list1: if (num % 2 == 0): ...
selecting out even number only once without repeating the same number in python list
python|python-3.x|list|for-loop|append
1
44
4
72,338,139
72,338,139
1
true
2022-05-22T13:41:02.137Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: selecting out even number only once without repeating the same number in python list<p><code>list1 = [2,4,6,8,3,4,2,]</code> From the above list I need to ob...
72,273,995
For loop in useEffect too many re-renders<p>I am working on a for loop that starts with 1 column at the window.innerHeight of 530px and increments with +1 if the window.innerHeight gets incremented with 40.</p> <p>This is what I have right now, but it says too many re-renders everytime. Does anyone know why?</p> <pre><...
<p>You need to add dependency list to your useEffect :</p> <pre><code>let gridcolumns = 1; useEffect(() =&gt; { for (let i = 530; i &lt; window.innerHeight; i += 40) { gridcolumns += 1; } setColumnsAmount(gridcolumns); },[]); </code></pre>
For loop in useEffect too many re-renders
javascript|reactjs
0
44
2
72,274,030
72,274,030
2
true
2022-05-17T12:22:26.640Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: For loop in useEffect too many re-renders<p>I am working on a for loop that starts with 1 column at the window.innerHeight of 530px and increments with +1 if...
72,299,311
Remove rendered data from UI<p>I have a component that prints 10 numbers one after another. I also have a button <code>Clean</code> that have to remove this 10 numbers when it's clicked. I am not sure how to implement it.</p> <pre><code>import { useState } from 'react' export default function Timeout() { const [mess...
<p>onClick takes in a function. Setting onClick to an arrow function should fix the infinite loop.</p> <pre><code>&lt;button onClick={()=&gt;setMessage([])}&gt; Clean &lt;/button&gt; </code></pre>
Remove rendered data from UI
reactjs|react-hooks
1
44
1
72,299,608
72,299,608
2
true
2022-05-19T05:56:54.970Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Remove rendered data from UI<p>I have a component that prints 10 numbers one after another. I also have a button <code>Clean</code> that have to remove this ...
72,302,317
how to convert a string array to number array?<p>I am trying to convert a string array to a number array A quick google search have lead me to this solution.</p> <pre><code> let numbersAsStringArray = originalQueryParams[property] ?? [] let numbers = numbersAsStringArray.map((i) =&gt; Number(i)); </code></pre> <...
<p>It's a compilation error, not runtime error. Just tell TS that numberAsStringArray is of type <code>string[]</code> and it should be ok.</p> <pre><code>let numbersAsStringArray = (originalQueryParams[property] || []) as string[]; let numbers = numbersAsStringArray.map((i) =&gt; Number(i)); </code></pre>
how to convert a string array to number array?
arrays|typescript
0
44
2
72,302,390
72,302,390
2
true
2022-05-19T09:48:15.903Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to convert a string array to number array?<p>I am trying to convert a string array to a number array A quick google search have lead me to this solution....
72,302,717
Scala: Can I write my function like a method of type?<p>Is it possible to write postfix function that I can use like that:</p> <pre><code>//... val myStr: String = &quot;some string&quot; val myNewStr = myStr myFunction otherMyFunction // Instead of: otherMyFunction(myFunction(myStr)) def myFunction(String: str): St...
<p>It sounds like what you're asking is whether you can add a method to the String type. Yes, you can do that with an implicit class. See, for example, <a href="https://www.baeldung.com/scala/implicit-classes" rel="nofollow noreferrer">https://www.baeldung.com/scala/implicit-classes</a>.</p>
Scala: Can I write my function like a method of type?
scala
0
44
2
72,302,874
72,302,874
2
true
2022-05-19T10:12:47.957Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scala: Can I write my function like a method of type?<p>Is it possible to write postfix function that I can use like that:</p> <pre><code>//... val myStr: S...
72,307,480
Does db_datawriter have a read permission on a database?<p>I'm learning more about Microsoft SQL Server and I get confused about what each database-level role does. I read an article which defines db_datawriter as follows:</p> <blockquote> <p>Members of the db_datawriter fixed database role can add, delete, or change ...
<p>No, it will grant write abilities such as <code>insert</code>, <code>update</code>, and <code>delete</code>.</p> <blockquote> <p>Members of the db_datawriter fixed database role can add, delete, or change data in all user tables.</p> </blockquote> <p><a href="https://docs.microsoft.com/en-us/sql/relational-databases...
Does db_datawriter have a read permission on a database?
sql-server
0
44
1
72,307,542
72,307,542
2
true
2022-05-19T15:44:11.767Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Does db_datawriter have a read permission on a database?<p>I'm learning more about Microsoft SQL Server and I get confused about what each database-level rol...
72,317,037
Creating a log to record when values change in a database<p>I'm trying to create a table which stores a date log of changes for certain attributes,easier to explain with an example + data - <a href="https://www.db-fiddle.com/f/rFE8tVHkkb46qiBivPm8oE/2" rel="nofollow noreferrer">DBFIDDLE</a>.</p> <p>In the example I've ...
<p>Have you considered merely using a <a href="https://cloud.google.com/bigquery/docs/materialized-views-intro" rel="nofollow noreferrer">materialized view</a> that projects this information out from some larger table of all your logged changes? Because of how these views work, they'd automatically return fresh data wh...
Creating a log to record when values change in a database
sql|google-bigquery
0
44
1
72,317,721
72,317,721
2
true
2022-05-20T10:01:46.060Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Creating a log to record when values change in a database<p>I'm trying to create a table which stores a date log of changes for certain attributes,easier to ...
72,321,064
How to add DATE_ADD in query on laravel<p>I have such a query</p> <pre><code>SELECT DATE_ADD(do, INTERVAL 1 DAY) AS od from termin </code></pre> <p>and I want to convert them to query in Eloquent</p> <pre><code>$tab = DB::table('termin')-&gt;get </code></pre> <p>how to do it Thank you for your help</p>
<p>You can convert your query as like below.</p> <pre><code>$tab = DB::table('termin')-&gt;selectRaw('DATE_ADD(do, INTERVAL 1 DAY) AS od')-&gt;get(); </code></pre>
How to add DATE_ADD in query on laravel
laravel|date|eloquent|add
0
44
1
72,321,725
72,321,725
2
true
2022-05-20T15:00:17.780Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add DATE_ADD in query on laravel<p>I have such a query</p> <pre><code>SELECT DATE_ADD(do, INTERVAL 1 DAY) AS od from termin </code></pre> <p>and I wa...
72,324,252
create a variable that is in sync with a files content in bash<p>In bash i'd like to read in a variable that is constantly in sync with a files contents.</p> <p>how can I get this done?</p> <pre><code>echo &quot;test&quot; &gt; /tmp/test value=$(&lt;/tmp/test) echo $value test echo &quot;test2&quot; &gt; /tmp/test ec...
<p>As @Fravadona comments, not possible.</p> <p>Using a function is a workaround:</p> <pre class="lang-sh prettyprint-override"><code>value() { cat /tmp/test; } echo &quot;test&quot; &gt; /tmp/test echo $(value) # =&gt; test echo &quot;test2&quot; &gt; /tmp/test echo $(value) # =&gt; test2 </code></pre>
create a variable that is in sync with a files content in bash
bash
1
44
2
72,325,060
72,325,060
2
true
2022-05-20T20:00:17.580Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: create a variable that is in sync with a files content in bash<p>In bash i'd like to read in a variable that is constantly in sync with a files contents.</p>...
72,336,233
I got an error when extracting data from a csv file by pandas<p>I'm trying to get a signal out of aapl data but i got this error</p> <pre><code>import numpy as np import pandas as pd import matplotlib.pyplot as plt from datetime import datetime apple_stock = pd.read_csv('AAPL.csv') apple_stock = apple_stock.set_index(...
<p>You cannot in one side use the [i] locator, and on the other side set it free. But, to do what you are expecting, here is a easy way :</p> <pre><code>import numpy as np import pandas as pd import matplotlib.pyplot as plt from datetime import datetime apple_stock = pd.read_csv('AAPL.csv') apple_stock = apple_stock.s...
I got an error when extracting data from a csv file by pandas
python|pandas
2
44
1
72,336,312
72,336,312
2
true
2022-05-22T09:18:55.040Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I got an error when extracting data from a csv file by pandas<p>I'm trying to get a signal out of aapl data but i got this error</p> <pre><code>import numpy ...
72,358,009
Pandas find and replace based on column items count<p>I have a dataframe that looks like this</p> <pre><code>import pandas as pd all_data_set = [ ('A','Area1','AA','A B D E','A B','D E'), ('B','Area1','AA','A B D E','A B','D E'), ('C','Area2','BB','C','C','C'), ('E','Area1','CC','A B D ...
<p>Try</p> <pre class="lang-py prettyprint-override"><code># identify rows where Type is BB m = all_df['Type'] == 'BB' # for Type BB rows, replace Group, AA members and CC members values by Name all_df.loc[m, ['Group', 'AA members', 'CC members']] = all_df.loc[m, 'Name'] print(all_df) </code></pre> <pre><code> Name ...
Pandas find and replace based on column items count
python|pandas|dataframe
1
44
2
72,358,099
72,358,099
2
true
2022-05-24T06:17:36.007Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas find and replace based on column items count<p>I have a dataframe that looks like this</p> <pre><code>import pandas as pd all_data_set = [ ('...
72,373,700
Problem applying an operation by NumPy advanced indexing<p>I have two arrays by shape <code>c = (2, 10, 2, 3)</code> and <code>p = (2, 5, 3)</code>. I want to pick the first vectors in the 3d dimension of <code>c</code> and minus it from each vectors in the corresponding row of <code>p</code>. It will be better underst...
<p>Let's start here:</p> <blockquote> <p>I have broadcasted p from shape (5, 3) to (2, 5, 3) to be corresponded with 1st dimension of c. Is there a better way, without this broadcasting (may be just by advanced indexing instead), to handle this problem?</p> </blockquote> <p>So, if I understand correctly, p should actua...
Problem applying an operation by NumPy advanced indexing
python|arrays|numpy|indexing|advanced-indexing
0
44
1
72,377,927
72,377,927
2
true
2022-05-25T07:42:35.460Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Problem applying an operation by NumPy advanced indexing<p>I have two arrays by shape <code>c = (2, 10, 2, 3)</code> and <code>p = (2, 5, 3)</code>. I want t...
72,389,595
java.lang.Class cannot be cast to clojure.lang.IFn when date capturing and string formatting<p>I'm not really seeing where I'm going wrong here, especially since I hit upon a minor variation at one point that allowed this, but couldn't explain why it worked. Please also tell me, in a more overall sense, what the issue ...
<p>Add a <code>.</code> right at the end of <code>SimpleDateFormat</code>. Right now, you're calling the class as a function, hence that exception. Adding a dot at the end makes it an instantiation.</p> <p>You can do the same with <code>(new java.util.Date)</code> - it can be replaced with <code>(java.util.Date.)</code...
java.lang.Class cannot be cast to clojure.lang.IFn when date capturing and string formatting
java|date|casting|clojure|interop
1
44
1
72,390,066
72,390,066
2
true
2022-05-26T09:25:02.417Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: java.lang.Class cannot be cast to clojure.lang.IFn when date capturing and string formatting<p>I'm not really seeing where I'm going wrong here, especially s...
72,397,109
Python dataframe: fill text in certain rows if other columns satisfied<p>I have two columns. I want to fill text in the second column based on the values in the first column.</p> <p>Here is my code:</p> <pre><code>df = pd.DataFrame({'value':[100,10,-5,2],'text':['fine','good',np.nan,np.nan]}) df['text'] = np.where(df['...
<p>You need to set the other part of your condition:</p> <pre><code>df['text'] = np.where(df['value'] &lt; 5, 'bad', df['text']) print(df) # Output value text 0 100 fine 1 10 good 2 -5 bad 3 2 bad </code></pre>
Python dataframe: fill text in certain rows if other columns satisfied
python|pandas|dataframe|numpy
2
44
4
72,397,140
72,397,140
2
true
2022-05-26T19:32:21.613Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python dataframe: fill text in certain rows if other columns satisfied<p>I have two columns. I want to fill text in the second column based on the values in ...
72,397,130
how to get subarray of matrix in python<p>say I have the following array <code>j</code>:</p> <pre><code>[[1, 2, 3, 4, 5], [7, 7, 7, 6, 4], [1, 1, 2, 0, 0]] </code></pre> <p>how can I get the subarray of 2x2 so the subarray would be:</p> <pre><code>[[1, 2], [7, 7],] </code></pre> <p>intuitively I assumed <code>j[0...
<p>You need to explicitly say what you want from each row:</p> <pre><code>[r[0:2] for r in j[0:2]] </code></pre>
how to get subarray of matrix in python
python|arrays|matrix
0
44
3
72,397,168
72,397,168
2
true
2022-05-26T19:35:20.580Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to get subarray of matrix in python<p>say I have the following array <code>j</code>:</p> <pre><code>[[1, 2, 3, 4, 5], [7, 7, 7, 6, 4], [1, 1, 2, 0, 0...
72,397,507
Generate smaller tensors for each sequence of values<p>Consider this tensor.</p> <pre><code>a = tf.constant([0,1,2,3,5,6,7,8,9,10,19,20,21,22,23,24]) </code></pre> <p>I want to divide it into 3 tensors (for this specific example), containing the groups where the numbers are immediately adjacent. The expected output wou...
<p>For the example provided, <a href="https://www.tensorflow.org/api_docs/python/tf/split" rel="nofollow noreferrer">split</a> should work:</p> <pre><code> a = tf.constant([0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 19, 20, 21, 22, 23, 24]) print(tf.split(a, [4, 6, 6])) </code></pre> <p>Output:</p> <pre><code>[&lt;tf.Tensor...
Generate smaller tensors for each sequence of values
python|tensorflow|keras|tensor|tf.keras
0
44
1
72,398,067
72,398,067
2
true
2022-05-26T20:09:12.733Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generate smaller tensors for each sequence of values<p>Consider this tensor.</p> <pre><code>a = tf.constant([0,1,2,3,5,6,7,8,9,10,19,20,21,22,23,24]) </code>...
72,263,979
How should I approach error handling in PHP? Specifically user input<p>I've been using PHP for quite a long time now, and I do enjoy it. However, it has come to my attention that my error handling is not up to scratch and for the new project I am working on, I want to adopt a proper error-handling method.</p> <p>I'm wo...
<p>I have utilised comments below to come up with two individual functions for soft errors and returning user errors</p> <p>For user errors:</p> <pre><code>function return_error($msg){ $_SESSION['error']=$msg; header(&quot;location:javascript://history.go(-1)&quot;); exit; } </code></pre> <p>For soft errors...
How should I approach error handling in PHP? Specifically user input
php|error-handling|error-logging|error-log
0
44
1
72,402,090
72,402,090
2
true
2022-05-16T18:29:43.670Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How should I approach error handling in PHP? Specifically user input<p>I've been using PHP for quite a long time now, and I do enjoy it. However, it has come...
72,277,448
How to access a variable outside of a class function if it wasn't passed to the function<p>I have been tasked to modify the behavior of a function in one of our Python classes.</p> <p>Our function takes a few parameters, one being a debug flag. Currently the if the debug flag is not specified then we assume it to be Fa...
<p>Use <code>globals()['debug']</code> instead.</p> <p>Or replace your fn() method to:</p> <pre><code>@classmethod def fn(self, debug=None): if debug is None: debug = globals().get('debug', 'BAD') return debug </code></pre>
How to access a variable outside of a class function if it wasn't passed to the function
python|variables|scope
0
44
3
72,277,645
72,277,645
2
true
2022-05-17T16:14:39.260Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to access a variable outside of a class function if it wasn't passed to the function<p>I have been tasked to modify the behavior of a function in one of ...
72,285,932
Pandas melt to copy values and insert new column<p>I have two dataframes like as shown below</p> <pre><code>test_id,status,revenue,cnt_days,age 1,passed,234.54,3,21 2,passed,543.21,5,29 11,failed,21.3,4,35 15,failed,2098.21,6,57 51,passed,232,21,80 75,failed,123.87,32,43 df1 = pd.read_...
<p>Because in ouput is not column <code>status</code> fors rmove it by <code>drop</code>, then use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.melt.html" rel="nofollow noreferrer"><code>DataFrame.melt</code></a> and add to <code>df2</code> by left join in <a href="http://pandas.p...
Pandas melt to copy values and insert new column
python|pandas|dataframe|numpy|pandas-groupby
2
44
2
72,286,031
72,286,031
2
true
2022-05-18T08:45:29.813Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas melt to copy values and insert new column<p>I have two dataframes like as shown below</p> <pre><code>test_id,status,revenue,cnt_days,age 1,passed...