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: Failed to install Delve for the lambda container on Mac<p>I used the VS Code AWS Toolkit and SAM to create a basic SAM web app based on Go(I VS Code generate...
<p>Turns out this is due to a bug in AWS Toolkit extension of VS Code. It was fixed in AWS Toolkit <a href="https://github.com/aws/aws-toolkit-vscode/blob/master/CHANGELOG.md#1470-2022-08-06" rel="nofollow noreferrer">1.47</a>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: WPF TextBox IValueConverter ConvertBack not triggered when ValidationRules fail<p>I have a TextBox which is linked to a double? in my backend viewModel. I ne...
<p>You should not use validation rules to validate your data when you have a view model class where you can implement the <code>INotifyDataErrorInfo</code> or <code>IDataErrorInfo</code> interface.</p> <p>Anyway, you can control <em>when</em> the validation rule is run by setting its <code>ValidationStep</code> proper...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to read a list of Path names as a pyspark dataframe<p>How do I read a list of paths as a pyspark dataframe (azure databricks)?</p> <p>Sample :-</p> <pre>...
<p>If you want to iterate on this list you can simply do a <code>for</code> loop :</p> <pre class="lang-py prettyprint-override"><code>dfs = {} for file_info in file_paths: print(f'loading {file_info.name} from {file_info.path=}') dfs[file_info.name.replace('.csv','')] = spark.read.option('header',True).csv(file_in...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Excluding files in glob.glob()<p>I have text files in a folder I need to iterate through and pull data from using python. To get all the path names I am usin...
<p>Ones you have your list of files you can use list comprehension to filter and remove any files that contain 'ER'. </p> <pre><code>files = [f for f in files if 'ER' not in f] </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to rename files in a folder with ".csv" at the end??[R]<pre class="lang-r prettyprint-override"><code>setwd("C:\\Users\\Note\\Documents\\Folder") n &lt;-...
<p>Try this instead of your third line</p> <pre><code>names &lt;- paste0(1:length(n), ".csv") </code></pre> <p>The numbers will be automatically coerced to character format.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is ViewPager2 delaying to load pages?<p>I decided to give a try on the new and now available stable release of <code>ViewPager2</code>.</p> <p>My <code>...
<p>I figured it out what was causing the <code>ViewPager2</code> initial delay to load the pages. </p> <p>It happens I was using <code>TabLayout</code> from <code>com.google.android.material.tabs.TabLayout</code> along with the <code>ViewPager2</code> to give scrollable tab titles to each page. But if you have a lot o...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: failed to create k8s cluster using kops<p>I am trying to create a k8s cluster using the kops utility, however, I am getting the below error.</p> <p>I have a ...
<p>The error you see there means that the control plane is unable to update your API DNS entry. This happens when a component called dns-controller doesn't run.</p> <p>You are trying to use very small instances for your control plane. Smaller instances than t3.medium, which is the default, will probably not be able to ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: regular expression to select particular word when it is not followed by particular pattern?<p>I have a list of the data in this format:</p> <pre><code>eth0:...
<p>Not sure about the Ubuntu implementation details but you can make use of a negative lookahead:</p> <pre><code>^eth\d+(?=:)(?!.*\n.*[^0-9]127\.0\.0\.1[^0-9]) </code></pre> <ul> <li><code>^eth\d+(?=:)</code> - the start of the line must be "eth", followed by one or more digits, and followed by a colon but do not cap...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create custom validator with parameters in spring boot?<p>I have written a validator for cron string that checks for a minimal interval.</p> <pre><cod...
<p>You just add it as an annotation property</p> <pre><code>annotation class ValidMinimalInterval( val message: String = &quot;The cron string doesn't fit in the minimal interval of 60 minutes&quot;, val groups: Array&lt;KClass&lt;*&gt;&gt; = [], val payload: Array&lt;KClass&lt;out Payload&gt;&gt; = [] ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I understand that caching is used in Spark?<p>In my <strong>Scala/Spark</strong> application, I create <strong>DataFrame</strong>. I plan to use this ...
<blockquote> <p>In fact, it must return two different count values.</p> </blockquote> <p>Why? You are calling it on the same <code>df</code>. Maybe you meant something like</p> <pre><code>val df1 = df.filter(...) println("count: " + df1.count()) </code></pre> <blockquote> <p>I assumed that the caching process wo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: My ODP.Net application is crashing when I add a Parameter to a Stored Procedure. It wasn't crashing before when we were using Microsoft/Oracle classes<pre><c...
<p>Old Code</p> <pre><code> With cmd ' CRASHING ON NEXT LINE. I CHANGED THE ORDER AND MADE IT ALL CAPS. .Parameters.Add(name:="EMPLOYEE", dbType:=OracleClient.OracleType.VarChar, size:=8).Value = strEmpId .Parameters.Add(name:="ROWCOUNT", dbType:=OracleClient.OracleType.Numb...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pipe git command to sed output<p>I am trying to pipe output from git to sed, which will inturn replace a value in file.config that represents the last commit...
<pre><code>sed -i '/&quot;commit&quot; *:/s/: *&quot;[^&quot;]*&quot;/: &quot;'$(git rev-parse HEAD)'&quot;/' file.config </code></pre> <p>will do it. You're confusing command-line arguments with stdin input. They're both good and widely-used ways of feeding the invoked program data but the differences in capacity and ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to add NaN values to row names of a dataframe in R<p>I am trying to create a data.frame but I want some rows to have the name NaN and I have not yet achi...
<p>You cannot have duplicated values in <code>rownames</code>. </p> <pre><code>rownames(frm) &gt; [1] "Hi" "NaN" "R" "NA..1" "Lang" "NA..2" "stat" "NA..3" rownames(frm)[4] &lt;- NaN </code></pre> <p>you get</p> <pre><code>Error in `.rowNamesDF&lt;-`(x, value = value) : duplicate 'row.names' are not all...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: BorderStyles transfers to other elements<p>I have set a Border Style into a UserControl.Resources with a x:key. If i set the Style into a Border all Labels g...
<p>If I understood your question correctly, you want to be able to apply this effect to every element that has an <code>Effect</code> field.</p> <p>If that's the case, instead of adding a style to your resources, you could directly add the effect itself:</p> <pre class="lang-xml prettyprint-override"><code>&lt;!-- [......
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Persisting google Banner Ad on bottom navigation bar in all Screens<p>Am new to flutter. I am creating a flutter app involving google mobile ads. I want to i...
<p>If you do not want to write the same code in all screens, then you could make modifications in the builder function of MaterialApp to include your banner ad there as:</p> <pre><code>MaterialApp( builder: (BuildContext context, Widget? child) { return Column( children: [ Expanded(c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: dynamically add inputs based on a input number I give<p>I want to dynamically add input fields based on the input number I give. now because I gave '#Templat...
<p>To avoid page overwrite, you can use jQuery <code>.append</code> as in <code>$(&quot;#TemplateCreate&quot;).append(htmlString);</code> <a href="https://api.jquery.com/append" rel="nofollow noreferrer">https://api.jquery.com/append</a></p> <p>The problem with your button is that you have bound it to the <code>click</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sum multiple values in the same column, if the respective cell below (in the same column) is not empty<p>I hope someone can help me. I have a table in excel ...
<p>For sum of <code>sales</code>-</p> <pre><code>=SUMIFS(B2:B31,A2:A31,&quot;Sales&quot;) </code></pre> <p>For sum of <code>Expec. Sales</code>-</p> <pre><code>=SUMIFS(B2:B31,A2:A31,&quot;Expec. Sales&quot;) </code></pre> <blockquote> <p><em><strong>Edit:</strong></em> Use below formula to sum <code>Expec. Sales</code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: format error when adding to AppDelegate.m<p>I am following react-native-codepush <a href="https://github.com/microsoft/react-native-code-push/blob/master/doc...
<p>Definition of method should not be included in <strong>@interface ... end</strong>, Only properties and methods are declared in <strong>@interface ... end</strong></p> <p>You are trying to write the definition of method in,</p> <pre><code>@interface ... @end </code></pre> <p>Instead add the method in</p> <pre><code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: DELETE sql statement in python<p>I have a postgres sql statement like so in python:</p> <pre><code>sql= &quot;&quot;&quot;delete from {table} where per...
<p>Let the database connector do your substitution.</p> <pre><code>where = [] vals = [] for k,v in (&quot;person&quot;,Person),(&quot;name&quot;,Name),(&quot;sale&quot;,Sale): if v: where.append(f&quot;{k} = %s&quot;) vals.append(v) sql= f&quot;DELETE FROM {TABLE} WHERE &quot; + (&quot; AND &quot;.j...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to webscrape multiple items in <tr> and split them in 3 variables with BS4?<p>I am trying to scrape a website with multiple brackets. My plan is to have ...
<p>Try:</p> <pre class="lang-py prettyprint-override"><code>import requests from bs4 import BeautifulSoup response = requests.get( &quot;https://www.carwow.co.uk/new-car-delivery-times#gref&quot; ).text soup = BeautifulSoup(response, &quot;html.parser&quot;) for tbody in soup.select(&quot;tbody&quot;): # for ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Case construct for Coq development<p>It seems that at some point there was a file SfLib.v that was used for the Software Foundations course. However, the cas...
<p>Maybe something changed since then, but now we need to <code>Import</code> notations.</p> <pre><code>(* 8.9, 8.10, and newer *) From Coq Require String. Export String.StringSyntax. (* [Export] means to [Import] the StringSyntax module, but also make it automatically available to whoever imports this file as well. ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: the skillbar is crooked bootstrap5.2<p>I tried to make a skillbar but it is wrong. I wanted to know how I can make it normal. Below you will find my code</p>...
<p>You only forgot to position your loading-bars at the starting point. <code>left:0</code> solved the problem</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-css lang-css prettyprint-override"><code>@import url("ht...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Another ActionController::InvalidAuthenticityToken in Rails 6<p>I am working on running a Rails application in production. It's still a proof of concept, but...
<p>In my case, solving this involved enabling the option in <code>config/environments/production.rb</code> as shown:</p> <pre class="lang-rb prettyprint-override"><code>config.force_ssl = true </code></pre> <p>I'm not sure if this is the only thing, unfortunately, since it was a while since I asked the question, howe...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Grep Multiple word From string in python<p>String Format and the expected result..</p> <blockquote> <pre><code>&gt;&gt;&gt;a = 'afd fdfe {a.b.c} fdferef {c....
<p>You seem to be confused about the meaning of <code>.</code>, <code>*</code>, and <code>?</code>.</p> <p><code>.</code> is a metacharacter which matches a single character (for example, <code>a</code> or <code>.</code> or <code>{</code>, or sometimes - but not usually - newline).</p> <p><code>*</code> is a metachar...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how do you scrape tables with the 'ngcontent' format using selenium/python?<p>Basic tables are fairly easy to scrape with Selenium. I am having trouble scrap...
<p>To grab the table data easily, you can use selenium with pandas</p> <pre><code>import pandas as pd from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.support.ui import WebDriverWait from selenium.webdr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Move to other Picker View tabs only after the user taps on a button in an alert view - SwiftUI<p>What I would like to be able to do is that when the user tap...
<p>SwiftUI is reactive world, means our code receives control post-factum... use UIKit representable instead for that...</p> <p>... Or, here is a possible workaround with proxy binding (however not sure if behavior persists in all OS versions)</p> <p>Tested with Xcode 13.4 / iOS 15.5</p> <p><a href="https://i.stack.img...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can you tell me if my code is right or wrong?<p>Page1 code</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="fals...
<p>Although your question is a bit hard to make sense of, my crystal ball is telling the issue is your data loading isn't aware of the <code>value</code> prop changing, since you compute <code>url</code> outside of the effect that actually loads the data.</p> <p>Then, you'll need to make <code>value</code> a dependency...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change Nuxt Store Variable<p>I'm looking to change a variable within my Nuxt store, though it's passing the object. The logging is working nicely, returning ...
<p>Mutation's first argument should be state and second one (optional) is payload. So in your case it should be like that:</p> <pre><code> export const mutations = { changeSortOption(state, option) { console.log(option) } } </code></pre> <p>More details you will find here: <a href="https://vuex.vuejs.o...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passing query string through variable value fails<p>Using Microsoft SQL Server 2015</p> <p>This works</p> <pre><code>create procedure Checking1(@SQLQueryStri...
<p>You need to tell SQL Server to execute your dynamic-SQL</p> <p><a href="https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-executesql-transact-sql?view=sql-server-ver16" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Make custom forms with annotations in Java<p>I'm trying to make custom forms with annotations. My idea is that given an annotated class, my code could genera...
<p>Before we get to reflections code, I think you're going to need another annotation to represent your classes that represent a custom form. Your current <code>@Form</code> annotation is better suited at the field level, since it's representing the label for each form field. I would rename this to <code>@FormField</co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# multithreaded program hangs when doing multiple audio sample collection<p>Good evening guys, I have issue with multithreading. I'm doing multiple audio sa...
<p>To access <code>pages[i].Controls</code> from a non-UI thread (e.g. a threadpool threat that will come from Parallel.ForEach) seems wrong. The NAudio object already uses event driven programming (you provide a <code>DataAvailable</code> handler and <code>RecordingStopped</code> handler) So there's no need to do that...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can´t loop through click event- function error appears to loop through that click event?! The loop somehow doesn´t work<p>the div elements should be self exp...
<p>You are pretty close to solutions but you pass an array of elements as 1 element. Try to modify it like this:</p> <pre><code>function moveElements(event){ function moveit(timestamp, els, dist, duration) { var timestamp = timestamp || new Date().getTime() var runtime = timestamp - starttime ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How change image in wxStaticBitmap in C++<p>The compiler tells me that the program class doesn't contain an element named SetBitmap when I want to change the...
<p>As said by Igor, it is better to speak english if you want a response.</p> <blockquote> <p>Compiler says that program class does not contain an element with name &quot;SetBitmap&quot; when I want to change an image in it.</p> </blockquote> <p>You should post the part of your code, because wxStaticBitmap has a member...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Combining/joining rows within the same dataframe based on grouping R<p>I am executing a map_df function that results in a dataframe similar to the df below. ...
<pre><code>library(dplyr) df %&gt;% group_by(name, year) %&gt;% summarise_all(mean, na.rm = TRUE) </code></pre> <p>This is a dplyr answer. It works, if your data really looks like the one you posted.</p> <p>Output:</p> <pre><code> name year A B C &lt;fct&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I list specific words it finds in the order it finds them in<p>I'm creating a discord bot and was wondering how I could list out the words in order it...
<p>Instead of looping through the dictionary loop through the message and then you can look for word matches when you hit a letter that matches the start of a key, like so:</p> <pre><code>item_dict = { &quot;okay&quot;: (&quot;Mythical&quot;, &quot;50000&quot;), &quot;hello&quot;: (&quot;Mythical&quot;, &quot;17500...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: applying a measure filter with date using DAX query<p>I am trying to get the customers whose Amount(Measure) is greater than 1000 for the given date period.<...
<pre><code>VAR WithAmount = ADDCOLUMNS( VALUES(Customer[ID]) ,&quot;myAmount&quot;,CALCULATE( [Amount] ,'Date'[Date] &gt;= DATE(2020,1,1) &amp;&amp; 'Date'[Date] &lt;= DATE(2020,1,7) ,ALL(Date) ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Store postman body JSON properties inside Typescript class with multiple optional properties<p>I am developing an API which I am calling from Postman. The PO...
<p>You can add properties to the class dynamically by adding them to the <em>this</em> instance inside the <strong>constructor</strong> method.</p> <pre><code>interface MyRequestInterface { name: string; username: string; [key: string]: string | number ; } class MyRequest { public name: string; public us...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find line number in multiline textbox that contains certain data<p>I would need a little help.</p> <p><code>Textbox1.Text</code> contains <code>1,2,3,4,5,6,...
<p>Don't use <strong>for each</strong>.</p> <p>You should iterate over your lines with an index and return the index.</p> <p>Code exmaple:</p> <pre><code> For index As Integer = 0 To TextboxX.Lines.Length Step 1 ' Here you can use your logic to check if the current line (by the index) is correct using Tex...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Conditionally "mutate" a column (whether or not add a column)<p>Just as the title says, I'm trying to conditionally add a mutate step to my dplyr pipe. But I...
<p>You don't need tidyeval</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) max.mpg &lt;- 50 mtcars %&gt;% {if(max.mpg &gt; 10) mutate(., foo=1) else .} #&gt; mpg cyl disp hp drat wt qsec vs am gear carb foo #&gt; Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calling catch() on save() method on mongoose document object gives me an undefined error<p>Below code snippet uses mongoose <code>findById()</code> to get th...
<p>Assuming <code>.save</code> doesn't take a parameter and returns a promise, the code should look like this</p> <pre><code>Script.findById(scriptId) .then(script =&gt; { if (script) { const scriptId = script._id.toString(); const demoUrl = `${scriptId}.mydomain.com`; if (true) { scrip...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: J Query Simple Color Picker - use as background color selector<p>I am trying to use the jQuery simple color picker to select and change the background color....
<p>To achieve that you only have to replace <code>#swatch</code> with <code>body</code> in the <code>refreshSwatch()</code> function:</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"...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Print within the SQL Server Select query based on the condition<p>I have this query from the link <a href="https://www.mssqltips.com/sqlservertip/3347/drop-a...
<p>Ms Sql 2016 dose not support if statement in middle of query. You must use case statement instead of it.</p> <p>you need to change</p> <pre><code>**--- Trying to Accomplish --** If delete_referential_action = 1 THEN FOR XML PATH(N''), TYPE).value(N'.[1]', N'nvarchar(max)'), 1, 1, N'') + ') ON DELETE CASCA...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change the color of navigationTitle for only one view?<p>I want to change to color of the navigationTitle of View1 to green, without changing the colo...
<p>This <a href="https://stackoverflow.com/a/72283860/6268327">link</a> may be helpful. There is solution:</p> <pre><code>struct View1: View { var body: some View { NavigationView{ ZStack { NavigationControllerAccessor(viewWillAppear: { nav in nav.navigationBa...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to access instance of exception "catched" with JUnit Rule ExpectedException?<p>Suppose that in a test is:</p> <pre><code>@Rule public Expecte...
<p>There is a less specialized version of <code>expect</code> method in that rule, that accepts a Hamcrest's matcher:</p> <p><a href="https://junit.org/junit4/javadoc/4.12/org/junit/rules/ExpectedException.html#expect(org.hamcrest.Matcher)" rel="nofollow noreferrer">expect(Matcher)</a></p> <p>This method would allow ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Perplexing borrow checker message: "lifetime mismatch"<p>I've recently come across a borrow checker message I've never seen before which I'm trying to unders...
<p>The problem is that <code>&amp;'a mut T</code> is <a href="https://doc.rust-lang.org/nomicon/subtyping.html#variance" rel="noreferrer"><em>invariant</em></a> over <code>T</code>.</p> <p>First, let's look at the working code:</p> <pre><code>fn foo(v1: &amp;mut Vec&lt;u8&gt;, v2: &amp;mut Vec&lt;u8&gt;, which: bool)...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you hide/disable the active tab's border color?<p>How do you hide/disable the active tab's border color? In the screenshot below, it is the red line ...
<p>By default, there is no color option specified for that (are you sharing a settings.json file?)</p> <p>To remove the color of the top border, look at your setting.json and find <code>workbench.colorCustomizations</code> and within it, find <code>tab.activeBorderTop</code> and delete it:</p> <pre class="lang-json pre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't pre-define dtype when reading data<p>I am reading a pipe delimited file without headings into Pandas and I am using Pandas version 0.24.2. And this is ...
<p>I got a different error:</p> <pre><code>ValueError: Unable to convert column coborrower_fico_at_origination to type int </code></pre> <p>import you import the data into Excel, you will see that there are 3 rows in this columns that are blank. The <code>int</code> type cannot handle blanks. You should change it to ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TypeError: token must be of type str, not NoneType<p>I'm trying to make a Discord bot with python but I get this error when I run it:</p> <pre><code>TypeErro...
<p>if your discord bot is hosted locally, without needing to be shared publicly or hosted online, you may simply set token variable directly to the string of your token.</p> <pre><code>token = 'MTAwNjA1NTQ4NTg3MjUzNzcwMQ.GcPn03.xeIRE4c1W0OF8aNtkA4hj1Nl2V6mowLV1BqWuU' </code></pre> <p>If you would like to make use of en...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MongoDB $inc field<p>I'm trying to write a function that takes a record id, an action, i.e. inc or dec, and a field name as a string to be incremented (it ca...
<p>you can use it like this</p> <pre class="lang-js prettyprint-override"><code>$inc: { [field]: string } </code></pre> <p>Note: check field value (using <code>if/else</code>) before performing operation because if someone passes &quot;password&quot; as field value and you have field named &quot;password&quot; in that...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ValueChanges are not detect when a value is set to the dropdown through backend?<p>I'm using one angular form to add and edit employee details. <code>valueCh...
<p>You can read the data directly</p> <pre><code>sendToBe({employee_id: this.createEmpForm.get('employee_id').value}) </code></pre> <p>or send the whole form (or parts)</p> <pre><code>const formValue = this.form.value sendToBe(formValue) </code></pre> <p>or start with current value</p> <pre><code>this.createEmpForm.get...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why do push/unshift functions on a list affect other lists that the list is assigned to in Javascript?<p>In Javascript, why do the push and unshift functions...
<p>The reason for that is because Array is not a primitive type. Meaning, if you assign an array to a variable, the variable will be a "pointer" to the Array that is located in the HEAP memory. So if you assign <code>list2</code> as <code>list</code>, you mean: "Set list2 as the same pointer of list1". In order to make...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Off-the-shelf function to search for key of given value in a Python dictionnary<p>I am looking for a way to find all keys of a dictionary that are mapped to ...
<p>Basically there is no python built in function for performing it. You can use <code>filter</code>: </p> <pre><code>my_dict = { 'a': 12, 'b': 0, 'c': 0 } print(list(filter(lambda x: my_dict[x] == 0, my_dict))) </code></pre> <p>You can use also numpy:</p> <pre><code>keys = np.array(list(my_dict.keys()...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I want to be able to "turn on" a video game console but only if the TV channel is set to 3. How do I do this?<p>Don't mind the other parts of my horrible cod...
<p>This is happening because there is two different instances of the TV class. </p> <p>One in console</p> <pre><code>public class Console { TV tv = new TV(5,25); </code></pre> <p>and one in the entry point</p> <pre><code>public static void main (String[] args) { //GameRoom Light light = new Light ("Mod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Run a script every time a computer is created<p>I need to run a script that moves computers to a specific OU every time they are created. I have been researc...
<p>I would use the newer <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.diagnostics/get-winevent" rel="nofollow noreferrer">Get-WinEvent</a> cmdlet and parse out the information from the XML.</p> <p>Try</p> <pre><code># by default, Get-WinEvent returns event information in the order of...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: UWP - Use RenderTargetBitmap and only capture the visual area<p>I want to use RenderTargetBitmap to just capture the visual area in UWP app. But the result i...
<blockquote> <p>UWP - Use RenderTargetBitmap and only capture the visual area</p> </blockquote> <p>The problem is RenderTargetBitmap will render all the content area for Canvas container, so the better way is use <a href="https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.uielement.clip?view=winrt-22621" rel="nof...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sort an array of different values in JavaScript<p>I have a use case where I need to sort two different lots of values in the same go. Basically, I'm building...
<p>Since the first rule state that &quot;Patient&quot; must be on top, I assumed &quot;Patient-Abandoned&quot; should be on top of &quot;John-On Hold&quot;.<br /> I think the code readability would be improved by some flag that store the result of basic checks (i.e. <code>aIsPatient</code> and <code>aIsAbandoned</code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to align icon with text underneath<p>The text under the icon starts from far back. I couldn't find a solution as I'm not even beginner on HTML or CSS. If...
<p>This is another way.</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-html lang-html prettyprint-override"><code>&lt;html&gt; &lt;head&gt; &lt;style&gt; ul.inside { max-width: 200px; list-style-position: outs...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I can't get data in fragment By Using Bundle()<p>in recycler view when click item work and clicked and the fragment open successfully but the date can't send...
<p>You are creating bundle . But you didn't bind the bundle as arguments. Try adding this line.</p> <pre><code>val bundle = Bundle() bundle.putString(&quot;SoraName&quot;, items[position].name) val fragment = SoraDetailsFragment() fragment.arguments = bundle // This is where bundle is attached to fragment as arguments ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: XSLT 1.0 Help in Sorting<p>I have a requirement where i need to do sorting and grouping. I have worked my XSLT with sorting but its not giving me the desired...
<p>Try it this way:</p> <p><strong>XSLT 1.0</strong></p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/&gt; &lt;xsl:key name="detail-by-item" match="Detail" use="ItemN...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Foreign key to the same table in Python Peewee<p>I am using ORM <a href="http://docs.peewee-orm.com/en/latest/" rel="nofollow noreferrer">peewee</a> for sql...
<p>This is documented very clearly: <a href="http://docs.peewee-orm.com/en/latest/peewee/models.html#self-referential-foreign-keys" rel="noreferrer">http://docs.peewee-orm.com/en/latest/peewee/models.html#self-referential-foreign-keys</a></p> <p>You just put <code>'self'</code> as the identifier:</p> <pre><code>class...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: OpenCV - How to get the data from a QR code without 'b' at the front?<p>so I am using OpenCV to read QR codes with my webcam and it is working great but the ...
<p>The <code>b</code> in front of the text means that the type is <code>bytes</code> not <code>str</code>, you need to decode it before printing it. For example:</p> <pre class="lang-py prettyprint-override"><code>bytes_text = b'Hola' print('Text in bytes:', bytes_text) &gt;&gt;&gt; Text in bytes: b'Hola' decoded_by...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Disable WAL mode<p>It seems like my solution is not working and I don't know why. Here is what I try:</p> <p><strong>Logic</strong></p> <p>My app has a singl...
<p>If you look at Section 3.3 of <a href="https://sqlite.org/wal.html" rel="nofollow noreferrer">https://sqlite.org/wal.html</a> you can only persist turning WAL mode on, you cannot persist turning WAL mode off. You can only turn WAL mode off as part of each connection and that setting will be forgotten when you close ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to delete a element from nested dictionary?<p>I have a dictionary that like this :</p> <pre><code>card_pool = { 'ace' : [1,11], '2' : 2, '3'...
<p>All dicts <code>l_card_pool[*]</code> are <em>the same dict</em>. If you're planning to mutate any of them, you need to copy them on creation, e.g.:</p> <pre><code>l_card_pool = {} for suite in ('spade', 'clover', 'heard', 'diamond'): l_card_pool[suite] = card_pool.copy() </code></pre> <p>That creates a shallow ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a regex that will match a string that contains a non fixed width string?<p>Here are two example strings:</p> <blockquote> <p>'If &lt;Person&gt;, is ...
<p>You can use</p> <pre class="lang-none prettyprint-override"><code>^(?:&lt;[^\s&lt;&gt;]*&gt;|[^&lt;&gt;])*$ </code></pre> <p>See the <a href="https://regex101.com/r/K3ayqd/1" rel="nofollow noreferrer">regex demo</a>.</p> <p><em>Details</em>:</p> <ul> <li><code>^</code> - start of string</li> <li><code>(?:&lt;[^\s&lt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to create a json file from a firestore collection using javascript<p>I have a collection in Firestore, and i want to create a button which saves the data...
<p>Just fetch your data, stringify it with your desired format and save it with a filewriter.</p> <pre><code>import fs from 'fs'; const fetch = async () =&gt; { const documents = (await getDocs(collection(ref, 'your-collection'))).docs.map((doc) =&gt; doc.data()); const json = new Blob([JSON.stringify(documen...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Subset a dataframe by single cell selection of DT::datatable<p>Below Im trying to subset the second datatable by clicking on a cell of the column owners of t...
<p>To make your code work you have to add <code>selection = list(target = &quot;cell&quot;)</code> as an argument of your <code>datatable</code> call. The way you used it inside <code>{}</code> you create a variable with name <code>selection</code> which however has no effect on the <code>datatable</code>:</p> <pre><c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Writing strings to a text file in python<p>I am generating some random strings in python using the following code:</p> <pre><code>import string import random...
<p>You need to <code>.close()</code> file or use <code>with</code> statement.</p> <p>This is including some optimizations:</p> <pre class="lang-py prettyprint-override"><code>import os from random import choice, randint import string alphabet = string.ascii_lowercase + string.ascii_uppercase + string.digits with open(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: BeautifulSoup: Extract the label of checked radio button<p>I have the radio buttons followed. How can I get the text of the <code>checked</code> radio button...
<pre><code>from bs4 import BeautifulSoup html = ''' &lt;li&gt; &lt;input class=&quot;bRadio&quot; value=&quot;1&quot; type=&quot;radio&quot; id=&quot;main.Option1&quot; name=&quot;main.Option&quot; checked=&quot;checked&quot;&gt; &lt;label class=&quot;col-form-label&quot;&gt;Equal Width&lt;/label&gt; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Count and Assign Consecutive Occurrences of Variable<p>I wish to count consecutive occurrence of any value and assign that count to that value in next column...
<p>You can repeat the <code>lengths</code> argument <code>lengths</code> time in <code>rle</code></p> <pre><code>with(rle(dataset$input), rep(lengths, lengths)) #[1] 1 2 2 2 2 1 4 4 4 4 1 1 </code></pre> <hr> <p>Using <code>dplyr</code>, we can use <code>lag</code> to create groups and then count the number of rows ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why it takes different times to run same program?<p>I was trying to run a deep learning code in which the test data contains 100 images. Each time I do the t...
<p>There can be a lot of factors of why this is happening. Also it would be good how big the relative time difference is. Are we talking about 5% or 50%?</p> <p>Since you experience this in both cases (deep learning and opencv) I would guess it is one of the following.</p> <p>Does something else run on the machine wh...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: iOS 15 DualSense is opening App Library on PS button long press<p>On iOS 15 a long press on the PS Button of the DualSense controller is opening the App Libr...
<p>If someone ever faces the same problem you can actually disable system gestures for the Home button.</p> <p>In Swift all you have to add is this line (controller is a <em>GCController</em> object)</p> <pre><code>controller.physicalInputProfile.buttons[GCInputButtonHome]?.preferredSystemGestureState = .disabled </cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TKINTER: Howto auto-update loop generated labels<p>I'm battling with tkinter's .after() functionality, and I see all the examples, these all work as demo in ...
<p>Note that <code>self.after(1000, self._update_status(status_frame))</code> will execute <code>self._update_status(status_frame)</code> immediately, not 1000ms later. Also you don't need <code>self._update_status()</code> at all for your case.</p> <pre class="lang-py prettyprint-override"><code>... from random impor...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Following query taking too long to execute. How to optimize it<p>I use the following query to get <code>years</code> and the <code>number of movies released ...
<p>I think you can use </p> <blockquote> <p>EXISTS</p> </blockquote> <p>instead of JOIN.</p> <pre><code>SELECT m.year, COUNT(m.id) FROM movies m where exists (select * from roles r where r.movie_id=m.id and exists(select * from actors a where a.id=r.actor_id and a.gender='F')) group by m.year; </code></pre> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PrimeVue Toast Component Error: Can't resolve './ToastMessage' in */toast<p>I'm currently starting a new project with vuejs and wanted to use primevue for so...
<p>I have a solution for your second error, but not sure how to fix your first "Can't resolve" error, as I am still figuring that one out.</p> <p>What does your webpack config look like? Do you specify a rule for CSS files? If the component uses a <code>&lt;style&gt;</code> block you need to tell webpack how to handle...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SAP Commerce (Hybris) and Apache Kafka integration consumer not getting created<p>I am trying to create Apache Kafka consumer / listener on SAP Commerce appl...
<p>The error occurs because there is OOTB hybris converter</p> <pre><code>de.hybris.platform.converters.impl.AbstractPopulatingConverter </code></pre> <p>This is causing the IllegalArgumentException. But this OOTB converter is not required. So, to avoid this error you can follow the steps given in the documentation as ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Multi-node Zookeeper on Docker Swarm<p>I'm setting up a multi-node Apache Kafka cluster, but it seems my Zookeeper instances are having trouble communicating...
<p>I managed to get it running using <code>zookeeper</code> image instead of <code>confluentinc/cp-zookeeper</code>. Here's my setup in case anyone else struggled with setting multi-node Zookeeper/Kafka on Swarm.</p> <pre class="lang-yaml prettyprint-override"><code>version: '3.7' x-zookeeper-envs: &amp;zookeeper-envs...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Return number of documents based on words in a field's string<p>How can I return the number of documents that have more than 2 elements in the "words" list w...
<p>Regarding the number of elements in the <code>words</code> array, my advice is to store that number in an additional field <code>words_count</code> at indexing time.</p> <pre><code> { "amount" : 1140, "words_count": 3, &lt;--- add this "words" : [ { "relevance_sc...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: FIDO2 seamless sign-in across devices - Passkeys<p><em><strong>EDIT 2</strong></em></p> <p>Just to ellaborate on what @Tim has already explained, I made thes...
<p>You are mixing a few different things here. The security key, local platform authenticator (Windows Hello) and your phone will all have their own credential.</p> <p>If you are just trying to test the new FIDO cross device authentication flow using your phone, do not require a resident credential (not yet supported) ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Does Kafka Consumer reconnect and resubscribe to topics after cluster goes down and comes back up<p>kafka consumer using librdkafka (high level consumer) con...
<blockquote> <p>Does consumer needs to resubscribe to topics again once it is connected to cluster?</p> </blockquote> <p>Yes. New group members will cause a rebalance amongst existing members, and they need to resubscribe</p> <blockquote> <p>What is a reliable way to detect the consumer is connected to cluster in...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: t-comb-form-native and boolean function to accept terms<p>I have a signup form working great, fine ! But I want to make a boolean field : "terms" and I want...
<p>I added in the state <code>accepted: false</code> to pass it true when terms are clicked <code>this.setState({accepted:true});</code></p> <pre><code> handleSubmit = async () =&gt; { const data = this._form.getValue(); if ( data &amp;&amp; data.email &amp;&amp; data.password &amp;&amp; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firestore rules to restrict users to their section of the DB<p>I am wondering how to restrict firebase to only the specific section of the DB that they own.<...
<p>It doesn't work because of this rule:</p> <pre><code>match /{document=**} { allow read: if true; } </code></pre> <p>It allows read access to all documents in the database to everyone, unconditionally, and it's overriding the other rule that you've written. Remove this rule if you don't want everyone to be able ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Z3py, random different solution generation<pre><code>from z3 import * import random a = Int('a') b = Int('b') s = Tactic('qflra').solver() s.add(a &gt; 10) ...
<p>I think you're conflating what randomization does with sampling. As @JohanC pointed out, you usually fix a random seed to get consistent results in SMT across multiple runs. Just because you change the seed, does <em>not</em> mean you'll get a different result. Sampling is an entirely different (and much more diffic...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Blazor Virtualize Adds empty space in list before cards<p>If I use this code:</p> <pre><code>&lt;div class=&quot;grid&quot;&gt; @foreach (var ski ...
<p><code>Virtualize</code> component generates two <code>divs</code> one before and one after the items. Those divs are necessary for the component to work.</p> <p><a href="https://i.stack.imgur.com/nc8hX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nc8hX.png" alt="enter image description here" />...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Storing a variable in an array (that functions as a value in an object) JavaScript<p>I have a simple function that checks if the username already exists in t...
<p>You could do that with a more efficient and less error prone way:</p> <pre><code>// look for the index in the array const pointIndex = this.points.findIndex(point =&gt; point.username === this.username); if(pointIndex &gt; -1){ // if found, push the time this.points[pointIndex].time.push(this.globalTime); } else...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: wire output can be used as an inside variable?<p>i am learning verilog and i am doing practice questions on <a href="https://hdlbits.01xz.net/wiki" rel="nofo...
<p>Verilog and SV allow the reading of outputs from within a module.<br /> It is different than VHDL which does not allow the same.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ANR on FirebaseInstanceIdReceiver<p>I'm getting the following error in my play console without any stack trace (on android 7 and 10).</p> <pre><code>Broadcas...
<p>These ANRs for <code>act=com.google.android.c2dm.intent.RECEIVE</code> are very common in Android apps which are sending a lot of push notifications.</p> <p>Most of them are caused by long application startup and processing push notifications on the main thread.<br /> Nickolay Chameyev from the Bumble Tech described...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compiling failed: argument type 'Character' does not conform to expected type 'ExpressibleByStringLiteral'<p>I have this code:</p> <pre><code>private func v...
<p>Use the following declaration</p> <pre><code>let acceptableChar = Set&lt;Character&gt;(arrayLiteral: "0", "9", "8", "7", "6", "5", "4", "3", "2", "1", ".") </code></pre> <p><em>Tested &amp; worked with Xcode 11.2 / iOS 13.2</em></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Graphql Codegen Wizard Terminated Unexpected<p>I am trying to use the GraphQL Codegen Wizard for my application. I followed the installation instruction fro...
<p>The only fix that I've come up with is downgrading to version 2.10.0 of graphql code generator.</p> <p>In your package.json make this change -&gt; &quot;@graphql-codegen/cli&quot;: &quot;2.10.0&quot;</p> <p>then npm install</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Optimise Kotlin code for button clicked state<p>I want to change the button background when the button clicked, the function is work by using this code</p> <...
<p>I would keep a variable that keeps track of the selected one like</p> <pre><code>private var selectedBank: View? = null </code></pre> <p>And then do</p> <pre><code>arrayOf(bank1, bank2, bank3, bank4).forEach { it.setOnClickListener { selectedBank?.setBackgroundResource(R.drawable.default_option_border_bg...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Looping over Tuple of Btye object gives ASCII value<p>The below code in python 3 returns as </p> <pre><code>fro val in A: print (val) </code></pre> <p>...
<p>It would appear that when you iterate of a <code>bytes</code> object, it yields a decimal value for each byte in it:</p> <p>eg:</p> <pre><code>&gt;&gt;&gt; phrase = b'Hello, world!' &gt;&gt;&gt; chars = list(phrase) &gt;&gt;&gt; chars [72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33] </code></pre> <p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I use a hidden_field_tag to help create a valid object in Ruby on Rails?<p>I'm creating a prayer website with the ability to comment on a public praye...
<p>With help from Maxence, I discovered I need to use <code>f.hidden_field</code> versus <code>hidden_field_tag</code></p> <p>so I changed the views/shared/_comment_form.html.erb to the following:</p> <pre><code>&lt;%= form_with(model: @comment) do |f| %&gt; &lt;%= render 'shared/error_messages', object: f.object %&g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CodeMirror - cut value and append text<p>Is there a way to cut the value by line numbers? For example, here's my editor's text area:</p> <pre><code>initial ...
<p>You can split your string into separate lines using <code>.split(/\n/)</code>. This will give you an element in an array for each line. Then, you can <code>.map()</code> each line into a string with <code>"someText</code> prepended to it (only if that line is valid - hence the <code>line ?</code> check). Then, you c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Improve sed modification between two patterns<p>I have this text file:</p> <pre><code> cat MyFile.xml | grep IndiceKK &lt;Ref IndiceKK=&quot;22&quo...
<p><code>sed -i -e '/IndiceKK/s/22\.[0-9]*/22/' MyFile.xml</code></p> <ul> <li>Match period with <code>\.</code> because <code>.</code> matches any char</li> <li>Match numerals <code>[0-9]</code> not non-space <code>[^ ]</code></li> <li>don't use <code>g</code> for glob match... it's not needed</li> </ul>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: useQuery data undefined when calling useEffect hook?<p>I'm a bit baffled here. According to <a href="https://stackoverflow.com/questions/55472134/how-can-i-u...
<p>Unless I'm not fully understanding your issue, this looks like expected behaviour. </p> <p><code>useEffect</code> will fire on mount and then anytime <code>data</code> changes, <code>data</code> will only change when the API call has completed. The initial <code>useEffect</code> call is going to happen before <cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Square of even numbers in Haskell<p>I am trying to write a basic function in Haskell as shown below. My aim is provide the code to square only even numbers w...
<p>One quite straightforward answer to your question is, you can inline a <code>if</code> statment directly into your list comprehension like so:</p> <pre class="lang-hs prettyprint-override"><code>[ if even x then x * x else x | x &lt;- [1..10] ] </code></pre> <p>This is possible since <code>if</code> is an expression...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python syntax: Could colons be optional when at end of line?<p>I would like to understand whether it would be possible to change the syntax of Python making ...
<p>Lookahead technicalities aside, the grammar would certainly not become ambiguous: all you’re doing is interpolating a <code>:</code> at the end of any line (before any comment) where doing so avoids a syntax error (so not after <code>lambda</code>, where one would be necessary but not sufficient). In particular, no...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Animate Compose GoogleMap to a Specified Location<p>I am working on a simple Maps App and I am trying to make <a href="https://developers.google.com/maps/doc...
<p>If it's one and only one time animation when your Composable is composed use LaunchEffect(key1 = true) as the code shows below.</p> <pre><code>val initialZoom = 6f val finalZoom = 15f val destinationLatLng = LatLng(destination.lat, destination.lng) val cameraPositionState = rememberCameraPositionState { positio...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reuse output variables from previous job<p>I'm trying to run 'publish-storybook' job conditionally, based on the variable from the previous job. Complete act...
<p>You're only defining <code>steps.outputs</code> and not <code>job.outputs</code>.</p> <pre><code>jobs: release: name: Release runs-on: ubuntu-latest # Map a step output to a job output outputs: published: ${{ steps.changesets.outputs.published }} steps: [... no further changes] </code></...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert a Single line of JSON to csv using jq in shell bash script<pre><code>{ &quot;name&quot;: &quot;john&quot;, &quot;age&quot;: &quot;22&quot;, &qu...
<p>Would this do it?</p> <pre class="lang-bash prettyprint-override"><code>jq -r ' [&quot;Daily Steps&quot;, &quot;Weekly Steps&quot;, &quot;Monthly Steps&quot;, &quot;Total Steps&quot;], ([.dailysteps, .weeklysteps, .monthlysteps] | . + [add]) | @csv ' data.json </code></pre> <pre class="lang-json prettyprint-o...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: force http.globalAgent.keepAlive = true<p>I have this node CLI tool that consumes all my network's NAT (network address translation) address ports whenever i...
<p>The <code>node</code> command supports a <code>--require</code> flag which preloads a module (or several modules) before executing file passed to <code>node</code>.</p> <p>Because of the <code>require</code> cache, if a module imports the <code>http</code> module and sets <code>http.globalAgent.keepAlive = true</cod...