input_text_instruct
stringlengths
288
45.8k
output_text
stringlengths
37
33.2k
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: mmonit not using remote server IP, using localhost instead<p>I've got an install of mmonit with various servers reporting into it. The monitoring is working,...
<p>Use a proper hostname or ipaddress in the Monit monitrc files.</p> <pre><code>set httpd port 2812 and use address 1.2.3.4 allow localhost allow 1.2.3.0/24 </code></pre> <p>The &quot;use address&quot; address used by Monit should be reachable by your M/Monit system. And the &quot;allow&quot; address mask should...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to download folder from firebase storage with flutter?<p>I want to download .epub files from firebase storage. I can download image file cause...
<p>Use Firebase's <code>writeToFile</code> instead of dio's <code>download</code>.</p> <pre><code>final fileRef = storageRef.child(&quot;&lt;path here&gt;&quot;); final appDocDir = await getApplicationDocumentsDirectory(); final filePath = &quot;${appDocDir.absolute}/&lt;path here&gt;&quot;; final file = File(filePath...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Not allow same email to register multiple times<p>I would like my newsletter signup to only allow diffrent emails to signup and not allow the same email to s...
<p>For whatever field you want it to be duplicated you can use <code>unique=True</code> in the definition of the field. Your models has to define something like the following.</p> <pre><code>from django.db import models class Subscriber(models.Model): email = models.EmailField(max_length=255, unique=True) date...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP - SQL Statement created wrong<p>I try to implement a view counter with database for my website.</p> <p>My code:</p> <p>Function, that creates the query:<...
<p>Your code won't work if there's a value that duplicates the last value in the array, because <code>$value === end($arrElement)</code> will be true for the duplicate. That will cause you to add an extra <code>VALUES</code> to the query.</p> <p>Don't use loops, use <code>implode()</code>. Then you don't need to treat ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to combine the results of multiple SEPARATED select statements?<p>I'm new to SQL in general, I don't know if this is already answered or just ...
<p>Save the results of the first query in a <a href="https://dev.mysql.com/doc/refman/8.0/en/create-temporary-table.html" rel="nofollow noreferrer">temporary table</a>, then select from it in your final query:</p> <pre class="lang-sql prettyprint-override"><code>set @a = 1; create temporary table query1 select @a as al...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How could I solve Duplicate identifier 'DateType' Error on React/Typescript Building process<p>I am working with MUI lib, so that I have installed also the l...
<p>Step by step for solving the problem:</p> <ul> <li> <ol> <li>yarn remove @mui/x-date-pickers (this will remove x-date-picker which has a problem of compatibility on its version 5.0 beta)</li> </ol> </li> <li> <ol start="2"> <li>yarn add @mui/lab (if you cant find how to install it, you should put on your package jso...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Preventing The Entire List Re-Render on Item Addition in React Without Using memo<p>Please consider the following code: <a href="https://codepen.io/kyxey/pen...
<p>You've said:</p> <blockquote> <p>This question was asked from me in a coding interview. They explicitly mentioned that I'm not allowed to use <code>memo</code> or <code>useMemo</code> in the sense that these are considered <em>cheating</em>! Now I don't know exactly why they think in such way but I'm sure there's an...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Presenting Serverless Microservices<p>I've used microservice architecture for years. I've also used serverless functions for years. But I've never found a ...
<p>My phone buzzed this morning and <a href="https://medium.com/aws-serverless-microservices-with-patterns-best/aws-event-driven-serverless-microservices-using-aws-lambda-api-gateway-eventbridge-sqs-dynamodb-a7f46220b738" rel="nofollow noreferrer">this Medium article</a> popped up.</p> <p>Seems to validate the private ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: change value at specific location in a tibble<p>I have a df</p> <p><code>df = data.frame(col1=1:4, col2 = 5:8, col3 = 9:12)</code></p> <p>I want to change th...
<p>A possible solution:</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) df %&gt;% mutate(col2 = ifelse(row_number() == 2, 44, col2)) #&gt; col1 col2 col3 #&gt; 1 1 5 9 #&gt; 2 2 44 10 #&gt; 3 3 7 11 #&gt; 4 4 8 12 </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PySpark query performance - join vs when<p>I have a query where I want to change the content of two dataframes (purDf ~432.8 MiB &amp; ticDf ~9.3 GiB) based...
<p>After some further testing I found the reason why Alternative 1 was slower than Alternative 2.</p> <p>Before I ran the code shown above I defined the dataframes purDf and ticDf without actually using them. Due to sparks Lazy Evaluation, the dataframes were not actually loaded until I needed them for the first time. ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R: empty lists inside list of lists after running function + for loop<p>I have a list of dataframes which contain two columns with variables: var1 and var2. ...
<p>It is looping from 2, and then it got assigned, thus the <code>1</code> was left as empty</p> <pre><code>lapply(df_list, \(x) lapply(2:3, \(i) list(x[complete.cases(x[[i]]),]))) </code></pre> <p>-output</p> <pre><code>[[1]] [[1]][[1]] [[1]][[1]][[1]] ID var1 var2 1 1 0.10 1 2 2 0.24 NA 3 3 0.11 0 4 4 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Vue using js in script to refer to elements<p>So I'm following a post in stackoverflow <a href="https://stackoverflow.com/questions/12328714/convert-text-to-...
<p>The rendering engine hasn't rendered the HTML at the point in time when you make the call to <code>documents.getElementById('textCanvas')</code>.</p> <p>In fact, to be honest, your code is hardly Vue at all. Vue has a lifetime hook called <code>mounted</code>, which occurs when the rendering engine has finished rend...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: cuda SIMD instruction for per-byte multiplication with unsigned saturation<p>CUDA has a nice set of <a href="https://docs.nvidia.com/cuda/cuda-math-api/group...
<blockquote> <p>however, I couldn't find a similar function that computes per-byte multiplication for a 32bit register.</p> </blockquote> <p>There isn't one that returns the 4 individual products.</p> <p>The closest is the <code>__dp4a()</code> <a href="https://developer.nvidia.com/blog/mixed-precision-programming-cuda...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to open chrome devtools and ensure that console tab is selected<p>When you do command+option+i on this page, it will open the devtools. When i...
<p>Yes, you can use command + option + j to always open the Console! <a href="https://developer.chrome.com/docs/devtools/open/#console" rel="nofollow noreferrer">https://developer.chrome.com/docs/devtools/open/#console</a></p> <p><a href="https://i.stack.imgur.com/mwoIn.png" rel="nofollow noreferrer"><img src="https://...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't draw a concentric pie chart in R<p>I have the following data:</p> <pre><code>Phyla V4 Fl &lt;chr&gt; &lt;dbl&gt; &lt;dbl&gt; P...
<p>You may try this</p> <pre><code>df %&gt;% pivot_longer(-Phyla, names_to = &quot;type&quot;, values_to = &quot;y&quot;) %&gt;% ggplot(aes(x = type, y = y)) + geom_bar(aes(fill = Phyla), stat = &quot;identity&quot;, color = &quot;white&quot;, position = &quot;fill&quot;, width=0.7) + coord_polar(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MetPy and grb2 file opening issue: xarray's Value Error<p>I found in this script: <a href="https://unidata.github.io/python-training/gallery/declarative_500_...
<p>The original example you linked, while the source data is in GRIB2 format, is accessing the data from a <a href="https://www.unidata.ucar.edu/software/tds/current/tutorial/DAP.html" rel="nofollow noreferrer">THREDDS</a> server using the OPeNDAP protocol. You can tell this from looking at the URL and seeing <code>htt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Detail view is not displaying content of models<p>My detail View in Django, isn't successfully displaying the content selected from the listviews. The follow...
<p>The object data is passed as <code>object</code> and <code>post_model</code>, not <code>Post</code>, so:</p> <pre><code>&lt;h1&gt;Article Page&lt;/h1&gt;&lt;br&gt; {{ <strong>object</strong>.Author }} {{ <strong>object</strong>.Body }}</code></pre> <hr /> <blockquote> <p><strong>Note</strong>: Models normally have ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reorder "interesting" pieces of text using sed<p>I have a file named <code>file</code>, whose content is</p> <pre><code>noise noise X noise STUFF1 noise STUF...
<p>Using <code>sed</code></p> <pre><code>$ sed -n '/^X/{s/.[^[:upper:]]*\([[:alnum:]]*\)/\1 /g;h};/^Y/{s/.[^[:upper:]]*\([[:alnum:]]*\)/\1 /g;G;s/\n//p}' file STUFF3 STUFF1 STUFF2 </code></pre> <pre><code>$ cat script.sed /^X/{ #Match line beginning with X s/.[^[:upper:]]*\(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't bind to 'ngSelected' since it isn't a known property of 'option' - Angular 14<p>I have a <code>select</code> with an option im trying to auto-select.</...
<p>I found the solution. In my code, I was using the <code>[value]</code> with the <code>[selected]</code></p> <p>I removed the <code>[value]</code> and now the <code>[selected]</code> works.</p> <pre><code>&lt;option *ngFor=&quot;let r of this.roles&quot; [selected]=&quot;this.user.role.id == r.id&quot;&gt; {{r.na...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: optimizing synapse delta lake table not reducing the number of files<p>I created a simple synapse delta lake table via:</p> <pre><code>CREATE TABLE IF NOT EX...
<p><code>Vacuum</code> would be a more suitable command for your need. <code>Optimize</code> is more for relocating the data in columnar format and optimizing the performance of your table. Vacuum would remove your old data files. The default for vacuum is to keep 7 days of retention. If you want to vacuum more recent ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: One page available at two addresses .htaccess<p><strong>Initial data:</strong></p> <p>The site has some page:</p> <pre><code> http://domen.com/index.php?act=...
<p>As I understand your question you simply want to add a rule to redirect the original URL to the rewritten one?</p> <p>This should do what you want:</p> <pre><code>RewriteEngine on RewriteCond %{QUERY_STRING} ^act=([A-Za-z0-9]{3,10})$ RewriteRule ^/?index\.php$ /%1 [QSD,R=301,L] RewriteRule ^/?([A-Za-z0-9]{3,10})$ /i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Binary Search Tree traversal using recursion to store in JSON<p>I am trying to write a function to traverse a tree and store the values in a dictionary. I am...
<p>The <code>left</code> and <code>right</code> keys in your dict should not have <em>data</em> as values, but dictionaries. So assign the result of the recursive call to these keys.</p> <p>I would also give a default value to the last argument, so the main caller does not have to specify it.</p> <pre><code> def tra...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Nest.js - process.env.npm_package_description does not return correct value<p>When running Nest.js application <code>process.env.npm_package_description</cod...
<p>So, I don't know the why yet, will update when I can find the code, but it <em>looks</em> like what is happening is that when the <code>description</code> in your <code>package.json</code> is empty then <code>process.env.npm_package_description</code> gets set to the first line (or close to it) of your README.</p> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sort() Method For Similar Values<p>I am sorting an array using the <code>sort()</code> method. When there is a duplicate value I'd like to run secondary logi...
<p>If the <code>inventoryTotal</code> values are equal, then you should return a sort result based on doing a string comparison (using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare" rel="nofollow noreferrer"><code>localeCompare</code></a>) of the two <cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the reason that PyCharm is not executing code correctly while everything is fine in the Python console<p>Code running in PyCharm does not run as it s...
<p>This is a bug. I just tried it and it does the same thing on my machine, however when I run it through the pycharm debugger it allowed me to enter all 4 inputs and output the correct result.</p> <p>A temporary workaround is to enable the &quot;Emulate terminal in output console&quot; for a given in Modify Run Confi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: When do we need to use WebSettings.setDatabaseEnabled?<p>I'm working with Android WebView and have a concern related to the Webview database</p> <p><a href="...
<p>Does the webpage you use it to display require the database API? If so, you need to enable it. If not, you don't. If you don't know what page will be displayed so you can't answer that, you probably should be launching a browser rather than using WebView- web view should be used to display specific pages in your...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Condition in while loop, how to avoid TS2532: Object is possibly 'undefined'<p>Consider the following snippet:</p> <pre class="lang-js prettyprint-override">...
<p>The return value can be <code>number | undefined</code>. This does <em>not</em> mean that the function will return the same type of value when called twice in a row. (What if the type returned depends on a flag that gets toggled every call, or depends on <code>Math.random</code>?)</p> <p>Try assigning the result to ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to test function defined on window object in Jest and typescript<p>I'm trying to test a call to a function defined on the global window object. I have lo...
<p>The problem here is your import order.</p> <p>When you <code>import { Api } from &quot;./api&quot;;</code>, you run <code>const verifier = window.Verifier;</code>, which, at the time, is <code>undefined</code>.</p> <p>If you change the order of the imports and spies it should work as expected:</p> <pre class="lang-j...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CSS not working inside subfolder in reactjs<p>I am working in Reactjs and i am using &quot;Nextjs&quot; framework,I am working in project Where i put my &quo...
<p>You can't import css from <code>document.js</code>. You'll have to do so from <code>pages/_app.js</code>.</p> <p><a href="https://nextjs.org/docs/basic-features/built-in-css-support#:%7E:text=Adding%20a%20Global%20Stylesheet" rel="nofollow noreferrer">Nextjs docs</a></p> <blockquote> <p>Due to the global nature of s...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find rows that have the same value and select the newer one<p>I got a table, that looks like this:</p> <div class="s-table-container"> <table class="s-table"...
<p>On MySQL 8+, we can use <code>ROW_NUMBER</code> here:</p> <pre class="lang-sql prettyprint-override"><code>WITH cte AS ( SELECT *, ROW_NUMBER() OVER (PARTITION BY sensorNr ORDER BY ModifyDate DESC) rn FROM yourTable ) SELECT serialNr, sensorNr, ModifyDate FROM cte WHERE rn = 1; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to create custom flag like is_staff and is_anonymous in django<p>There are some Boolean fields in Django's <code>User</code> Model, for example <code>is...
<p>You can create custom user model that is derived from <code>AbstractUser</code>.</p> <pre><code>from django.contrib.auth.models import AbstractUser class Student(AbstractUser): is_student = models.BooleanField(default=False) </code></pre> <p>And in settings.py, you need to set this user model as the AuthUser mo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to visually hold a button after it's been pressed in PySimleGUI?<p>I want to replace a dropdown with the user clicking an option instead.</p> ...
<p>There's no option <code>indicatoron</code> provided now, but tkinter code will work for it.</p> <blockquote> <p>Normally a radiobutton displays its indicator. If you set this option to zero, the indicator disappears, and the entire widget becomes a “push-push” indicatoron button that looks raised when it is cleared ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the "sense" of a command line option?<p>I am reading the documentation for <a href="https://developer-old.gnome.org/glib/stable/glib-Commandline-opti...
<p>If an option does not take an argument, it can be considered boolean. The option is usually considered 'true' if present, or 'false' if absent. Those interpretations can be reversed, and that changes the sense of the option.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Disable DoubleTapGesture Zoom out on MKMapView<p>I have observed <code>MKMapView</code> zoom-out on Double tap gesture, I didn't find any way to disable it. ...
<p>There is no API to disable or change double-tap behavior with <code>MKMapView</code>.</p> <p>But, if you really want to do so, one approach would be to find and remove the double-tap gesture recognizer from the <code>MKMapView</code> object.</p> <p>In the project you shared, you could do that in <code>makeUIView</co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trailing context match EOF flex-lexer<p>I want to match these two tokens:<br /> 1. <code>NUM</code>: A series of characters in <code>[0-9_]</code> with an op...
<p>The fact that you can't put EOF in trailing context is occasionally annoying but there's almost always a workaround, usually based on using maximal munch match ordering to ensure that some pattern matches at EOF because any other match would be longer. (Remember that trailing context counts for length comparison eve...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Tokenize equation using regex<p>I would like to tokenize equations using regex. My inputs would be something like this:<code>-cos(x)+4ln(x^2.2)^4=-2(pi+x)</c...
<pre><code>signs = ['\+', '\-', '\\', '\*', '\^', '\(', &quot;\)&quot;, '\{', '\}', '\[', '\]', '\=']; // Used to define mathematical symbols singRegex = new RegExp('[\\'+signArr.join('\\')+']', 'g'); </code></pre> <p>Generate regular expression like: <code>/[\+\-\\\*\^\(\)\{\}\[\]\=]/g</code> for symbols</p> <pre><co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to connect apache kafka to eclipse ditto?<p>I'm trying to connect apache kafka 2.x to eclipse ditto in locally with default configurations.</p> <p>I'm fo...
<p><strong>I solved</strong>: Checking in the ditto-connectivity logs (on docker), I found an error regarding a java library. To solve the problem I followed the installation of ditto again (<a href="https://github.com/eclipse/ditto#getting-started" rel="nofollow noreferrer">https://github.com/eclipse/ditto#getting-sta...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compare Times to get active time from data<p><a href="https://i.stack.imgur.com/peN4c.jpg" rel="nofollow noreferrer">Simulator Screenshot</a></p> <p>In the e...
<p>As the array is sorted you simply need to find the first item/index whose date is greater than the current date</p> <ul> <li>If the index is not found (current date is later than the date of the last item) the item is the last item</li> <li>If the index is 0 (current date is sooner than the date of the first item) t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create a column indicating shared unique cluster ID in R<p>I'd like to create a column that gives a unique CoupleID if ID and PartnerID contain the same valu...
<p>Try this</p> <pre><code>library(dplyr) df |&gt; rowwise() |&gt; mutate(g = paste0(sort(c_across(ID:PartnerID)) , collapse = &quot;&quot;)) |&gt; group_by(g) |&gt; mutate(CoupleID = cur_group_id()) |&gt; ungroup() |&gt; select(-g) </code></pre> <ul> <li>output</li> </ul> <pre><code># A tibble: 6 × 3 ID PartnerI...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Print the pair i,j of a matrix whose value is 1 in matlab<p>I'm working on a Matlab program that creates 2 n*n matrices, where n and each of the terms of the...
<p>You can use <a href="https://www.mathworks.com/help/matlab/ref/find.html" rel="nofollow noreferrer"><code>find()</code></a> to find all non-zero values. use <code>~A</code> to reverse the booleanness and find the zeros afterwards. Then concatenate everything and use <a href="https://www.mathworks.com/help/matlab/ref...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Shift letters in object array in a certain order<p>I'm trying to create unique <a href="https://web.library.yale.edu/cataloging/hebraica/about-gematria" rel=...
<p>I think you are looking for something like this:</p> <pre class="lang-py prettyprint-override"><code>from string import ascii_uppercase def gematria(n, alphabet): length = len(alphabet) ret = {} for i in range(length): j = i * n % length letter = alphabet[j] while letter in ret: ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I make a javacard appet which is not possible to be multi instance<p>I want to create a javacard applet which could not be installed more than once a...
<p>If the package AID is always the same the installations should fail during the loading process automatically.</p> <p>If the package and instance AIDs are using some pattern like an increasing last digit you could use <code>JCSystem.lookupAID</code> and try to iterate over the possible AIDs and fail if another instan...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to rotate a map view in SSRS?<p>I have a floor plan map that I have georeferenced in QGIS, drew polygons for the rooms over the floor plan, an...
<p>In case anyone else has the same problem, my solution for this ended up as follows from <a href="https://www.youtube.com/watch?v=_DKxAJ1xsrQ" rel="nofollow noreferrer">this tutorial</a>:</p> <ul> <li>Connect to the database in QGIS to display the data I had for the floor plan that had been loaded into SQL Server.</l...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cypress: Get all elements that have some specific attribute equal to any value<p>I am trying to get all elements that just have a specific attribute, doesn't...
<p>You can also directly use <code>row-index</code> for this:</p> <pre class="lang-js prettyprint-override"><code>cy.get('[row-index]').should('have.length', 3); </code></pre> <p>Another way to assert length:</p> <pre class="lang-js prettyprint-override"><code>cy.get('[row-index]').its('length').should('eq', 3); </code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use regex to match a group multiple times<p>Sorry for the bad title, I didn't know how to word this properly. I have a URL such as /colour-white/size-...
<p>It is pretty common to add multiple rewrite rules for different numbers of parameters. This works, including what comes before it (&quot;dresses&quot;) for up to three parameters. Adding a 4th parameter is just a fourth line. The number of rules needed increases linearly with the number of parameters, not exponen...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Inner_join output not string as a column<p>I want to join two data frames by the year date of the laydate df. I used the 'inner_join' function and it seemed...
<p>The issue is that you input your data as <code>character</code> so it can't be analyzed directly. You have to convert to <code>numeric</code> to make a histogram or perform any numeric operations. Also if you want to extract a column as a vector use <code>dplyr::pull()</code> rather than <code>dplyr::select()</code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why we write header and footer element inside of the body element in HTML5?<p>When we code in html5 we usually write code in this format</p> <pre><code>&lt;!...
<blockquote> <p>My question is why we do not write them separately when all the three tags has different semantic meaning?</p> </blockquote> <p>Because the semantic meaning they have isn't what you think it is.</p> <p>The <code>&lt;head&gt;</code> contents data <em>about</em> the document while the <code>&lt;body&gt;</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "Ambiguous column name" in SQLite using update and set<p>First of all, I'm sorry because I know there are many questions regarding &quot;Ambiguous column nam...
<p>Your syntax is wrong.<br/> There is no need to refer to the updated table after <code>FROM</code> and the <code>ON</code> clause must be replaced with a <code>WHERE</code> clause.<br/></p> <p>This is the correct syntax (if your SQLite version is 3.33.0+) for a join-like <a href="https://www.sqlite.org/lang_update.ht...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bad Request: message text is empty when sending get request via winapi to telegram bot<p>I'm trying to send message to telegram chat from bot using winapi an...
<p>There are a number of issues with this code:</p> <ul> <li><p>You don't need to typecast the return value of <code>wstring::c_str()</code> to <code>LPCWSTR</code> (aka <code>const wchar_t*</code>), as it is already that type.</p> </li> <li><p>You can't send body data in a <code>GET</code> request. The <a href="https:...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What value is used by the fill argument if the mapped variable isn't unique (ggplot)<p>Say we have some data like so:</p> <pre><code>df &lt;- as.data.frame(m...
<p><code>ggplot</code> doesn't need to decide <em>which</em> fill value to draw. It draws them all. The tiles are opaque, so you can only see the last tile drawn in a particular position. Typically this is just down to where the data point is within your data frame, with the points coming later being drawn on top of th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Display yes/no with content_tag helper by boolean<p>I am trying to display a badge pill that says 'Yes' or 'No' based on it's boolean value, using a content_...
<p>This (or something like it) will do the trick:</p> <pre><code>def boolean_for(bool = false) style = ['danger', t('No')] pill_text = 'No' if [true, 'true', 1, '1'].include?(bool) style = ['success', t('Yes')] pill_text = 'Yes' end content_tag(:span, pill_text, class: &quot;badge badge-pill badge-%s...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Left join on two DataFrames giving error cannot be applied to (org.apache.spark.sql.Dataset, org.apache.spark.sql.Column, String)<p>I am able to read them tw...
<p>Updated code to use</p> <p><code>sparkSession.read.parquet</code> instead of S3Reader and that worked</p> <pre><code>val geoFeaturesPropertyDF = sparkSession.read.parquet(&quot;s3n:&quot; + giNewBucket + geoInsightsPath + &quot;/properties.parquet&quot;) val meceGaiaGaia = sparkSession.read.parquet(&quot;s3:&quot; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: If I am manipulating the DOM with vanilla JS... can I make one of those items a React component?<p>I've got an applet right now that builds a table of TODOs ...
<p>You can dynamically insert a React component into an existing container easily enough:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>setTimeout(() =&gt; { // simulating a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to enable Placeholder for Floating Input Field in react?<p>bootstrap based Floating input place holder value not able to change. wanted to show some tex...
<p>It's not intended to show placeholder, when using a floating label.</p> <p>When no value is provided the label is displayed in the middle of the input and covers the space where a placeholder is normally shown. When value is provided label <strong>floats</strong> to the top corner of the input and below you can see ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Strapi V4 filter where relation does not exist<p>I'm setting up a comments-like system where comments have a <code>parent</code> field which relations to ano...
<p>So I found a solution to this using the Strapi query API rather than the entity service:</p> <pre class="lang-js prettyprint-override"><code> const posts = await strapi.db.query('api::post.post').findMany({ where: { thread: entity[0].id, parent: null...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Join columns, duplicating existing row for each variable in new column<p>Ok so say we have two different columns of data. One is just a running date column:<...
<p>You can use the regular joining functions from <code>dplyr</code> to perform a cross-join like this by setting the <code>by</code> argument to <code>character()</code>:</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) left_join(A, B, by = character()) #&gt; # A tibble: 18 × 2 #&gt; day I...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Arabic sentence for words are reversed on datatables pdfhtml5 "pdfmake"<p><a href="https://i.stack.imgur.com/95hUn.png" rel="nofollow noreferrer"><img src="h...
<p>This library doesn't support rtl very well.. but you could fix this issues in table body using &quot;render&quot; function in columns option to reverse the content..</p> <p>the problem is with your table head, because you can't customize table header content..</p> <p>but I figured out a trick to solve this issue..</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Nesting types in interfaces<p>So, I'm just trying to break down all the various types and interfaces for my project.</p> <p>Most of my data structures use an...
<p>Okay, looks like I was trying to over complicate.</p> <p>This seems to look correct:</p> <p><code>audit.interface.ts</code></p> <pre><code>export interface IAudit { [key: string]: number; } </code></pre> <p><code>component.interface.ts</code></p> <pre><code>import { IAudit } from 'Interfaces/audit.interface'; exp...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: 404 Error on Tomcat Server even when the WAR file is in the right folder<p>I am new to maven and building Java projects. So I built a Java project using Mave...
<p>There is a change for tomcat from version 10 onwards where they started supporting jakarta servlet and are migrating from javax. So I suspect your war will need to be migrated first. For that they have already provided a set of guidelines which you can read about on their official pages.</p> <p>For now ,</p> <ol> <l...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Merge two (or more) lists of dictionaries pairing using a specific key<p>I have a set of different lists of dictionaries (actually obtained reading Excel wor...
<p>I'm not sure if this is more efficient than your solution:</p> <pre><code>from operator import itemgetter from itertools import chain, groupby a = [{'idx': 1, 'foo': 'xx1', 'bar': 'yy1'}, {'idx': 0, 'foo': 'xx0', 'bar': 'yy0'}, {'idx': 2, 'foo': 'xx2', 'bar': 'yy2'}] b = [{'idx': 0, 'fie': 'zz0', 'fom': '...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the fastest\best way to get file names from a folder using PowerShell?<p>The directory has 20k folders in it. In these folders there are subfolders a...
<p>Very similar to <a href="https://stackoverflow.com/a/72324922/15339544">mklement0's helpful answer</a> but using the instance methods from <a href="https://docs.microsoft.com/en-us/dotnet/api/system.io.directoryinfo?view=net-6.0" rel="nofollow noreferrer"><code>DirectoryInfo</code></a>.</p> <p><a href="https://docs....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I am unable to label the data points on the graph using matplotlib<p>This is the code that I have been writing, but unable to add labels to the data points. ...
<p>You can add these two additional lines after plotting the scatter plots. They will add the text to the first and last entries. You can do additional things like background box, etc. if required. You can check matplotlib documentation and examples <a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mac M1 Spyder : ModuleNotFoundError: No module named 'lxml'<p>I am using Mac M1 now, when I am trying to import lxml in my python code, it shows below:</p> <...
<p>The main reason Spyder can't find 'lxml' is I used standalone Spyder, in order to fix this, I have to use a separate environment.</p> <p>1 - Follow below article to create a new virtual environment <a href="https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtua...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a logical algorithm to generate unique outputs for the given inputs?<p>I have a table of inputs that needs to output a unique formatted byte. The by...
<h2>18 bytes, 11 cycles</h2> <p>A small lookup table will be the smallest, fastest and don't forget most versatile solution to your question. You can easily change how these numbers map to each other.</p> <pre><code>LDX input ; 2 bytes, 3 cycles (Zero Page) LDA lookup,X ; 3 bytes, 5 cycles STA output ; 2 byt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add header to message with Graph API<p>I'm currently using Graph API to download messages and then move them to a different mail folder. This all works perfe...
<p>I believe the MIME support is read-only currently. To move emails, I suggest using the move action:</p> <pre class="lang-cs prettyprint-override"><code>GraphServiceClient graphClient = new GraphServiceClient( authProvider ); var destinationId = &quot;deleteditems&quot;; await graphClient.Me.Messages[&quot;{messag...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Expandable editor in scrollview cutting text in Maui<p>I am trying to create an editor field which behaves roughly like the one on Messenger. That is:</p> <u...
<p>After lots of frustation I figured out that the ScrollView did not properly register the changes of the content.</p> <p>I solved it by (at least on Android) by adding the following to the code-behind file:</p> <pre><code>// There is a mismatch between these values. They should be equal. // It appears the autosize do...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I add an IP address in a AWS CLI with out exporting<p>I am running below command to ingress in aws-cli, it is working fine if I provide an IP address...
<p>Use <code>-s</code> with <code>curl</code>.</p> <p>Try this:</p> <pre><code>aws ec2 authorize-security-group-ingress --group-id sg-123456778 --protocol tcp --port 22 --cidr $(echo &quot;$(curl -s https://checkip.amazonaws.com)/32&quot;) --profile xyzzy </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ReferenceError: member is not defined in Discord bot<pre><code>const { MessageEmbed} = require('discord.js') module.exports = { name: 'guildMemberA...
<p>When creating an event listener for the <code>guildMemberAdd</code> event, you would get a parameter which is the member who joined the server by default. So if you had an event listener like this, you could just use the <code>member</code> without defining it anywhere:</p> <pre class="lang-js prettyprint-override">...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Detect multiple keypresses and trigger an action once in p5.js<p>I want the user to be able to press <kbd>a</kbd>+<kbd>d</kbd> <strong>once</strong> and my g...
<p>There are a few approaches. The event-driven approach is using p5's <a href="https://p5js.org/reference/#/p5/keyPressed" rel="nofollow noreferrer"><code>keyPressed</code></a> and <a href="https://p5js.org/reference/#/p5/keyReleased" rel="nofollow noreferrer"><code>keyReleased</code></a> callbacks, pulling the key's ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Display different text values in an array with a button<p>Currently all values in the array are displayed at once when clicking on one of the two buttons. My...
<h1><strong>Follow up answer:</strong></h1> <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 arr = [{_id:1,name:"T-Rex"},{_id:3,name:"Predator X"},{_id:4 ,name:"Velociraptor"...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google Apps Script not sending email<p>We are trying to get e-mail notifications in cases there would be some dramatic changes in our revenue data. Could any...
<p>Try changing <code>if (overdueValue === &quot;TRUE&quot;)</code> to <code>if (overdueValue === true)</code></p> <p><strong>Updated Code:</strong></p> <pre><code>function sendEmail() { const ss = SpreadsheetApp.getActive(); const sh = ss.getSheetByName(&quot;Sheet1&quot;); const data = sh.getRange(&quot;B2:L80...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Animate closing dropdown menu with js and css?<p>I have a menu with submenu items, i managed to create a simple animation with css keyframe when openi...
<p>There are multiple ways to achieve this. Because you're showing and hiding the drop down lists with the <code>display</code> property we'll need to stick to animations.</p> <p>Create a new class for the <code>animateToBottom</code> keyframes. This class should be added <em>after</em> an element with the <code>show</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to solve this specific SQL query? My solution also returns not wanted values<p>I have three tables in my DB:</p> <ul> <li>&quot;<em>Film</em>&quot;, whic...
<p>You should first inner join &quot;<em>film</em>&quot; with &quot;<em>proiezioni</em>&quot;, such that you'll ensure to get projected films. Then you can exclude all theathers where the film was projected in any city other than &quot;<em>Pisa</em>&quot;, which will output films that were projected in Pisa only.</p> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQLAlchemy map to list related objects<p>I have a problem with mapping relation between two entities in SQLAlchemy. I am trying to achieve the next behaviour...
<p>The thing is that you're using <code>dynamic</code> loading strategy for relationship (<a href="https://docs.sqlalchemy.org/en/14/orm/collections.html#dynamic-relationship-loaders" rel="nofollow noreferrer">the docs are here</a>).</p> <p>When querying with <code>lazy = 'dynamic'</code>, SQLAlchemy generates a separa...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I insert HTML boiler plate code in Visual Studio Code on Mac?<p>I started the coding journey and installed VSC suggested during a YouTube tut.</p> <p>...
<p>I couldn't get VSCode to expand <code>!+Tab</code>, but I agree with you that it should have worked.</p> <p>However, I've figured out that you can use <code>html:5+Tab</code> (or just <code>!</code> with the <code>Emmet: Expand Abbreviation</code> command) to get a similar result.</p> <pre><code>&lt;!DOCTYPE html&gt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ACF - Display a photo for selecting a checkbox in Advanced Custom Fields<p>To sell my products, I need to display file types on the wc single product page. f...
<pre><code>function acf_product_icon_type(){ $prodoct_icon = get_field_object('product_type_icon'); $icons = $prodoct_icon['value']; if ($icons): $icons_img = array( 'Illustrator' =&gt; 'ai', 'Photoshop' =&gt; 'ps', 'Xd' =&gt; 'xd', 'Lightroom' =&gt; '...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Docker is not copying file on a shared volume during build<p>I would like to have the files created on the building phase stored on my local machine</p> <p>I...
<blockquote> <p>I can't understand why the files are not created on the building phase...</p> </blockquote> <p>That's because the build phase doesn't involve volume mounting.</p> <p>Mounting volumes only occur when creating containers, not building images. If you map a volume to an existing file or directory, Docker &q...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Automatically installing the latest Quarto version<p>I use a Quarto script to render my blog in Python. Quarto frequently updates, and I want to automaticall...
<p>This is another example leveraging latest github release and <code>gh</code> CLI</p> <pre><code>gh --repo quarto-dev/quarto-cli release download --pattern '*.deb' sudo dpkg -i $(ls quarto-*.deb) rm $(ls quarto-*.deb) </code></pre> <p>This could be adapted to any repo with Github release.</p> <p>Using <code>_download...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I build my custom CUDA library by CMake and link to it correctly?<p>I am trying to use cmake to build my own library. The code is finished by CUDA C/...
<p>With the <strong>first</strong> <code>CMakeLists.txt</code>, the shared and static library can be built. Then, use <code>NVCC</code> to compile the user's interface and link to <em>static</em> library. For example, one can go to the <code>Test</code> library, then input</p> <pre><code>nvcc ./src/main.cu ../lib/libcu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Open source data of the world map that includes longitude and latitude information along with land and sea indicator<p>I've came across OpenStreetMap and it'...
<p>you might want to have a look at the NaturalEarth datasets...<br /> <a href="https://www.naturalearthdata.com/downloads/" rel="nofollow noreferrer">https://www.naturalearthdata.com/downloads/</a></p> <p>They provide land and ocean shapefiles (and much more) which should fit your purpose.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React form error: Form submission canceled because the form is not connected<p>I have a form inside a class component. When I submit the form, I get a warnin...
<p>The browser's default handling of a form submission is to make an HTTP POST request to the server and reload the page with whatever is in the response (which may or may not even be content the browser can render). This is almost never what you want in a single page application, because your entire app and all of its...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to send a specific string to function in Kivy?<p>I am making a video search app, and I came across this issue and I can not solve it. The user...
<p>That is a common problem with defining a <code>lambda</code> that uses a loop index. The fix is to define another index that equals the loop index. Like this:</p> <pre><code> for i in range (len(vid_list)): self.ids.container.add_widget( OneLineAvatarIconListItem(text=vid_list[i], on_release=l...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to restrict Firebase API keys in the Google Cloud console<p>I have a question about the interplay of the Google Cloud API keys and the keys, that are use...
<p>I found out how Firebase updates its keys:</p> <blockquote> <p>When you first obtain your app's Firebase config file/object, Firebase checks if there are any existing API keys in your project that have &quot;Application Restrictions&quot; that match the app (for example, a matching bundle ID for the Apple app).</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Permanently change the background color of a pdf book from white to a gentle grey<p>I'm reading a 800-page PDF book, and the white background color burns my ...
<p>You can use a BeginPage procedure with Ghostscript to initially fill the page with a colour, and then render the page contents. If you use the pdfwrite device as the output device then you can create a new PDF file where the background is non-white.</p> <p>Make a text file on disk (eg gray.ps) with this content</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TypeError: test_admin_login() missing 1 required positional argument: 'self'<p>I'm writing test cases for my Django-based rest APIs. The problem is in the me...
<p>if any function needs the <code>self</code> this means you need to create an instance of it first to use it and you use <code>cls</code> not an instance so all you need is to create an instance</p> <pre class="lang-py prettyprint-override"><code>cls().test_admin_login(cls) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Multiple authentication servers for my OAuth 2 resource server<p>I have implemented a simple resource server with Spring Boot and Spring Oauth2 with Google a...
<p>For multi tenant scenarios (several token issuers), you should have a look at <a href="https://github.com/ch4mpy/spring-addons" rel="nofollow noreferrer">https://github.com/ch4mpy/spring-addons</a>. Your use-case is very close to <a href="https://github.com/ch4mpy/spring-addons/tree/master/samples/tutorials/resource...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to read .dat file from AWS S3 using mdfreader<p>I'm using Python 3.7 and trying to read a .dat file from AWS S3 and convert it to one or more CSV on cert...
<p>The easiest method would be to use <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.download_file" rel="nofollow noreferrer"><code>download_file()</code></a> to download the file from Amazon S3 to <code>/tmp/</code> on the local disk.</p> <p>Then, you can use your...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there an R function that turns a frequency table into a prop table?<p>What is the simplest way of turning a frequency data table into a prop table in R?</...
<p>Your data frame <code>df</code> has a 2nd column called <em>Total</em>. It seems that you want to divide subsequent columns by this one.</p> <pre><code>df[-1] &lt;- df[-1] / df$Total </code></pre> <p>After this, the 1st column <em>Time</em> does not change. 2nd column <em>Total</em> becomes 1. Other columns become p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Register page with Sveltekit + MongoDB but it keeps saying my inputs are null<p>Making a register page with MongoDB but it keeps saying my inputs are null. T...
<p>This is off:</p> <pre class="lang-js prettyprint-override"><code>const body = await request.body; </code></pre> <p>You need</p> <pre class="lang-js prettyprint-override"><code>const body = await request.json(); </code></pre> <p>(I recommend using TypeScript, it would yell at you because <code>request.body</code> has...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Partition an array into 2 arrays with equal sums<p>we have an array of integers that has to be partitioned into 2 arrays. My goal is not just to say i...
<p>One approach is to use knapsack algorithm. The knapsack has to hold a weight of Total Sum/2. Get the items whose weight is (Total Sum)/2.the remaining items will have same weight.</p> <p>Other approach is backtracking. Just run through the list to get a combination of numbers summing to Total Sum/2, once found a lis...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does python in while loop returns bigger value first even tho first one is supposed to be left pointer which can be only smaller<p>Hi so I did leetcode q...
<p>As those in the comments have pointed out, what you are currently returning, <code>{ l+1, r+1}</code>, is a set. Sets will hash their elements and display them in a manner that may not reflect how you defined them. What you likely want instead (as indicated by the function's annotation) is a list, <code>[ l+1, r+1]<...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use receivedDateTime in Graph API Request?<p>I am trying to use the receivedDateTime filter clause when calling the Graph API, but I'm running into is...
<p>You need to append the <code>Z</code> in the ISO 8601 time format, where Z represents the zone designator for the <strong>zero UTC offset</strong>. (e.g. <code>2022-05-23T11:59:59Z</code>)</p> <pre><code>https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=receivedDateTime ge 2022-05-23T11:59:59Z <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to remove duplicate in an array in Rust?<p>I have generated an array of numbers. I would like to remove the duplicates. In javascript I can just use <cod...
<h3>Using the standard library</h3> <p>Usually, sorting an array is an ok way of deduplicating it, but, except if you are using a radix sort (which is not the sorting method Rust uses), it's asymptotically better to what you would do in JS. Here is the Rust equivalent:</p> <pre class="lang-rust prettyprint-override"><c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to save dataframe to dictionary of different length<p>So I have a data frame that looks like this</p> <pre><code>2018-01-01 00:00:00 False 2018-01-01 ...
<p>You can use filtering and <code>groupby.agg</code>:</p> <pre><code>(df .loc[df[1], 0] .groupby((~df[1]).cumsum()) .agg(list) .reset_index(drop=True) .to_dict() ) </code></pre> <p>Output:</p> <pre><code>{0: ['2018-01-01 01:30:00', '2018-01-01 02:00:00', '2018-01-01 02:30:00'], 1: ['2018-01-01 04:00:00', '2018-...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to import a library component that exists in node_modules folder<p>I've installed 'react-image-gallery' library using yarn</p> <pre><code>yarn add rea...
<p>When using some third-party <code>packages</code> as <code>dependencies</code>, not all of those <code>packages</code> are written in <code>TypeScript</code>. Therefore the packages developers provide also an installation for the <code>type declarations</code> if other developers want to use those <code>types</code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: /bin/sh: /Users/{userName}/Desktop/{name}/Test No such file or directory (React Native Ios build issue in Mac book)<p>Project is in <strong>React Native Cli<...
<p>Check your main folder name it should not include spaces. After doing this try building your app again.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How we can check arr and stringA are satisfied with targetString in one goal?<p>I have a scenario to check whether the array or a string includes one specifi...
<p>There isn't a single method that has this behavior. You could make your own function to do it though. <code>typeof</code> can be used to tell whether you're checking a <code>string</code>; you could also use <code>Array.isArray</code> to tell if you're checking an <code>Array</code>.</p> <p><div class="snippet" data...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas get average from second dataframe of the last N rows within time interval<p>I have 2 DFs:</p> <p>DF1</p> <div class="s-table-container"> <table class=...
<p>You need to use <a href="https://pandas.pydata.org/docs/reference/api/pandas.merge_asof.html" rel="nofollow noreferrer"><code>pandas.merge_asof</code></a> to align the timestamps:</p> <pre><code>df1.join(pd .merge_asof(df2.sort_values(by='Timestamp'), df1.sort_values(by='Timestamp') ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: tf.GradientTape giving None gradient while writing custom training loop<p>I'm trying to write a custom training loop. Here is a sample code of what I'm tryin...
<p>Check the <a href="https://www.tensorflow.org/guide/autodiff#getting_a_gradient_of_none" rel="nofollow noreferrer">docs</a> regarding a gradient of <code>None</code>. To get the gradients for <code>x1</code>, you have to track <code>x</code> with <code>tape.watch(x)</code>:</p> <pre><code>x1 = tf.Variable(1.0, dtype...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to catch text till paranthesis in Python Regex?<p>I have a concatenated text that I want to split using Regex. Luckily there is a pattern. The pattern is...
<p>With</p> <pre><code>\(\d*-\d*\)\s*\w*:[^(]* </code></pre> <p>you can catch everything after the colon that is not an open parenthesis.</p>