input_text_instruct
stringlengths
288
45.8k
output_text
stringlengths
37
33.2k
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I speed up my code here? Trying to iterate and replace certain values in every row. Details in body<p>I'm trying to modify a pandas dataframe such th...
<p>As far as I can see your code is not just slow but gets permanently stuck in the <code>while</code> loop because the relevant variables are not actually altered on each iteration. (The values within <code>sf</code> are altered but not within the current <code>row</code>.) You can make it work by moving the logic to ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Selecting 4 consecutive rows after conditioın<p>I have this data</p> <pre><code>ratings &lt;- data.frame(Rating = c(0,99,99,99,99,99,99,99,0,99,99,99,99,99,9...
<pre class="lang-r prettyprint-override"><code>ratings &lt;- data.frame(Rating = c(0,99,99,99,99,99,99,99,0,99,99,99,99,99,99,99,99,99,99,99), Trial = c(1,NA,NA,NA,NA,NA,NA,NA,2,NA,NA,NA,NA,NA,3,NA,NA,NA,NA,NA)) library(dplyr, warn.conflicts = FALSE) ratings %&gt;% mutate(var = replace(rep(0, n()), which(Trial == ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use join for a stream of CompletableFuture<p>Supposedly, I have the following method</p> <pre><code>public static Stream&lt;CompletableFuture&lt;Strin...
<p>The &quot;surprising&quot; results are due to how <code>findPricesStream</code> is implemented: it returns <code>shops.stream().map(shop -&gt; CompletableFuture.supplyAsync(...)</code>. The CompletableFuture is not constructed until a terminal operation is applied to the returned stream. This is done in your own met...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: When plotting, wanting to 'hold' a y value over an x interval. [Not a 'bar plot' question]<p>For some reason I am blank on this one:</p> <pre><code>x = np.a...
<p>You would need to append the last y point, such that both arrays have the same number of elements, then use <code>drawstyle="steps-post"</code> to get a step-like appearance.</p> <pre><code>import numpy as np import matplotlib.pyplot as plt x = np.arange(5) #[0 1 2 3 4] y = np.array((3, 6, 1, 9)) #[3 6 1 9] plt.p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to display phone numbers in SQL that contain two and only two '0s'?<p>I am trying to write a query that will extract phone numbers from a column that are...
<p>Use <code>like</code> and <code>not like</code>:</p> <pre><code>where Phone like '%0%0%' and Phone not like '%0%0%0%' </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: finding the size of an string array that saves integers C<p>I am currently working on a project where I am manipulating command line data, but I can't seem t...
<pre><code>int size_arr = sizeof(len2) / sizeof(len2[0]); </code></pre> <p><code>sizeof(len2)</code> asks for the total allocated size of <code>len2</code> in bytes. This only works because C knows how many you allocated at compile time and turns it into a constant. It doesn't tell you which ones you've filled in. C do...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use stringr to only keep a column with matching text<p>My data:</p> <pre><code>structure(list(x = c(-32.2473803623946, -10.3430055552535, ...
<p><code>select</code> with <code>where</code> should return a single TRUE/FALSE for each column for selection of that column. So, wrap with <code>any</code> - i.e. <code>str_detect</code> will be applied on each of the columns to check whether there is 'Bipolar', but the length will be equal to the length of the colu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Swift - Holding closure reference leaks<h2>Edit (after discussion):</h2> <p>It's a common practice in <code>SwiftUI</code> to have a <code>View (struct)</cod...
<blockquote> <p>Why is holding a reference to a closure cause a memory leak even if the closure does not retain anything?</p> </blockquote> <p>Because the closure <em>does</em> retain something. It retains <code>self</code>.</p> <p>For example, when you say</p> <pre><code> manager?.shouldDismiss { sh...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Quarkus com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class<p>I'm using quarkus to call a web service, this service ...
<p>You need to register <code>UserInfoDto</code> for reflection. GraalVM removes all the classes, fields and methods that do not seem to be used by the application. And when using reflection, most of the time, it can't figure out they are used.</p> <p>Quarkus has some mechanisms to detect things and register some of th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to place multiple columns as a single column most easily in R dataframe?<p>How to make values in columns 1,2,3,4 appear as values in a single column 1 in...
<pre><code>data.table::melt() </code></pre> <p>or </p> <pre><code>reshape::melt() </code></pre> <p>Example</p> <pre><code>library(reshape) mdata &lt;- melt(mydata, id=c("id","te")) </code></pre> <p>Result</p> <pre><code>d t v value 1 1 x1 5 1 2 x1 3 2 1 x1 6 2 2 x1 2 </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I am facing problem for adding "implementation 'com.firebaseui:firebase-ui-database:8.0.1" in android studio(java)<p>I am facing problem for adding &quot;imp...
<p>Try deleting the corrupted cache. Invalidation caches and restart.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert string to date in Java for given format<p>I have a response from an API for a date field.</p> <pre><code>&quot;billCycleDate&quot;:&quot;2022-07-15T0...
<p>Try this</p> <pre><code>inputFormatter = DateTimeFormatter.ofPattern(&quot;yyyy-MM-dd'T'HH:mm:sszzz&quot;, Locale.ENGLISH); </code></pre> <p>Reference: <a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings#zzzSpecifier" rel="nofollow noreferrer">https://docs.microso...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R: How to display mean-separation letters for 2-way ANOVA when interactions are not significant?<p>I am comparing a fertilizer experiment where I have a resp...
<p>The solution was to use the <code>agricolae</code> package:</p> <pre><code>install.packages("agricolae") library(agricolae) mod1 &lt;- lm(response ~ genotype + rate, data = demo) Anova(mod1, type = "III") genotype &lt;- HSD.test(mod1, "genotype") genotype #Part of the output: response groups 1 0.4536856 a 3...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Typescript check whether a type is tuple or array<pre><code>type A = [1, 2, 3] type B = (1|2|3)[] type IsTuple&lt;T&gt; = ??? type C = IsTuple&lt;A&gt; // ...
<p>update, I figured out the answer, by checking the length</p> <pre><code>type A = [1, 2, 3] type B = (1|2|3)[] type C = A['length'] //3 type D = B['length'] // number </code></pre> <p><a href="https://www.typescriptlang.org/play?ssl=6&amp;ssc=1&amp;pln=1&amp;pc=1#code/C4TwDgpgBAglC8UDaBGANFATBgzAXQChRIoAhBKAChQB9Mac...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SwiftUI Tabbed View prevent swipe to next tab<p>I'm trying to prevent swiping to the second tab until the user has clicked a button on the first tabbed view ...
<p>Small wrong approach. In your <code>ContentView</code>, you are supposed to bind the <code>allowSwipeTo2</code> variable with the <code>tab1View</code>.</p> <p>To fix your problem, change the type of variable <code>allowSwipeTo2</code> in <code>tab1View</code> to <code>@Binding var allowSwipeTo2 : Bool</code>, and f...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Edit yaml file and save it with python<p>I have a yaml file that looks like this:</p> <pre><code>grids: phxgrid: class: spexxy.grid.FilesGrid file...
<p>There's no need to read the entire CSV file into memory. Read the YAML configuration in first, then write new YAML files as you iterate through the CSV file.</p> <pre><code>from csv import reader import yaml with open('config.yaml') as f: doc = yaml.load(f) values = doc['components']['star']['init'][0]['valu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert in R from numeric to char without changing value<p>I have a data table extracted from SQL Server, using sqlQuery and it looks like this:</p> <p>| PK ...
<p><code>0.061999998986721</code> is the full value. You could use <code>round</code> or <code>signif</code> within <code>as_character</code> depending on how the other numbers are formatted. For the example provided:</p> <pre class="lang-r prettyprint-override"><code>&gt; as.character(round(0.061999998986721, 3)) [1] ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Jest virtual mock: how do I troubleshoot this failure?<p>So I have this import statement in a module that I'm trying to test using jest 25.1 running on node ...
<p>So, the problem here turned out to be jest's implementation of <code>import</code> vs <code>require</code> in the .spec file.</p> <p>By changing this line:</p> <pre class="lang-js prettyprint-override"><code>import { functionA, functionB } from './module-under-test' </code></pre> <p>To this:</p> <pre class="lang...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to prevent Vim adding a newline at EOF for LaTex files?<p>When I edit a LaTex (.tex) file Vim automatically adds a newline at the end of file on write. H...
<p>That should be (almost) enough:</p> <pre><code>augroup mytex | au! autocmd FileType tex setlocal nofixeol augroup end </code></pre> <p>But note that if some file already had a newline at the end, then that newline becomes "invisible" in Vim and you cannot remove it normally.</p> <p>To deal with this you can u...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: UnPublish app not available to select in google play console<p>I'm trying to un-publish an app in play console but the un-publish checkbox is disabled. I jus...
<p>Thanks to @<a href="https://stackoverflow.com/users/19580355/pineapplepie">PineapplePie's</a> comment i was able to un-publish the app. App had managed publishing on. After turning off managed publishing i was able to un-publish the app.</p> <p><strong>Following was the problem</strong> <a href="https://i.stack.imgu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# ef core efficiently determine if there is only one row in a query<p>What is the most efficient way to check if a particular query has one row AND only one...
<p>You can use the same technique as any ORMs do - take two records and apply <code>Count</code>.</p> <pre class="lang-cs prettyprint-override"><code>var count = await _FilteredContext.Context .Where(x =&gt; x.Criterion == FilterCondition) .Take(2) .CountAsync(); var singular = count == 1; </cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: vaadin 23 textfield set type<p>I'm using a vaadin TextField on mobile and want to change the input elements 'type' attribute to 'search' so that on mobile th...
<p>There is no Java API for this, but you can do it with JavaScript call from Java side.</p> <pre><code>textField.getElement().executeJs(&quot;this.inputElement.setAttribute('type','search');&quot;); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas pivot_table create a new column for each entry<p>I have a pandas dataframe like this</p> <p><img src="https://i.stack.imgur.com/0Rhkm.png" alt="enter...
<p>Use <code>gruopby</code> and <code>reset_index</code> to create numeric index for each hobby in each name group. Reshape (unstack) to obtain matrix format.</p> <pre><code>df = pd.DataFrame({'Name':['Anna','Anna','Anna','Lisa','Lisa','Tom' ], 'Hobby':['drawing','swimming','skiing','running','singin...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Measure Accuracy in Hierarchical Clustering (Single link) in R<p>How can I measure accuracy in Hierarchical Clustering (Single link) in R with 2 Clusters ? H...
<p>Accuracy is not the most accurate term, but I guess you want to see whether the hierarchical clustering gives you clusters or groups that coincide with your labels. For example, I use the iris dataset, and use setosa vs others as target:</p> <pre><code>data = iris target = ifelse(data$Species=="setosa","setosa","ot...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Update text outside of partialview .Net 6<p>I have created a table from a list of objects, using a partialview. Using an ajax call(so the page doesnt have to...
<p>One easy option that comes to mind would be to add a hidden input to your partial view and set it's value to the Total Count of <code>TempData</code>, then in your ajax use this hidden value to set the one outside of your partial view:</p> <p><strong>Partial View</strong>:</p> <pre><code>.... &lt;input type=&quot;hi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: problem with inserting data into the bar chart plotly graph_objects<p>so I'm trying to add the lists ( Internal, External ..) to the bar chart but the data g...
<p>In your case, the problem is:</p> <ol> <li>You want to plot a bar chart with <code>plotly.graph_objects</code></li> <li>What exactly is data that <code>go.Bar()</code> needed. (<code>status</code>, <code>escalation</code>)</li> </ol> <p>Deduce from questions above,<br /> a) How do you fetch the minimum portion of da...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Char array in C yields extra characters than required<p>I have this simple program in which I initialize a string with &quot;HELLO&quot;. I need the output t...
<p>After the <code>for</code> loop, you need to put string terminating 0 bytes to the new strings, and also make sure they habe room for it:</p> <pre><code>char lo[2+1]; char hi[3+1]; for(...) { } hi[hiPos] = '\0'; Lo[loPos] = '\0'; </code></pre> <p>Otherwise any string functions will have buffer overflow, causing und...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to hide horizontal scroll<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre...
<p>Hope the below snippet could help you.</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>body{height:1200px; width:100%; overflow:hidden}</code></pre> <pre class="snippet-c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the correct way of running test cases(in headless firefox) in xvfb and record the test cases using ffmpeg<p><a href="https://malinowski.dev/recording...
<ol> <li>create a <code>.sh</code> file(for Linux) and enter the below lines</li> </ol> <pre><code>xvfb-run --listen-tcp --server-num 93 -s &quot;-ac -screen 0 1920x1080x24&quot; (--command for running the program--) &amp; export DISPLAY=:93 ffmpeg -f x11grab -video_size 1920x1080 -i :93 -codec:v libx264 -r 12 video.mp...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Typescript: How to check interface type<p>I have a method getUniqueId which accepts two kinds of interfaces below, which will return the uniqueId depending w...
<p>Interfaces in Typescript just syntatic sugar for your ide. It is unpossible to check interface types like in other languages. Knowing in C# for example.</p> <p>But with <a href="https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards" rel="nofollow noreferrer">type guard</a> you can...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: You are loading Turbolinks from a <script> element inside the <body> element - leads to duplicated elements in the view<p>I am having a very weird problem. I...
<p>First off using a meta tag like that is completely invalid. The <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta" rel="nofollow noreferrer">meta tag</a> is an empty element and thus NEVER has a closing tag or contents.</p> <p>These are valid examples of meta tags:</p> <pre><code>&lt;meta cha...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to show the values of a product details when editing in a modal using jquery,ajax and laravel<p>i want to update the details of a product using a modal w...
<pre><code>@foreach($fromUpdateController as $nData) &lt;select name=&quot;rentalhousecategory&quot; class=&quot;rentalselectcat form-control text-white bg-dark&quot; required style=&quot;width:100%;&quot;&gt; @foreach($allrentalcategories as $category) &lt;option &lt;?php if($nData-...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Homebrew incompatible architecture error on M1 MacBook<p>I am getting below error while running <code>/bin/bash -c &quot;$(curl -fsSL https://raw.githubuserc...
<p>Deleting <code>/Library/Developer/CommandLineTools</code> with <code>sudo rm -rf /Library/Developer/CommandLineTools</code>and running <code>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SOLVED - Why Does Spring-Security Ignore My Log-In-Attempt (Vaadin, Postgres)<p>Vaadin has a springboot-security-integration via &quot;LoginForm&quot; by set...
<p>Well not even 10 minutes after posting here I have found the answer, despite having struggled with this for almost a whole day now.</p> <p>When implementing UserDetails in my User.class, the implemented methods <code>isAccountNonExpired()</code> and <code>isCredentialsNonExpired()</code> by default implementation re...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firestore Document field reference<p>I want to do a firestore field reference to a document i have created. However i keep running into this issue where i ca...
<p>What you're trying to do isn't really possible. You can only create references to a document, and you have to know the full path to that document.</p> <p>If you want a value of a field in a document, you have to read the document entirely.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use the sum of two aliases in an order by clause in postgres?<p>Here is what I have so far...</p> <pre><code>SELECT *, (SELECT COUNT(*) FRO...
<p>Do it like this:</p> <pre><code>select * from ( SELECT *, (SELECT COUNT(*) FROM upvote up WHERE up.post_id = post.id) AS upvotes, (SELECT COUNT(*) FROM downvote dw WHERE dw.post_id = post.id) AS downvotes FROM post) A ORDER BY (upvotes+downvotes) DESC; </code></pre> <p><a href="https://dbfiddle.uk/?rd...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: When onRestoreInstanceState is not called?<p><a href="https://developer.android.com/reference/android/app/Activity.html#onRestoreInstanceState(android.os.Bun...
<p>The normal lifecycle of an <code>Activity</code> looks like this:</p> <ul> <li>onCreate()</li> <li>.</li> <li>onStart()</li> <li>onResume()</li> <li>onPause()</li> <li>onStop()</li> <li>.</li> <li>onDestroy()</li> </ul> <p>The lifecycle callbacks between <code>onStart()</code> and <code>onStop()</code> can occur o...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Gremlin Tinkerpop get vertex with partial ID<p>Is there a way to get a vertex with only a partial ID? For example, let's say I have two unique values that ma...
<p>You need to use <code>TextP</code> and not <code>Text</code>, and you also need to add a filtering step. So it becomes:</p> <pre class="lang-java prettyprint-override"><code>g.V().hasId(TextP.startingWith(&quot;employeeName/&quot; + name)); </code></pre> <p>This assumes you are sending the request from Java. In a la...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use mysql query multiple times<p>I have this select menu in a for loop, so the query is running multiple times. And a lot of more of these queries so ...
<p>You should read all the rows into an array when you first run the query, and then iterate that array in your <code>for</code> loop e.g.</p> <pre><code>$sql_kwal = "SELECT id, kwaliteit FROM kwaliteit ORDER BY kwaliteit ASC "; if(!$res_kwal = mysqli_query(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Code querying a website multiple times not working?<p>Sorry for my limited python knowledge.</p> <p>I was using this code:</p> <pre><code>import requests sy...
<p>Use a list to store the value on each iteration, and then loop through them to print the results.</p> <pre class="lang-py prettyprint-override"><code>import requests symbols = [&quot;XYZW&quot;,&quot;XYZW&quot;,&quot;ABC&quot;] urls = [] for s in symbols: urls.append('https://www.alphavantage.co/query?function=...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using GEKKO for Moving Horizon Estimation online 3<p>This is the following question after <a href="https://stackoverflow.com/questions/73036434/using-gekko-f...
<p>The objective function value from the solver iterations gives a clue that one of the variables is getting very large. It could be related to the divide-by-zero issue that is in the response to <a href="https://stackoverflow.com/questions/73036434/using-gekko-for-moving-horizon-estimation-online-2">Using GEKKO for Mo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mongo MQL group by date and add counts of other field values<p>I'm struggling to understand how to query my data using MQL. My dataset looks a bit like this:...
<p>This can be done in several different ways, heres a quick example using a conditional sum:</p> <pre><code>db.collection.aggregate([ { "$addFields": { "eventDate": { "$dateFromString": { "dateString": { "$substr": [ ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React Components: How To Structure React Live Search Form With Infinite Scrolling<p>I'm creating a React Movie app which enables user to search for movies an...
<p>The approach is sound - storing state at a higher level and having <code>SearchForm</code> be a component that just uses its passed in <code>props</code>. A few pointers</p> <ul> <li>Create a container component for the &quot;page&quot; i.e. <code>&lt;Movies&gt;</code>. Your <code>&lt;App&gt;</code> should be kept f...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What's the best way of web api authentication to Microsoft Graph to access emails in the service account mailbox?<p>I am trying to figure out which way would...
<p>--Does this mean that if nobody is going to accept the app rights to access emails it will not be able to do so?</p> <p>no, that means after admin consent the api permission, then you can access any users' emails in your tenant.</p> <p>--What would be easier/preferred way to implement this kind of functionality?</p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: String Unexpected Behavior in C<p>I was writing a simple program to read a string and then print it.</p> <pre><code>#include&lt;stdio.h&gt; // void printStr...
<p>You have two <code>%s</code> in the format string, but only one additional argument. So there's no argument corresponding to the second <code>%s</code>. This causes undefined behavior. This means that anything can happen, so nothing should be &quot;unexpected&quot;.</p> <p>It's a bit surprising that this causes it t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding variable amount of lines to file in Bash<p>I have a file with lines of a format XXXXXX_N where N is some number. For example:</p> <pre><code>41010401...
<p>One way in <a href="/questions/tagged/awk" class="post-tag" title="show questions tagged &#39;awk&#39;" rel="tag">awk</a> is to set field separators to underscore and print all missing records when 2nd field is greater than 1 in a loop like below.</p> <pre><code>$ awk 'BEGIN{FS=OFS="_"} $2&gt;1{for(i=1;i&lt;$2;i++)...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Disposable custom controls in Xamarin.Forms/MAUI<p>Many tutorials and guides suggest that when you create a custom control in Xamarin.Forms or .NET MAUI with...
<p>It seems you have to do it manually.</p> <p>Javier Suarez answered this question with a <a href="https://www.youtube.com/watch?v=8d7xLErPm9o&amp;lc=UgzXYwxHY79uanaQVTF4AaABAg&amp;ab_channel=JavierSu%C3%A1rez" rel="nofollow noreferrer">Youtube comment</a> under his video.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Overload macro as variable and function<p>First, there are a lot of posts on overloading macros:</p> <ul> <li><a href="https://stackoverflow.com/questions/16...
<p>It's not a macro, but looks like it</p> <pre><code>struct SmartMacro { constexpr operator int() const noexcept { return 3; } constexpr int operator()(int a, int b) const noexcept { return a + b; } }; constexpr SmartMacro FOO; int main() { int a = FOO(0,1); int b = FOO; std::cout &lt;&lt; a + b; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MERGE vs delete and insert into select<p>I am looking at the <code>MERGE</code> statement, and I do not understand the point of it. </p> <p>Correct me if I ...
<p>A <code>Merge</code> statement does not make the target table a copy of the source table, You've got that part wrong.</p> <p>It provides a shorter way to write conditional DML statements - <code>insert</code> / <code>update</code> / <code>delete</code> - by letting you write a single statement that will execute eit...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ordering within group and selecting non-null values<p>I've a table with data merged from several sources, and I would like to:</p> <ul> <li>Group by a column...
<p>You may use <a href="https://docs.oracle.com/en/database/oracle/oracle-database/21/dwhsg/sql-pattern-matching-data-warehouses.html#GUID-136DAC89-DA17-45C6-9E37-C9892723AC79" rel="nofollow noreferrer"><code>match_recognize</code></a> to capture rows with non-null values and reference them in a <code>measures</code> c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Stop record thread witn commit results in mongodb<p>There is a Put method: <code>@RequestMapping(value = "/api/v1/fias/{fileName}", method = PUT)</code>. Th...
<p>I changed the startUpdate method:</p> <pre><code>@Service public class AsyncFias { private static final Logger log = LoggerFactory.getLogger(AsyncFias.class); private final FiasFileService fiasFileService; private final MongoDBService mongoDBService; private AtomicBoolean inProgress = new AtomicBo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pygame Character wont move left or right<p>In my below code using PyGame, the character won't move left or right and the bullet won't shoot. I'm not sure wha...
<blockquote> <p>the character won't move</p> </blockquote> <p>The movement of the player <code>player_change</code> is continuously set 0, in the main application loop. Further more, the position of the player is continuously initialized:</p> <blockquote> <pre class="lang-py prettyprint-override"><code>def game_l...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found:<p>My project is built in <code>Azure Pipelines</code> using <...
<p>Found a way to fix it!</p> <p>By looking into my project's <code>./bin/Debug/netcoreapp3.1/</code> directory, fount that, even if I build it on Windows, it still creates <code>runtimes/unix</code> directory and puts there that DLLs that were missed in <code>Ubuntu</code>.</p> <p>So, by manually upload all from <co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Event Storming Events?<p>I have a question in Event Storming or DDD about whether shall all commands trigger an aggregate and then an event or it is not mand...
<p>You first need to understand that the events are raised by aggregate. They are the result of modifications (change in state) of aggregate and so do not have a direct impact from command.</p> <p>Getting this out, think of events as a change in aggregate. Commands trigger the possibility of change. But if change doesn...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Posting to a teams channel from a logic app or flow which includes an banner alert / activity feed item<p>I have a logic app which posts a channel chat messa...
<p>You're on the right track with the Bot, but you're wanting to send something called a "Pro-active" message. You need the bot registered in the channel in order to get access to a few key properties (conversation id, service url, etc.), but you can use those to send a message from -outside- your bot (e.g. in an Azure...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas : Apply regex with multiple patterns and expand the results along with nan values<p>Say I have a dataframe :</p> <pre><code>df = pd.DataFrame({'date' ...
<p>The <code>[aA-zZ]</code> regex part is not matching only letters, the letter matching regex is <code>[a-zA-Z]</code>.</p> <p>Besides, you are joining matches with a comma into single strings, while you want to get three separate columns.</p> <p>You can use a fixed pattern of yours and merge the groups by using</p> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Web3: Extract data from soliditySha3<p>Let's say I call the following function to generate a hashed message for generating a signature.</p> <pre class="lang-...
<p>Turns out the hashed value is not reversable, but I can use the same variables to hash again on the smart contract and check if the two hashed values are the same, so I can know the value is transferred correctly.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JavaScript input field must equal number hidden in JavaScript code<p>I am getting spammed by bots like crazy in my contact us form. I have tried, random secu...
<p><code>squest</code> refers to the element with <code>id="squest"</code> itself, you should take the <code>value</code> from that.</p> <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Nonidentity" rel="nofollow noreferrer">Non-identity / strict inequality (...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the equivalent of 'match' in the new react version<pre><code>function ProductScreen() { const dispatch = useDispatch() const productDetails = use...
<p>If by &quot;match&quot; you mean the <code>match</code> object that was a RRDv5 <a href="https://v5.reactrouter.com/web/api/Route/route-props" rel="nofollow noreferrer">route prop</a> used to access the route path params, i.e. <code>props.match.params.id</code> then there is no equivalent in RRDv6. There are no rout...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to open playwright HTML Report (using Docker)<p>I have pulled the image using below command into my root of the project</p> <pre><code>docker pull mcr...
<p>Max is right, you have to add for example in your playwright.config.ts the option <code>open: 'never'</code>. For example:</p> <pre class="lang-js prettyprint-override"><code>const config: PlaywrightTestConfig = { // (...) reporter: [ ['html', { open: 'never'}], ['list'] ], // (...) } </code></pre> <p>And to a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generic CQRS Query handler with custom return type<p>I am trying to build a generic query handler using the MediatR (v8) library. Lets jump to the code: Firs...
<p>Basically, I moved the Result&lt;> from the type parameter in the class declaration to the method declaration. I also removed the interfaces for clarity (you didn't share the definitions anyway).</p> <pre><code>public abstract class AbstractQueryHandler&lt;TQuery, TQueryResult&gt; where TQuery : Query&lt;TQuer...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Order by row groups with the highest value, then by the highest value per group<p>Suppose I have the following table:</p> <div class="s-table-container"> <ta...
<p>I might be late to a party, and solution is probably overcomplicated, but it should be suitable for all cases. The idea is to pivot Values for Keys in columns <a href="https://dbfiddle.uk/?rdbms=sqlserver_2019&amp;fiddle=4d73419dce74d7c29cb0668dcdcfcfe3" rel="nofollow noreferrer">1</a>,[2],... from biggest to lowest...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to configure ASP.NET Core 3.1 application to run ReactJS and MVC website side by side<p>I have a ASP.NET core react website created with <a href="https:/...
<p>In <code>startup.cs</code> the endpoint mapping is configured for MVC. This can be made to work but it will be easier to change this;</p> <p>Change</p> <pre><code>app.UseEndpoints(endpoints =&gt; { endpoints.MapControllerRoute( name: "admin", pattern: "admin/{controller}/{action=Index}/{id?}"); }); </c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to keep the changes done in a file in pod in kubernetes, even after the pod getting restarted?<p>I am trying to change a file in a pod in kubernetes but ...
<p>Very basic example on how to persist file content as below.</p> <p>First <strong>Create a persistent volume</strong> refer below yaml example with hostPath configuration</p> <pre><code>apiVersion: v1 kind: PersistentVolume metadata: name: my-pv-1 lables: pv: my-pv-1 spec: capacity: storage: 1Gi vol...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: WebAPI convert nested JSON to string<p>I have a somewhat complex JSON coming into a WEBAPI -</p> <pre><code>{ "TypeInq": "ResidentialStart", "DataIn...
<p>You can directly deserialize the incoming json object. Then just reference the appropriate property you want the value of.</p> <p>object somenewobject = new JavaScriptSerializer().Deserialize(response.Data.ToString());</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: plugin:vite:import-analysis - Failed to parse source for import analysis because the content contains invalid JS syntax. - Vue 3<p>I've updated my project fr...
<p>So i figured it out. This line:</p> <pre><code>const messages = await import( /* webpackChunkName: &quot;locale-[request]&quot; */ `./locales/${locale}.json` ) </code></pre> <p>should have been:</p> <pre><code> const messages = await import(`./locales/${locale}.json`) </code></pre> <p>I cant explain why it is so b...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change a value in a nested array matching Id in JavaScript<p>I have a nested array object which is like:</p> <p><div class="snippet" data-lang="js" data-hide...
<p>If you're only making a small change it seems a little redundant to create a new array for <code>nestedArray</code> and new arrays for each <code>item</code>.</p> <p>Just loop over the data and change that one <code>selected</code> where the <code>id</code> matches, and then you can just break out of the loop - job ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python : Why I can't compare indexes of two dataframes when one is random sample<p>I have a two large datasets <code>answer</code> and <code>truth</code> and...
<p>You should simply pass the values within <code>.loc</code> you will however get a FutureWarning you can ignore for now. Here is an example:</p> <pre><code>import pandas as pd data_1 = {'index':[1,2,3,4,5],'Name':['Sanji','Zoro','Luffy','Nami','Chopper']} data_2 = {'index':[1,2,5,6,7],'Enemies':['DfDqx','Kuro','BigM...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Invalid Object Name SSISDB.dbo.DDLEvents<p>I am using Sql server 2017.I have admin access to Server.When I am trying to create a role and provide read to any...
<p>This error comes from a trigger. Find the trigger, fix the underlying error by debugging the code in the trigger or disable the trigger and the error will go away.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create type of textfield / textbox it shouldn't be a single widget<p>How to create type of Text field? it shouldn't be a single widget. is there any w...
<p>this might help.<a href="https://api.flutter.dev/flutter/material/TextFormField-class.html" rel="nofollow noreferrer">textformfield</a></p> <pre><code>import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; void main() =&gt; runApp(const MyApp()); class MyApp extends StatelessWidget { con...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Struggling to understand nested vmaps in JAX<p>I just about understand unnested vmaps, but try as I may, and I have tried my darnedest, nested vmaps continue...
<p>Each time <code>vmap</code> is applied, it maps over a single axis. So say for simplicity that you have a function that takes two scalars and outputs a scalar:</p> <pre class="lang-py prettyprint-override"><code>def f(x, y): assert jnp.ndim(x) == jnp.ndim(y) == 0 # x and y are scalars return x + y print(f(1, 2...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I add value labels on line chart based on groupby()?<pre><code>results = df.groupby('depart')['Survey'].mean().to_frame(name = 'Mean').reset_index() ...
<p>One way is using <code>annotate</code></p> <pre><code>results.plot(x = 'Unit', y = 'Mean', marker = 'o', figsize=(8,5)) plt.grid(True) plt.ylim(3.60, 5.00) ax = plt.gca() for i, val in enumerate(results['Mean']): label = results.loc[i, 'Mean'] ax.annotate(label, (i, val), ha='center') plt.show() </code></pre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error when deploying my Visual Studio project zip file to azure "The command failed with an unexpected error. Here is the traceback:"<p>I have created an Asp...
<p>There is a tiny error in your command. For <code>--src " C:\pus\bin.zip"</code>, there is a redundant <strong>white-space</strong> in </p> <p><code>" C:\pus\bin.zip"</code>. Just remove the <strong>white-space</strong>, and it will work.</p> <p>so the correct command should be: </p> <pre><code>az webapp deploymen...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get prefill input value ionic angular<p>I retrieve some data on init from an API and display them in my view to prefill some fields.</p> <p>I'm a form view ...
<p>Instead of setting the value in the tag you can set it in your TS file, like this:</p> <pre><code>this.form = this.formBuilder.group({ job_description: new FormControl("YOUR VALUE HERE") }); </code></pre> <p>It works in my computer ...</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to validate uniqueness of a field before save, if the field is changed before save?<p>I have a <code>User</code> model that needs to validate the uniquen...
<p>So turns out for what I needed exactly I need to make a <code>validate</code> call and then verify the uniqueness that way. I used the following code:</p> <pre class="lang-rb prettyprint-override"><code>class User &lt; ApplicationRecord has_secure_password before_validation :downcase_name, :downcase_email bef...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Discord.js How to change verification level<p>I want to change verification level in my discord server using with discord.js . Can you help me how can i do t...
<p>Try to interpret your question more specifically. How do you want to do this? A command when starting a bot, when connecting to a server?</p> <p>With <code>on message</code> trigger you can do this as follow.</p> <pre><code>client.on('message', message =&gt; { if (message.content.startsWith('!changeverlvl') { ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to setup web-hook using custom commit message?<p>I want to set up a web-hook using custom commit message. I want to trigger web hook when developer commi...
<p>The following code worked for me, simply check the latest git commit message and selectively build your job:</p> <pre><code>def resultlog = sh(returnStdout: true, script: 'git log -1 --pretty=%B') if (resultlog.contains("Proceed with Migration")) { //your code } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to read "\t" as tab in golang<p>I tried to parse <code>"\t"</code> from shell as <code>TAB</code>, however, it does not work.</p> <p>Here I give a simpl...
<p><code>\t</code> is a backslash escape which denotes the tab character (e.g. in interpreted string literals). If you have the backslash escape, you may use <a href="https://golang.org/pkg/strconv/#Unquote" rel="noreferrer"><code>strconv.Unquote()</code></a> to "decode" it (into the tab character).</p> <p>One thing y...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I match multiline expressions with junk in the middle?<p>I'm trying to match a multiline expression from some logs we have. The biggest problem is due...
<p>This approach starts by first stripping out the leading log content of each line, leaving behind the content you want to target. After that, it does an <code>re.findall</code> search using a regex pattern similar to the one you are already using.</p> <pre class="lang-py prettyprint-override"><code>inp = &quot;&quot...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Casting x.year from Datetime as a string<p>I'm trying to have a program that writes the day, month and year from Datetime to a flat file. However it doesn't ...
<p><code>fo.write(str(x.year))</code> has no reason not to work, though you should probably use <code>datetime.strftime('%Y')</code> instead.</p> <p>It also looks like you're writing fields individually which is a bit odd, why not use a custom CSV dialect and write the output record by record through that?</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Oracle [Procedure] - Sum function ignores WHERE clause<p>I have a problem with a ORACLE Procedure, it seems that SELECT SUM ignores my WHERE clause, and Sum...
<p>Your problem is that your input parameter has the same name as your column, so when the query sees</p> <pre><code>WHERE SCOTT.EMP.DEPTNO = deptno </code></pre> <p>it interprets <code>deptno</code> as <code>SCOTT.EMP.DEPTNO</code>, meaning that it is true for all values of <code>deptno</code>. Change the name of yo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter BlendMode 'the getter isn't defined'<pre class="lang-dart prettyprint-override"><code>background: ShaderMask( shaderCallback: (rect) { retu...
<p>The getter is not defined as the class is not defined. This error usually appears when you have not imported <code>dart:ui</code> (in the case of <code>BlendMode</code>).<br> So make sure that you have the following import at the top of your file:</p> <pre class="lang-dart prettyprint-override"><code>import 'dart:u...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there an elegant regex to grep a MAC address accounting for various delimiters?<p>I will occasionally search aggregate logs files on my syslog server for ...
<p>Simply store the mac-address to search in a variable and use Bash's replace expanded value to generate the Regex for <code>grep</code>:</p> <pre class="lang-bash prettyprint-override"><code>mac='56:ea:b6:a6:82:5e' # Compose a regex on-the fly by replacing all colons with [:.-]? grep -iE &quot;${mac//:/[:.-]?}&quot;...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Failed to execute 'setAttribute' on 'Element': '[editor]?' is not a valid attribute name<p><strong>The error occurred as a result of this sequence:</strong><...
<p>I think you have incorrectly imported the <code>ClassicEditor</code> Please modify the below line!</p> <p>Before:</p> <pre><code>import * as ClassicEditor from '@ckeditor/ckeditor5-build-classic'; </code></pre> <p>After:</p> <pre><code>import ClassicEditor from '@ckeditor/ckeditor5-build-classic'; </code></pre> <p>....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "return render_template()" doesn't work [XMLHttpRequest() & flask]<p>I would like to realize this.</p> <ol> <li>A user speaks to a web browser.</li> <li>A w...
<p>Its ocurs because you change are calling a route who changes the HTML inside of Ajax request(XMLHttpRequest), so you have two options, the first is change the HTML in response like these: </p> <pre><code>xhr.onreadystatechange = function() { if (xhr.readyState == XMLHttpRequest.DONE) { document.write(xh...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: 'System.ServiceProcess.ServiceController version issue with Wix Installer and .Net Core 3.1<p>I get an exception "Could not load file or assembly 'System.Ser...
<p>I resolved the problem by first using publish to generate the output files, and then added them as components to my <code>Product.wxs</code> file. Then the service installed and ran fine. It was a lot of files so I wrote a small console app to generate the component XML to a file and pasted that into the <code>Produ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add items to an array without duplicates with using Map object<p>I'm trying to add new values to an array without duplicates.</p> <p>I'm using Map object to ...
<blockquote> <p>How to accomplish this iteration successfully?</p> </blockquote> <p>To test map membership you should not <em>iterate</em> the map. The advantage of a map is that you can check for membership with <code>has</code>. Also, you should not include the map as the first element of the new array, but spread th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What am i doing wrong? it wont run thru every condition<p>I'm trying to have someone guess a number from 1 to 6. I give them two tries if, by the end of the ...
<p>You are using comparison instead of assignment in the below segment</p> <pre class="lang-js prettyprint-override"><code>if (parseInt(guessLess) === number) { answer === true; </code></pre> <p>Change it to </p> <pre class="lang-js prettyprint-override"><code>if (parseInt(guessLess) === number) { answer = tru...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to check JSON response condition to show data in tableview cell in swift<p>this is json response in postman:</p> <pre><code>{ &quot;result&quot;: { ...
<p>You are not achieving the outcome you expect because of your switch statement.</p> <p>The switch statement execute only one of its paths, the first matching condition to be precise. So every time</p> <pre><code>indexData?.certificate_required == &quot;Y&quot; </code></pre> <p>is true</p> <pre><code>cell.subCatLbl.te...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SwiftUI search field from a local JSON file<p>I'm trying to retrieve data from a local JSON file like this:</p> <pre><code>[{ "name": "John", "lastnam...
<p>To start, I recommend making a struct to represent your JSON structure. Try the following: </p> <pre><code>struct Person: Codable, Hashable { let name: String let lastname: String let age: String } typealias People = [Person] </code></pre> <p>I usually make a <code>typealias</code> to handle the arra...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting Feature Importances for XGBoost multioutput<p>Beginning in xgboost version 1.6, you can now run multioutput models directly. In the past, I had been...
<blockquote> <p>Is it the first, last, or some sort of average across all the targets</p> </blockquote> <p>It's the average of all targets.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Select element value is string<p>I am sending select element selected value through ajax to Laravel controller action and validated the value as required in ...
<p>I added another laravel validation i.e <code>not_in:0</code> and that worked for me. Simply its check for request parameter if zero whether parameter is string or integer</p> <pre><code>$validators = Validator::make($request-&gt;all(), [ 'lob_id' =&gt; 'required|not_in:0', 'sub_lob_id' =&gt;...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hierarchical model using JAGS for R shows wrong number of means<p><a href="https://i.stack.imgur.com/T4tIH.png" rel="nofollow noreferrer"><img src="https://i...
<p>It looks like you are using nested indexing, where <code>grp</code> is a vector of length <code>y</code> and describes what group each element <code>y</code> belongs to. If each group needs it's own mean then you need to generate 5 <code>theta</code> priors. This is most easily done in it's own loop. Thus, your mode...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Weird problem with relationships in Laravel<p>I have something like this in my controller :</p> <pre><code>namespace App\Http\Controllers; use App\Invoice;...
<p>The reason it is adding the <code>product</code> relationship when you return the invoice is because you are calling the following:</p> <pre class="lang-php prettyprint-override"><code>$product = $invoice-&gt;product; </code></pre> <p>This is because Laravel is loading the relationship when you call it and storing...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding and revoking permission to a specific user with a specific role<p>I am using this package <a href="https://github.com/spatie/laravel-permission" rel="...
<p>like this.?</p> <p>specific user role and permission you can manage</p> <pre class="lang-php prettyprint-override"><code>$user = User::find(7); $user-&gt;assignRole("user"); // assign role to that user $user-&gt;givePermissionTo(['editor','shopping']); // for giving permission to user $user-&gt;revokePermission...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add a product subtitle in woocommerce archives pages like shop<p>I am a total beginner with PHP and would like to add a subtitle before the product title on ...
<p>How it's currently written it's just a string. Remove the double quotes. </p> <p>Also use <code>get_field()</code> instead of <code>the_field()</code> because <code>the_field()</code> will print. That won't work when concatenating strings.</p> <p>Change the priority of the action to determine the location of the s...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Centering bootstrap table in center of page<p>I am working on placing a bootstrap table in the center as the content of a boostrap nav tab. It is centered fo...
<p>You need to use <strong>col-6</strong> class for each table cell, it is equal <code>width: 50%</code> half of the entire row. Also, I added <code>row justify-content-center</code> to <strong>myTabContent</strong> to keep tabs and contents centered.</p> <p><strong>UPDATED.</strong> To center the tabs , I added <stro...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Goutte laravel web scrap from all table data<p>I need to scrap all Th and td data return like an array. Result showing only first Th/td data.</p> <pre class=...
<p>The provided code is looping every table (<code>$page-&gt;filter('table')-&gt;each</code>) and selecting only a single <code>tr &gt; th</code>. But what you want is to loop the <code>tr</code>'s of the table.</p> <p>Probably you will need to do something like the following:</p> <pre class="lang-php prettyprint-overr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Update a Mysql table based on a value from the same table<p>I have a table called questions with columns <code>(id, title, message, permalink)</code>. I want...
<p>Your query operates on a single row. You don’t need aliases or additional select, just:</p> <pre><code>UPDATE questions SET permalink = SUBSTRING_INDEX(REPLACE(LOWER(title),' ','_'), '_', 4): </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Modelling class as complement / negation of Parent Sibling Class OWL/Protege<p>I'm trying to model, desires and intentions in OWL as follows.</p> <p><a href=...
<p><strong>Why no individuals are inferred</strong></p> <p>The reason why you get no individuals inferred when you add <code>and not NonAchievableDesire</code> is as @UninformedUser said: there is absolutely no information in your ontology from which a reasoner can infer that <code>A</code>, <code>B</code> and <code>C<...