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: Execution optimizations have been disabled for shadowJar and reobfShadowJar task<p>I have been having trouble getting shadowJar working properly it either gi...
<p>I managed to get it working properly by adding <code>tasks.shadowJar.dependsOn('reobfJar')</code></p> <p>and also apparently, it's a problem with shadowJar itself <a href="https://github.com/johnrengelman/shadow/issues/713" rel="nofollow noreferrer">https://github.com/johnrengelman/shadow/issues/713</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how can i solve Reverse for 'Add' with arguments '('',)' not found. 1 pattern(s) tried: ['agregar/(?P<producto_id>[0-9]+)/\\Z'] error?<p>I'm doing a tutorial...
<p>ok guys i just fin the error to my problem, i going to post here for other people with the same problem.</p> <p>In my serializer i dont specified the 'id'</p> <pre><code>class ProductoSerializer(serializers.HyperlinkedModelSerializer) : class Meta: model = Producto fields = ['url', 'nombre', 'codigo', 'preci...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fixing coin change Backtracking solution(bruteforce)<p>I know the optimal problem for this solution is using dynamic programming. However, I wanted to try th...
<pre class="lang-py prettyprint-override"><code>class Solution: def coinChange(self, coins: List[int], amount: int) -&gt; int: if amount == 0: return 0 output = amount+1 def backtrack(cur,arr): if cur == 0: nonlocal output output = m...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In R, how to find the location of a word in a string?<p>How can I find the first location of specific words in a dataframe cell, and save the output in a new...
<p>Here's a simple for loop:</p> <pre><code>for(i in dict) { df[[i]] = stringi::stri_locate_first_fixed(df$text, i)[, 1] } df # text coke pepsi fanta # 1 omg coke is so awsme 5 NA NA # 2 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can i toggle the same button click event for two cases?<pre><code>private void btnRecord_Click(object sender, EventArgs e) { FFmpeg_C...
<p>The simplest way may be to introduce the flag which will store the current player state. For just a play/stop this flag may be <code>bool</code>, for more states e.g. play/pause/stop it may be <code>enum</code>. Then you can use this flag to determine the current state and change it accordingly</p> <pre><code>bool p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get image from bytes in Python?<p>I have an image (jpeg). I get the bytes from it simply using open('img.jpg', 'rb'). And for instance I send that byt...
<p>Use the PIL module. More information in answers here: <a href="https://stackoverflow.com/questions/62348356/decode-image-bytes-data-stream-to-jpeg">Decode image bytes data stream to JPEG</a></p> <pre><code>from PIL import Image from io import BytesIO with open('img.jpg', 'rb') as f: data = f.read() # Load...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reference a variable from a string in Python<p>I have a number of global variables in my script (e.g. group_1, group_2, group_3) and I am trying to refer to ...
<p>Global variables are available through the <code>dict</code> returned by <code>globals()</code>. So,</p> <pre><code>&gt;&gt;&gt; group_1 = &quot;one&quot; &gt;&gt;&gt; group_2 = &quot;two&quot; &gt;&gt;&gt; group_3 = &quot;three&quot; &gt;&gt;&gt; &gt;&gt;&gt; def plot(group_number): ... return globals()[f&quot...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MongooseError: Query was already executed: Error: Discord.js<p><strong>Code</strong></p> <pre><code>const fetch = require(&quot;node-fetch&quot;); client.o...
<p>You cannot use await and callback in same query, you should remove await</p> <pre><code>chatbots.findOne({ guild: message.guild.id }, async (err, data) =&gt; { //do some thing } </code></pre> <p>or callback</p> <pre><code>const data = awaitchatbots.findOne({ guild: message.guild.id }) //do something </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring Boot and H2 Table Population Error: org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL<p>I am having trouble getting an H2 ...
<p>In Entity class you have defined column name in camel case i.e. BuildingCode,</p> <pre><code>@Id @Column(name = &quot;BuildingCode&quot;) private String id; </code></pre> <p>This will make JPA to expect a column named building_code in the DB table and if it does not find one, it will create column named building_cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to reference a foreign key in an database to another database?<p>I understand that it is possible in <code>MySQL</code>, but I can not figure ...
<p>When talking about foreign keys, SQLite's built-in foreign key constraints do not work across databases. But you can make cross database calls:</p> <pre class="lang-sql prettyprint-override"><code>attach 'database1.db' as db1; attach 'database2.db' as db2; </code></pre> <pre class="lang-sql prettyprint-override"><co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make fixed filenames for nuxt build in production?<p>I am using nuxt with SSR inside a Docker container. Whenever I build my project for production, i...
<p>I guess something wrong with your browser caching policy and it's not working as expected because the not found/404 status code issue is not a common thing.</p> <p>In order to answer your question about the fixed chunk name for production build in Nuxt, there is a built-in method to make it work and you can learn th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unpacking Characters from an Integer<p>I'm trying to update 16 bit code to 32 bit code and unpack a given unsigned int to 4 characters. It's working alright ...
<p>You're not shifting correctly. Since <code>mask1</code> matches the high-order byte, you have to shift 3 bytes down, not just 1 byte. So it should be</p> <pre><code>*aPtr = (pack &amp; mask1)&gt;&gt;24; *bPtr = (pack &amp; mask2)&gt;&gt;16; *cPtr = (pack &amp; mask3)&gt;&gt;8; *dPtr = (pack &amp; mask4); </code></pr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Query Blob storage with multiple Tags in where not working<p>I am able to successfully get Blobs from storage via postman filtering on 1 Tag. When I expand ...
<p>According to <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key#shared-key-format-for-2009-09-19-and-later" rel="nofollow noreferrer">Shared Key format for 2009-09-19 and later</a></p> <blockquote> <p>Convert all parameter names to lowercase.</p> <p><strong>Sort the query pa...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I read Json as Map[String,String]?<p>I got the problem when parsing JSON to Map[String, String]. The idea is to parse the nested object to a key sepa...
<p>You can think about it this way, if the JsValue is a JsObject, you need to extract the key values and append them to the current state of your function, if it's anything else, you can just add them to the state of your function, and then return them. Thinking recursively:</p> <pre class="lang-scala prettyprint-overr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Gitlab pipeline failing on "Cleaning up project directory and file based variables"<p>I have a Gitlab pipeline that is failing when it attempts <strong>docke...
<p>I was missing something in my GitLab project settings which is <strong>enabling Project Registries</strong> :</p> <ol> <li>https://domain/group/subgroup/project/edit</li> <li>Visibility,project features,permissions &lt;&lt; Container Registry (Toggle to enable)</li> </ol>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is best practice for filtering a map in React JSX return<p>When returning the below in a component to render cards where would you put a filter on somet...
<p>Your approach is the best approach.</p> <p>Firstly, <code>filter</code> and <code>map</code> is the clearest functions to use.</p> <p>Secondly, it's better to use <code>filter</code> before <code>map</code> for two reasons:</p> <ul> <li>By removing unwanted items before mapping them, you save computations as you don...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: serialize self-referential foreign key<p>Lets say I want to create an article that links via slug to one or multiple other articles (for now one). A post req...
<p>You can serialize the slug by working with the <code>article_previous_id</code> field:</p> <pre><code>class ArticleSerializer(serializers.ModelSerializer): article_previous = serializers.CharField(<strong>source='article_previous_id'</strong>) class Meta: model = Article fields = ('heading',...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: sliding_up_panel shadow how to remove it<p>im using sliding_up_panel package i want to add my location button above the panel so i build it like this, the pr...
<p>Let's just create a custom BoxShadow that takes the BlurStyle as parameter.</p> <pre><code>class CustomBoxShadow extends BoxShadow { final BlurStyle blurStyle; const CustomBoxShadow({ Color color = const Color(0xFF000000), Offset offset = Offset.zero, double blurRadius = 0.0,...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I convert my Jquery code to a StimulusJS controller Rails 7?<p>I'm building out a feature to show if the discount code in a text field is valid. I jus...
<p>This can be done in Stimulus, but if you have it working you may just want to move on to other things and refactor later if needed.</p> <p>Nonetheless, here is a breakdown of how to convert your jQuery to vanilla (i.e. no library) JS and also Stimulus.</p> <p>A great resource is this website - <a href="https://youmi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I keep first, if value of row1 column1 == row2 column2?<p>I want to check all rows in dataframe,</p> <ul> <li><p>if <strong>this row</strong>'s <code>...
<p>You can use</p> <pre class="lang-py prettyprint-override"><code>m1 = df['Column1'] == df['Column2'].shift() m2 = df['Column2'] == df['Column1'].shift() out = df[~(m1 &amp; m2)] </code></pre> <pre><code>print(out) Column1 Column2 0 A B 2 A C 3 A D 5 B C </code></pre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using Ajax GET to download compressed JSON files<p><strong>Background.</strong></p> <p>I'm tasked with debugging some <code>PHP</code> and <code>JavaScript</...
<p>If your server returns this header for the AJAX call:</p> <pre class="lang-none prettyprint-override"><code>Content-Type: application/x-gzip </code></pre> <p>without this one:</p> <pre class="lang-none prettyprint-override"><code>Content-Encoding: gzip </code></pre> <p>then the browser will <strong>not</strong> unco...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fail compilation if imports from Package B exist in a class in Package A<p>I am working on a Spring Boot project and am following the Onion Architecture, whe...
<p>I think you should look at ArchUnit <a href="https://www.archunit.org/" rel="nofollow noreferrer">https://www.archunit.org/</a> it allows you to implement this kind of constraint in a unit test form, You can then hook that into your build/CI to block changes breaking your rules.</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 call a function when no longer hovering mat-option in Angular?<p>I was given the following code</p> <pre><code>&lt;mat-form-field appearanc...
<p>Use &quot;mouseleave&quot; event (same use as &quot;click&quot;) to execute function on stop hover. For detecting typing you can use &quot;keydown&quot; or &quot;keyup&quot; events.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Circle Trim Start from the Top<p>I am creating a circular progress bar and I wanted to find out how can I start the progress bar from the top and not from th...
<p>Here is one of the solution that worked for me.</p> <pre><code>ZStack { Circle() .stroke(lineWidth: 5.0) .foregroundColor(.gray) .opacity(0.4) .frame(width: 75, height: 75) Circle() .trim(from: 0, to:...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using linprog for solving a minimization problem<p>I've an absolute error loss function of the following form,</p> <p><a href="https://i.stack.imgur.com/kIav...
<p>@Natasha. I hope I understood the question correctly and this is about finding the scale factor <code>a</code> for the function <code>f</code> which best approximates the function <code>g</code> in the least absolute deviation sense. If yes, then following remarks before I share some code:</p> <ol> <li>I placed the ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Divide element by sum of groupby in dask without setting index for every column<p>I have code implemented in pandas, but am having trouble converting to dask...
<p>Try with <code>transform</code></p> <pre><code>df.loc[:,[0,1,2,3]] = df/df.groupby('lab_id').transform('sum')[[0,1,2,3]] df Out[767]: 0 1 2 3 lab_id 0 0.111111 1.00 2.0 0.166667 a 1 2.000000 0.80 NaN 0.500000 b 2 0.222222 0.75 1.0 1.000000 a 3 -1.000000 0.20 NaN...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SHAP not working with LightGBM categorical features<p>My model uses <code>LGBMClassifier</code>. I'd like to use Shap (Shapley) to interpret features. Howeve...
<p>Let's try slightly different:</p> <pre class="lang-py prettyprint-override"><code>from lightgbm import LGBMClassifier import shap X_train = pd.DataFrame({ &quot;Age&quot;: [50, 20, 60, 30], &quot;Smoker&quot;: [&quot;Yes&quot;, &quot;No&quot;, &quot;No&quot;, &quot;Yes&quot;]} ) X_train[&quot;Smoker&quot;]...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: testing-library/react rendering empty <div /> for a redux toolkit component<p>testing-library/react rendering empty for a redux toolkit component</p> <pre><...
<p>I found the reason why it's not working. It's because, in myComponent, I had a typo in the conditional statement. Thanks, everyone.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Resizing image in Rails HTML<p>I have an image that looked fine in html, but upon putting it into RubyOnRails as</p> <pre><code> &lt;figure class=...
<p>I believe one way could be to use <a href="https://edgeapi.rubyonrails.org/classes/ActiveStorage/Variant.html" rel="nofollow noreferrer">ActiveStorage::Variant</a>. You can then specify the height and width (among other things). Hope this helps. Of course you can also fix it in css by giving it a class and giving th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to connect kubernetes deployment having multiple containers to multiple service ports of a single service?<p>I have a scenario like:</p> <ol> <li>Have a ...
<p>I am trying to re-produce this using <a href="https://kind.sigs.k8s.io/" rel="nofollow noreferrer">kind</a> and I can't. Here is my cluster config file:</p> <pre><code>apiVersion: kind.x-k8s.io/v1alpha4 kind: Cluster nodes: - role: control-plane extraPortMappings: - containerPort: 30000 hostPort:...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you deploy ABP.IO application template projects?<p>I have some tiered ABP.IO application template project deployment questions - but they may be ASP.N...
<p>I am using ABP with Blazor Wasm and IdentityServer is not seperated. So I am publishing only .Host and .Blazor projects.</p> <ol> <li>No, you only need them for published projects (.Host, .Web, .Blazor etc)</li> </ol> <blockquote> <p>Should I create appsettings.Production.json files in my class library/DLL projects...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP regex match any string ending with asterisk<p>I have a php 7 app and I want to match some patterns using regex. I have the following pattern so far:</p> ...
<p>You can extend the alternation with the parts that you want, and put the most specific ones at the beginning.</p> <pre><code>=\*[^\s*=]*|=[^\s*=]*\*|=[~*]?|!=|\(\)|[&lt;&gt;]=? </code></pre> <ul> <li><code>=\*[^\s*=]*</code> Match <code>=*</code> optionally followed by any char except <code>=</code> or a whitespace ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to detect swipe up in horizontal scroll view - Android<p>I have a HorizontalScrollView which has 2 cards that scroll horizontally, I want to detect swipe...
<p>Try to use <code>onTouchListner</code> for example :</p> <pre><code> view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { } ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I'm building a program that takes an undefined number of inputs, store them in arraylists, and print only before exiting the program the variables<p>I can't ...
<p>I drafted a quick version of your code for inputdata() which cuts out the need for repeat().</p> <pre><code> ArrayList&lt;Student&gt; students = new ArrayList&lt;&gt;(); //declare and initialize your arrayList outside the loop so it is not redeclared and replaced in each iteration. while (true){ Syst...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the Python equivalent of Stata's mkspline?<p>In Stata, <code>mkspline</code> automatically creates variables containing a linear spline given a serie...
<p>I don't think there is a function for that.</p> <hr /> <p>Try with numpy:</p> <pre><code>thresh = [0,30,40,50] diffs = np.maximum(df[['v1']].to_numpy() - thresh,0) diffs[:,:-1] = np.minimum(diffs[:,:-1], [np.diff(thresh)]) </code></pre> <p>Output:</p> <pre><code>array([[10, 0, 0, 0], [20, 0, 0, 0], ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get access to atom values outside RecoilRoot<p>In my project, i'm using &quot;react-three/fiber&quot; which is required to store all content inside &quot;Can...
<p>There are 2 different renders DOM and Canvas.</p> <p>Couldn't find any workarounds to transfer states via Recoil, so i used Zustand state manager for score state. It can transfer states even between renders!</p> <p>Work like a charm.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Post Json data from ReactJs Frontend to Flask Backend with axios<p>I managed to get data from Flask to ReactJs Frontend, but I haven't managed to send data f...
<p>The problem is in the React code before it hits your Flask app: The <code>postPath</code> function is expecting to be passed an event, but you're calling it without any arguments: <code>postPath()</code>.</p> <blockquote> <p>Cannot read properties of undefined (reading 'preventDefault')</p> </blockquote> <p>In this ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: react and react-dom not working, please help out<p>I do not know why react and react-dom isn't working with my code. you can see the color of the react and r...
<p>Inside app component your Index component file path is not correct</p> <pre><code>import react from &quot;react&quot;; import reactDom from &quot;react-dom&quot;; import Index from '../src/Index' function App() { return ( &lt;Index /&gt; ); } </code></pre> <p>import look like as this code</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I remove space between bars while plotting bar plot using pandas and matplotlib in Python?<p>I have a pandas dataframe <code>df</code> which looks as...
<p>The problem is that each point in the x axis is allocating space for 10 different bars. So any size you put, you will always have 9 empty spaces. Instead, you should restructure the df before plotting:</p> <pre><code>import matplotlib.pyplot as plt colors = [&quot;royalblue&quot;,&quot;green&quot;,&quot;green&quot;...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ggplot2 density of one dimension in 2D plot<p>I would like to plot a background that captures the density of points in one dimension in a scatter plot. This ...
<p>This is a bit of a hacky solution because it (ab)uses knowledge of how objects are internally parametrised to get what you want, which will yield some warnings, but gets you want you'd want.</p> <p>First, we'll use a <code>geom_raster()</code> + <code>stat_density()</code> decorated with some choice <code>after_stat...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Making multiple Node Express API request calls<p>I followed this guide <a href="https://herewecode.io/blog/step-by-step-guide-create-first-api-with-node-expr...
<p>Found a way of doing it with axios, just require it at the top and can have multiple calls and group all the responses together.</p> <pre><code>const express = require('express') const app = express() const port = 3000 const axios = require(&quot;axios&quot;) app.get('/', (req, res) =&gt; res.send('Welcome to Make ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rerendering child component when parent state changes in React<p>I'm still pretty new to React, so I'm sorry if this has a simple answer. I'm trying to make ...
<p>Just a few remarks:</p> <p>Don't use the state as a key for <code>TopBar</code>, In the <code>render</code> of <code>PhotoShare</code>.<br /> React keys should be simple Strings.<br /> You can simply use <code>&quot;TopBar&quot;</code> as a key.<br /> Anyways it's a single child &amp; a key may not be even required....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ggplot: Can I make a heatmap where intensity is indicated by area covered rather than color?<p>I have data from a 2d grid, where each entry has an intensity ...
<p>Here is an example of converting a matrix (in this case of squared correlation values) to an area-based heatmap.</p> <pre class="lang-r prettyprint-override"><code>library(ggplot2) cor &lt;- cor(mtcars)^2 df &lt;- reshape2::melt(cor) # Make sure the thing that you're mapping to area is between 0 and 1 df$value &lt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ListView goes up and down when i scroll it - flutter<p>I made a listview on flutter but it goes up and down when I scroll it</p> <p>things I already tried:</...
<p>To change the axis of scroll use</p> <pre><code>scrollDirection: Axis.horizontal, </code></pre> <p><strong>Edit</strong> To keep the background without scrolling use the layout as below</p> <pre><code>import 'package:flutter/material.dart'; const Color darkBlue = Color.fromARGB(255, 18, 32, 47); void main() { ru...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: multiply keys of dictionary to each other<p>the dictionary I have is:</p> <pre><code>teachers = [ {'Name':'Mahdi Valikhani', 'phoneN':'+989012345679', 'h...
<p>Iterate over each <code>dict</code> and compute salaries and add new <code>key</code> and <code>value</code> like below:</p> <pre><code>teachers = [ {'Name':'Mahdi Valikhani', 'phoneN':'+989012345679', 'hours':6, 'payment':50000}, {'Name':'Ali Afaghi', 'phoneN':'+989011234567', 'hours':8, 'payment':45000}, ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SonarQube github action not able to get projectKey<p>Currently trying to add SonarQube to my project with github actions. The issue is that it can't get the ...
<p>According to the <a href="https://github.com/SonarSource/sonarqube-scan-action#usage" rel="nofollow noreferrer">action README file</a> as well as <a href="https://community.sonarsource.com/t/monorepo-and-sonar-project-properties/52812" rel="nofollow noreferrer">this thread</a>, adding the <code>projectBaseDir</code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How To draw a changing trajectory with direction and angle as values in Python<p>What I am trying to do is collect Keyboard and mouse input data while I play...
<p>Since your timestamps are equidistant and your keyboard and mouse inputs are mutually exclusive, you could simplify this task to an interpretation of a list of actions:</p> <pre><code>import numpy as np from matplotlib import pyplot as plt actions = [&quot;w&quot;, &quot;a&quot;, &quot;s&quot;, &quot;d&quot;, 90, &...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL. How to obtain unique values from table but only for 1 column?<p>I have a table1 . I sort this table by name, and by time column :</p> <pre><code>SELECT...
<p>You can use the function <code>argMin</code> aggregation function (<a href="https://clickhouse.com/docs/en/sql-reference/aggregate-functions/reference/argmin/" rel="nofollow noreferrer">https://clickhouse.com/docs/en/sql-reference/aggregate-functions/reference/argmin/</a>) to achieve the desired result. If you need ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Issue by listing specific selectors and get href<p>I'm new to javascript and using puppeteer, i'd like to get all the podcast url from this url <a href="http...
<p>I found the correct way to do it:</p> <pre><code> const elements = await page_podcast_list.$$eval('div.block3-content.block3-content-modif', podcasts =&gt; { return podcasts.map(podcast =&gt; podcast.getElementsByTagName('a')[0].getAttribute('href')); }); console.log(typeof(elements)); console.log(eleme...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bootstrap Modal should return focus to last focused element after closing<p>I have focusable table rows, which on trigger open a Bootstrap Modal. However I n...
<p>I found a solution. I save the last focus on the <code>show.bs.modal</code> Event and then focus back on it after the modal is hidden with the <code>hidden.bs.modal</code> event.</p> <pre><code> var lastFocus; $('.modal').on('show.bs.modal', function (e) { lastFocus = $(':focus'); }) $('.modal').on('hidden.bs...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compare and fetch the missing keys between 2 nested dictionaries<p>I am trying to compare 2 nested dictionaries and trying to find the missing keys between t...
<p>There's a library <code>dictdiffer</code> that might help you:</p> <pre class="lang-py prettyprint-override"><code>import dictdiffer d = {'A': {'B': {'C': True, 'H': 'h', 'D': {'E': 'e', 'F': 'f'}}}} e = {'A': {'B': {'C': True, 'D': {'E': 'e', 'F': 'f', 'G': [2, 3, 4, 5, 6, 7]}}}} list(dictdiffer.diff(d, e)) # -&gt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Transforming dataframe to sparse matrix and reset index<p>I have a data set with the rating of user ID to all product ID. There are only 5000 products and 10...
<p>Hi hope this helps and good luck with your thesis:</p> <pre><code>import pandas as pd from scipy.sparse import coo_matrix dataframe=pd.DataFrame(data={'User ID':[1,1,2,2,5], 'Product ID':[14,15,14,16,19], 'Rating':[0.1,0.2,0.3,0.3,0.4]}) row=dataframe['User ID'] col=dataframe['Product ID'] data=dataframe['Rating']...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why this do while loop is infinite after it take false?<hr /> <p>After entering a value except 1,2,3,4 It will perform an infinite loop. Why is that guys?</p...
<p>With the information available it seems like your code works as intended. If you put a 5 the loop ends. If you put a Q the loop ends too. Typing 1,2,3 or 4 just adds a vote and continues with the loop which I understand is what you want the code to do.</p> <p>Is there something missing in your question? If so please...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular Capacitor, only showing index.html<p>I have an Angular application that I want to convert in Android application thanks to Capacitor. I installed Cap...
<p><code>webDir</code> should be the directory where your code is built, <code>src</code> folder contains the code before building it. Si according to your config, it should match the <code>outputPath</code>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: HTML background image insert<p>I am new into coding. I am currently trying to build a personal website. When adding an background image, is adding it to a fr...
<p>The <code>&lt;img&gt;</code> tag <code>src</code> specifies the path to the image.</p> <pre><code>&lt;img src=&quot;stackOverflow.jpg&quot;&gt; </code></pre> <ol> <li><p>Image in Another Folder: If you have your images in a sub-folder, you must include the folder name in the <code>src</code> attribute.</p> <pre><cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: mongo indexes where multiple filters & sorts are applied<p>Suppose I have the following schema:- collection name- <code>Test</code></p> <pre><code>{ &quot;ui...
<p>There is no silver bullet for dealing with 'any number of fields in any combination' kind of scenario. You'll have to decide what queries are the most critical for your application, and create indexes that support them. Less frequent queries may be better off only partially supported.</p> <blockquote> <p>The best ov...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I run a node script in a Vite React project<p>I am trying to build a little SPA where a user can run a Presto query, I am using a Node presto client....
<p>Vite is a frontend toolkit, it does not execute backend code, for that you would have to send a request to your backend</p> <pre class="lang-js prettyprint-override"><code>// App.jsx function App() { const [data, setData] = useState([]) const getData = async () =&gt; { const response = await fetch('http://m...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GatsbyJS - how to set up gatsby-node.ts with createPages?<p>I was migrating my Gatsby site to typescript and followed the <a href="https://www.gatsbyjs.com/d...
<p>You have to convert <code>exports.createPages = () =&gt; {}</code> to <code>export const createPages = () =&gt; {}</code>.</p> <p>Currently you have <code>export const sourceNodes</code> where the <code>createPage</code> action won't be called. It has to happen in the <code>createPages</code> lifecycle.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Send JavaScript variable as input to python code<p>In JavaScript code declared a variable, that variable should be passed as input to python child process wh...
<p>Made it work by connecting the stream listener to <code>stdout</code> rather than <code>stderr</code>:</p> <pre class="lang-sh prettyprint-override"><code>python_process.stdout.on('data',function(data) { console.log(data.toString()); }); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Syslog doesn't send messages over UDP<p>I want to send logs to a remote server using rsyslog. Somehow rsyslog doesn't send any messages.</p> <p>This is my co...
<p>You forgot to include the <em>message</em> in your template. I am not sure though, if it would be sent anyways - just without a message - or if it would be discarded.</p> <p>To solve that, just append <strong>%msg%</strong> to the template string:</p> <pre><code>template(name=&quot;myTemplate&quot; type=&quot;st...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to serve static HTML files with vanilla javascript including submodules?<p>I want to serve a static html file with elements defined in a javascript file ...
<p>Splitting the code to a server part and a client part solved my issues, as correctly pointed out in the comments.</p> <p>So all the server handling was placed in a <code>server.js</code> file, while the client specific content (which is to be injected into the <code>index.html</code> file) was placed in the <code>i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regex Reverse Search on a String<p>I'm trying to extract the second last value in a string so I can return the value &quot;<strong>Minute</strong>&quot;. I'm...
<p>You can use the following regex:</p> <pre><code>[^,]+(?=(?:,[^,]+){1}$) </code></pre> <p>It extracts the first non-comma values <code>[^,]+</code> occurring after a comma, a sequence of non-comma values and the end of string <code>(?:,[^,]+){1}$</code>. If you want preceeding values, it's sufficient to increment the...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extracting one dictionary from a list of dictionaries (Python)<p>I have a list of dicts like this:</p> <pre><code>[{'name': 'kabuto', 'id': 140}, {'name': '...
<p>It's possible use this way using filters:</p> <pre class="lang-py prettyprint-override"><code>pokemons = [{'name': 'kabuto', 'id': 140}, {'name': 'articuno', 'id': 144}, {'name': 'nidorino', 'id': 33}] pokemon = list(filter(lambda p : p['name'] == &quot;kabuto&quot;, pokemons))[0] print(pok...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: pytest + django giving me a database error when fixture scope is 'module'<p>I have the following inside <code>conftest.py</code></p> <pre><code>@pytest.mark....
<p>Ok, turns out this is a <a href="https://github.com/pytest-dev/pytest-django/issues/514" rel="nofollow noreferrer">known limitation, and it's somewhat documented here.</a> If you want to solve this issue, and get away from this bug:</p> <pre><code>@pytest.mark.django_db @pytest.fixture(scope='module') def thing(djan...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python flaml autoML doesn't pick up the monotone and interaction constraints<p>In Python, I have trained a flaml autoML (at the moment I am only interested i...
<p>The form of your constraints may be off. Per <a href="https://microsoft.github.io/FLAML/docs/reference/automl/" rel="nofollow noreferrer">the doc</a>, it should be of the form <code>custom_hp = {'&lt;model name&gt;': {'&lt;parameter name&gt;': {'domain'=&lt;parameter value(s)&gt;} } }</code> So maybe try</p> <pre><...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SwiftUI display different images/text on toggle/true or false<p>I'm trying to create a button that displays a different images/text depending on the current ...
<p>In lieu of more details, generally the best way to adjust your view in the result of an object's property is to make the smallest adjustment necessary. In this case, you can limit the change to the <code>systemName</code> of the image:</p> <pre class="lang-swift prettyprint-override"><code>Button { taskViewModel...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: .NET MAUI WebAuthenticatorResult not working for Strava<p>I am creating a .NET MAUI app that is going to get some data from the Strava API. When I try to use...
<p>If you check part <a href="https://docs.microsoft.com/en-us/xamarin/essentials/web-authenticator?tabs=android#get-started" rel="nofollow noreferrer">Get started</a> of document <a href="https://docs.microsoft.com/en-us/xamarin/essentials/web-authenticator?tabs=android" rel="nofollow noreferrer">Xamarin.Essentials: W...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Set Chart as Agent's Icon<p>I want to create an agent that will process some data and show it on chart. I want the chart to be the icon of the agent so when ...
<p>This is not what &quot;Icons&quot; are made for. Use the default approach:</p> <ol> <li>ensure your chart has &quot;show on embedded agent&quot; enabled</li> <li>embed the agent into some parent agent (or main)</li> <li>Click on the agent or agent population</li> <li>in the properties, click the &quot;show presentat...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cannot access APIs when add IHostedService service in ASP.NET Core<p>I use <code>.NET 6</code> and when I add an IHostedService service in ASP.NET Core, I ca...
<p>You are causing an infinite loop on your <code>StartAsync</code> method, and as noted by the documentation <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-6.0&amp;tabs=visual-studio#startasync" rel="noreferrer">here</a>:</p> <blockquote> <p>StartAsync should be...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TypeError: expected str, bytes or os.PathLike object, not list error when reading files in a folder<p>I want <code>all_image_files</code> to retrieve all the...
<p>The problem is that you get <code>image_files</code> by calling <code>glob</code>, so <code>image_files</code> is a list of paths. That causes a problem in the next line of code, because you try to do <code>os.path.join(image_files, &quot;*.tiff&quot;)</code>, and the arguments to <code>os.path.join</code> should b...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Doing hourly rate calculations for hour more than 24<p>I am recording my time spent on a project in google excel sheet. There is a column which does addition...
<p>Try</p> <pre><code>=C41*D40*24 </code></pre> <p>and change formet on the result as $ <a href="https://i.stack.imgur.com/2sejU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2sejU.png" alt="enter image description here" /></a></p> <p>one hour is part of a day, as you know 1/24th of a day, that's w...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to filter Pandas data table using two fields in Python?<p>I have the following pandas data table :</p> <pre><code> File_name River Confidance ...
<pre><code>df[df['T Area'].eq(0) | df['T Area'].div(df['Overlap Area']).gt(0.5)] </code></pre> <p>Output:</p> <pre><code> File_name River Confidance X Y W H T_Area Overlap_Area 0 test1.png BRIDGING 0.587851 739 821 769 894 0 0.0 1 test1.png BRIDGING 0.579243 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reactive ggplot with Shiny-<p><strong>Hi community</strong> Im try to make a reactive Shiny app.</p> <p>When I select the name &quot;Lugar&quot; appear the p...
<p>Since you want to have 2 tabs (1 for the fixed plot and 1 for the reactive plot) you need to use <code>navbarPage</code>.</p> <p>&quot;sel_Lugar&quot; was not found and it couldn't be used for the plot because <code>data()</code> doesn't have this column. The way that you tried to get data it was giving you a column...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python - text color of one variable in multivariable sentence in Tkinter label<p>The text source consists out of elements from a nested lists. A label is cre...
<p>The easiest way to do this is to create multiple labels in a frame and set the colour of the one you want.</p> <pre><code>list1 = [[&quot;test&quot;, 3, 2, 0], [&quot;test2&quot;, 4, 1, 1],[&quot;test3&quot;, 0, 5, 2]] row = 1 for i in list1: label_wrapper = customtkinter.CTkFrame(master = self.frame_1) labe...
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 rerun a python program from within the same program?<p>I'm making a mini python based game where if the game is lost I ask the user to 'rer...
<p>You can create a function of the game and run it, like this:</p> <pre><code>def game(): print('GAME STUFF') active = True while active: game() restart = input(&quot;\n Do you want to restart the program? [y/n] &gt; &quot;) if restart.lower() == &quot;n&quot;: active = False </code></pre> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I can't do an installment calculation with an installment fee addition in Shopify Liquid<pre><code>&lt;p style=&quot;font-size: 18px&quot;&gt; ou 12x de ...
<p>You can't do percentage calculation within liquid. You need to calculate the formula to get your number.</p> <p>If I understand it correctly you want to calculate 12 rates of a an amount increase by 17.2%. So let's say your initial price is <code>X</code>, the price with interest is <code>117.2/100*X</code> and if y...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: setting rpi-gpio pin on high after running a python script<p>I'm building a photogrametry setup with raspberry pi and stepper motor. The python script runs f...
<p>To make my comment an answer:</p> <p>Gpiozero only resets the pins it touches, so if you don't initialize or touch pin 26 with gpiozero (i.e. replace <code>step_en.off()</code> with <code>pigs w 26 0</code> and don't even initialize step_en), it shouldn't also reset the pin:</p> <pre><code>import os import time imp...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I verify the strongAuthenticationEmailAddress in a custom policy?<p>My users connect with a username and provide an email for password recovery, usin...
<p>Like this:</p> <pre class="lang-xml prettyprint-override"><code>&lt;OutputClaim ClaimTypeReferenceId=&quot;strongAuthenticationEmailAddress&quot; PartnerClaimType=&quot;Verified.email&quot; Required=&quot;true&quot;/&gt; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to push an element to the left of a div and another element to the right of that same div?<p>Basically I have this long bar div and 2 pieces of text insi...
<p>You haven't shared any code, so it's hard to know what you've attempted so far..</p> <p>You mention you've set the text via innerHTML, but if you're instead able to actually edit the markup itself, then this left/right text split can easily be achieved by using flexbox. Here, I've sepearted the items with the <a hre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can I hide implementation details of this concept from the end user?<p>I have looked at several similar questions on SO. Maybe I am not grokking the solution...
<p>The return type of a function is a static property, it can't change based on runtime data.</p> <p>If you can, lift <code>UseCase</code> to a template parameter, and use <code>if constexpr</code> to have exactly one active <code>return</code> for each instantiation.</p> <pre><code>template&lt;UseCase a&gt; auto Engin...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I change values in a scriptable object?<p>I'm trying to make a class selecting system and I have 2 scriptable objects one for the player and the other...
<p>So what you could do is to make the playerClass a property and set the values in the set function, but maybe it's easier to just make the fields be properties that forward the playerClass values. I'll use the <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/member-access-operators...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Untracked git submodules<p>For one of my project I decided to use submodules.<br /> They are nice to keep different plugins for application in separate repos...
<blockquote> <p>I have to choose between loosing all my submodule changes or commit them first.</p> </blockquote> <p>You should be able to add and commit, while ignoring your submodules:</p> <blockquote> <h2><a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-submoduleltnamegtignore" rel="nofollow...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: %pre section doesn't work in kickstart installation<p>During kickstart installation i try to configure network in %pre section but it doesn't work.</p> <p>Wh...
<p>Ok, if someone wants to make network work in %pre section of kickstart file, a runtime image should be added in ISO and inst.stage2 should point to that image.</p> <p>If I'm not wrong commands in kickstart's main body is taken in consideration in stage1. But the commands/scripts in %pre run in stage2. As the install...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why laravel migrate:fresh takes a long time for 422 tables?<p>I have a Laravel project and I'm using this command to migrate a database every time I want to ...
<p>This is an answer to speed-up issue, not <code>internal server error 500</code>, because there's not any details related to issue that causing that error.</p> <p>I'm assuming you're using <code>Laravel 8</code> at least, and base on that you can try <code>Schema Dump</code>, which It's added to creates a dump of the...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Deserializing XmlArrayItemAttribute to PascalCase property is Null<p>I am consuming a 3rd party XML API and have copied a postman response from the API and &...
<p>The following resolved the issue and appears to be the required attributes to get it to deserialize correctly. I'm not very clear on what the generated code was doing to achieve the same result, but this has solidified my preference of JSON over xml</p> <pre><code> [XmlArray(&quot;threads&quot;)] [XmlArrayIte...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dockerize my gradle java project but encounter jdk version mismatch between compile time and runtime<p>I am developing a gradle java project (it is pure java...
<p>From oracle <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-4.html" rel="nofollow noreferrer">documentation</a></p> <blockquote> <p><strong>Java SE | Released | Major | Supported majors</strong></p> <p>1.0.2 | May 1996 | 45 | 45</p> <p>1.1 | February 1997 | 45 | 45</p> <p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using SwiftUI on watchOS, how to align views to the navigation title?<p>I would like to align some content to the same inset the the navigation title uses.</...
<p>Use <code>.scenePadding(.horizontal)</code>. That will automatically apply the padding you want on the larger watches. Docs: <a href="https://developer.apple.com/documentation/swiftui/menu/scenepadding(_:)" rel="nofollow noreferrer">https://developer.apple.com/documentation/swiftui/menu/scenepadding(_:)</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Make last Item of the Compose LazyColumn fill rest of the screen<p>There is a regular list with some data and LazyColumn for showing it.</p> <pre><code>LazyC...
<p>If your items are all same height and you have have info of how tall they are via static height or using <code>Modifier.onSizeChanged{}</code> you can do this by getting height of the LazyColumn using <code>BoxWithConstraints</code> maxHeight or <code>rememberLazyListState().layoutInfo.viewportSize</code></p> <p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Drop list of fields from confluent <-> elastic connector<p>Using confluent cloud's elastic search connector to push data into elastic. Is there a way to drop...
<p>The <a href="https://docs.confluent.io/platform/current/connect/transforms/replacefield.html#replacefield" rel="nofollow noreferrer">ReplaceField</a> transform allows you to exclude/include particular fields.</p> <p>If that's not available, the alternative is to use Kafka Streams/KsqlDB to create a new topic that th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Converte int to char*<pre><code>int num = 123; char num_charr[sizeof(char)]; std::sprintf(num_char, &quot;%d&quot;, num); </code></pre> <p>how to convert int...
<pre><code>char num_charr[12]; // space for INT_MIN value -2147483648 itoa( num, num_charr, 10 ); </code></pre> <p>Note: <code>itoa</code> is not supported on all compilers.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Delete row based on a duplicate value from range in another sheet?<p>I have 2 sheets in a spreadsheet, I want to check if in Sheet 1 ('QualityCheck') ...
<p><code>getDataRange</code> has no arguments. I think that an error occurs by this. From your question, <code>var values2 = s2.getRange(&quot;A3:A&quot; + s2.getLastRow()).getValues();</code> might be useful. When this is reflected in your script, it becomes as follows.</p> <h3>From:</h3> <pre><code>var values2 = s2.g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to connect paths in Docker file<p>I am running a Jenkins job, inside a docker container, this job requires doxygen but im getting an error saying -</p> <...
<p>Add these lines near the bottom of your Dockerfile:</p> <pre><code>RUN mkdir -p /opt/fc4-usr-local/bin RUN ln -s /usr/bin/doxygen /opt/fc4-usr-local/bin/doxygen </code></pre> <p>The first line creates the directory. The second line creates a symlink from one path to the other</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: substring research of a binarystring. how to improve this program in terms of speed?<p>A binary sequence S is stored in a text file. We are interested in the...
<p>Here's a solution that runs almost instantly:</p> <pre><code>from collections import defaultdict def sub_freq(text_f: str, min_len: int, max_len: int, n: int) -&gt; list[tuple[int, list[str]]]: with open(text_f) as f: text = f.read().strip() frequencies = defaultdict(int) for part_len in range(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: jquery check a div to see if it has any text in it<p>I would like to use jQuery to check if a div has any text in it. if it does then show the div otherwise ...
<ol> <li>First identify the textual content of the div</li> <li>Trim it to remove any trailing white space</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>let showHide =...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Query to find an entry between dates<p>I have a table containing several records associated to the same entities. Two of the fields are dates - start and end...
<p>you can use a <code>SELECT</code> with <code>BETWEEN</code> as <code>WHERE</code> clause</p> <p>The date format of MySQL is yyyy-mm-dd , if you keep that you wil never have problems</p> <blockquote> <pre><code>CREATE TABLE datetab ( `ID` INTEGER, `Name` VARCHAR(4), `Start` DATETIME, `End` DATETIME ); INSER...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to replace the certificate content in a file using sed or awk<p>I have a CA CERT stored in a <code>Kubernetes_CA.crt</code>, now I need to place the cont...
<p>You may use this single <code>sed</code> command for this:</p> <pre class="lang-bash prettyprint-override"><code># create indentation sed 's/^/ /' Kubernetes_CA.crt &gt; temp.crt # use indented cert in sed sed -i.bak -E -e '/^# *-+BEGIN /,/^# *-+END / {/-END /r temp.crt' -e ';d;}' file-2 cat file-2 # some othe...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: need to print a pattern, got first half. Can't figure out second half<p>I need to print the following pattern:</p> <pre><code>* ** *** **** ***** **** *** **...
<p>Try using a second loop to print the second half:</p> <pre><code>def print_triangle(height: int) -&gt; None: for n in range(1, height): print('*' * n) for n in range(height, 0, -1): print('*' * n) print_triangle(height=5) </code></pre> <p><strong>Output:</strong></p> <pre><code>* ** *** ****...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to upload file from frontend to backend<p>I am developing a full stack web-app as part of my thesis. One of the things I am supposed to implement is the ...
<p><code>dataset.file</code> was a FileList actually and I had to change <code>onSubmit</code> to:</p> <pre class="lang-js prettyprint-override"><code> const onSubmit: SubmitHandler&lt;DatasetFormValues&gt; = dataset =&gt; { if (dataset.name &amp;&amp; dataset.file) { let formData = new FormData(); for...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Copy objects from the nested array into the new array in React JS<p>I have a big nested array of objects and each object has an object called 'set. Something...
<p>You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer">.map</a> to extract the set from each object</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find first match in string from the end<p>I have a string</p> <pre><code>Manager of Medical Threat Devlop at Micro </code></pre> <p>I want to find any words ...
<p>You can use</p> <pre class="lang-py prettyprint-override"><code>re.findall(r'.*\b(?:for|at|of)\s+(.*)', text) </code></pre> <p>See the <a href="https://regex101.com/r/XcuCJv/2" rel="nofollow noreferrer">regex demo</a>. <em>Details</em>:</p> <ul> <li><code>.*</code> - any zero or more chars other than line break char...