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:
how to check a point if it lies inside a rectangle<p>I have a rectangle Rect (x,y,w,h) and a point P (px, py).
x and y are the top left coordinate of the rec... | <p>The point P(px, py) lies inside the Rectangle with top left pt. coordinates (x,y) and width and height w&h respectively if both the conditions satisfy:</p>
<ul>
<li>x < px < (x+w)</li>
<li>y > py > (y-h)</li>
</ul>
<p>Hope this helps :)</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
unable to pass datetime to google appengine from jsp form<p>I am trying to save the Date and Time taking it through the user from a frontend created in JSP a... | <p>It's unclear to me how are you taking that time in your front end but you are passing an invalid time format to Java.</p>
<p>In your front end you are using this format:</p>
<pre><code>yyyy-MM-dd'T'HH:mm
</code></pre>
<p>Java expect this format:</p>
<pre><code>yyyy-MM-dd HH:mm:ss.SSS
</code></pre>
<p>You have 2... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding polygon to plotly scatterplot<p>I created a plotly scatterplot in R on which I would like to add a polygon.</p>
<p><a href="https://i.stack.imgur.com/... | <p>Two solutions below. First, adding <code>inherit = FALSE</code> to <code>add_plygons()</code>.</p>
<pre><code>library(tidyverse)
library(plotly)
xym<-data.frame(y=c(3,4,4,3),
x=c(5,5,6,6))
fig <- plot_ly(data = iris, x= ~Sepal.Length, y = ~Sepal.Width, color = ~Species, text = ~paste(Species), ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google Charts column chart how to change vertical axis scale?<p>I have a <a href="https://jsfiddle.net/4v70bcw1/4/" rel="nofollow noreferrer">column chart</a... | <p>to use ticks and still be dynamic,<br />
you can use data table method <code>getComumnRange(columnIndex)</code><br />
to determine the min and max values of the y-axis values</p>
<p>then use those values to build the ticks array,<br />
see following working snippet...</p>
<p><div class="snippet" data-lang="js" data-... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Download a file reading first a file which contains the url<p>I have an mp3.txt file which contains URLs to download. How do I read the contents to then down... | <blockquote>
<p>How do I read the contents to then download the URLs?</p>
</blockquote>
<p>Example (as per <a href="https://www.autoitscript.com/forum/topic/208571-download-a-file-reading-first-a-local-txt-file-which-contains-the-full-url/?do=findComment&comment=1505225" rel="nofollow noreferrer">additional require... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Should I still specify Mongo's replicaset in my connection string?<p>I'm using Mongo with C# mongo driver<sub>(2.10)</sub>.</p>
<p>I've managed to connect t... | <p>Lots have changed over the course of time with MongoDB C# driver. Your decision will need to be based on the version you are using.</p>
<p><a href="https://jira.mongodb.org/browse/PERL-131" rel="nofollow noreferrer">First link</a> written in 2014 for perl driver</p>
<p><a href="https://stackoverflow.com/questions/... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I can't exit the program, just closing the window pyqt5<p>i Make program to show Message and after sometime change the Message but If you close the program, ... | <p>You could try using a <code>QtCore.QTimer</code> instead of a <code>threading.Timer</code>, e.g. (note that the time interval in <code>QTimer</code> is in ms)</p>
<pre><code>def mone():
self.Label.setText('Hello')
QtCore.QTimer.singleShot(3000, mtwo)
def mtwo():
QtCore.QTimer.singleShot(3000, mthree)
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Got Segmentation fault on accessing char array in function strcpy()<h1>Question</h1>
<p>I am always getting segmentation fault when I use the following code... | <p>String literals like <code>"Hello World"</code> have type <code>char const[]</code> and are stored in read-only memory, trying to change them crashes your application. Casting away <code>const</code> like you do won't fix that.</p>
<p>One fix would be to allocate the destination string on the stack:</p>
<pre><code... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is this Mysql Descending query not returning as intended?<p>i have this query:</p>
<pre><code>SELECT product_list.id AS listId, product.prod_name AS prod... | <p>The <code>FORMAT</code> function returns a string so you are not ordering based on integer values. You can use the inner call of that function to order and it will be by the integer value.</p>
<pre><code>order by MIN(pricelist.price) desc
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does .Net 6 determine it Enviroment<p>I've created a .Net 6.0 Console application. I need it to be able to migrate the database using the Entity Framewor... | <p>Production is the default.</p>
<p>Check out <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-6.0" rel="nofollow noreferrer">Use multiple environments in ASP.NET Core</a></p>
<blockquote>
<p><strong>Environments</strong></p>
<p>To determine the runtime environment, ASP.N... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find the run_length of a series of number digits and output as tuple of (digit, count)<p>Given an integer I need to create a list of tuples such that in each... | <p>You can create a simple run length encoder by keeping the previous character and keeping a count of the "run" - i.e. how many characters you've seen before it changes.</p>
<pre class="lang-py prettyprint-override"><code>def compress_rle(s):
compressed = []
if not s:
return compressed
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the difference between "returning super.getItemId(position)" and just returning "return position"<p>what is the difference between <code>returning su... | <p>Read the explanation about <a href="https://stackoverflow.com/questions/3767365/super-in-java/43538444">super</a>.</p>
<p>Calling <code>super.getItemId(position)</code> will call the <a href="https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/com/android/internal/widget/RecyclerView.java#... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert any decimals in each column to integers<p>I have a dataset where each column might have some decimals which i wish to convert to integers.</p>
<pre><... | <p>For generalization, suppose that your numbers are can be expressed as pretty fractions, and using @MrFlick's <a href="https://stackoverflow.com/questions/62681308/create-a-function-for-least-common-multiple-for-a-vector-in-r-with-helper-functi">lcm function for vector</a></p>
<pre><code>library(pracma)
library(MASS)... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
c# Converting a type to a generic<p>I'm trying to consolidate some code in an old .NET 4.0 project using <code>UnityContainer</code> for DI.</p>
<p>I have th... | <p>The Unity itself may have the better way to do this, but if we want to go in the reflection way, then we can do the following.</p>
<pre><code>public class CustomProviderBasesConvention : IAssemblyScannerConvention
{
void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
{
var met... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to find the same entries in 2 pandas series but with different case sensitivity<p>I would like to compare 2 pandas series and find the same entries in bo... | <p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.lower.html" rel="nofollow noreferrer"><code>Series.str.lower</code></a>:</p>
<pre><code>df = pd.DataFrame({'Identifier_1':['aBc','aBC'],
'Identifier_2':['Abc','ABZ'],
'Comment':['com1','com... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
if is in python not working on negative number<p>I've been working in python for a while now but just now I've encountered an error that I can't explain. </p... | <p>== checks if the two values are equal, is checks if the two objects are the same object. So when you create an integer object from your function you need to use ==. Using is here is checking if the function object -6 is the reference to another object -6.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Whats difference between test suite and test<p>Just installed fresh new react.</p>
<p>Create new <code>utils.js</code> file in <code>src</code> folder and wr... | <p>Test <em>suites</em> contain one or more tests. In this case <code>App.test.js</code> is the test suite. That suite contains two tests, <code>"test sum function"</code> and <code>"renders learn react link"</code>. This means you have one test suite with 2 tests.</p> |
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 make Period selectable in leaflet.timedimension<p>I use leaflet to show data for users on a map. I also use different leaflet plugins.
One ... | <p>Can you have the value of <code>period</code> changed by the user from a dropdown or input somewhere in the HTML?</p>
<pre><code>let user_input = 'PT60M' // Let PT60M be the default.
// Get user_input somewhere, (i.e. from a HTML dropdown, radio button, you can
// easily test using javascript's `prompt()` before c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WPF: automatically update ListView<p>I have a ListView that shows me .txt files in a specific folder. I want the ListView to update automatically as soon as ... | <p>Here is a simple example that uses the MVVM architectural pattern.</p>
<hr />
<p>There is a view model class that holds the <code>FileSystemWatcher</code> and an <code>ObservableCollection</code> of <code>FileInfo</code> objects that is used as source of a data binding in the view.</p>
<p>You have to take care for t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
using replace() to grab id from each link stored in an array?<p>The list of links is taken from the input while each link in the input is separated by a spac... | <ol>
<li>Split by <code>\nhttp</code></li>
<li>Find ID</li>
</ol>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var links=`https://drive.google.com/file/d/1jTZ37iVWdb6MEs1HQzFtk... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to assign a variable with another variable value without getting it the same id?<p>I was coding a test program that test many functions in Python to lear... | <p>You are right that assignment operators just bind the same object to the new variable. In general you can alternatively construct a new object by using copy or some other method. But this won't always work for every kind of value.</p>
<p>In some cases it is not even possible for the same value to have a different id... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Usage example of polynomial-algebra<p>I'm looking for a Haskell library to manipulate multivariate polynomials. I found <a href="https://hackage.haskell.org/... | <p>Here are some things I can tell by reading the <code>polynomial-algebra</code> docs you linked:</p>
<ul>
<li>You are offered a choice of several ways to describe the variables</li>
<li>The coefficient is abstracted over, and can be any type you like</li>
<li>The polynomial types all support <code>Num</code> so long ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Select only the jsonb object keys which are filtered and ordered by values in child object<p>in postgres 13, I have a Jsonb object and I am able to get only ... | <p>I would first 'normalize' JSON data into a table (the <code>t</code> CTE) and then do a trivial <code>select</code>.</p>
<pre class="lang-sql prettyprint-override"><code>with t (key, priority, ts) as
(
select key, (value ->> 'priority')::integer, value ->> 'timestamp'
from jsonb_each('{
"135&... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace transformation: What is the right way to do it?<p>I do this to replace a character in a string:</p>
<pre class="lang-py prettyprint-override"><code>d... | <p>This warning can be resolved by using the method <code>copy()</code>:</p>
<pre><code>df.loc[:,'msg'] = df['msg'].str.replace(u'X','W').copy()
</code></pre>
<p>Or <code>assign()</code></p>
<pre><code>df = df.assign(msg=df['msg'].str.replace(u'X','W'))
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to bold/keep measure names in r after merging on common columns<p>If I have two dataframes:</p>
<pre><code>tibble1 <- tibble("DoB" = c("... | <p>Here is a <code>tidyverse</code> <code>flextable</code> solution:</p>
<ol>
<li><p>After binding both tibbles we use coalesce to create <code>Variables</code> column.</p>
</li>
<li><p>We group by 2 rows and bring the tibble in shape with select</p>
</li>
<li><p>we use <code>group_modify</code> to add a row in first p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
XText Grammar rule for Abstract EMF Class<p>I have an EMF metamodel containing Abstract Class <code>A</code> and Concrete Classes <code>B</code> & <code>... | <p>it is not possible to call rules you don't have nor a catch all children</p>
<p>if you just want to have child rules and add a parent to them without a explicit rule for the parent</p>
<p>you can do</p>
<pre><code>B returns A:
{B} "b" name=ID;
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TYPO3 - Access settings in AuthenticationService<p>I do develop a little extension for a TYPO3 v10 where I need to gain access to the my extension-settings i... | <p>When the AuthenticationService is consulted for FE or BE login, typoscript is not available yet, as authentication happens early in the middleware stack (have a look at the order of the PSR-15 middlewares in the configuration module of the backend).</p>
<p>This is because typoscript is page dependend and whether you... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
o.apache.coyote.http11.Http11Processor: The host [${ip}] is not valid<p>I've noticed the following entry in the log of a Spring Boot application. What does i... | <p>The value of the <code>host</code> field in the header of the http request you sent does not resolve <code>${ip}</code> correctly, please check the information of the request you sent.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use nativescript-drawingpad in Nativescript-Vue?<p>I am trying to use Brad Martin's nativescript-drawingpad (<a href="https://github.com/BradMartin/na... | <p>With UI plugins you would mostly follow the <a href="https://nativescript-vue.org/en/docs/getting-started/nativescript-plugins/" rel="nofollow noreferrer">standard instructions</a> from the NativeScript Vue docs and I see you are already doing that.</p>
<p>Consider Core flavor as raw HTML (XML) & CSS, Vue / Ang... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
emmeans: regrid() for binomial GLMM with user-defined link function<p>I have fitted a binomial GLMM in R with a modified link function with a fixed guessing ... | <p>Looking at the linked suggestion, it appears that <code>mafc.logit()</code> is a function that returns a list with all the information needed to implement the transform. All you need to do is update the <code>emmGrid</code> object with that information:</p>
<pre><code>mod.emm <- update(mod.emm, tran = mafc.logit(... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Having a particular key in the registry apply to multiple conditions via the AppliesTo string value<p>I have a key that needs the rules enforced by it to app... | <p>The 'OR' keyword can be used to apply the rule enforced by a key to multiple cases in the <code>AppliesTo</code> string value.</p>
<p>Example: <code>AppliesTo=C: OR D:</code></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
If statement in react function<p>I have 2 inputs with minimum and maximun number range, and I'm trying to use if statement so if user puts in the minimun inp... | <p>In your function minRangeInputChange, your are checking <code>minNum</code> vs <code>maxNum</code>, so if <code>0 > 100 then set minNum to 100</code>. You want to compare the user value vs the max value, so if <code>XX > max (let's say 50), then set minNum to max</code></p>
<p>You should try this value :</p>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can a USB HID keyboard report be more than 8 bytes in size?<p>Can a USB HID keyboard report be more than 8 bytes in size? If yes what else is it related with... | <p>HID Report descriptor is a descriptor for data stored in the reports that gets in and out of your device. Host knows the size of input reports by parsing this descriptor. If you want to change any report size, you need to modify its descriptor accordingly.</p>
<p>HID input reports are transported through USB Interr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why am i getting undefined in my console, when i try to subscribe and use my context using typescript and react<p>When trying to create a simple quiz app wit... | <p>Any component that wish to use context value, should be wrapped inside the provider. Your <code><App /></code> component is using context value, so it should be:</p>
<pre><code><QuizContexProvider>
<App />
</QuizContexProvider>
</code></pre>
<p>You can put the provider in <code>Index.ts</co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
get record from list of dictionary with latest date python<p>I have a dict like this:</p>
<pre><code>[{'name': 'name1' , 'date':'1997-07-16 19:20:00+01:00'},... | <p>You can use <code>max</code> with <code>key=</code> parameter:</p>
<pre class="lang-py prettyprint-override"><code>data = [
{"name": "name1", "date": "1997-07-16 19:20:00+01:00"},
{"name": "name3", "date": "2006-07-16 19:20:00+01:00&q... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Build a PDF file Manually from scratch and embed images<p>I'm trying to generate a PDF file programmatically. </p>
<p>The entire case is: I'm receiving a mu... | <p>This first thing that stands out is your <code>startxref</code> is pointing to the wrong spot.</p>
<p><a href="https://i.stack.imgur.com/XQ4pk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XQ4pk.png" alt="enter image description here"></a></p>
<p>It points to the red, but should point to the b... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
with bs4 check if a class in another class exists or not and save the results accordingly in a list<p>I need to scrape information and store the information ... | <p>Simply use your <code>BeautifulSoup</code> object and check if element you try to find is available or not:</p>
<pre><code>author.get_text(strip=True) if (author := e.find('span', attrs={'class':'color-secondary'})) else None
</code></pre>
<p><strong>Note:</strong> <em>walrus operator requires Python 3.8 or later to... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google App Script URLFetch quota not clear<p>I'm interested of building a spreadsheet add-on that relies on external services and it seems that URLFetch is t... | <h2>Apps Script quota apply per user invoking a service.</h2>
<p>i.e. if each user of the application calls a service on his own behalf - each user will have awarded the quota mentioned in the documentation. </p>
<p>On the contrary, if you are using a service account that performs a call on behalf of a user without i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas / Pyspark Add Column to show duplicated values over condition<p>If like to add a column in my dataframe to mark if a condition is meet or not but I do... | <p>First, you calculate if a <code>name + surname</code> has a mark over 5. This can be done by calculating the maximum mark for that <code>name + surname</code>. Using that info, flag the records based on the condition.</p>
<pre><code>data_sdf. \
withColumn('name_max_mark', func.max('mark').over(wd.partitionBy('na... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Generating a CSV using Javascript<p>I successfully am generating a CSV using Javascript. I want to have two lines in the final CSV - one header and one data ... | <p>Try using blob API <a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/Blob</a>.
Here is an example <a href="https://stackoverflow.com/questions/17103398/convert-javascript-variable-value-to-csv-file">Convert JavaScript variable v... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript: Array element display depending on index<p>I'm very new in the coding world and my question is:
I have 2 arrays</p>
<pre><code>var user = ['Admin... | <p>A simple javascript <code>for</code> loop should do the trick</p>
<pre><code>var user = ['Admin', 'Sarah', 'Kellan', 'Kayliah', 'Kesiah', 'Chloe', 'Keba'];
var valid = ['free', 'free', 'free', 'reject', 'free', 'free', 'reject'];
for (var i = 0; i < valid.length; i++) {
if (valid[i] == 'reject') {
Display(u... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bootstrap 5 iframe unresponsive height<p>iframe in bootstrap card scales with width but not height how do I make the height responsive as well?</p>
<p><div c... | <p>From the bootstrap documentation: (<a href="https://getbootstrap.com/docs/5.2/helpers/ratio/#example" rel="nofollow noreferrer">https://getbootstrap.com/docs/5.2/helpers/ratio/#example</a>)</p>
<blockquote>
<p>Wrap any embed, like an <code><iframe></code>, in a parent element with <code>.ratio</code> and an as... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Array values not updated properly<p>I'm having an issue where I want to use an existing array and update one of it's properties using a for loop. I expect th... | <p>The problem is here:</p>
<pre><code>newAccount.accounts = accounts;
</code></pre>
<p>That just makes the property <code>accounts</code> on the new object refer to the <strong>same array</strong> as <code>accounts</code>, it doesn't copy the array. So all your code is working on the same array, and on the same object... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Attempting to move files with certain names to a new directory<h1>I am attempting to move files that start with PS-110 to a new folder I created named PS-110... | <pre><code>files_move = [files_move.append(f) for f in glob.glob('PS-110*.pdf')]
</code></pre>
<p>This doesn't create a list of files, it creates a list full of <code>None</code>. This is because <code>files_move.append(f)</code> returns None. And you're overwriting <code>files_move</code> with the new list by the tim... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to use an if for have a condition with few characters in an attribute value with XSLT 1.0<p>I have an XML I need to match one text node (my XSLT my xslt ... | <p>You could try this:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes&quo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Element won't hide - Jquery<p>I have several wrappers which contain a loading gif while the real image loads. </p>
<p>I also have some jquery that is suppos... | <p>Your code is working fine but you can improve it like this:</p>
<pre><code>$('.displayImg').on("load", function() {
$(this).prev(".loadingImage").hide();
});
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swapping column data in vba array<p>I am trying to make a Linear cutting list. Found some code to start with from <a href="http://dailydoseofexcel.com/archiv... | <p>You only have two columns, so you can do something like this instead:</p>
<pre><code>'Fill array with cuts
For i = 0 To UBound(CutArr, 1)
CutArr(i, 0) = rInputCuts.Cells(i + 1, 2) 'ColB
CutArr(i, 1) = rInputCuts.Cells(i + 1, 1) 'ColA
Next i
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Send 2 identical Graphql queries in one call but with different variables<p>I have a search query which takes an variable and searches based on that.</p>
<p... | <p>When a selection set includes the same field multiple times, you need to utilize aliases for the duplicate fields:</p>
<pre><code>searchBasicTeachersByRatingMedium: searchBasicTeachersByRating(rating: 3) {
id
name
title
}
searchBasicTeachersByRatingHigh: searchBasicTeachersByRating(rating: 4) {
id
name
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I calculate the distance between two squares on a grid, including the target square<p>I've been trying variations on the following code...</p>
<pre c... | <p>The problem is that performing a cast (<code>(int)</code>) effectively does a "floor" operation on your number, cutting off any decimal values, even if those decimal values are <code>.99999</code>. It sounds like you're looking instead to round the value to the nearest integer, which can be done with the <code>Math.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
node.js - Error: SQLITE_ERROR: near "users": syntax error<p>I'm trying to put a JSON object "Synced" (Which you will see in the code)
This is the code for a ... | <p>As Dave Newton said, I had to check my quoting. What I did was change my double quotes to single quotes which solved the problem.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CSS Hover Effect doesn't working as I want<p>I have two divs, one parent and one child. When hover the parent div element, i want to change background-color ... | <p>You line <code>.buttonHorizontal :hover</code> should be <code>.buttonHorizontal:hover</code> without the empty space!</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combine "Year", "Month", and "Day" columns in Biqquery to a Date column<p>I am new to the bigquery. I was looking into the public dataset <code>gsod</code>, ... | <p>Use below</p>
<pre><code>SELECT date(year, month, day) as date_ymd, *
FROM `bigquery-public-data.samples.gsod`
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Classes and packages encapsulation in an hexagonal architecture<p>I would like to know if in Java (JDK 17) there is a way to easily handle classes and packag... | <p>To achieve strong encapsulation with Java, you could make use of maven modules per layer, left, right and domain.
I have not tried but I guess Java 9 modules would also help here. Check <a href="https://medium.com/swlh/a-practical-example-of-applying-java-modules-in-a-hexagonal-architecture-d345deec654b" rel="nofoll... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java using Saxon (s9api) to transform XML: How to add input files in resources?<p>I use saxon (HE 9.9.1-6) to transform a XML to a HTML file. Saxon is used b... | <p>Some suggestions:</p>
<ul>
<li><p>Use a URI with the <code>classpath:</code> scheme (fairly recent addition and may not be supported on all paths where URIs are used)</p></li>
<li><p>Register an <code>UnparsedTextResolver</code> with the configuration; Saxon will delegate the task of finding the resource to this re... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Runing a REST web site from IIS Express returns 404 Not found<p>Developing a Dotnet Framework 4.8 REST API in VS2019 and starting IIExpress that way is no pr... | <p>The tricky part to simulate VS launching IIS Express is that you must call IIS Express command line with the correct <code>/config</code> switch pointing to the <code>applicationHost.config</code> file generated by VS (hidden in <code>.vs</code> folder, for VS2015 and above).</p>
<p><a href="https://docs.microsoft.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Preventing multiple switch statements<p>I'm currently writing a custom logging method for my Web API where users can purchase items. This log method will log... | <p>Whenever you are working on an object model and find yourself writing a ton of <code>switch</code> statements, it usually means you've put the class-specific logic in the wrong place. You should put it with the class itself, not the class that consumes it.</p>
<p>To put it another way, your logger should <em>not</e... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
change text of a Text graphics object using gfx library of Dojo<p>I've created a text object with some code like :</p>
<pre><code>var surface = dojox.gfx.cr... | <p>You can simply access the node and change it's innerHtml text like </p>
<pre><code>myText.rawNode.innerHTML = "Updated !";
</code></pre>
<p>See below snippet :</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-j... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get max salary and count from employee table<p>I have task where I need to filter in such a way that need to print the <code>max(salary * months)</cod... | <p>Here's one option:</p>
<p>Sample data:</p>
<pre><code>SQL> with emp (employee_id, name, months, salary) as
2 (select 12, 'ami', 15, 1230 from dual union all
3 select 14, 'bik', 1 , 678 from dual union all
4 select 15, 'tom', 10, 500 from dual union all
5 select 16, 'bob', 12, 3456 from du... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I extract specific parts of an argument and put them in their own variable<p>So I'm trying to get the name and id of an emoji in discord (discord.js) ... | <p>You can 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 str = `<:hack_wump:670702611627769876>`;
const [name, id] = str.slice(2, -1).spl... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding an external script to Nuxt<p>I have a script from a third party, that I need implemented on my Nuxt site in the Header.
What would be the best way to ... | <p>You can do it in the same way, just place the script into a javascript file and use the path to that file as a script's <code>src</code> property value in the <code>nuxt.config.js</code>:</p>
<pre><code>script: [
{ src: '/scripts/myScript.js' },
]
</code></pre>
<p>The <code>myScript.js</code> would be placed in ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
use preloaded bundled font in react<p>i wonder how do i access a font in CSS, when i preloaded it with <code>link</code> in a bundled app, font files get ren... | <p>well did not find any ways around that, solved by uploading font to a corporate CDN</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
clang error: cannot pass object of non-trivial type 'std::vector<long>' through variadic method; call will abort at runtime [-Wnon-pod-varargs]<p>I build wit... | <p>Why not also pass the function as a template parameter:</p>
<pre><code>#include <iostream>
#include <string>
#include <vector>
bool save(int a, std::vector<long> arr)
{
std::cout << a << '\n';
std::cout << " hello \n";
return true;
}
template <type... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
My tic tac toe game only works on the first click<p>I got this code from this <a href="https://www.youtube.com/watch?v=hYEEofdVOSY" rel="nofollow noreferrer"... | <p>After testing, I found the reason why the score cannot be displayed. Because the contents of the score box are not initialized when the program starts, <code>plus = int::Parse(playero->Text);</code> will cause an exception.</p>
<p>Solution:</p>
<p>Add the initialization of the score box in the MyForm_Load functio... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Racket 8.5 does not close primary and secondary windows<p>I installed Racket 8.5 on my MacBook (MacOS Ventura Beta) and ran into a number of problems:</p>
<o... | <p>I have no idea about the window thing: this doesn't happen on macOS 11 and I suspect is an artifact of running it on some beta version of macOS.</p>
<p>The arguments are because you're not in fact using <code>2htdp/image</code> but <code>htdp/image</code>, which provides a different version of <code>empty-scene</cod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get request does not get data on first call<p>I am working on an Angular project which needs to get data from my backend, which provides requests to an API, ... | <p>You should call get method when post request complete.
For example you can do in subscribe like that:</p>
<pre><code>ngOnInit(): void {
this.postUrlData();
}
postUrlData(){
this.route.queryParams.subscribe(params => {
this.urlData = {
vin : params['vin'],
dealerId: params['dealeri... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Stop Firebase from adding index number of ObservableCollection<p>Does anyone know how I can stop Real Time Firebase from adding the index of an observable co... | <p>If you want to get rid of the <code>-N7...</code> type keys, call <code>PutAsync</code> instead of <code>PostAsync</code>.</p>
<p>If you want to get rid of the <code>0</code>, then don't post a <code>ObservableCollection<Exercise></code>, but instead post a single <code>Exercise</code> object.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Jinja2 template is not detecting my python variable<p>I am trying to use a simple if statement in a jinja2 template as such:</p>
<p>testing.html :</p>
<pre><... | <p>you need to pass all the variables you want to inject in the template in the <code>render_template</code> function call, in your case:</p>
<pre><code>@app.route('/')
def testing():
typeEntry = "new"
return render_template("testing.html", typeEntry=typeEntry)
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
get only the second word<p>When i was parsing (simple html dom.php), I encountered the following problem, when receiving the final data, I need to get only t... | <p>You need to get the <code>innertext</code> of the element, not use the entire element as a string.</p>
<p>You can use <code>explode()</code> to split the string into words.</p>
<pre><code>$town_name = $town->innertext();
echo explode(' ', $town_name)[1];
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Constraints for Rotor Balancing Problem with CVXPY<p>I am a machinery engineer with minimum background on math. I was tempted to use CVXPY to write a simple ... | <p>After getting a user input for constraint masses matrix <code>wc(N,1)</code> the following code seemed to do the trick: </p>
<pre><code>const=[]
const += [cp.norm(W2[i])<=wc[i]for i in range (N) ]
prob3=cp.Problem(objective2,const)
prob3.solve()
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
String Manipulation topic message<p>I am working on an assignment that requires you to subscribe to a topic, retrieve a message, then remove a character from... | <p>You are passing the string as <code>const &</code> which as the <code>const</code> implies can't be changed.
Change the signature to <code>void callback_func_name(std_msgs::String& msg){</code> so you take a reference to the message, which will modify the original object.</p>
<p>Note when taking a reference... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GCP vm firewall block all incoming port but 80. How SSH?<p>I ssh to GCP Centos vm instance by port 22 but I run firewall-cmd script to block all incoming por... | <p>You can solve this by creating a <a href="https://cloud.google.com/compute/docs/startupscript" rel="nofollow noreferrer">startup-script</a> with the firewall-cmd commands you need to have the port 22 opened and then apply it to your instance. </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In kivy, how do I separate the on_release of multiple buttons in a single custom widget?<p>I am defining a custom widget with multiple buttons named SplitBut... | <p>You can do a very similar thing with the <code>on_release</code> methods as you did with the <code>text</code>. You can add <code>ObjectProperty</code> in <code>SplitButton</code> to hold a reference to the method to be called in <code>on_release</code>. Here is a modified version of your code that does that:</p>
<p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to show HTML text in TextView?<p>how to show this html code in TextView. without any minimum API requirement</p>
<p>HTML CODE IS BELOW:</p>
<pre><code>... | <p>Here is Solution.</p>
<pre><code>package com.andro.coundowntimer;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.text.HtmlCompat;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
String htmlCode= "<h2>Hey !</h2>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to mirror only tags to codecommit from bitbucket<p>I have an AWS CodeCommit repo. It has as source a bitbucket repo.
I am following this guide:</p>
<p><a... | <p>In my Pipeline (using bitbucket and CodePipeline), I resolved creating an ssh key in my bitbucket's repository (>Settings), importing it to a user, on my AWS account, with right permissions (see below), and writing this bitbucket-pipelines.yml file:</p>
<pre><code>
image: atlassian/default-image:3
pipelines:
t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use findOneAndUpdate using an aggregated query in mongoDB?<p>I am using nestJS as a backend connected with MongoDB. I am able to access a nested array... | <p>You want to use <a href="https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/" rel="nofollow noreferrer">arrayFilters</a> like so:</p>
<pre><code>db.collection.updateOne(
{
//query to match document
},
{ $set: { "Categories.$[cat].name": newValue } }, //set name to ne... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Terraform - Optional Nested Variable<p>I'm trying to create a module for Sagemaker endpoints. There's an optional object variable called <code>async_inferenc... | <p>You could use a <code>dynamic</code> block [1] in combination with <code>for_each</code> meta-argument [2]. It would look something like:</p>
<pre><code>dynamic "async_inference_config" {
for_each = var.s3_output_path != null && var.max_concurrent_invocations_per_instance != null ? [1] : []
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to edit a file with SED?<p>I am running docker on a Virtual Machine on an Amazon AWS EC2 instance and I want to edit one file (application.properties) wh... | <p>Given the following <code>application.properties</code> example file</p>
<pre class="lang-ini prettyprint-override"><code>toto="some value"
accessToken="atoken"
pipo="other value"
bingo=1
</code></pre>
<p>the following <code>sed</code> command:</p>
<pre><code>sed -i 's/^\(accessToken=\)... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter: update was called on null<p>I am trying to make a game with flutter's library Flame. But I am getting this error every time. It is saying that the u... | <p>Your <code>initialize</code> function is async, meaning it will run in the background. Therefore when update is first called, <code>startText</code> is null and gives you the NPE. You probably want to add some check on <code>update</code> to make sure it's initialized before moving forward with update code, or make... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calling webservice results in error "Object reference not set to an instance of an object"<p>I call a specific <code>webservice</code> method from my android... | <p>After several days and hours on end of testing I was able to resolve the issue. I am rather new at developing android apps, so certain things tend to stick in my mind and one of those things is that android for some reason tends to add an extra space, albeit randomly it seems, and depending on the situation, it can... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to achieve layout with jetpack compose where icon is position absolute on column layout<p>I have comment box and need to put icon on specific position ( ... | <p>You can do it by using <code>Modifier.offset{}</code> and putting your <code>Icon</code> inside a <code>Box</code> with <code>Modifier.align(Alignment.BottomEnd)</code></p>
<pre><code>@Composable
private fun Test() {
Column(modifier = Modifier.padding(10.dp)) {
Box(
modifier = Modifier
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Slice a dataframe by max value as an index<p>I currently have a dataframe of <code>strain</code> and <code>stress</code>, containing corresponding values. I ... | <p>You can use <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.argmax.html?highlight=argmax#pandas.Series.argmax" rel="nofollow noreferrer"><code>argmax</code></a> to find the index of the maximum:</p>
<pre><code>imax = df.stress.argmax()
df.iloc[imax:imax+5]
</code></pre>
<p>Result:</p>
<pre><code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I make the main category page?<p><strong>Greetings!</strong> I have the following code:</p>
<p><strong>urls.py</strong></p>
<pre><code>re_path(r'^cat... | <p>If you adjust your regexp to</p>
<pre><code>re_path(r'^category/(?P<hierarchy>.*)$', show_category, name='category'),
</code></pre>
<p>it will also match just <code>category/</code>.</p>
<p>You can then edit your view to something like</p>
<pre><code>def show_category(request, hierarchy=None):
hierarchy = (... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
"Unexpected {" shopify admin api get request in php<p>I'm trying to issue a get request in php with the shopify admin api.</p>
<pre><code>$productId = "... | <p>You are attempting to put raw JSON into PHP, you can't do this. You need to build a PHP array:</p>
<pre><code>$productId = "11235813213455"
// `session` is built as part of the OAuth process
$client = new Shopify\Clients\Rest(
$session->getShop(),
$session->getAccessToken()
);
$product = [
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why does my array of strings assignment not work with pointers?<p>I have a struct that stores 5 <code>char *</code> pointers</p>
<pre><code>struct x {
... | <p>The structure has the data member arr.</p>
<pre><code>struct x {
char *arr[5];
};
</code></pre>
<p>So you have to write accessing the data member using the operator <code>.</code> or <code>-></code> for example like</p>
<pre><code>*( (*str).arr + 0) = "hello";
</code></pre>
<p>that is the same a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why cannot define function of type 'Set -> Set' in Agda?<p>Assume there are four types , D, Q, P, C</p>
<pre><code>data Q : Set where
q1 : Q
q2 : Q
data... | <p>Because the Agda compiler erases types during compilation, it is not allowed to pattern match on <code>Set</code> directly. (The error 'unreachable clause' is a bit confusing but it results from Agda interpreting <code>D</code> as a pattern variable rather than the datatype.)</p>
<p>The usual way to work around this... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to restart process if it crashes using powershell?<p>I'm trying to run Core Keeper Dedicated Server, everything seems fine, but from time to time CoreKee... | <p>Solved problem like this:</p>
<pre><code># Feel free to change these (see README), but keep in mind that changes to this file might be overwritten on update
$CoreKeeperArguments = @("-batchmode", "-logfile", "CoreKeeperServerLog.txt") + $args
$script:ckpid = $null
function Quit-CoreKe... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Update Null values using values from other column<p>I am new to using SQL queries on SQL Server, and hence I have met a roadblock.
I have a table in the give... | <pre><code>UPDATE yourTable SET
TYPE=U.[TYPE]
FROM (
SELECT DISTINCT T.[CLASS_NAME], T.[TYPE], T.[DESCRIPTION]
FROM yourTable T
WHERE T.[TYPE] IS NOT NULL AND T.[DESCRIPTION] IS NOT NULL AND T.[CLASS_NAME] IS NOT NULL
) U
WHERE
yourTable.[TYPE] IS NULL
AND U.[CLASS_NAME]=yourTable.[CLASS_NAME]
AND... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get only numbers or 1 defualt value in MYSQL<p>I'm using the following information from the db, numbers and text. The text will always be at the end of the v... | <p>In your case you can try:</p>
<p><code>select Formato,case when Formato like '%ml' or Formato like '%grs' then 1 else cast(Formato as UNSIGNED) end as result from yourtable</code></p>
<p>And for better performance i suppose u store the value of Formato and unit in two columns.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to deploy Static Vue application with Spring Boot on a Weblogic Server?<p>I have a Spring boot application deployed on a Weblogic server, and I want to a... | <p>Turns out the problem was indeed that it was pulling assets from /weblogicurl rather than /weblogicurl/myapp.</p>
<p>Adding <code>base: '/myapp/'</code> to my vite.config.ts (or vue.config.js for non vite) resolved it.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add a fixture as part of mark.parametrize in a pytest?<p>I want to be able to parametrize a fixture list and list within a list for a unit-test like i... | <p>I think this should do what you want:</p>
<pre class="lang-py prettyprint-override"><code>@pytest.fixture(scope="session")
def simple_list() -> list[int]:
return [1, 2, 3]
@pytest.fixture(scope="session")
def list_within_a_list() -> list[list[int]]:
return [[1, 2, 3], [3, 4, 5], [... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How i can transform Dataframe in many temporal feature in Python?<p>i have this dataframe:</p>
<pre><code> Timestamp DATA0 DATA1 DATA2 DATA3 DA... | <p>If I understand it correctly, you want e.g. a list of dataframes, where each dataframe is a progressing slice of the original frame. This example would give you a list of dataframes:</p>
<pre><code>import pandas as pd
# dummy dataframe
df = pd.DataFrame({'col_1': range(10), 'col_2': range(10)})
# returns slices o... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
what is the purpose of "movl $0, %ebx" or getting 0 into ebx before an int $0x80 Linux SYS_EXIT?<p>I know that its getting 0 into ebx but why? I'm so sorry i... | <p>This is the equivalent of <code>_exit(0);</code> in C; except that the Linux kernel uses different calling conventions (parameters passed in registers and not on the stack).</p>
<p>The <code>movl $0, %ebx</code> is loading the 2nd parameter (0) into the right register for the kernel's calling convention. The first p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AVPlayer won't play local files until i add them to the project<p>i would like to play video files that are for example on my desktop, but i only get them pl... | <p>You have the Mac OS tag on your question, so I gather you are trying to do this on your Mac?</p>
<p>Is the app set up to run in the sandbox? If so, it won't have access to anything other than it's app directories (documents, caches, and a few others) and it's bundle.</p>
<p>The other thing you can do is display a fi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change maximum concurrent tasks in a GCP Cloud Tasks queue<p>I'd like to know how to change the maximum number of concurrent tasks in a queue. I know that th... | <p>You can use the following command to set the <a href="https://cloud.google.com/tasks/docs/configuring-queues#rate" rel="nofollow noreferrer">maximum number</a> of concurrent tasks:</p>
<pre><code>gcloud tasks queues update [QUEUE_ID] \
--max-dispatches-per-second=[DISPATCH_RATE] \
--max-concurrent-dispatches=[MAX_R... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
subscribing mobx @observable using rxjs Observable but not getting on change in a deep level component (ts file)<p>i am trying to get change from angular-mob... | <p>If you dive deeper in <code>mobx</code> you will get to the following link <a href="https://github.com/mobxjs/mobx/blob/582a51691ebdbb5b8cd628ee286919a6dafc480c/src/v5/core/computedvalue.ts" rel="nofollow noreferrer">observer</a> where you can find the following comment</p>
<pre><code>/**
* A node in the state dep... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use library fmt with clang<p>My code is like</p>
<pre><code>#include "fmt/compile.h"
int main() {
using namespace fmt::literals;
auto r... | <p>Build of fmt depends on a bunch of macros. Here, build fails because <code>operator () ""_cf</code> is not defined in the clang version. If you look at the code you'll see it depends on macro <code>FMT_USE_NONTYPE_TEMPLATE_ARGS</code> for whatever reason.</p>
<p>Probably <code>godbolt</code> at inclusion o... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I reduce the color palette of an image in Python 3?<p>I've seen answers for Python 2, but support for it has ended and the Image module for Python2 is... | <p>Here's one way to do it with PIL - you may want to check I have transcribed the list of colours accurately from <a href="https://en.wikipedia.org/wiki/Color_Graphics_Adapter#Color_palette" rel="nofollow noreferrer">here</a>::</p>
<pre><code>#!/usr/bin/env python3
from PIL import Image
# Create new 1x1 palette imag... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TypeError: undefined is not an object (evaluating 'item.id.toString') on React Native<p>I've been experiencing this error. I also checked out other related p... | <p>Please try this for any flatlist. this is work if you get data or not.</p>
<pre><code><FlatList
data={newcreate}
keyExtractor={(_,i) => i.toString()}
renderItem={({item}) => <AdddedItems item={item} />} />
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Property 'Error' does not exist on type 'MovieData | ResponseError'. Property 'Error' does not exist on type 'MovieData'<p>Answered</p>
<p>So I have followin... | <p>You need a type guard here to check if your object is of type <code>ResponseError</code>.</p>
<p>You cannot use <code>instanceof</code> here, since that is used to check if an object belongs to a certain <code>class</code>.</p>
<p>Whereas in your case, you are using <code>interface</code> and <code>type</code>.</p>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert a list of DataFrame columns (len(list) == len(df)) into a list of column values at the respective list idx?<p>Given a DataFrame</p>
<pre><code... | <p>You can use transpose of the dataframe, so you will have columns as indices and then more importantly you want to take the diagonal of the transposed df, because of the way you want to access the specific items. So use <a href="https://numpy.org/doc/stable/reference/generated/numpy.diag.html" rel="nofollow noreferre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.