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: Configuration usage inside an Entity class<p>Imagine, we have an entity like this:</p> <pre><code>public class Entity { public int Id { g...
<p>Since you're talking of injection, I assume you're using .NET Core, right?</p> <p>You'd better be injecting your configuration file in the <code>Entity</code> class constructor:</p> <pre><code>public class Entity { IConfiguration Configuration; int restriction; public Dictionary&lt;int, string&gt; D...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I assign cgroup resource limits per gitlab runner job to ensure fair sharing of resources?<p>I'd like to assign cgroup limits to my gitlab runner job...
<p>What seems to work is to not try to take the job out of its own cgroup / scope with <code>cgclassify</code>. It turns out that each gitlab runner job is already put into its own systemd scope. So we just need to modify the limits in that scope.</p> <p>This script will determine what scope you are in and apply the ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ggplot show the value rounded to one decimal place above the bar chart<p>I want to round the values above the bar chart to one decimal place. For example 14 ...
<p>Add <code>round</code> to your <code>geom_text</code>:</p> <pre class="lang-r prettyprint-override"><code>library(tidyverse) tribble( ~Strecke, ~CPUE, &quot;1b&quot;, 1.333, &quot;1c&quot;, 1.222, &quot;1b&quot;, 2.666, &quot;1c&quot;, 2.777 ) |&gt; mutate(Strecke = factor(Strecke)) |&gt; ggplot(aes(S...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to replace slow 'apply' method in pandas DataFrame<p>I have a DataFrame with currencies transactions:</p> <pre><code>import pandas as pd data = [[165366...
<p>You could just use pandas <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.cumsum.html" rel="nofollow noreferrer"><code>cumsum</code></a> here:</p> <p><strong>EDIT</strong> After adding a condition: I don't know how <code>transform</code> performs compared to <code>apply</code>, I'd say just tr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ignore Repeated content in a String in Python<p>I am looking for support to Ignore repeated content in a string.</p> <p>a= &quot;Item 1.01 Entry the party...
<pre class="lang-py prettyprint-override"><code>import re a = &quot;Item 1.01 Entry the party thereto Item 2.02 Exit Item 4.02 Please go from Item 1.01 Item 5.06 lets have some party&quot; code = [] for i in re.findall(r&quot;Item \d+(?:\.\d+)?&quot;, a): if not i in code: code.append(i) print(code) # [...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: comma separated values of specific column in table to list of integers in LINQ<p>I have one column with values 12,13,14 and I want that to be comma split and...
<p><code>string.Split</code> and <code>SelectMany</code> are probably the pieces you're missing.</p> <pre><code>List&lt;int&gt; list1 = ( from rar in unitOfWork.StudentRepository.GetAsQueryable() where rar.RequesterId == userId &amp;&amp; rar.StatusId == 0 select new { rar.RoleIds } ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a better way to find an specific object inside an array by name?<p>I know this could be easily done with a loop like I'm doing in the method below. ...
<p>I'd probably go with something like:</p> <pre><code>const index = items.map(({ value }) =&gt; value).indexOf(selectedValue) </code></pre> <p>Map over the items to create an array of the exact thing you are searching for, and then find the index of that thing.</p> <hr /> <p>Note: for very large arrays, this may be sl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how does "for" loop works python?<p>Why does it happen, that on four while-iteration &quot;for loop&quot; iterates only 2 times, while the array length is 3<...
<p>When the last item of any of the arrays turns 0 (which happens after a few turns), you have the item deleted. This makes there only be 2 items instead of 3, and the for loop runs over those items, so it only iterates twice.</p> <p>Edit::one good solution is to make a copy of the array, so that you can use one to del...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Singin is not a function react context<p>I'm trying to build a function that will makes the login context in react using typescript. The IDE says no errors, ...
<p>Make sure you are involving your App with the <code>AuthContext</code>. See in my code:</p> <pre><code>import React from &quot;react&quot;; import { Router } from &quot;react-router-dom&quot;; import Routes from &quot;./routes&quot;; import history from &quot;./routes/history&quot;; import { AuthProvider } from &q...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: function at the end of code- why do i have to place it?<p>I'm just starting my adventure with Python. Unfortunately, I can't figure out why, at the end of m...
<p>First, you don't need to put all your code into a function. Your code could be rewritten as this:</p> <pre class="lang-py prettyprint-override"><code>sum = a + b print(sum) </code></pre> <p>And it would work fine. <strong>A function, by definition, is a block of code that is given a name</strong>, so you can use it ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Linear Gauge functionality via AmChart 4<p>I'm looking to do a chart like <a href="https://stackoverflow.com/questions/11608947/html5-js-linear-gauge">this o...
<p>A gauge chart is essentially a stacked column(bar) chart of only 1 type of series data. I've modified stacked column chart to look like the gauge chart linked in the question.</p> <p>working demo: <a href="https://codepen.io/rabelais88/pen/RwMGxxJ" rel="nofollow noreferrer">https://codepen.io/rabelais88/pen/RwMGxxJ<...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Make all types passed as template-template argument a friend<p>In the following code, I would like whatever type I pass through to <code>MyStruct</code> to b...
<p>A solution is to declare a common base class <code>Wrapper</code> as a friend of <code>MyStruct</code> and the wrap the private function. Declare <code>xxx_TYPE</code> as a derived class of this common class <code>Wrapper</code>.</p> <pre class="lang-cpp prettyprint-override"><code>template &lt;typename T&gt; struct...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to show values in pandas pie chart?<p>I would like to visualize the amount of laps a certain go-kart has driven within a pie chart. To achive this i woul...
<p>By using a command like:</p> <pre><code>plt.pie(values, labels=labels, autopct='%.2f') </code></pre> <p>By setting up autopct at this format, it will show you the percentage in each part of the graph. If there is any problem, please share a screenshot of your result .</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Concat columns of a groupby object Pandas<p>I have a dataset as shown below</p> <pre><code> No Manufacturer Description Capacity Bezeichung2 Name...
<p>Fixing up the groupby by filling <code>nan</code> values:</p> <pre><code>out = (df.fillna('') .groupby(['No', 'Manufacturer', 'Description', 'Capacity', 'Bezeichung2', 'Name'])['Year'] .agg(['min', 'max']) .reset_index()) print(out) </code></pre> <p>Output:</p> <pre><code> No Manu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to format the number? I was looking for the answer but haven't been able find the right one<p>So I have following numbers and I would like to format it i...
<p>you can get it done this way. I hope it would work for you.</p> <pre><code>let value = &quot;2,597.6,099,999&quot;; let num = Number(value.replace(/,/g, &quot;&quot;)); let result = num.toLocaleString(undefined, {minimumFractionDigits: 2}) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to filter users based on several criteria in Powershell when using Get-AdUser<p>I have a question that I was hoping someone could help me with, please. I...
<p>As <a href="https://stackoverflow.com/users/14903754/abraham-zinala">Abraham</a> pointed out in his helpful comment, you can do the filtering using exclusively the <a href="https://docs.microsoft.com/en-us/previous-versions/windows/server/hh531527(v=ws.10)" rel="nofollow noreferrer">AD Filter</a> / <a href="https://...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Webscrape HTML in Python Using BeautifulSoup<p>I'm attempting to use a website to scrape a specific html table that contains the following information:</p> <...
<p>You need JS to view that, so it is easier to scrape via the underlying API.</p> <p>Google Chrome Inspect Network XHR then search api, find the one you need, then structure a python request to receive the json using the authorization token as such.</p> <pre><code>import requests url = &quot;https://services.intotheb...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I use multiple channels in the same struct<p>In my code I want to do the following:</p> <ol> <li>Recieve data from inputs as <code>event</code> and <...
<p>I solved it by writting:</p> <pre class="lang-golang prettyprint-override"><code> // Connect to the WhatsApp client go Connect() for { select { case data := &lt;-p.data: fmt.Println(&quot;recieved&quot;) switch { case len(data.event) &gt; 0: ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Succinct way to join between XML queries?<p><em>Oracle 18c:</em></p> <p><a href="https://dbfiddle.uk/?rdbms=oracle_18&amp;fiddle=a1c7e04d943c21708c8e16cf9940...
<p>There are multiple solutions including:</p> <ol> <li><p>Using sub-query factoring clauses:</p> <pre><code>WITH domain AS (&lt;domain_query&gt;), subtype AS (&lt;subtype_query&gt;) SELECT ... FROM domain LEFT OUTER JOIN subtype ON (...); </code></pre> </li> <li><p>Using subqueries:</p> <pre><code>SELECT ... FROM ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Parse Array of JSON Objects using Axios<p>Using <strong>Axios</strong> I'm trying to pass <code>JSON</code> data as <code>params</code> to the endpoin...
<p>I'd use JSON.stringify on your params...</p> <pre><code>const parseParams = (params) =&gt; { const keys = Object.keys(params); let options = []; keys.forEach((key) =&gt; { options.push(`${key}=${encodeURIComponent(JSON.stringify(params[key]))}`); }); return options.join('&amp;'); }; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python Aiogram: Convert 'State' to 'int'<p>Let's say I want:<br /> A bot to ask how many doughnuts the user needs, and in response it receives the word &quot...
<p>What does the State class look like? I assume you store the value in the State object. Furthermore, the <code>__int__</code> method must be implemented, otherwise the <code>int</code> function cannot be applied to a State object. With this method you can return the stored value (in my example below I have called thi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to set default value in multiselect dropdown in multistep form with react-select<p>I am currently working on a multistep form with multiselect dropdowns ...
<p>I found the error in the handleChange function. It should save the state as an object with value and label instead of an array:</p> <pre class="lang-js prettyprint-override"><code> const handleChange = (name) =&gt; (e) =&gt; { setSelectedValue((prevState) =&gt; ({ ...prevState, [name]: e.map((x) =&g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R compute average increase for a timeseries dataset<p>Let' say I have the following dataset.</p> <p>How can I compute the average increase in times (I don't ...
<p>You can use the slope of the regression line to get the increase per year based on fitting a linear model to the data.</p> <pre><code>fm &lt;- lm(AvgTMean ~ year, DF); fm ## ## Call: ## lm(formula = AvgTMean ~ year, data = DF) ## ## Coefficients: ## (Intercept) year ## -6.93064 0.01582 &lt;-- 0.0...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Limit drag in single direction and to a specific location<p>I am trying to make a custom notification control for winform. I'm currently trying to make it dr...
<p>After tinkering a lot, I found a solution that is somewhat near to my expectation. What I did is that I introduced a new variable that records the Starting location of the notification which is compared with current location during a mouse up event.</p> <p>Here is the new code:</p> <pre><code>private int cordX, cord...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to save pdf file in flutter?<p>I have a pdf file. I want to write that file in phone memory? Below is the code. First I am scanning then I am converting ...
<p>I haven't seen the <code>.openWrite()</code> method before, but the <a href="https://api.flutter.dev/flutter/dart-io/File/openWrite.html" rel="nofollow noreferrer">documentation</a> says that it has 2 named arguments FileMode and encoding - try to specify them. If it won't work, I can only share my solution, with <c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to generate a monthly report using 1 formula at A2<p>I am trying to build a monthly report. How can I write 1 formula at A2 to show Monthly Expense Summa...
<p>try:</p> <pre><code>=ARRAYFORMULA(REGEXREPLACE(QUERY({TEXT(13-TEXT(Data!A2:A, &quot;m&quot;), &quot;000&quot;)&amp; TEXT(Data!A2:A, &quot;×mmmm&quot;), Data!A2:C}, &quot;select Col3,sum(Col4) where Col4&gt;0 group by Col3 pivot Col1&quot;)&amp;&quot;&quot;, &quot;^\d+×&quot;, )) </code></pre> <p><a href="https://...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Blanc page after importing <Home /> componenet<p>I just started a new React project and created <code>Home</code> page, but i got this error :</p> <pre><code...
<p>just change it like below:</p> <pre><code>import Home from &quot;./pages/Home&quot;; const App = () =&gt; { return &lt;Home /&gt;; }; export default App; </code></pre> <p><code>Note: Remove Enter before Home component!</code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Copy path in CodeAcademy<p>I am a beginner at HTML I am trying to put one of my projects on to a workspace on CodeAcademy.</p> <p>I however have multiple htm...
<p>Use relative path instead...</p> <p>Let's say your project structure is like this:</p> <pre><code>pages/about.html services.html index.html </code></pre> <p><strong>In index.html:</strong></p> <pre><code>&lt;a href=&quot;./index.html&quot;&gt;Home&lt;/a&gt; &lt;a href=&quot;./services.html&quot;&gt;Services&lt;/a&gt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Assigning an Excel Chart Object Name with XlsxWriter<p>Is it possible to assign an Excel Chart Object name to a chart I am creating with XlsxWriter?</p> <p>T...
<p>It is (unintentionally) undocumented but you can set the object name for a chart when you create it. Like this:</p> <pre class="lang-py prettyprint-override"><code>import xlsxwriter workbook = xlsxwriter.Workbook('chart.xlsx') worksheet = workbook.add_worksheet() # Create a new Chart object. chart = workbook.add_c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to deal with TypeScript not treating uninitialized optional parameter as undefined<p>Here's the simplified reproduction of my function:</p> <pre class="l...
<p>The problem is that when you don't pass in a <code>value</code> argument, there is no value from which the compiler can infer <code>T</code>, and inference just fails. When inference fails, it generally falls back to its <a href="https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints" rel=...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: XML Deserialization of xsi:type="array"<p>I need to replicate this XML structure with class instances but I am failing on the xmlAttribute <strong>xsi:type=&...
<p>I got it working by serializing data and getting serialize output to match input</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; using System.Xml.Serialization; namespace ConsoleApplication23 { class Program { const string INPUT...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to show download pdf button in every post bottom created with ACF<p>I created the a text field in which I can add url of pdf file. Now I'm trying to show...
<p>All you need is to concat your button with existing content. With current code it will override. Check below code for reference:</p> <pre><code>add_action( 'the_content', 'show_download_url' ); function show_download_url($content) { $download_pdf = get_post_meta( get_the_ID(), 'download_pdf', true ); if...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to call an instance of a class that makes an API call, and a function within that class that makes the request, and assign this to variable? Swift<p>This...
<p>You have an asynchronous operation - <code>searchBusinesses</code>. When you call this function, it takes time to get a result. You are using <code>await</code> to handle this.</p> <p>You can't use <code>await</code> outside of an asynchronous context, which <code>viewDidLoad</code> is not. You are using a <code>T...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Selecting entries of a pytorch tensor with another tensor<p>I have a tensor <code>a</code> with with float entries and <code>torch.Size([64,2])</code> and I ...
<p>You can perform this straight with an indexing of <code>a</code> on both dimensions:</p> <ul> <li><p>On <code>dimension=0</code>: a &quot;sequential&quot; indexing using <a href="https://pytorch.org/docs/stable/generated/torch.arange.html" rel="nofollow noreferrer"><code>torch.arange</code></a>.</p> </li> <li><p>On ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Choosing a hash function for API call to determine when to update<p><strong>Context:</strong> <br> In the design of our application, for certain frequently-u...
<p>Any hash function with a low collision probability is workable for this application. You're not using the hash to secure your data against modification.</p> <p>That being said, you should avoid MD5 for code-reviewer and boss reasons. It's no longer good for security, and some people don't like seeing it used in any ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there any function to get multiple timeseries with .get and create a dataframe in Pandas?<p>I get multiple time series data in series format with datetime...
<p>Although, you haven't provided the df yet but this piece of code would definitely help:</p> <pre><code>df = pd.DataFrame({'tagid': [12, 34, 56, 78], 'time': ['2022-01-01 12:10:00', '2022-01-01 17:00:00', '2022-01-02 18:10:00', '2021-01-01 12:00:00']}) df['time'] = df['time']...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: useEffect is running twice on mount in React<p>I have a counter and a <code>console.log()</code> in an <code>useEffect</code> to log every change in my state...
<p>This is a normal behaviour since React 18 when you are in <code>development</code> with <code>StrictMode</code>. Here is an overview of what they say in the <a href="https://reactjs.org/docs/strict-mode.html#ensuring-reusable-state" rel="nofollow noreferrer">doc</a>:</p> <blockquote> <p>In the future, we’d like to...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a better way to yield a stats for grade == 0, 0 < grade < 60, 60 =< grade < 70 and so on?<p>I'm trying to yield a stats for several some kind of &qu...
<p>Try this</p> <pre><code>df['category'] = (df['grade']/10).astype(int) #This bit converts categories between 0 and 6 into 1. So the categories you now have are 0, 1, 6, 7.., 10 df['category'] = np.where((df.category &gt; 0) &amp; (df.category &lt; 6), 1, df.category) for i in range(max(df.category)+1): if len(d...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TypeScript: Generic function which returns the same type as parameter<p>Consider this (which doesn't compile):</p> <pre><code>function roundTo&lt;T = number ...
<p>Credit for this answer goes to @jcalz.</p> <p>Use an overload signature to set a conditional return type of <code>T extends number ? number : T</code>. Then the implementation can relax the type inference.</p> <pre><code>// Overload signature export function roundTo&lt;T extends number | null | undefined&gt;( num:...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Concat 2 list of dictionaries with same id<p>I have 2 lists of dictionaries</p> <pre><code>a = [{'id':1, 'name':'John Doe'}, {'id':2, 'name':'Jane Doe'}, {'i...
<p>You could use the new merging dictionaries feature introduced in Python 3.9:</p> <pre><code>&gt;&gt;&gt; a = [{'id': 1, 'name': 'John Doe'}, {'id': 2, 'name': 'Jane Doe'}, {'id': 4, 'name': 'Sample Doe'}] &gt;&gt;&gt; b = [{'id': 1, 'rating': 9}, {'id': 2, 'rating': 7}, {'id': 3, 'rating': 8}] &gt;&gt;&gt; b_id_to_d...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PyQt5: fill all columns of QTableWidget<p>I am trying to solve the sorting issue and found this answer: <a href="https://stackoverflow.com/questions/13074035...
<p>The problem is that you enable sorting before adding items to the table. This means that the table is resorted every time a new item is added. If you scroll down to the bottom of the table in your example, you will see that the last row of the second column has a value. So what is happening is that the same cell of ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create a 32 bits exclusive conda env<p>How can I create a exclusively 32 bits conda environment? I tried:</p> <pre><code>set CONDA_FORCE_32BIT=1 conda...
<p>Follwing commands will successfully get a 32-bit python. I suppose the main problem is the environment variable. You know windows is this. :(</p> <pre><code>conda create -n py27_32 conda activate py27_32 conda config --env --set subdir win-32 conda install python=2.7 </code></pre> <p><a href="https://i.stack.imgur.c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error with firebase starting project on vue2<p>When I run <code>npm run dev</code>, get next error I write on Vue 2 webpack-simple, firebase 9.9.0 Tried npm ...
<p>I just needed to update vue-cli</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Grouped diminishing weighted cumsum<p>Suppose I have this data</p> <pre><code>df &lt;- tibble( id = c(rep(&quot;ID100&quot;, 3), rep(&quot;ID...
<p>Maybe you want something like this where you multiply by the (row number)-(row number)*0.75 per group using <code>data.table</code>:</p> <pre class="lang-r prettyprint-override"><code>library(tibble) df &lt;- tibble( id = c(rep(&quot;ID100&quot;, 3), rep(&quot;ID200&quot;, 3), rep(&quot;ID450&q...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: get all button elements dragged into div element<p>im trying to make any button elements can be dragged into a div. in the end i want to make sure that any n...
<p>You do need use <code>querySelectorAll</code>, and use <code>forEach</code> on the returned <code>NodeList</code> to attach the event handler to each button.</p> <p><code>dataTransfer</code> is then set with the appropriate <code>id</code>, which need to be added in the HTML.</p> <p>This property is then read back i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can I make a folder as a remote repository on Hostinger Server and push to it from local machine?<p>I have a domain on <strong><a href="https://www.hostinger...
<p>I used this solution to make a remote repository on <a href="https://www.hostinger.com" rel="nofollow noreferrer">Hostinger</a> file manager.</p> <p><strong>First</strong></p> <p>I login to Hostinger using <strong><code>SSH-Key</code></strong></p> <blockquote> <p><code>ssh -p 65002 username@IP-address-for-my-website...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JavaScript sorting array of objects by description field in the object<p>I'm not very skilled with JavaScript and I have an issue where I need to sort array ...
<p>You can do:</p> <pre><code>result.data.sort((a, b) =&gt; a.description.localeCompare(b.description))); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ModuleNotFoundError: No module named 'pygimli'<p>I'm having trouble importing pyGIMLI on Jupyter Notebook. I installed it as recommended on <a href="https://...
<p>I just found out what the problem was : I forgot to install ipykernel in the new environment. I could solve my issue using :</p> <pre><code>conda install nb_conda conda install ipykernel python -m ipykernel install --user --name mykernel </code></pre> <p>Sorry for my dumb issue and thank you to those who already com...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to get length of WeakMap?<p>I have a <code>WeakMap</code> like this:</p> <pre><code>let obj = new WeakMap(); let objKey1={&quot;a&quot;:1}; let objKey2={...
<p>From the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap" rel="nofollow noreferrer">documentation</a></p> <blockquote> <p>But because a WeakMap doesn't allow observing the liveness of its keys, its keys are not enumerable. There is no method to obtain a list of the k...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: java.lang.ExceptionInInitializerError with AppiumFieldDecorator - JAVA, Cucumber, Appium<p><strong>Hey all!</strong><br/> I'm trying to set up an automation ...
<h2>OK, so I found the problem and a solution!<br/><br/></h2> <hr /> <p><strong>The problem was with the runner configuration.</strong><br/> For some reason if we initialize the page objects inside the <code>@Before</code> hook of Cucumber it fails but if we do the same within the <code>@BeforeClass</code> hook of Test...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Nextjs with Nodejs Thread Pool<p>I'm using nextJS with NodeJS and want to enable child processes or workers. The code provided by nextjs themselves works com...
<p>This is how I did it if you are searching for the same thing. :)</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 express = require("express"); const next = require("ne...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Size not being displayed on productdetails page<p>I am doing CRUD using serializers and foreign keys and I have made a product details page which shows the d...
<p>try this in ypur view.py</p> <pre><code>def productdetails(request,id): prod = Products.objects.get(id=id) product = POLLSerializer(prod) return render(request,'polls/productdetails.html',{'data':prod.data}) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: VB.Net sorting files in a directory by natural date order<p>I have a directory with many Excel files named [MMM yyyy].xlsx:</p> <p>Jan 2012.xlsx</p> <p>Feb 2...
<p>You can do this:</p> <pre><code>Dim dir = New DirectoryInfo(MY_PATH). EnumerateFiles(&quot;*.xlsx&quot;, SearchOption.TopDirectoryOnly). OrderByDescending(Function(x) DateTime.ParseExact(x.Name.Replace(&quot;.xlsx&quot;, &quot;&quot;), &quot;MMM yyyy&quot;, Nothing) For Each f As FileInfo In dir ' c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create Kafka topic in Active-Passive Kafka cluster architecture<p>I'm trying to figure out what is the proper way to create a topic in Active-Passive Kafka ...
<p>KMM2 (at least) does monitoring of Kafka topics in the source cluster.</p> <p>In detail take a look at how often KM does use the admin to <a href="https://github.com/apache/kafka/blob/f9201666a1216fcbe07ed4f2ba544833fced6e39/connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorSourceConnector.java#L216...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Iterating over std::optional<p>I tried to iterate over an <code>std::optional</code>:</p> <pre><code>for (auto x : optionalValue) { ... } </code></pre> <...
<p><code>std::optional</code> does not have a <code>begin()</code> and <code>end()</code> pair. So you cannot range-based-for over it. Instead just use an <code>if</code> conditional.</p> <p><em>See Alternative 2 for the closest thing to what you want to do.</em></p> <p>Edit: If you have a temporary from a call result ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Colors.black doesn't work but Colors.blue does - flutter<p>I was wondering why some Colors. don't work on flutter? For example, I can use Colors.blue for my ...
<p>If you are using VS code you might not getting error message. I'm using Android Studio and it complains that</p> <pre><code>The argument type 'Color' can't be assigned to the parameter type 'MaterialColor?' </code></pre> <p>Since <strong>primarySwatch</strong> accepts <strong>MaterialColor</strong> you cannot use Co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What single line query can be used in SQL to display usernames from transaction history?<p>I have two tables :Users and transactions</p> <p>Table structure:<...
<ol> <li>Simply join transaction table with users table twice to get names for the userid_1 and userid_2</li> <li>Include a <code>WHERE</code> clause to match the user you want to look at (say user 7)</li> </ol> <p><a href="https://dbfiddle.uk/?rdbms=mysql_8.0&amp;fiddle=e7ebeddf315fb237245b4ccc96391907" rel="nofollow ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to handle varbinary columns in repodb queries?<p>In a project includes RepoDB, it is used by queries but I have problem with varbinary columns.</p> <pre>...
<p>I found the solution using <code>SqlBinary</code> (thanks to @Jeroen):</p> <pre><code>param.Add(&quot;MyContent&quot;, myObject.MyContent == null ? DBNull.Value : new SqlBinary(myObject.MyContent )); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Move jittered points to align with dodged boxplots but the points have different shapes<p>Tons of answers for dodging points and boxplots at the same time bu...
<p>You can use the <code>group</code> aesthetic</p> <pre class="lang-r prettyprint-override"><code>ggplot(data, aes(x = trt, y = value, color = year)) + geom_boxplot(outlier.size = 0, alpha = 0.7, size = 2) + geom_point(alpha = 0.4, position = position_jitterdodge(jitter.width = 0.8), size = 3, a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Failed to scan [jar:file:/app.jar!/BOOT-INF/lib/spring-webmvc-5.2.5.RELEASE.jar!/] from classloader hierarchy<p>Trying to deploy my web app through Kubernete...
<p>All I needed to do was target a lower jdk!</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Blazor WebAssembly - How to create Policy-Based Authorization<p>I have been trying to add Authorization and permissions to my project.</p> <p>I have managed ...
<p>I made it work with this.</p> <pre><code>&lt;AuthorizeView&gt; @if (@context.User.Claims.Count(c =&gt; c.Value == Permissions.Products.Create) != 0) { &lt;a class=&quot;btn btn-success&quot; href=&quot;product/create&quot;&gt;Create&lt;/a&gt; } @if (@context.User.Claims.Count(c =&gt; c.Value ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React Native - Type Script - Object should be changeble to a number when user clicks add<p>My question is, what should I modify on the interface so the numbe...
<p>I see a couple of issues here.</p> <ol> <li>The code for <code>onAdd</code> doesn't do anything, and shouldn't compile because <code>prevState</code> is undefined. The function states, but does'nt do anything with, the new array. I would expect it to be something like <code>const onAdd = () =&gt; setRoute([...rout...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you use element attributes with Svelte when compiling to a custom element?<p>I am trying to create a custom checkbox using Svelte and compile it to a ...
<p>While that works, Svelte allows you to simplify it quite a bit:</p> <pre class="lang-html prettyprint-override"><code>&lt;svelte:options tag=&quot;my-checkbox&quot;/&gt; &lt;script&gt; // `checked` will be `false` by default, but a user may pass in a // different value through the attribute/property with th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Segregated copy for nested closures<p>I looked for similar questions like <a href="https://stackoverflow.com/questions/61002805/rust-make-a-closure-inside-a-...
<p>You must use <code>move</code> to avoid the issue with <code>i</code>. If you don't want to move the vec into the closure, you can take a reference to it first and move <em>that</em> into the closure:</p> <pre><code>let iterator = (0usize..length) .flat_map (|i| { let vec = &amp;vec[..]; (0usize....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change where Gradle 'Test' task saves file<p>I'm running into the following error when attempting to run my Appium testing framework. It seems like th...
<p>The allure report can be customised to save results and report to specific paths, see amendment of your build.gradle below:</p> <pre><code>allure { version = '2.4.1' autoconfigure = true aspectjweaver = true allureJavaVersion = &quot;18.0.1&quot; resultsDir = file('/path/to/test/results') rep...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How To Perform Specific SELF Join Query SQL<p>I am having a hard time solving this question that I am practicing with.</p> <blockquote> <p>Retrieve employee ...
<p>I will give the answer by stepping through how you'd make this with images to show each step.</p> <p>Here is the table I created to give you an example: <a href="https://imgur.com/a/LX2SGDN" rel="nofollow noreferrer">Demo Table</a> (yes, I know I misspelt designation)</p> <hr /> <p>Let's start off by creating a self...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python: Recreate file path with shorter name(s)?<p>D:\MyDir contains a huge number of directories with or without subdirectories which may or may not contain...
<p>You could traverse each folder that you wanted to change to the bottom level. Move each file at the bottom up two levels and change their names. Then remove any empty folders on your way back up. Then finally change the name of the directory itself.</p> <p>Here is an example. Without knowing what your planning on r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unity - Scroll view gets stuck while scrolling too fast<p>I am trying to make a parallax scroll-and-snap scroll view on a iOS iPhone game(a duplicate of the ...
<p>Ok – turns out I put the <code>LerpTargetPos</code> method in the <code>LateUpdate</code> method, instead of <code>Update</code>; after I put it in <code>Update</code>, everything seems to work fine.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring dependency inection or default value?<p>I have a class <code>Car</code> which has a dependency : <code>Motor</code></p> <p>My class <code>Car</code> i...
<p>Based on <a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/Autowired.html" rel="nofollow noreferrer">Autowired</a> documentation,</p> <blockquote> <p>The constructor with the greatest number of dependencies that can be satisfied by matching beans i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create a factor variable based on conditions across multiple columns in R<p>Data:</p> <p><a href="https://i.stack.imgur.com/CtURj.png" rel="nofollow noreferr...
<p>Here's a tidy solution:</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) library(tidyr) dat &lt;- expand.grid(id = 1:3, num=1:6) dat$Sys &lt;- NA dat$Sys[which(dat$id == 1)] &lt;- runif(6, 10, 100) dat$Sys[which(dat$id != 1)] &lt;- runif(12, 110, 145) dat$Dia &lt;- NA dat$Dia[which(dat$i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: List specific objects in AWS S3 SDK<p>I'm trying to delete multiple objects in a bucket using SDK, but when i pass the list of KeyVersions to the method .del...
<p><code>DeleteItem</code> will still return a successful response if the object does not exist. This is irrespective of SDK version or language as this response is returned by the underlying S3 API.</p> <p>If you need to know an object has been deleted or not, since you're on the v1 of the Java SDK:</p> <ol> <li><p>Fo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas to nested json<p>My Pandas df is like:</p> <pre><code>RollCall Physics Chemisty Maths 1 20 30 25 2 25 30 30 3 15 12 35 4 20 15 3...
<p>In your case do</p> <pre><code>df['RollCall'] = df['RollCall'].astype(str) d = {} d['StudentDetails'] = df.set_index('RollCall').to_dict('index') d Out[366]: {'StudentDetails': {'1': {'Physics': 20, 'Chemisty': 30, 'Maths': 25}, '2': {'Physics': 25, 'Chemisty': 30, 'Maths': 30}, '3': {'Physics': 15, 'Chemisty'...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add a new line before a capital letter?<p>I am writing a piece of code to get lyrics from genius.com.</p> <p>I have managed to extract the code from t...
<p>If genius.com doesn't somehow provide a separator, it will be very hard to find a way to know what to look for.</p> <p>In your example, I made a regex searching for <code>&quot; [A-Z]&quot;</code>, which will find &quot; He...&quot;. But it will also find all places where a sentence starts with &quot; I...&quot;. So...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How does useMemo() create an id for its factories?<p>There is a function in React called <code>useMemo()</code></p> <pre><code>const eg = React.useMemo(() =&...
<p>React knows which is which because it makes the assumption that you will always call <code>useMemo</code> exactly the same number of times, in exactly the same order. Thus, it knows that the 1st time you call <code>useMemo</code> during a render, it should check the dependency array from the 1st call last time, and ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NullReferenceException when passing Arg.Any<int>() as argument using NSubstitute<p>I have a customer class which accepts an IDbGateway interface as a constru...
<p><code>Arg.*</code> are meant to be used in arranging/stubbing the mocked behavior.</p> <p>They are not meant to be used as actual parameter values when exercising the test</p> <blockquote> <p>Argument matchers should only be used when specifying calls for the purposes of setting return values, checking received call...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Giving width to div in bootstrap grid<p>I am creating an inbox page, and need to give width to date column so it can display inline instead word break.</p> <...
<p>To achieve the behavior which accommodate a long date. You need to change the HTML structure like below.</p> <pre><code>&lt;div class=&quot;d-flex align-items-center justify-content-between&quot;&gt; &lt;div class=&quot;name h5 m-0&quot;&gt; No One &lt;/div&gt; &lt;div class=&quot;ago-time small&qu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Blazor Server-App: Bind code behind to multiple Razor-components<p>I want to make a mobile desgin for my already existing blazor-server application I current...
<p>The solution I came up with goes like:</p> <ol> <li>Foo.razor.cs goes into a seperate class like FooComponent.cs</li> <li>FooMobile.razor and FooDesktop.razor now inherits this base class</li> <li>U can you all functionality of the base type inside your razor component</li> </ol>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JS TS how to refactor repetitive code into a higher order function with multiple param types<p>I've been wanting to refactor the following code into a higher...
<p>So basically you want to refactor this part:</p> <pre><code>try { /* SOME OPERATION */ timer({ ...metricsLabels, success: 'true' }); return result; } catch (err: any) { timer({ ...metricsLabels, success: 'false' }); throw new Error(err.message); } </code></pre> <p>You can just wrap it in a funct...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Problem Implement Update UI with LiveData, Retrofit, Coroutine on Recyclerview : adapter Recyclerview not update<p>I'm newbie use Kotlin on my dev apps andro...
<p>You have 3 different <code>LiveData</code>s, right? One with a list of news data, one with a loading error message, and one with a loading state.</p> <p>You set up an <code>Observer</code> for each of these, and that observer function <em>gets called whenever the <code>LiveData</code>'s value updates</em>. That's im...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get the actual Qt window title<p>I need to get the <em>visible</em> title of a Qt top level window (or MDI subwindow), because I want to list window titles i...
<p>There is no absolute and certain way to get the title that the OS will <em>finally</em> show in the title bar of a top level window.</p> <p>As explained in the <a href="https://doc.qt.io/qt-5/qwidget.html#windowTitle-prop" rel="nofollow noreferrer"><code>windowTitle</code></a> documentation, some systems might suppo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: UnableToDeserializePostBody when trying to create a teams meeting with php Microsoft Graph Api<p>Calling Graph API endpoint</p> <pre><code>POST https://graph...
<p>Remove <code>message</code> object from <code>$CreateMeetingBody</code> and keep its content only.</p> <pre><code>$CreateMeetingBody = array( 'subject' =&gt; 'Test afspraak Marloes', 'body' =&gt; array ( 'content' =&gt; 'Does morning work for you?', 'contentType' =&gt; 'HT...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to retrieve the complete set of types in a UnionType from a symbol using the Typescript Compiler API<p>I've searched high and low, and even cloned the Ty...
<blockquote> <p>Why is string | number | undefined a UnionType, but string | undefined is not?</p> </blockquote> <p>Enable the <code>strictNullChecks</code> compiler option and it will work.</p> <p>When <code>strictNullChecks</code> is <code>false</code> the compiler won't store if a type is nullable and so <code>strin...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I solve the html2canvas image cross origin issue?<p>I'm attempting to convert a DOM element to a PNG image. Everything works OK except for the cross ...
<p>Just add <code>crossOrigin=&quot;anonymous&quot;</code> to your image it will solve the issue</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript program has something wrong ,I don't know why the length of log is not 10?<p>Javascript program has something wrong ,I don't know why the length o...
<p>The arguments you're giving to <code>substr()</code> are appropriate for <code>substring()</code>. Since <code>substr()</code> is deprecated, you should just change to <code>substring()</code> and you'll get the results you want.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-b...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Material ui TreeItems change style conditionally based<p>I'm using <a href="https://mui.com/material-ui/react-tree-view/" rel="nofollow noreferrer">TreeView<...
<p>After a little while this is what I got. I tried to match the design of the gif as good as possible.</p> <p><a href="https://i.stack.imgur.com/weHrz.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/weHrz.gif" alt="enter image description here" /></a></p> <p>I used this <code>data</code> which I der...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unioning Promise in Typescript<ul> <li>To summary the question, I'm asking that is unioning type inside generic and outside generic makes different type.</li...
<p>It would be a better idea to define <code>Response&lt;T&gt;</code> to be <code>ResponseSuccess&lt;T&gt; | ResponseError&lt;T&gt;</code> rather than making it a <code>Promise</code>. It makes the three <code>Response</code> types consistent with one another and makes it clearer when something is really a <code>Promis...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Return rows depends on timestamp between them<p>The problem is that I want to get every n'th record from table but based on datetime.</p> <p>I have table whe...
<p>Thanks to @ourmandave's comments, I was able to resolve the problem. I didn't notice that I can use <code>DATEDIFF</code> with <code>%</code>.</p> <p>So, to get entries only one per two hours, I simply write the query like that. So, obviously:</p> <pre><code>SELECT * FROM [dbo].[Table] WHERE DateDiff(Minute, 0, Ti...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert combinations of row+column as Column headers<p>I have a dataframe as follows:</p> <pre><code>Machine Time Part PowerA PowerB 1 ...
<p>Let us do <code>pivot_table</code> then <code>swaplevel</code></p> <pre><code>s = df.pivot_table(index= ['Machine','Time'], columns = df.Part.astype(str).radd('Part'), values=['PowerA','PowerB'], fill_value=-1).swaplevel(1,0, axis=1).sort_index(level=0, axis=...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In Python tkinter, how to shrink the canvas, not the button, when window reduced the size<p>The canvas with options <code>fill=BOTH</code> and <code>expand=T...
<p>Pack order matters. You can pack the button to the bottom side first, then pack the canvas:</p> <pre class="lang-py prettyprint-override"><code>from tkinter import * def callback(event): print(event.width, event.height) root = Tk() canvas = Canvas(root, width=360, height=360, bg='green', bd=0, highlightthickn...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ng test not passing Jest CLI options any more in v14?<p>I am using Jest with Angular (instead of Karma). The <code>angular.json</code> file seems to be confi...
<p>Okay quoting @just-jeb from github</p> <blockquote> <p>It's mentioned in the <a href="https://github.com/just-jeb/angular-builders/blob/master/MIGRATION.MD#jest-builder" rel="nofollow noreferrer">migration guide</a>. It's a breaking change of Angular CLI, not the builder. camelCase arguments are no longer supported....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to add file path in django project<p>I am making an online judge in Django. I am taking user code in a file and then compile it and running it and giving...
<p><strong>did you consider putting your cpp file inside static files and define STATIC_URL and STATICFILES_DIRS in your setting.py</strong></p> <p>you can put in the function you are using cpp file</p> <pre><code>import os print(os.getcwd()) </code></pre> <p>this script to know exact location of your script and put cp...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I am in MacOs and my Pygame window does not close<p>Window Class</p> <pre class="lang-py prettyprint-override"><code>def __init__(self, window_dimension: tup...
<p><a href="https://www.pygame.org/docs/ref/pygame.html#pygame.quit" rel="nofollow noreferrer"><code>pygame.quite()</code></a> is a function that uninitializes all pygame modules and must be called after the application loop. The enumerated constant for the event type that occurs when the window is closed is <code>pyga...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using r shiny inputs to run a r script<p>I have already made a r script to calculate queue times using queuing theory but now I wish to make a ui/website whe...
<p>To elaborate on my comment:</p> <pre><code>library(shiny) myScriptFunction &lt;- function(Lambda) { Mue &lt;- 4 Rho &lt;- Lambda/Mue matrix &lt;- matrix(0,10,2) matrix[,1] &lt;- 1:10 calculatewq &lt;- function(c){ P0inv &lt;- Rho^c/(factorial(c)*(1-(Rho/c))) for (i in 1:c-1) { P0inv = P0inv...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to resolve "edition2021 is required" when compiling all cw-plus contracts in docker container?<p>I am trying to compile all contracts on the <a href="htt...
<p>The Rust compiler in your Docker version is separate from the version on your system, and the version in the image isn't new enough to support the 2021 edition. You can fix this by using a newer version of the Docker image that has a newer Rust compiler:</p> <pre class="lang-bash prettyprint-override"><code>docker r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Select to which ItemGroup to add Content entries using .csproj extension in VS Code<p>How could I select to which <code>ItemGroup</code> the <code>Content</c...
<p>It doesn't matter which ItemGroup you select, neither does the order.</p> <p>Usage of <strong>Item</strong>, <strong>ItemGroup</strong> elemtens</p> <p><a href="https://docs.microsoft.com/en-us/visualstudio/msbuild/item-element-msbuild?view=vs-2022#attributes-and-elements" rel="nofollow noreferrer">https://docs.micr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Any short way to create a combinations of arrays with fixed length and sum?<p>For example:</p> <pre><code>array = [4,0,0] </code></pre> <p>The generated arra...
<p>The following solution is not exactly what you are looking for, i.e., it does not output in the same order as you have mentioned, but the values returned inside the list are the same.</p> <pre><code>from itertools import product def findPairs(sum_value, len_value): lst = range(sum_value + 1) return [ ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get last 3 months data with case statement<p>I would like to create a derived column by using a case statement or any other better suggestions.</p> <p>My ask...
<pre><code>SELECT SaleID, SaleStartDate, [Is New Move-In] = CASE WHEN SaleStartDate &gt;= DATEADD(MONTH, -3, GETDATE()) AND SaleStartDate &lt; GETDATE() THEN 'Yes' ELSE 'No' END FROM [dbo].[Sale] </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to loop through 3d array with if statement python?<p>I am trying to loop through a array with an if statement.</p> <p>For example:</p> <pre><code>arr = n...
<p>Are you trying to do:</p> <pre><code>out = np.where(np.isin(arr, arr[0][1][:3]), arr*0.1, arr) </code></pre> <p>or:</p> <pre><code>arr = arr.astype(float) arr[np.where(np.isin(arr, arr[0][1][:3]))] *= 0.1 </code></pre> <p>output:</p> <pre><code>array([[[ 0. , 1. , 2. , 3. , 4. ], [ 0.5, 0.6, 0....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What should I do to sort an object by name ascending and descending<p>I have tried to find a solution and could find something that is close but not there ye...
<p>If I understood your question correctly, then it's essentially a duplicate of <a href="https://stackoverflow.com/questions/1069666/sorting-object-property-by-values">this question</a>.</p> <p>From the linked question's comments: &quot;The ordering of object properties is non-standard in ECMAScript&quot;, so you can'...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TYPO3 DDEV installation upload to server<p>I have a local ddev based TYPO3 site. If I want to upload it on my apache server there is some path issues with th...
<p><a href="https://usetypo3.com/composer-changes-for-typo3-v11-and-v12.html" rel="nofollow noreferrer">This article</a> describes your issue probably.</p> <p>The main issue if you want to keep the old structure is to use</p> <pre><code>&quot;typo3/cms-composer-installers&quot;: &quot;^2.0 || ^3.0&quot; </code></pre> <...