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:
Selecting all records from table, but return key-value object for easier mapping on the frontend<p>I have a table similar to this:</p>
<pre><code>id de... | <p>You can use <code>jsonb_agg(jsonb_build_object('id', id, 'text', text))</code> to build the aggregated objects in postgresql, then create the final one from your application:</p>
<pre><code>WITH data(id, device_id, text) AS (
VALUES (1, 1234, 'test1')
, (2, 1234, 'test2')
, (3, 1236, 'test3')
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Within column operations in R<p>I have a dataset that looks something like this:</p>
<pre><code>dt<- data.table(group= c(1,1,2,2,3,3),
var1=c("a"... | <p>Grouped by 'group', compare whether the number of observations (<code>.N</code>) is not equal to the number of unique observations of 'var1' (<code>uniqueN</code>) to create the 'IDvar1', and get the <code>diff</code>erence of 'var2' to create the 'diffvar2' column</p>
<pre><code>library(data.table)
dt[, c("IDv... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Grok Conditional pattern in Logstash yaml (if..else)<p>I would like to do grok pattern based on filter conditions using if-else. I've tried but I got the wro... | <p>In your first grok the timestamp is HTTPDATE format instead of ISO8601 format, you must change it. Delete also the white space after <code>\]</code></p>
<p>Here my suggestions</p>
<pre><code>filter {
if ([service] =~ /service-name/) or ([service] =~ /service-name1/) {
grok {
match => { "message&q... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why Dropdown is not working after ajax call?<p>I am using jquery code to make drop down on sidebar filters. this code is working properly but after selecting... | <pre><code>jQuery(document).on('click', "SELECTOR", function(event){
});
</code></pre>
<p>This bind a click event to the document and all child elements within it. This method will works with dynamically created elements also</p>
<p>Working with <code>jQuery(document).on(</code> events</p>
<p><div class="sni... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scanf() stores a newline when I type characters 'i' or 'n'<p>I'm trying to have my program end if the user types 'end' and while brainstorming for an impleme... | <p><code>i</code> is the first character in <code>inf</code> and <code>n</code> is the first character in <code>nan</code>. Those are legitimate inputs for the <code>%f</code> format conversion, so <code>scanf</code> will look at the next character. When it turns out the the next character is <code>\n</code>, <code>sca... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Table Spotlighting - change text colour based on value on multiple columns<p>I would like to replicate the following table that in tableau is called <a href=... | <p>Loop through the numeric columns and add a colour based on the value (change the <em>ifelse</em> statement as needed):</p>
<pre><code>tab %>%
mutate_if(is.numeric,
function(i){
cell_spec(i, color = ifelse(i > 1, "green", "red"))}) %>%
kbl(escape = FALSE) %... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript >= comparison with two negative numbers producing incorrect result<p>I've come across strange behaviour where both before and after using toFixed(... | <p><code>toFixed</code> produces a string. You aren't comparing numbers, you're comparing strings, which are compared alphabetically.</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:
sort array of object based on data inside array<p>let say I have array like following</p>
<pre><code>[
{
id:"1",
name: "sa... | <p>I solved it, here is working solution.</p>
<p>first of sort the <code>data</code> array inside each object</p>
<pre><code>data.sort((a, b) => Date.parse(b.last_update) - Date.parse(a.last_update))
</code></pre>
<p>then sort the main array</p>
<pre><code>main.sort(a, b) => Date.parse(b.data[0].last_update) - Da... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++11 packaged_task doesn't work as expected: thread quits and no output<p>I've this code snippet:</p>
<pre><code>#include<future>
#include<iostream... | <p>You're moving the packaged task into the thread and then trying to get the future object from the moved-from task which no longer has any state. For me this throws an exception: <a href="https://godbolt.org/z/Gh534dKac" rel="nofollow noreferrer">https://godbolt.org/z/Gh534dKac</a></p>
<blockquote>
<p>terminate calle... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Postman set highest id from response's array as environmental variable<p>I have an endpoint X in my runner which returns the array containing tons of objects... | <p>You need to iterate over all the elements in the response.</p>
<p>First time, you set the environment variables (in case the response has only one item, or the first item has the highest ID).
For every following item, you check if the ID is bigger than what you have stored already. If yes, you overwrite with the new... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python loop generating Excelfiles<p>i have following code:</p>
<pre class="lang-py prettyprint-override"><code>#import requests
from pandas import pandas as ... | <p>You could use <code>zip()</code>:</p>
<pre><code>#import requests
from pandas import pandas as pd
base_url = "https://baden.liga.nu/cgi-bin/WebObjects/nuLigaTENDE.woa/wa/groupPage?championship=B2+S+2022&group="
Gruppe = ["1","24"]
Team = ["H1","H2"]
#Tabelle &... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unsure why undefined variable notice trying to get product 'id' when adding ACF fields to custom column?<p>I have added a custom column to WooCommerce Produc... | <p>For anyone viewing. If using $product and $post, then you need to use global $product; and global $post to get access to them.</p>
<pre><code>global $product;
$product_id = $product->get_id();
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
getDoc from firestore without searching for specific uid<p>I'm having an issue getting the collection info. Using this code, I could only get the doc with a ... | <p>To get all documents from a collection or documents that match a query you should use <code>getDocs()</code> instead of <code>getDoc()</code> that is used to fetch a single document as the function name suggests.</p>
<pre><code>const snapShot = collection(db, 'Files');
const getSnapShot = await getDocs(snapShot);
c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java Stream API: Modify a specific line in a file<p>I am reading the content of a <code>readme</code> file as a list of strings</p>
<p>And I want to modify a... | <p>You wouldn't need Apache commons, I'd suggest using <code>Files.lines</code> of <code>java.nio.file.Files</code>, also you can have the implementation one single method like below</p>
<pre><code>import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.uti... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error while querying Microsoft Graph API via Postman<p>I am trying to call Microsoft graph Api via Postman to get users. Before calling the query, it is aski... | <p>Please check if you have generated the token by giving below <strong><a href="https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http" rel="nofollow noreferrer">API permissions</a>:</strong></p>
<p><a href="https://i.stack.imgur.com/Jvgx7.png" rel="nofollow noreferrer"><img src="https:... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
what is the difference between MedicationDispense vs MedicationAdministration fhir? Functionally speaking<p>what is the difference between MedicationDispense... | <p>MedicationDispense is used to track the supply of a medication (typically a prescribed medication) for patient use. In out-patient settings, it tracks the provision of a supply of medication to a patient or their representative - typically for periods of 30 days or longer. In in-patient settings, it is generally u... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# Windows Forms - MouseDownEvent with PictureBox<p>I want to build an application to visualize searching algorithms (such as DFS, BFS) using C#.<br />
I am ... | <p>I believe you're seeing this behavior because <code>PictureBox</code> tries to <a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.control.capture?view=windowsdesktop-6.0" rel="nofollow noreferrer">Capture</a> the mouse on the <code>MouseDown</code> event. This is usually a "good" thi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Extrapolate NaN values in a numpy array<p>I have two values and know their index in an array full of nans. I want to interpolate / extrapolate all the nan's<... | <p>You can't specify <code>left</code> and <code>right</code> to achieve extrapolation with <code>interp</code>, they are just constant values.</p>
<p>If you prefer a pure numpy solution, you can linearly extrapolate based on the first/last two values of the interpolated array:</p>
<pre><code>def extrap(x, xp, fp):
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React Routes problem with Tags other than Route<p>Using <code>"react-router-dom": "^5.3.2"</code></p>
<p>In my component I have the follo... | <p>The only valid children of the <code>Switch</code> component are the <code>Route</code> component (<em>including custom route components</em>) and the <code>Redirect</code> component. <code>React.Fragment</code> breaks this abstraction. The <code>Switch</code> component returns the first child <code><Route></c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python unittest Mock an object to not have an attribute<p>I have a function that runs some code if the object has a certain attribute, and in rare cases if i... | <p>You could try to use a <a href="https://docs.python.org/3/library/unittest.mock.html?highlight=patch#unittest.mock.PropertyMock" rel="nofollow noreferrer">PropertyMock</a> for the property, and generally you shall be able to set the respective side effect. Here is a simple working example:</p>
<pre class="lang-py pr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to produce only the title without a plot in ggplot?<p>Is it possible to generate only the title without a plot in ggplot?</p>
<pre><code>ggplot() +labs(t... | <p>You could "remove" the panel background using <code>theme(panel.background = element_blank())</code>:</p>
<pre class="lang-r prettyprint-override"><code>library(ggplot2)
ggplot() +
labs(
title = "title",
subtitle = "subtitle",
caption = "none"
) +
theme(pan... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MediaLive (AWS) how to view channel alerts from php SDK<h2>Question</h2>
<p>I have set up a Laravel project that connects to AWS MediaLive for streaming.<br>... | <p>Thanks for your post.</p>
<p>Channel alerts will go your AWS CloudWatch logs. You can poll these alarms from SDK or CLI using a command of the form 'aws cloudwatch describe-alarms'. Related log events may be retrieved with a command of the form 'aws logs get-log-events'.</p>
<p>You can also configure a CloudWatch ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I instantiate a prefab through a script in Unity C# correctly?<p>I am instantiating a prefab thru a script in Unity. It's kind of working but not real... | <p>It seems that you are trying to instantiate an object that is supposed to be used inside <code>Canvas</code> (unity UI system) in the world space.</p>
<p><code>Canvas</code> component on the root object is needed to render all child UI elements like <code>Button</code>, <code>Text</code>, <code>Image</code>, etc.</p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
UseWebpackDevMiddleware replaced in dotnet core 6<p>Dotnet core 6 is telling me:</p>
<pre><code>'WebpackDevMiddleware.UseWebpackDevMiddleware(IApplicationBui... | <p>It would seem that the package references needed to be updated to include the specific <code>SpaServices</code> package, too:</p>
<pre><code>- <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.17" />
+ <PackageReference Include="Microsoft.AspNetCor... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
faster way to save multi-dim numpy array in self-describing format such as json<p>I am looking for fast way to save multi dimensional array in self-describin... | <p><code>np.save()</code> already gives you a self describing file, and as you have shown it is very fast. If you want speed and self description, it is a great choice.</p>
<p>Text based formats like JSON or CSV will always be slower than binary ones like what <code>np.save()</code> gives you.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Second col goes to second line instead of sharing the same row<p>For some reason, the second column doesn't share the same row, instead, it goes to the secon... | <p>I think it happened because you didn't close your links <code></a></code> otherwise your <code>col-md-6</code> classes needs to be reduced to either <code>col-sm-6</code> or just <code>col-6</code> -- see in the snippet this is working</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rails credentials files and Rails environment<pre><code>Rails 7
</code></pre>
<p>I am running into some issues using <strong>[Rails.env.to_sym]</strong>. Som... | <p>That’s correct — the main credentials file (<code>credentials.yml.enc</code>) is overwritten by environment-specific files.</p>
<p>If you run <code>bin/rails credentials:edit -h</code> from the command line, you’ll see this:</p>
<pre><code>=== Environment Specific Credentials
The `credentials` command supports pass... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PythonAnywhere Issues<p>I am a new python user. I'm getting the following error when trying to run my code in PythonAnywhere, despite it working fine on my l... | <p>It COULD be helpful to send header info along with your request. You can pass a <a href="https://docs.python.org/3/library/urllib.request.html#urllib.request.Request" rel="nofollow noreferrer">Request object</a> into your request like this:</p>
<pre><code>url = input("Enter the URL you want to analyse: ")... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
nginx tcp stream (k8s) - keep client connection open when upstream closes<p>I have an application that accepts TCP traffic (not HTTP) and I'd like the abilit... | <p>What you describe is how nginx works out of the box with http. However</p>
<ol>
<li>Nginx has a detailed understanding of http</li>
<li>HTTP is a message based protocol i.e. uses requests and replies</li>
</ol>
<p>Since nginx knows nothing about the protocol you are using, even if it uses a request/reply mechanism w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Laravel form post data from placeholder value<p>I want to pass the data on a form placeholder without user input, want to know if that is possible...</p>
<p>... | <p>You need to pass the username through the value attribute, but make the input element read-only like this:</p>
<pre><code><input type="text" class="form-control" id="exampleFormControlInput1" name="name" value="{{ auth()->user()->name }}" readonly>
</code... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I change a gif in react with a continious running loop?<p>I am trying to change the state of an animated a character on a website running in react.
Th... | <p>You can render a gif state (of the current animation), then update the state based on the users actions:</p>
<p><code>this.setState({gif: <url_to_gif>})</code> if using a class component</p>
<p>or <code>const [GIF, setGIF] = useState('');</code> then <code>setGIF(<url_to_gif>)</code> if using hooks/funct... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does kivy show me a white background instead of the real rgba number?<p>In this program i set the background color of <code>Label</code> to <code>6, 61, ... | <p>You are providing 8-bit integer RGB values, i.e. integers from 0 to 255 where 255 is fully saturated.</p>
<p>Kivy's API uses floating point RGB values in the range 0-1.</p>
<p>To convert from your units to those that Kivy expects, divide your RGB values by 255.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React Select Async creatable doesn't save to the state<p>I am using react select async creatable,
the data from api loads correctly and can select it also ca... | <p>You should use <code>onChange={handleInputChange}</code> instead of <code>onInputChange={handleInputChange}</code></p>
<ul>
<li><p><strong>onChange</strong> triggers when a new option is selected / created.</p>
</li>
<li><p><strong>onInputChange</strong> triggers when writing a new option.</p>
</li>
</ul> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to filter objects whose created_date exceeds 30 days<p>Here,I have model</p>
<pre><code>from django.db import models
class Product(models.Model):
na... | <p>You don't need to annotate and filter, you can just set the filter to pick out dates that are before 30 days ago, like so:</p>
<pre><code>from datetime import timedelta
from django.utils import timezone
thirty_days_ago = timezone.now() - timedelta(days=30)
Product.objects.filter(created_at__lte=thirty_days_ago)
</c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to display WooCommerce Featured Products but in custom order<p>Is there any way to display featured products in the way I want?
Assume there are 5 produc... | <p>Yes there is an option to do that already.
In each product ( inside Woocommerce ) click on the TAB "Advanced".
Inside this tab, you will find an option called menu order.</p>
<p>A greater number here simply means it will be further away from the beginning of the display list</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a good way to add snapping to a ttk tkinter scale?<p>I am trying to make a ttk themed Tkinter slider, by using the <code>ttk.Scale</code> widget. Pr... | <p>According to the <a href="https://tcl.tk/man/tcl8.6/TkCmd/ttk_scale.htm#M7" rel="nofollow noreferrer">document</a>, the callback for <code>command</code> option will be triggered <em>whenever the scale's value is changed via a widget command</em>. So calling <code>scale.set(...)</code> will trigger the callback and... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Variance and Average on a 2D array in C#<p>I was reading this article and I trying to follow their code example but I think I am missing a library.</p>
<p>T... | <p>In case you want to apply <em>Linq</em> method to 2D array <code>T[,]</code> items, you can use <a href="https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.oftype?view=net-6.0" rel="nofollow noreferrer">OfType()</a> (or <code>Cast<T>()</code>) to obtain a enumeration <code>IEnumeration<T>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React router v5 useHistory.push goes without params<p>I'm using router-dom V5 and when i try to navigate to another page with some params it goes without the... | <p>It seems the issue is that the <code>Link</code> component is missing the <code>to</code> prop, and the <code>proceedHandleClicked</code> doesn't prevent the default link action from occurring. Two navigation actions are issued. The first is the <code>navigate.push</code> <em><strong>then</strong></em> the link acti... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
is it possible to do 1 Advice to multiple PointCut?<p>For ex: i want to log every behavior in a book class.
Is it possilbe to do it with Spring-AOP?</p>
<p><... | <p>you can try with bellow expression in <code>@Around</code>, for example :</p>
<pre class="lang-java prettyprint-override"><code> @Pointcut("execution(* AOPviaAnnotation.Book.*(..))")
public void allMethodOfBook() {};
@Around("allMethodOfBook()")
public void logBookInfo(){
...... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Modifying list in determined indexes steps<p>I have a list with repeated values and need to modify all of those. Notably, the repetitions always occur with a... | <p>If the step size of indices is known but not the value, one can use <a href="https://docs.python.org/3/library/stdtypes.html#ranges" rel="nofollow noreferrer">a <code>range</code></a> to generate all indices efficiently. A <code>for</code> loop then allows to operate on the elements via the indices:</p>
<pre class="... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
BASH: the script quits without an error after an IF condition (possible bug?)<p>I have the following code:</p>
<pre><code>DOMAIN="mydomain.net"
if ... | <p>To follow up on my comment with an answer:</p>
<pre class="lang-bash prettyprint-override"><code>SSL_CUSTOM=$(echo ${DOMAIN}| grep -c 'myapi.com' || true)
# ...............................................^^^^^^^
</code></pre>
<p>That lets <code>grep -c</code> do what it does, but if no matches are found, the exit st... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why doesn't this work for the last 4 or 5 indexes of the string?<p>The purpose of this code is to make the odd placed letters uppercase and the odd ones lowe... | <p><code>word.index(let)</code> will get you the <em>first</em> index of that letter, not the current one as you iterate. Use <code>for index, letter in enumerate(word):</code> instead.</p>
<pre><code>def myfunc(word):
new_word = ''
for index, let in enumerate(word):
if (index + 1) % 2 == 0:
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to stream data from Broadcast Receiver to Flutter?<p>I want to stream data from Broadcast Receiver (native Android) to Flutter.</p>
<p>The Receiver :</p>... | <p>Create native <a href="https://api.flutter.dev/javadoc/io/flutter/plugin/common/EventChannel.html" rel="nofollow noreferrer">EventChannel</a> and <code>setStreamHandler</code> to get access to <a href="https://api.flutter.dev/javadoc/io/flutter/plugin/common/EventChannel.EventSink.html" rel="nofollow noreferrer">Eve... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Heapsort with a selectable amount of children<p>Im trying to write some code that could sort an array using heapsort. The heap have two children right now bu... | <p>Just because you made it so easy:</p>
<pre class="lang-C++ prettyprint-override"><code>template <typename T>
void heapify(T arr[], int n, int d, int i) {
int biggest = i;
int childrenStart = d * i + 1;
int childrenEnd = childrenStart + d;
if (childrenEnd > n) {
childrenEnd = n;
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is onTap not working because of padding?<p>I made an Onboarding Page that uses ValueNotifier to change ThemeMode.
But OnTap didn't work, so I tried to fi... | <p>You can't tap on your button due to the order of your <code>Stack</code> children. You are rendering Widgets above your button, which makes it unclickable. To fix your issue, you should move your button to the end.</p>
<pre><code>Stack(
children: [
BackgroundWaveImage(),
...,
Button(),
]
)
</code></p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do a typewriter effect in rust<p>So I'm attempting to learn the basics of rust; and I thought a good way of doing that might be to convert an old pyth... | <p>A simple and straight forward translation:</p>
<pre class="lang-rust prettyprint-override"><code>use std::io::Write;
fn scroll(s: &str) {
for c in s.chars() {
print!("{c}");
std::io::stdout().flush().expect("Flushing to succeed");
std::thread::sleep(std::time::Dur... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can you require that a concept parameter is a reference `&` type?<p>In the following <a href="https://godbolt.org/z/YWs74esxo" rel="nofollow noreferrer">... | <p>You cannot (reasonably) detect if takes a reference parameter. But you can detect if it can take an rvalue:</p>
<pre><code>template <class Type, class Source>
concept ConsumerOfRvalue = requires(Type type, Source &&source, std::ranges::iterator_t<Source> position) {
type(std::move(source), po... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GROUP on one column and aggregate counts based on distinct values in another column<p>I have a table with values like so:</p>
<pre><code>CREATE TABLE myTable... | <p>This is your query</p>
<pre><code>SELECT
DISTINCT ts,
COUNT(CASE WHEN usr_id = 'A' THEN 1 END) AS count_a,
COUNT(CASE WHEN usr_id = 'B' THEN 1 END) AS count_b,
COUNT(CASE WHEN usr_id != 'A' AND usr_id != 'B' THEN 1 END) AS count_others
FROM myTable
GROUP BY ts
ORDER BY ts
</code></pre>
<p><a href="... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
'runtime_error' from c++ not captured in iOS<p>In my iOS project, I use a C++ module. The C++ module throws exception for some cases and the Objective C++ wr... | <p><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Exceptions/Articles/Exceptions64Bit.html#//apple_ref/doc/uid/TP40009044-SW1" rel="nofollow noreferrer">C++ Interoperability</a></p>
<blockquote>
<p>In 64-bit processes, Objective-C exceptions (NSException) and C++
exception are inter... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Argument error due to ruby 3.0 deprecation<p>I recently upgraded the ruby version of my app to <code>3.0</code>. After which multiple test cases were failing... | <p><code>:params => {}</code> is a <code>Hash</code> of <code>{params: {}}</code> to use kwargs (keyword arguments) the syntax is similar but distinctly different to the parser.</p>
<p>To resolve this (and clean up your code a bit) change all instances of <code>:symbol => value</code> to be <code>symbol: value</c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to validate XML with multiple XSD stored in Odoo modules<p>I need to validate an xml that I generate with two XSD files provided. I am struggling because... | <p>As Michael Kay commented, I needed to get the absolute path to the XSD file. In odoo I have managed to do it by using the following code:</p>
<pre class="lang-py prettyprint-override"><code>import os
# This gets the location of the absolute location of the python file running
current_location = os.path.dirname(os.p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
adding row number to QTableView in pyside2<p>is there any way I could add a row number beside the QTableView just for info and not actually add it into the d... | <p>You can just return the row number in your headerData implementation like:</p>
<pre><code>QVariant MyTable::headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const
{
if (orientation == Qt::Vertical && role == Qt::DisplayRole)
return section;
return QAbstractItem... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SIGABRT: Object reference not set to an instance of an object SetStatusBarColor Xamarin iOS<p>I get the crash <code>SIGABRT: Object reference not set to an i... | <p>You should get the <code>statusbar</code> like below:</p>
<pre><code> UIView statusBar = new UIView(UIApplication.SharedApplication.KeyWindow.WindowScene.StatusBarManager.StatusBarFrame);
if(statusBar == null)
{
//throw a meaningful exception or give some usefu... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unity: Creating a gameobject list for a puzzle game<p>I need help with a difficulty I have with lists.
Basically I need a code that allows me to check a list... | <p>If I understand you correctly what you have is</p>
<pre><code>public List<GameObject> theList;
</code></pre>
<p>and now you want to check if all of the items in this list have been destroyed / there is any item in the list which is not destroyed yet.</p>
<p>You can either use a simple loop like e.g.</p>
<pre><... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
301 redirect if filename end has different characters<p>The filenames that I want to redirect are like following:</p>
<pre><code>/wp-content/uploads/2022/06/... | <blockquote>
<p>Those files are deleted, those were duplicate files I decided to redirect but not redirecting. I put that rule in htaccess file in WP directory</p>
</blockquote>
<p>If those files are deleted and you put this rule at the end of the <code>.htaccess</code> file, <em>after</em> the WordPress code block the... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting Key type Error in using python and XML XPath<p>Getting a type error while taking input of XML attribute</p>
<p><strong>XML</strong> file from which t... | <p>Check the code below:</p>
<pre><code>import xml.etree.ElementTree as ET
xml = """<?xml version="1.0"?>
<data>
<system>
<vulnerability name = "Crack Passwords"/>
<vulnerability type="reverse">
<input updated... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a function to convert coordinates to a list of coordinates creating a circular polygon?<p>Example code:</p>
<pre><code>def circle_to_polygon(coordin... | <p>Shapely - <a href="https://shapely.readthedocs.io/en/stable/project.html" rel="nofollow noreferrer">https://shapely.readthedocs.io/en/stable/project.html</a> ?<br />
You could create a <a href="https://shapely.readthedocs.io/en/stable/manual.html#points" rel="nofollow noreferrer">point</a>, add a <a href="https://sh... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Group list of strings by most common case variant<p>I have a function that is given a list of strings from a database to display as options in a select filte... | <p>Here's my solution:</p>
<pre><code>List<string> values = new List<string>{
"aaa", "aaa", "Aaa", "BBB", "BBB", "bbb"
};
var filterData = values
.Where(rawValue => !string.IsNullOrEmpty(rawValue))
.GroupBy(gx => gx, StringCompa... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
nunit test case for db connection<p>I am new to Nunit framework, C# and dotnet. How to write a test case using Nunit for a db connection. I was not able to f... | <p>Calling an assert function <code>NUnit.Framework.Assert.That(con.State == ConnectionState)</code> for <code>con.Open()</code> and <code>con.close()</code></p>
<pre class="lang-cs prettyprint-override"><code>namespace TestProject
{
[TestClass] //Test Framework
public class UnitTest1
{
Connection c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What's the point of creating classes and self in python?<p>What's the point of creating classes and self in python? Like:</p>
<pre><code>class ThisIsClass(se... | <p>It becomes necessary to pass <code>self</code> argument to the functions of your class. however, your code has several problems like the initialization of <code>var</code> variable. You need a constructor <code>__init__</code> to create the variable, after that, you will be able to modify it:</p>
<pre><code>class Th... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bar plot in seaborn<p>While doing EDA of <a href="https://www.kaggle.com/competitions/titanic" rel="nofollow noreferrer">Titanic dataset</a> in Kaggle I comb... | <p>From <code>seaborn.barplot</code> documentation.</p>
<blockquote>
<p>help(seaborn.barplot)</p>
</blockquote>
<p>The plot is showing you the mean of the 'Survived' values per bin ('N of relatives'). You could specify the <code>estimator</code> parameter to change this behaviour (e.g. <code>estimator=median</code>).</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to activate TypeScript verification of types?<p>I'm trying to follow a tutorial in which this sample of code is expected to fail. But in my machine it wo... | <p><a href="https://deno.com/blog/v1.23#no-type-checking-by-default" rel="nofollow noreferrer">Starting in v<code>1.23</code>, by default, Deno does not type-check your code when executing it.</a></p>
<p>You can type-check your code (without executing it) using the command <code>deno check</code>. You can also type-che... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CloudSearch filtered query works in test dashboard but not on search endpoint<p>I need to filter my search by the host.
I was able to do this in the CloudSea... | <p>I didn't make one thing super clear. I am using a custom domain instead of the default endpoint.</p>
<p>Turns out I only had a small handful of query string parameters set up in my API in API Gateway.</p>
<p>Once I added the additional query strings to the API I was able to make the queries.</p>
<p>I also learned th... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Efficiently insert alternate rows and columns in Python<p>I need to alternate Pytorch Tensors (similar to numpy arrays) with rows and columns of zeros. Like ... | <p>I am not familiar to <em>Pytorch</em>, but to accelerate the code that you provided, I think <strong>JAX</strong> library will help a lot. So, if:</p>
<pre><code>import numpy as np
import jax
import jax.numpy as jnp
from functools import partial
a = np.arange(10000).reshape(100, 100)
b = jnp.array(a)
@partial(jax.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check if the related values in two columns are equal<p>In the following Excel sheet I want to find a formula in the third column to do the following:<br/>
Fo... | <p>If the Fasle are actually typos for FALSE, you could just check for existence of <em>any</em> true in column B with same letter in column A:</p>
<pre><code>=COUNTIFS(A2:A12,A2:A12,B2:B12,TRUE)>0
</code></pre>
<p><a href="https://i.stack.imgur.com/DgoR4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgu... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get images from assets folder?<p>I'm beginner and I currently learn vue.js. I try to create a carousel slider but I can't get my images from the asset... | <p>I found the solution. This code (require) doesn't exist in vue.js 3:</p>
<pre><code><img :src="require(`../assets/${slide}.jpg`)" />
</code></pre>
<p>Run: npm run build and you'll get dist folder where you can save your images then call from there. It works for me.</p>
<p>So the solution is:</p>
<pre... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to send image picked with image_picker from child widget to his parent?<p>I'm trying to send a picture selected with image_picker from child to his paren... | <p>Change <code>onPressed</code> like this. The problem is image file picked inside method and ui is not waiting for this method complete it's job. <code>await</code> keyword used to wait for operation result. For more, search about asynchronous programming in dart.</p>
<pre><code>onPressed: () async {
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
storing values in an array using react usestate hook<p>I have the following formik based example where I'm using primereact fileupload.
Everytime user upload... | <p>Let me answer this:</p>
<p><strong>Question 1:</strong></p>
<p><strong>Is <code>setUploadedFileCategory(uploadedFileCategory =>[...uploadedFileCategory,selectedAssetCategoryId]);</code> a correct way of pusing items in the array?</strong></p>
<p><strong>Answer</strong>
It works and here is the example code:</p>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to replace react component with another when event triggered in that component<p>So, i (Total react beginner) have this React component.</p>
<pre><code>i... | <p><strong>ANSWER TO YOUR LAST COMMENT TO HANDLE TIMER</strong></p>
<p>Instead of using <code>react-useinterval</code> you could create a <code>useTimer()</code> hook of your own</p>
<pre class="lang-js prettyprint-override"><code>import { useEffect, useRef, useState } from "react";
const useTimer = () =>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When I run the code, it is having an issue with ':' after False in my if statements. idk why because the example has it the same. line 14 and down<pre><code>... | <p>The regular expression module provides an easy way to approach what you intend to achieve with the code provided in your question. The code below should do what you intend to achieve, so try it out:</p>
<pre><code>import re # regular expressions module
# All vanity plates must start with at least two letters.
# Numb... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
getDeclaredMethods() return inherited methods if superclass is default<p>I have two classes</p>
<pre class="lang-java prettyprint-override"><code>// BaseClas... | <p>I have analyzed the issue and here is the results. I have simplified a bit the example from the question.</p>
<p>This answer handles the first question of OP</p>
<blockquote>
<p>Why getTest() generate a bridge method if BaseClass is default?</p>
</blockquote>
<p>For second question regarding the inconsistency appear... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Send a message in a random channel (discord.py)<p>The setup: I've made a bot to interact with users on my server. One of the features I've added is the game ... | <p>Here's a shorter version, using <a href="https://docs.python.org/3/library/random.html" rel="nofollow noreferrer">random</a> again:</p>
<pre class="lang-py prettyprint-override"><code>import random
#random_channel = random.choice(message.channel.guild.channels)
random_channel = random.choice(message.guild.channels)
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React JW player how to get current duration of video?<p>I am using <a href="https://www.npmjs.com/package/react-jw-player" rel="nofollow noreferrer">React JW... | <p>You can access "raw" JW player by doing</p>
<pre class="lang-js prettyprint-override"><code><ReactJWPlayer playerId="id" ...
let playerInstance = window.jwplayer('id');
</code></pre>
<hr />
<p>To get current position of JW Player do</p>
<pre class="lang-js prettyprint-override"><code>playerIn... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to initalise Elixir module with random constant?<p>I know in Elixir I can initiate a module with a random variable like so:</p>
<pre><code>defmodule MyMo... | <p>I wanted to clarify the earlier comment in an answer: yes, you can use <code>Enum.random/1</code> e.g.</p>
<pre><code>defmodule MyMod do
@words ["test", "hello", "bye"]
@word Enum.random(@words)
end
</code></pre>
<p>or you could reference an existing function (e.g. one providing mor... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PowerShell - Error when querying AD if user enters credentials<p>Trying to create a basic script for my IT helpdesk team that queries our AD to see if a comp... | <p>The <a href="https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.directoryentry.-ctor?view=dotnet-plat-ext-6.0#system-directoryservices-directoryentry-ctor(system-string-system-string-system-string)" rel="nofollow noreferrer"><code>DirectoryEntry</code> constructor</a> you're using requires the <str... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change Fontawesome icon color<p>I am trying to create a shape like this via CSS :</p>
<p><a href="https://i.stack.imgur.com/Drxwz.png" rel="nofollow noreferr... | <p>Do you mean add <code>color:white</code>?</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>i.fa {
border-radius: 300px;
box-shadow: 0 0 3px #888;
padding: 0.7em 0.7em... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating a binary flag to return whether someone has used a product in the last n days<p>I have three variables: the person using the item, the date the item... | <p>I think you need to consider how you're setting up your data. Below is an example of how you can create your <code>IF</code> conditions to make it work -- using data that is unclear in your post.</p>
<p>Set up your data like so, with cell <code>Z1</code> using the name <code>AnchorDate</code>.</p>
<p><a href="https:... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to compare between two text and print out the difference in a dict<p>Hello people of stackoverflow!</p>
<p>I have a problem where I want to compare betwe... | <p>Answer to Question 1:
you can store these values as list of dictionaries</p>
<pre><code>list_1 = [
{'tin': '00194500874886', 'Amount': 'LOW'},
{'tin': '00523523523574', 'Amount': 'MEDIUM'},
{'tin': '56756756536745', 'Amount': 'NONE'},
{'tin': '00194523575674', 'Amount': 'HIGH'},
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create .csv and send as response in express/koa<p>I have some data in csv format and I want to send it as a file attachment (example.csv) to an http response... | <p>If you have constructed a string of comma-separated values organized into lines separated by <code>"\n"</code>, you can send it as an attachment with express middleware like the following:</p>
<pre class="lang-js prettyprint-override"><code>app.get("/csvdownload", function(req, res) {
var csv =... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to I use below import statement in palantir foundry: import spark.implicits._<p>When I attempt to import spark.implicits._ in Global Code as below,</p>
<... | <p><code>spark.implicits_</code> is for use with the scala language. If you are new to Spark, and want to use python, I recommend you follow the guide on getting started in Python Transforms: <a href="https://www.palantir.com/docs/foundry/transforms-python/getting-started/" rel="nofollow noreferrer">https://www.palant... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pandas dataframe apply a function depending on index/column name<pre><code>multipliers = {'A' : 5, 'B' : 10, 'C' : 15, 'D' : 20}
df = pd.util.testing.makeDat... | <p>Use lambda function and for pass column name use <code>x.name</code>:</p>
<pre><code>np.random.seed(2022)
multipliers = {'A' : 5, 'B' : 10, 'C' : 15, 'D' : 20}
df = pd.util.testing.makeDataFrame() # a random df with columns A,B,C,D
f = lambda x, col: multipliers[col] * x
df2 = df.copy()
for c in df.columns:
df2... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create an array of objects with one of the properties being an array from a single array<p>I got this array:</p>
<pre><code>[
name1,
email1@name1.com... | <p>You could reduce the array by having a look to the strings.</p>
<p>If you got an <code>'@'</code> add the string to the last object to <code>members</code>, otherose add a new object to the result set.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="sn... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
python3 -m switch files<p>If I run this on my (Linux) command line.</p>
<pre><code>python3 -m serial.tools.list_ports
</code></pre>
<p>I get the result:</p>
... | <p>The <code>-m</code> flag in python is used for:<br />
-m mod : run library module as a script (terminates option list)</p>
<p>What does "terminates option list" mean?
It means that, any future options get passed to the program you are providing and not to python.</p>
<p>So in your scenario, it's running th... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
'Type' does not refer to a value<p>I've checked other questions with similar errors, and they didn't seem comparable to the issue that I'm running into. I'm ... | <p>Not sure why you are trying to name this object, just</p>
<pre><code>Room::Room()
: Room{Enemy{"Goblin"}}{
}
</code></pre>
<p>Temporaries (like <code>Enemy{"Goblin"}</code>) are objects <strong>without</strong> names.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove edge animation in HorizontalPager<p>I am using <a href="https://google.github.io/accompanist/pager/#horizontalpager" rel="nofollow noreferrer">Horizon... | <p>You can wrap the HorizontalPager like this to remove the animation:</p>
<pre><code>CompositionLocalProvider(
LocalOverScrollConfiguration provides null
) {
HorizontalPager(count = 10) { page ->
// Our page content
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I tried to work with Cancellationtoken but it wont work<p>So basically I tried following some Tutorials und examples on how to cancel an Task.</p>
<ul>
<li>I... | <p>This won´t work because you check your token only once. By the time you press the stop button the code has stepped over your if clause.</p>
<p>You would need to check the token more often while you do <code>//Here is a really long Api and Saving in Database process</code> or pass it to functions that support <code>C... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is string::resize and string::substr O(1)<p>I am working on a coding problem in which I have to delete all occurrences of a substring T in a string S (ke... | <p><code>string::resize</code> isn't <em>always</em> linear. If you're expanding a string, it's linear on the number of characters copied, which is potentially the total number in the resulting string (but could be less, if the string already has enough space for the character(s) you add, so it only has to write the ne... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Razorpages Post new record and return to page with updated Id<p>Using Net6.0 Razorpages, I have a form that returns a Person by Id, and allows the user to up... | <p>Check your model design, <code>PersonId</code> is the <code>PrimaryKey</code> in database, when user post a new record, The value of <code>PersonId</code> is self-incrementing rather than depending on the value of the <code>PersonId</code> in the new record. When user want to post a new record, The input box of <cod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to hide secrete keys in apis<p>I wanna ask you how I gonna hide the secrete keys in API like database connection username, password or services API keys<... | <p>There are already a number of discussions regarding storing secrets in environment variables (good to avoid committing them to version control - bad for a number of <a href="https://diogomonica.com/2017/03/27/why-you-shouldnt-use-env-variables-for-secret-data/" rel="nofollow noreferrer">reasons</a>). I'm not going t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't make CircleCI work along Python project set through pyproject.toml<p>I have setup a Python Project with dependencies listed in a pyproject.toml file as... | <p>After digging documentation, it appears none "orbs" (some kind of pre-defined actions you can import) provided by circleci does the trick off the shelf for <code>pyproject.toml</code> configured project. Hence, I had to start from a blank <code>config.yml</code> to make it happen. Moreover, I had to test b... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
File Create Unix<p>I have this data set ( txt).
For example:</p>
<p>input:<br>
0 275,276,45,278<br>
1 442,22,455,0,456,457,458<br>
75 62,263,264,265,266... | <p>Ignoring the last part you mentioned "80 454", I found a solution to print as required.</p>
<p>Suppose all these values are stored in a file names "stack.txt", the following bash code will be useful.</p>
<pre><code>#!/bin/bash
while read i;do
f=$(awk -F" " '{print $1}' <<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to extract data from a big and deep down object in javascript<p>I have a very deep-down object from which I need to extract a specific object from it. bu... | <p><code>var slider = obj[0].data.pageLayouts.data[0].attributes.slider</code></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var obj = [{
"data": {
"pageLayouts": {
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typescript - Accessing value from enum<p>I was trying to solve a typescript challenge and encountered this issue <code>Element implicitly has an 'any' type b... | <p>First of all, your Enum should look like this (<a href="https://www.typescriptlang.org/docs/handbook/enums.html#numeric-enums" rel="nofollow noreferrer">source</a>):</p>
<pre class="lang-js prettyprint-override"><code>enum Resistors {
Black,
Brown,
Red,
Orange,
Yellow,
Green,
Blue,
Violet,
Grey,
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
T-SQL Command not entering CATCH<p>I have a sql agent job that runs a job step to import an xml file into a table. This is working fine. I want to have a r... | <p>This is, as Stu has (just) alluded to, one of those errors that can't be "caught" easily. One method you could use, however, is to use a defered statement and execute it inside <code>sys.sp_executesql</code>; this'll result in the behaviour you want:</p>
<pre class="lang-sql prettyprint-override"><code>BEG... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sending email(outlook as server) in azure databricks notebook in python?<p>I tried to configure using localhost. I ran this in my cmd line.
(python -m smtpd ... | <p>To resolve <code>connection refused</code> error, you can try following ways:</p>
<ul>
<li>Firewall might be blocking access to port 1025</li>
<li>Alternatively, you can try <a href="https://www.futurequest.net/forums/archive/index.php/t-22718.html" rel="nofollow noreferrer">using port 25</a></li>
</ul>
<p>As per <a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Customer retention rate in snowflake<p>I have this formula for the customer retention rate but kinda stuck in translating it into a sql code in snowflake:</p... | <p>if we check for each customer if they have "old sales" and "new sales"</p>
<pre><code>select customer_id, min(date) as min_date, max(date) as max_date, min_date < (current_date()-30) as old_sales, max_date >= (current_date()-30) as new_sales
from values
(1,'2022-05-01'),
(2,'2022-05... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a custom Blazor multiple select HTML component? Error: MultipleSelect requires a value for the 'ValueExpression' parameter<p>I am working to cr... | <p>because you inherit the component InputBase, you must use bind-value.
I edited a lot of the code to make it work</p>
<pre><code>@using BlazorApp2.Client.Components
@using System.Linq.Expressions
@using System
@using System.Collections.Generic
@using System.Diagnostics.CodeAnalysis
@inherits InputBase<Option>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
javascript Convert array of objects to single row of sum<p>I want to sum all rows to a single row in javascript array</p>
<pre class="lang-js prettyprint-ove... | <p>You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce" rel="nofollow noreferrer"><em>reduce</em></a> to integer sum each entry in each object.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
List comprehension when there are repeated elements in both lists<p>I want to find all words that have a particular set of target letters. My code works when... | <p>This is a good use case for <code>collections.Counter()</code>. It gives us a clean way to check whether the desired overlap exists between a word in <code>target_words</code> and the <code>target</code>, accounting for duplicate letters (with a suggested improvement by <a href="https://stackoverflow.com/users/72126... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to reorder Wagtail admin menu items<p>There are some custom menu items in the admin's menu, it is easy to order them (the items marked in red below).
Jus... | <p>You can use the <a href="https://docs.wagtail.org/en/stable/reference/hooks.html#construct-main-menu" rel="nofollow noreferrer"><code>construct_main_menu</code> hook</a> to modify existing menu items.</p>
<p>For example, to move the Pages item to the bottom, place this code in a <code>wagtail_hooks.py</code> file wi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.