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:
Elasticsearch + NEST: Use token-filter only for comparisation but not on analyzers result<p>I want to build an analyzer in elasticsearch that ignores the cas... | <p>Note that <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html" rel="nofollow noreferrer">Analyze API</a> performs analysis on your input text and returns <strong>tokens</strong>. These tokens are the output of analyzer, but these are <strong>not the final output</strong>, we... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding an artificial primary key versus using a unique field<p>Recently I Inherited a huge app from somebody who left the company.</p>
<p>This app used a SQL... | <p>You are talking about the difference between <em>synthetic</em> and <em>natural</em> keys.</p>
<p>In my [very] personal opinion, I would recommend to always use synthetic keys (and always call it <code>id</code>). The main problem is that natural keys are never unique; they are unique in theory, yes, but in the real... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do a partial map from source in Automapper<p>I am trying to map only 2 out of 4 properties from an object to the destination type. In my case <code>De... | <p>This can be solved by removing <code>MemberList.Source</code> from argument list of <code>CreateMap()</code> and ignoring all remaining unmapped destination members.</p>
<pre><code>CreateMap<DeleteCommand, Asset>()
.ForMember(x => x.DeletedDate, opt => opt.MapFrom(src => DateTime.UtcNow))
.ForMember(... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple Model validation in single EditForm in Server-Side Blazor<p>I have a form that binds to three related models in a single EditForm. I am looking to ... | <p>I guess what you need here is the ObjectGraphDataAnnotationsValidator component, which enables validation of complex types.</p>
<p>Here's a <a href="https://gunnarpeipman.com/blazor-data-annotations-object-graph-validation/" rel="nofollow noreferrer">link to a simple sample</a></p>
<p><a href="https://github.com/d... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check next line in bash<p>I have a text like:</p>
<pre><code>set 1 recovery 2 2
set 2 recovery 2 2
% ERROR Unknown error
set 3 recovery 2 2
set 4 recovery 2... | <p>Assumptions:</p>
<ul>
<li>there's at least one non-<code>ERROR</code> line before each <code>ERROR</code> line</li>
<li>no 2 consecutive lines are <code>ERROR</code> lines</li>
</ul>
<p>Sample data:</p>
<pre><code>$ cat check.dat
set 1 recovery 2 2
set 2 recovery 2 2
% ERROR Unknown error
set 3 recovery 2 2
set 4... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firebase android impementation realtime database problem<p>I had a problem when I try to implement <code>implementation 'com.google.firebase:firebase-databas... | <p>Change:</p>
<pre><code> minSdkVersion 14
</code></pre>
<p>into this:</p>
<pre><code> minSdkVersion 23
</code></pre>
<hr>
<p>Change :</p>
<pre><code> repositories {
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
</code></pre>
<p>int... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make dictionary comprehension in Python<p>I need advice about comprehensions. Got <strong>TypeError: unhashable type: 'list'</strong> but I can't see ... | <p>I suggest this:</p>
<pre class="lang-python prettyprint-override"><code>data = (
'abcdefg',
(10, 20, 30, 40, 50),
(55,81, 33, 44)
)
# TODO from this:
# lens = dict()
#
# for el in enumerate(data):
# lens[el[0]] = len(el[1])
# TODO to this
lens = {el[0]: len(el[1]) for el in enumerate(data)}
print... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
VBA Insert Picture Dynamically In Cell Based On Cell Value and do nothing if the cell is empty<p>I have a statement with Image Dynamically In Cell (fom I11 t... | <p>Please, use the next solution. You did not answer the clarifications question, so it automatically run if any cell in range "D11:D19" is change. The code checks if a picture exists on the corresponding cell ("I & modified cell row), it is deleted. If after modification the cell is empty, the code ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
An issue with np.nan when using it to replace all elements of an array<p>Here is an 1D array:</p>
<pre><code>a = np.array([1, 2, 3])
</code></pre>
<p>I am ... | <p>Your array is being created with <code>dtype='int64'</code>. If you create you array as an array of floats it will work.</p>
<pre><code>a = np.array([1, 2, 3], dtype=float)
a[:] = np.nan
print(a)
</code></pre>
<p>will give</p>
<pre><code>[nan nan nan]
</code></pre>
<p>alternatively you could create your array us... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use FCM (Firebase Cloud Messaging) while making build of expo react native app through eas cli<p>I had expo sdk less than sdk 45 in my expo react nati... | <p>Run <code>eas credentials</code>, select Android, then Push Notifications: Manage your FCM Api Key, and then choose the appropriate option to set up the key.
<a href="https://docs.expo.dev/app-signing/managed-credentials/#android" rel="nofollow noreferrer">docs...</a></p>
<p><strong>OR</strong></p>
<ol>
<li>Go to <a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I update the transactions status when cache expire?<pre><code>var cacheExpirationOptions = new MemoryCacheEntryOptions
{
AbsoluteExpiration = Da... | <pre><code> var expirationTime = DateTime.Now.AddMinutes(30);
var expirationToken = new CancellationChangeToken(
new CancellationTokenSource(TimeSpan.FromMinutes(31)).Token);
var cacheEntryOptions = new MemoryCacheEntryOptions()
.SetPriority(CacheItemPriority.NeverRemove)
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using os.listdir(os.path.join) with pandas series to obtain list of file in the folder from a variable<p><strong>Task</strong></p>
<p>In excel I have in cell... | <p>I don't know if I understood what you're trying to do, but here's how you can take a <code>Pandas Series</code>, combine it with a base path, and list all directories inside:</p>
<pre class="lang-py prettyprint-override"><code>
from pathlib import Path
import pandas as pd
# Path we'll be using as common base path.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to extract specific no. of character from dataframe column Python<p>Like Left formula we Used in Excel same as I want to extract no. of character from Po... | <p>What you can do is define a new function that does the comparison and apply that to a new column (<code>Expected OutPut</code> in your example).</p>
<pre><code>def f(row):
val = str(row['Policy no.'])
return val[:10] if row['Insurer'] == "Hdfc" else val[:7]
df['Expected OutPut'] = df.apply(f, axi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
c++ template short circuit logic AND (&&)<p>I've been told that <strong>logic AND</strong> (<code>&&</code>) in template doesn't work, so I want to u... | <p>The template is fine. This is a bug in gcc versions 5.4 through 6.1: <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71875" rel="nofollow noreferrer">template specialization compile error</a>. You happen to be on the bottom edge of the bugged version range.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AttributeError: 'NoneType' object has no attribute 'text' when scraping Ebay product titles<p>Following <a href="https://www.youtube.com/watch?v=IGi6m8maxOY"... | <p>Some items are without title or soldprice. They will return none. And you will get that error. So you need to skip them.</p>
<p>Another thing is <code>item.find('span', {'class': 's-item__title--tagblock__COMPLETED'})</code> this line is always returning none. So you need to check why.</p>
<p>To learn: <a href="http... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to compute the gradient of only one output unit?<p>I have a trained model called <strong>net</strong>, last layer(output layer) is a Dense layer with 10 ... | <p>It's quite simple actually: You need to do <em>everything</em>, including indexing, inside the tape context. Meaning:</p>
<pre><code>with tf.GradientTape(persistent=True) as tape:
output = net(x)[0, 0]
grad = tape.gradient(output, x)
</code></pre>
<p>This should work as intended. Keep in mind that even someth... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use inline C# in the browser instead of Javascript<p>I have just discovered Microsoft introduced Blazor which allows C# code to be run in the browser.... | <p>No, you can't just put the C# code in a <code>script</code> tag. Browsers don't know how to parse and run C# code. What Blazor does is compile C# (on the server) into .Net assemblies, which are then run in the browser via <a href="https://webassembly.org/" rel="noreferrer">WebAssembly</a>. Details in the <a href="ht... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Graph start from the middle to downwards<p>I have used the Multiple axis highchart graph to plot on my page. Kindly help me to fix the grey colour bar graph ... | <p>Please check this example: <a href="http://jsfiddle.net/BlackLabel/75Lkt6gx/" rel="nofollow noreferrer">http://jsfiddle.net/BlackLabel/75Lkt6gx/</a> - the grey columns start from the bottom of the chart because they are assigned to a hidden axis.</p>
<p>You should use only one y-axis and define <code>min</code> and ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to save json object variable based on specific value<p>I am trying to read json response from url in python. the below code works fine but the problem is... | <p>To get first value which match some criteria from list we can pass <a href="https://docs.python.org/3/reference/expressions.html#generator-expressions" rel="nofollow noreferrer"><em>generator expression</em></a> which iterates over this list with condition straight into <a href="https://docs.python.org/3/library/fun... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kafka Retention.ms on specific topic is not working as expected<p>I'm creating topic like this in spring boot with <strong>retention time is 10 sec (10000ms)... | <p>Kafka only deletes <strong>closed segments</strong> (assuming the <code>LogCleaner</code> is enabled, and running) that are older than the retention period. Notice that you have <code>segment.bytes</code> value in your topic config, which defaults to 1GB. So, if your records are very very small, then you'd need to s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can't I sort this PowerBI chart?<p>I have charts I want to sort descending. I've read there's a "more options" option if you click on the chart... | <p>My best guess at this point is that you are using two different fields for Male and Female numbers. If this is the case, you won't get the sorting option since the values are coming from two different fields. If you simply want to interchange the position, you can do so in the values section. If this is not the case... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bluetooth reboots ESP32 when connecting<p>I've tried running an old application of mine on an ESP32 micro controller and I kept getting errors such as</p>
<b... | <p>Turns out there has been an update in ESP32-Arduino.</p>
<p>Changing</p>
<pre><code>platform = espressif32
</code></pre>
<p>to</p>
<pre><code>platform = espressif32@3.5.0
</code></pre>
<p>solved my issue.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL Leaderboard query optimization<p>I'm currently making a leaderboard where I'm using the specific code to go:</p>
<pre class="lang-java prettyprint-over... | <p>Get rid of the <code>FORCE INDEX</code> clauses. That is causing the slowdown.</p>
<p>After that, show us the <code>EXPLAIN</code> again, but in text <em>not</em> as an essentially unreadable image.</p>
<p>(I don't have an answer to the 80ms vs 16ms)</p>
<p><strong>More</strong></p>
<p>That query is counting how ma... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Do I need an index on the second column of a compound primary key?<p>My schema is something like below -</p>
<pre><code>CREATE TABLE `products` (
`accoun... | <p>Think of a telephone book. It's like an index on <code>(last_name, first_name)</code>. If you look up a person by their last name, it's very helpful that it's sorted by last name first. If you look up a person by both last name and first name, it is also helpful.</p>
<p>But if you use the phone book to try to look u... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pipeline trigger doesn't run because it's getting the wrong branch<p>Friends how to make Run Pipeline get the desired branch by default.
My trigger is not be... | <p>Can you try this syntax :</p>
<pre><code> trigger:
branches:
include:
- feat-regression-test
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Slight acos precision difference between Clang and Visual C++<p>I have some cross platform code I'm working with. On the Mac it's compiled with Clang, on Win... | <p>If you look at the binary representation of these floating point values you can see that the mac/clang's value <code>A</code> is the next lowest floating-point number than windows/msvc's value <code>B</code></p>
<pre><code>A 3.14159250 0x40490FDA
B 3.14159274 0x40490FDB
</code></pre>
<p>Whilst B is close... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding set value to pre-defined variable<p>So I've got a variable <strong>expireint</strong> which I have used in previous functions and has a value of <stro... | <p>My test:</p>
<pre><code>var expireint = 20200210;
expireint += 300;
document.write(expireint);
</code></pre>
<p>For me, executing this (in a html tag)
writes <code>20200510</code> to the document.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
convert the date column of the dataframe to the date type<p>I have the following dataframe:</p>
<pre><code> import pandas as pd
from datetime imp... | <p>Actually what is happening is that both Series <code>df['Date_start']</code> and <code>df['Date_end']</code> are of type <em>datetime64[ns]</em>, but when you show the dataframe, if all the time values of the columns are zero, it doesn't show them. What you can try, if you need a formatted output, is to convert them... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Storing a std::function as a private member results in it being null when used<p>I am at a loss for why this isn't working. I've tried passing a function by ... | <p>The problem was with how I was calling the overloaded constructor it seems:</p>
<pre><code>StateIndicator::StateIndicator(QWidget *parent) {
StateIndicator(parent, StateIndicator::DefaultSelectionStrategy);
}
</code></pre>
<p>should be</p>
<pre><code>StateIndicator::StateIndicator(QWidget *parent) :
StateInd... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Access an application running on NodePort of minikube inside an EC2 instance from outside world<p>I have an EC2 instance say its IP is 44.XX.XX.XX (Say IP1),... | <p>I'm assuming this is only for development purpose? You need to port forward the traffic from your EC2 node to minikube as minikube runs as separate VM.</p>
<p>Once you have kubectl setup on the IP2 host machine talking to the minikube cluster, you can use <a href="https://kubernetes.io/docs/tasks/access-application... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
lifetime error when calling method with mutable `self` reference<p>Here is the code in question:</p>
<pre class="lang-rust prettyprint-override"><code>struct... | <blockquote>
<p>Where is the "autoref" happening here?</p>
</blockquote>
<p>Autoref happens when you invoke a method. See <a href="https://stackoverflow.com/a/73077094/501250">this question</a> for more information.</p>
<blockquote>
<p>I noticed that removing the <code>mut</code> from the reference to self f... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why am I getting a syntax error with this python ternary expression?<p>Why am I getting a syntax error with this python ternary expression? Can't find anythi... | <p><strong>This is not a good way to code, but if you want a one-liner:</strong></p>
<pre class="lang-py prettyprint-override"><code>(right_pointer := right_pointer - 1) if condition else (left_pointer := left_pointer + 1)
</code></pre>
<p>This uses the <a href="https://docs.python.org/3.8/whatsnew/3.8.html#assignment-... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Keeping all strings JNI android to protect from reverse engineering?<p>This is how i am keeping strings in JNI </p>
<pre><code>extern "C" JNIEXPORT jstring ... | <p>You can't prevent reverse engineering but you can make it harder, involving more work and extra steps that not everyone is capable of.</p>
<p>Putting constants in a native library prevents them from appearing in the decompiled java code. Connecting which string in the compiled library matches which value in the fin... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use cURL to stream file to a server without buffering?<p>I'm writing a Node.js <code>PUT</code> endpoint to allow users to upload large files. As I te... | <p><code>curl</code> will exit when it receives the 409 response and the response is ended, at least in my testing.</p>
<p>What allows <code>curl</code> to start the upload, is that the request includes the header <code>Expect: 100-continue</code> which causes node http(s) to use the default <a href="https://nodejs.org... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I achieve Promise.all().then() behavior with jQuery.when().done() if I have an unknown number of requests?<p>I have a little code segment like this:<... | <p>You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply" rel="nofollow noreferrer"><code>Function.apply()</code></a> to invoke a function with an array as a list of parameters. To get the responses, iterate the <a href="https://developer.mozilla.org/en-US/... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
make ruby default to 3.1.2 on macOS<p>I am working on macOS.</p>
<pre><code>brew upgrade ruby
Warning: ruby 3.1.2 already installed
</code></pre>
<p>but doi... | <p>It might be easier if you use a ruby version manager like rbenv or rvm</p>
<pre><code>brew install rbenv
rbenv install 3.1.2
rbenv use 3.1.2
</code></pre>
<p>Otherwise, you can check this answer: <a href="https://stackoverflow.com/a/8731098/14473816">https://stackoverflow.com/a/8731098/14473816</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Terraform Azure function app - simple example not spinning up the function properly<p>Having followed the tutorial in here: <a href="https://docs.microsoft.c... | <p>After digging in deeper, in the following post:
<a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-infrastructure-as-code?tabs=windows" rel="nofollow noreferrer">functions infrastructure as code</a></p>
<p>in <strong>Custom Container Image</strong> section it says:</p>
<blockquote>
<p>Also, se... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I make the Circle Avatar's location static so that it does not change while entering text into a form?<p>This code of Forget password and I use <code>... | <p>Move the <code>Stack</code> to the <code>Container</code> with the fields and then use <a href="https://api.flutter.dev/flutter/widgets/Transform/Transform.translate.html" rel="nofollow noreferrer"><code>Transform.translate</code></a> to move the icon outside the border. This way the avatar circle is going to be fix... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R - Get a list of tables matching regex pattern in a user function<p>I wish to create a user function in R which merges multiple tables that uses regular exp... | <p>We can use <code>reduce</code> will <code>full_join</code></p>
<pre><code>library(dplyr)
library(purrr)
multi.merge <- function(pattern) {
mget(ls(pattern = pattern, envir = .GlobalEnv), envir = .GlobalEnv) %>%
reduce(full_join)
}
dt <- multi.merge("^m_")
</code></pre>
<h3>data</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pull back specific post codes from table in SQL<p>I'm having an issue in selecting specific post codes.</p>
<p>These are all valid UK post code formats:</p>... | <p>I think the logic you want is:</p>
<pre><code>WHERE ad.PostCode like 'WV1 [0-9][A-Z][A-Z]' OR
ad.PostCode like 'WV1[0-9][A-Z][A-Z]'
</code></pre>
<p>I'm not sure if numbers are allowed for the last three characters.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to make the "Save" button in React admin Sticky in React Admin<p>I am using reactadmin , i need to make the save button in edit page sticky as... | <p>Yes! You can inject a custom toolbar using <code><SimpleForm toolbar></code>, and use the <code>sx</code> prop to manipulate style. Due to the way the <code>position:sticky</code> CSS rule applies, you must also reset the overflow of the containing element.</p>
<pre><code> <Edit {...props} sx={{ "&... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jQuery: enable element on radio check<p>jQuery function isnt enabling my disabled submit button?</p>
<p><div class="snippet" data-lang="js" data-hide="false"... | <p>The issue is because you only read the state of the radio control in the document.ready handler, ie. when the page loads not when the user changes its state.</p>
<p>To fix this attach a <code>change</code> event handler to the radio and set the <code>disabled</code> state of the button based on that.</p>
<p>Finally,... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to fix an issue that occurs while using string format inside a loop<p>When I use string formatting <code>.format()</code> inside a loop, I notice that... | <p>The first round of your loop (using keyword <code>A</code>) overwrites the <code>where</code> value in your dictionary so that the <code>{}</code> are no longer present when the next iteration of the loop (using keyword <code>B</code>) starts.</p>
<p>The solution is to keep a "clean" copy of the value and ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to merge 3 defferent comparative dataframes<p>I have 3 seperate data frames which are; <strong>close_price_df</strong>, <strong>returns_df</strong> and <... | <p>Use <code>pd.concat()</code></p>
<pre class="lang-py prettyprint-override"><code>
pd.concat([close_price_df, returns_df, volume_df], axis=1)
</code></pre>
<p><strong>Edit:</strong></p>
<p>Since 3 dataframes that merged all have the same columns, the column name for each df better be prefixed first to avoid some pro... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas set style for Timedelta columns<p>I have a Jupyter notebook in which I'm displaying a dataframe that I would like to:</p>
<ul>
<li>Hide the index</li>... | <p>This is quite an easy fix, just add a formatter for the <code>Timedelta</code> column also:</p>
<pre class="lang-py prettyprint-override"><code>df.style.format(formatter={
'api_id': make_hyperlink,
'Timedeltas': lambda v: f"{v.round('d').days} days",
}).hide()
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Print a Date with some text in a new File using Shell Script<p>I'm new to the Shell script. </p>
<p>I want to create a file using shell script and write a c... | <p>First of all you will want to format the output of date if you want to use it in the filename. If not you can use standard date command. You can find date format explanations <a href="https://www.thegeekstuff.com/2013/05/date-command-examples/" rel="nofollow noreferrer">here</a> </p>
<p>Here is a sample block of co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need to fetch data into array BEFORE sending it as a prop in React<p>I am fetching the user's permissions from an API call. I get the permissions and push th... | <p>You need to add two hooks: <code>useState</code> and <code>useEffect</code>.</p>
<p>Initialize the <code>userPermissions</code> array with <code>useState</code>. Then, within <code>useEffect</code>, fetch your data and update <code>userPermissions</code> using the updater function. This will trigger a re-render and... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GNU parallel with dependencies?<p>Is there a way to run scripts with dependencies via GNU <code>parallel</code>?</p>
<p>I wish to run the following scripts:<... | <p>Look at <a href="https://www.gnu.org/software/parallel/man.html#example-gnu-parallel-as-queue-system-batch-manager" rel="nofollow noreferrer">https://www.gnu.org/software/parallel/man.html#example-gnu-parallel-as-queue-system-batch-manager</a></p>
<p>So something like:</p>
<pre><code>true >jobqueue; tail -n+0 -f ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MSVC C/C++ compiler undefined behavior warning<p>I've compiled simple UB code without any warnings or errors using Visual Studio 2019:</p>
<pre><code>int ma... | <blockquote>
<p>Clang and GCC gives warnings for this example. Do they generate warnings for any possible UB?</p>
</blockquote>
<p>No. Many things are defined as "undefined behavior" instead of requiring a diagnostic, exactly because they are extremely difficult (or even theoretically proven to be impossible) to de... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript module import fails - why?<p>I'm a javascript newbie and I'm trying to figure out why this import statement fails. I don't know if this is relevan... | <p>You are mixing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules" rel="nofollow noreferrer"><strong>es6 modules</strong></a> with <a href="https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Using#Importing_CommonJS_modules" rel="nofollow noreferrer"><strong>Commonjs... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change the default file extension icon on vscode-icons don´t works<p>I am trying to change the icon from the extension <strong>test.js</strong>. I found this... | <p>The <code>id</code> of the icon is <code>testjs</code>.
<a href="https://github.com/vscode-icons/vscode-icons/issues/2358#issuecomment-580774277" rel="nofollow noreferrer">Answare by JimiC</a></p>
<pre><code>{
"vsicons.associations.files": [
{ "icon": "test", "format": "svg", "overrides": "testjs" }
]
</c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scheduled Firebase cloud functions timeout<p>I am getting <code>Cloud Function finished with status: 'timeout'"</code> error when running scheduled clou... | <p>Okay, thanks to @doug-stevenson, I replaced promises with <a href="https://axios-http.com" rel="nofollow noreferrer">axios http client</a> and now it works without any timeouts.</p>
<p>Example:</p>
<pre><code>exports.extendEvaluationTokenLife = functions.pubsub
.schedule('every 5 minutes')
.retryConfig({
ret... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove common columns from two dataframes by keeping one common column intact<p>I have a dataframe1 that contains columns like <code>'ID', 'A', 'B', 'C', 'D'... | <p>Try using the below code:</p>
<pre><code>df4 = df1[['ID'] + [df1.columns.drop(df2.columns.tolist() + df3.columns.tolist())]]
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Balancing Dataset in Pandas<p>I have a dataset in a form of a pandas dataframe, the data has this form:</p>
<pre><code>file_path, label
- -
</code>... | <p>You can drop the last 20K rows on some condition using pandas <code>drop</code>.</p>
<pre><code>df.drop(df[df.labels == 0].index[-20000:], inplace=True)
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get first element of list or `None` when list is empty?<p>I can do it like this but there has to be better way:</p>
<pre class="lang-py prettyprint-ov... | <p>I think the example you give is absolutely fine - it is very readable and would not suffer performance issues.</p>
<p>You could use the ternary operator python equivalent, if you really want it to be shorter code:</p>
<pre><code>last_or_none = arr[0] if len(arr) > 0 else None
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pygame.MOUSEBUTTONDOWN not registering<p>For some reason I can't get <code>pygame.MOUSEBUTTONDOWN</code> to register on <code>pygame.event.get()</code>.</p>
... | <p>It is a matter of <a href="https://docs.python.org/3/reference/lexical_analysis.html" rel="nofollow noreferrer">Indentation</a>. In your code <code>event.type == pygame.MOUSEBUTTONDOWN</code> is evaluated only, if <code>event.type == pygame.KEYDOWN</code> is <code>True</code>. That's impossible, since <code>event.ty... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Applying a generic to a generic?<p>I'm trying to enforce typings to match expected inputs of a function in a record, I have the following:</p>
<pre><code>typ... | <p>From your use case it looks like you want:</p>
<pre><code>type ActionFunc<K extends Keyed> = (arg: Inputs[K]) => string;
const ActionMappings: { [K in Keyed]: ActionFunc<K> } = {
abc: (x) => {
// (parameter) x: ABC
return x.money.toFixed(2); // okay
}
}
</code></pre>
<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Where to place dispatch function for useReducer and why?<p>I'm new to React and I'm currently learning about useReducer.
I've created a simple login feature ... | <pre><code> if (credentials.isCredValid === true) {
alert ("Success!")
} else {
alert ('failed')
}
</code></pre>
<p>You are probably referring to above alert that you didn't immediately see "Success". That doesn't happen like that, just like with updating state, when you dispatch somet... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How is vector<vector<int>> "heavier" than vector<pair<int,int>>?<p>During a recent interview, I suggested using <code>vector<pair<int,int>></code... | <p>Each vector is a single contiguous area of memory, dynamically allocated.</p>
<p>Let's say that you have 1000 values you'll be working with.</p>
<pre><code>std::vector<std::pair<int, int>>
</code></pre>
<p>This gets you a single, contiguous block of memory, for 2000 integers.</p>
<pre><code>std::vector&l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JedisPool vs JedisPooled<p>Looking at the <a href="https://github.com/redis/jedis" rel="nofollow noreferrer">Jedis Getting Started</a>, I understand it's bet... | <p>With <code>JedisPool</code> you can do transactions, e.g., something like this:</p>
<pre class="lang-java prettyprint-override"><code>try (Jedis jedis = pool.getResource()) {
Transaction t = jedis.multi();
t.sadd("planets", "Venus");
t.sadd("planets", "Mars");
t.exec()... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
LiveData observer not triggered<p>I want to navigate to an other <code>Fragment</code> when the user selcts a value (player id) in the <code>AlertDialog</cod... | <p>You've to use shared viewmodel.</p>
<p>Update your fragment and dialog as well</p>
<pre><code>val viewModel: WelcomeViewModel by activityViewModels()
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I'm trying to use a div name as a variable to toggle a div on and off for multiple buttons<p>I have been trying to figure this out and I can't seem to do so ... | <p>Not tested:</p>
<pre><code>document.getElementById("someOtherBtn").addEventListener("click", function() {
myFunction("someOtherDiv");
});
function myFunction(theDivName) {
var x = document.getElementById(theDivName);
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.dis... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Conditional statement using two raster in R<p>I am trying to create this grid "<em>To divide the population grid into two segments: (A) population with ... | <p>You can use <code>terra::ifel</code> for that.</p>
<p>Example data</p>
<pre><code>library(terra)
set.seed(0)
ntl <- rast(nrow=50, ncol=20, val=sample(40, 1000, replace=TRUE))
pop <- rast(nrow=50, ncol=20, val=sample(0:10, 1000, replace=TRUE))
</code></pre>
<p>Solution</p>
<pre><code>x <- ifel(pop <= 1, N... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Porting ShaderToy Chromakey example to P5.js<p>I’m try to porting the shadertoy chromakey example to p5 with webcam as video source. After many time reading ... | <p>The mayor issue is, that you didn't specify and set the uniform variable <code>iResolution</code>. But there are some more issues in the shader code (<code>tex0</code> and <code>tex1</code> rather than <code>text0</code> and <code>text1</code>).</p>
<p>Fragment shader:</p>
<pre class="lang-c prettyprint-override">... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firebase onValue doesn't fire and i don't know why<p>I'm tryin to do a simple web3 app with Next/Js & Firebase.</p>
<p>People can connect with their wall... | <p>Are you sure the user has permission to read the data? If not, you'll get an error message in the console of where the code executes. Alternatively, you can also detect such a permissions error with:</p>
<pre><code>onValue(allPlayersRef, (snapshot) => {
...
}, (error) => {
console.error(error);
});
</code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to go to new line in index values of an array after each regular expression "\n" in JavaScript?<p>I am a beginner in JavaScript I tried to find a solutio... | <p>Would something like this help (separating each sentence and placing it on a new array):</p>
<pre><code>Arr.flatMap(x => x.split('\n').filter(t => t.trim() !== ''));
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
error: passing 'const obj' as 'this' argument discards qualifiers<p>The following code:</p>
<pre><code>#include <iostream>
#include <string>
#inc... | <p>You should make it a <code>const</code> member function explicitly:</p>
<pre><code> void show() const { cout << "addr = " << this << ", i_ = " << i_ << endl; }
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Selenium cannot target div in iframe only on Chrome<p>I have a div with a class attribute with the value <code>textLayer</code>. I'm trying to get that div.
... | <p>Try dynamic xpath with explicit wait.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Make a general function with years from a URL<p>Let's say I want to make a general function of a URL, for example: <a href="https://en.wikipedia.org/wiki/202... | <p>We could use <code>paste0</code>:</p>
<pre><code>read_url <- function(year){
paste0("https://en.wikipedia.org/wiki/",year)
}
read_url(2015)
</code></pre>
<pre><code>[1] "https://en.wikipedia.org/wiki/2015"
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Tag concatenation for displaying dictionaries dynamically<p>I Have a dictionary (dict_) returned from my view. inside the template i want to access specific ... | <p>Django's templates are <em>deliberately</em> restricted to make it inconvenient to perform dictionary lookups like that, or to make function calls (with parameters). The reason is that business logic is better written in the <em>view</em>, not in the template.</p>
<p>You can for example make the mapping in the view... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find a pattern on filenames - Python<p>I need to search all .xlsx files that have the following name: mg_YYYMMDD.xlsx
The YYYYMMDD date must be greater than ... | <p>One way would be to use the string itself as a comparison:</p>
<pre><code>lastdate = "20200122" #in the form YYYYMMDD
filenames = [fn for fn in os.listdir() if fn.endswith(".xlsx") and fn[0:3] == "mg_" and fn[3:-5] >= lastdate]
</code></pre>
<p>EDIT: To consider conversion from datetime
if last_date is from py... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I am sending attachments in the messages but the messages.attachements isn't showing any attachments in my discord js bot<p>This is the code for messageCreat... | <p>You're most likely missing the <code>MESSAGE_CONTENT</code> intent.</p>
<p>Go to <a href="https://discord.com/developers/applications/" rel="nofollow noreferrer">https://discord.com/developers/applications/</a> and enable the <code>Message Content Intent</code> in the Bot section.</p>
<p>Image for reference: <a href... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why Android Navigation Component screen not go back to previous Fragment,but a method in onViewCreated of previos Fragment being called?<p>I have 2 fragment ... | <p>Android maintains a back stack that contains the destinations you've visited. The first destination of your app is placed on the stack when the user opens the app. Each call to the <code>navigate()</code> method puts another destination on top of the stack. Tapping Up or Back calls the <code>NavController.navigateUp... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Make Pycharm treat single and double quotes the same in searches<p>I'm working on some code which is partly my own and partly copied from a colleague's progr... | <p>You can use regex in search box ".*" and operator OR with symbol "|":</p>
<p><a href="https://i.stack.imgur.com/LLVvi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LLVvi.png" alt="enter image description here" /></a></p>
<p>Thank you</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In React.js, I want to be able to search username without distinguishing between uppercase and lowercase letters<p>I am making a system that can get json dat... | <p>Make your data and search value in the same case (uppoerCase or lowerCase). Then compare with your search value.</p>
<p>You can try the below method:</p>
<p>Change the following line</p>
<pre><code>return output.firstName.includes(data.search)||output.lastName.includes(data.search);
</code></pre>
<p>to this line</p>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a circle radial gradient with custom size and position in CSS<p>I'm currently trying to recreate a rock paper scissors game using HTML CSS &... | <p>This could be achived with a combination of <code>border</code>,<code>box-shadow</code> and a <code>inset box-shadow</code></p>
<p>I've added a little snippet below to illustrate my solution</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code"... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to install mpi4py without sudo?<p>When I try to install mpi4py without sudo using <code>pip install</code> on Ubuntu 22, I get the following error (with ... | <p>Answer was to use conda instead of pip:</p>
<pre><code>conda install -c conda-forge mpi
conda install -c conda-forge mpi4py
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Parameter index out of range (1 > number of parameters, which is 0). output when attempting to save information to database<p>I created a small program where... | <p>You are missing the place holders <code>?</code> to put the values, your query should be :</p>
<pre><code>String sqlconn = "INSERT INTO userdata (UserID, LastName, FirstName, MiddleName," +
" Email, Sex, HomeAddress, City, CPUBrand, ComputerType, HardwareSpecs," +
" GPUBrand, GPUType, GPUVRAM) " +
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Read .csv and combine duplicate columns - pandas<p>I have a .csv file with 893 columns that I need to read into pandas (or R) to analyze. When the spreadshee... | <p>The problem is that you are creating a dict where the keys are not unique, so this can't be created in the form you want it to be (the values are just overwritten with the last one). The dict itself is then correctly handed to pandas and used to create the DataFrame.</p>
<p>You could use for example a different meth... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use the same singleton instance in Razor pages?<p>I'm writing an ASP.NET Core app and ran into the peculiar problem that my Razor pages seem to use di... | <p>The solution is to inject the service in the <code>IndexModel</code> constructor and not as a parameter to the page handler method.</p>
<pre><code>private readonly MyService _myService;
public IndexModel(MyService myService)
{
_myService = myService;
}
public async Task<IActionResult> OnPostAddAsync()
{... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Selecting and grouping multiple columns in dtplyr vs dplyr<p>I'd like to <code>group_by</code> <code>across</code> several variables in <code>dtplyr</code> w... | <p>It seems that the method for <code>group_by</code> with <code>dtplyr</code> (<code>group_by.dtplyr_step</code>) is creating the issue.</p>
<pre><code>> methods('group_by')
[1] group_by.data.frame* group_by.data.table* group_by.dtplyr_step*
</code></pre>
<p>Not sure if it is a bug or not.</p>
<pre><code>> tra... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I deploy commands to all guilds with discord.js?<p>I am writing a discord bot and I have a deploy-commands.js file. In it's current state it can only... | <p>Simply replace this lign</p>
<pre class="lang-js prettyprint-override"><code> rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
</code></pre>
<p>by</p>
<pre class="lang-js prettyprint-override"><code> rest.put(Routes.applicationCommands(clientId), { body: commands })
</code></pre>
<p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Alternative to POI's getCellNum method<p>I am working on a legacy system that uses the getCellNum method in</p>
<pre class="lang-xml prettyprint-override"><... | <p>It's listed in the <a href="http://javadox.com/org.apache.poi/poi/3.13/deprecated-list.html" rel="nofollow noreferrer">deprecated list</a>:</p>
<p><code>org.apache.poi.hssf.usermodel.HSSFCell.getCellNum(</code>)
(Oct 2008) use <a href="http://javadox.com/org.apache.poi/poi/3.13/org/apache/poi/hssf/usermod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How add to button second function on click, when was map and render ?(react)<p>How to add second function onClick, when was map and render i need to add clas... | <p>What I would recommend if you want the function to be dynamic, is to pass dynamic value, Also you are doing in the right way, just you need to understand, let me give you an example.</p>
<pre><code> function ButtonsDes({button, filter}) {
// button value is like button= ['green', 'blue', 'yellow']
retu... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular Material Table cannot show data<p>I'm following online tutorial to create a mat table to display some hard coded data. But the table is empty. I'm ne... | <p>If you do not have any other errors, correct your template data binding and add <code>matSort</code> directive to your <code>mat-table</code> table html tag. You are binding <code>[dataSource]</code> in your html to <code>data</code> property not <code>dataSource</code> property.</p>
<pre><code><table mat-table [... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rust loop - borrowed value does not live long enough<p>In a rebroadcaster (redis to zmq) implementation i am unable to figure out how to resolve the lifetime... | <p>This fails because the sink wants an <code>Into<Message></code> but doesn't apparently perform the conversion immediately, so the reference needs to continue to exist for some unspecified amount of time, and the values they refer to are destroyed too soon. Basically, you need to give the sink an owned value i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
OpenEdge ABL UI Freeze window until Popup closes<p>I'm using OpenEdge ABL to create a window that will run a secondary window on the touch of a button. Howev... | <p>I got around this was by adding: </p>
<pre><code> DO WITH FRAME {&FRAME-NAME}:
</code></pre>
<p>Making the sensitivity of the buttons false meant that they would not be pressed while the child window was running.</p>
<pre><code> ASSIGN CURRENT-WINDOW:SENSITIVE = FALSE.
RUN D:\adherenceEdit_12875-Win.w(IN... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Confusion when appending to slice<p>Can someone explain why in the first example if appending to y changes also x but in the second example it doesnt?</p>
<p... | <p>In the first case <code>y</code> has the same underlying array as <code>x</code> and as you append to <code>y</code> and everything fits into that array <code>x</code> is also affected.</p>
<p>In the second case <code>y</code> has the same underlying array as <code>x</code> as first, but when you try to append new v... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'administration/portfolio%20'<p>In the menu, when I click on <code>Portfolio... | <p>In your dashboard.component.html:</p>
<pre><code><a routerLink="{{ submenu.url }} "
</code></pre>
<p>should be</p>
<pre><code><a routerLink="{{ submenu.url }}"
</code></pre>
<p>This matches because <code>%20</code> is a space.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how get the title of a custom post type as link to its related post?<p>I want to get the post title of an custom post type and link it to its related post.
S... | <p>Use <code>get_permalink()</code> to obtain the current <code>$post</code>'s permalink.</p>
<pre><code>while (have_posts()) : the_post();
?>
<a href="<?= get_permalink() ?>"><?= sanitize_title(get_the_title()) ?></a>
<?php
endwhile;
</code></pre>
<p>In case you're using a very o... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is O((b-a)/c) the time complexity of list[a:b:c] in python3?<p>According to <a href="https://wiki.python.org/moin/TimeComplexity" rel="nofollow noreferrer">h... | <p>Surely it is. Getting a value from a list via its index, is O(1). Getting k items from a list via their indexes, is O(k). No matter you are getting them with steps or getting them without steps or even without slices:</p>
<pre class="lang-py prettyprint-override"><code>l = list(range(10))
l1 = l[1:6:2]
l2 = [l[1], l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
bs4 scraping data from HTML page<p>I'm new to bs4 and trying to scrape data from <code>table class="ids_table"</code>. Here is an HTML example:</p>... | <p>I don't really understand your 4th point, nonetheless:</p>
<pre><code>from bs4 import BeautifulSoup
import pandas as pd
html = '''<div class="table-wrap">
<table class="ids_table"><tbody>
<tr>
<td class="ids_td"><b>First string</b></td>
&... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Library method: Async or not?<p>I have gotten it through my head (perhaps incorrectly) that library methods that take some time should generally be made asyn... | <blockquote>
<p>The method Evaluate takes quite some time because it must call the algorithm method that is passed in many times. The algorithm method is not async.</p>
</blockquote>
<p>The <code>Evaluate</code> method works by timing execution. Since "asynchronous" usually means I/O, and since I/O is orders of magn... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Procmail/munpack: Extracting headers similar to text and attachments?<p>I currently have set up fetchmail to transfer mail to procmail and a .procmailrc file... | <p>You can easily save the headers separately, but of course you can't predict which file name <code>munpack</code> will assign to the extracted message.</p>
<pre><code>:0hc
headers
:0
| munpack -q -C "$FILE_DIR"
</code></pre>
<p>This simply writes the headers to <code>headers</code>. Perhaps you could add some logi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Removing specific word from WebElement text<p>Hello I am scraping a website using selenium which has a button named view profile whenever i scrape it shows m... | <p>You can get the text of the button alone and remove it</p>
<pre><code>for pp in driver.find_elements_by_class_name('results'):
button_text = pp.find_element_by_class_name('search-result__button').text
text = pp.text.replace(button_text, '')
print(text)
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to add multi-paged shinysurvey output to a modal dialog?<p>I have an rshiny app and I'd like to add a multi-paged survey using shinysurveys, b... | <p>I'm not sure why <code>surveyOutput</code> stops working inside a <code>modalDialog</code>, but if you wrap it with, for example, <code>basicPage</code> it works.</p>
<pre><code>showModal(modalDialog(
shiny::basicPage(
shinysurveys::surveyOutput(
survey,
survey_title = "Analyst... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does this code does not pass all test cases? (Finding the smallest positive integer in a given array)<p>For the following coding Challenge:</p>
<blockquo... | <pre><code>def solution(array):
smallest = 1
new_arr = list(set([i for i in array if i>0]))
new_arr.sort()
for i in new_arr:
if i<=smallest:
smallest+=1
else:
break
return smallest
x = solution([1, 3, 6, 4, 1, 2])
print(x) # 5
</code></pre>
<p>a little ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using same expected rows for multiple expected queries returns result just for the first one with sqlmock<p>I am writing tests with <code>sqlmock</code> in <... | <p>A quick glance at the <a href="https://github.com/DATA-DOG/go-sqlmock/blob/master/rows.go#L124" rel="nofollow noreferrer">source</a> suggests that the instance can't be re-used, you will have to create as many instances of <code>sqlmock.Rows</code> as the select queries that you expect. Each time your code calls <co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to load a different video for Dark Mode<p>I want to load a different video based on the light/dark mode?</p>
<p>I searched around, but only found how to... | <p>It's really unfortunate that <code>media</code> isn't supported on <code>source</code> elements inside of a <code>video</code> elements. This kind of leaves us needing to use multiple video tags (or javascript) like this:</p>
<pre class="lang-html prettyprint-override"><code><style>
.dark-video {
display... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I bind a Task<List<Card>> to Either<> with Language-Ext<p>I have devices (eg mobile phones, payment terminals, etc) that can request a list of cards h... | <p>When you use the</p>
<pre><code>from x in foo.ToAsync()
from y in bar.ToAsync()
</code></pre>
<p>syntax, all values must be in the same monad. Here you start with <code>GetDeviceSerialNumberFromToken().ToAsync()</code>, which is an <code>EitherAsync</code> value, so all subsequent values must also be <code>EitherAsy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.