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:
Do changes made with SharedPreferences.Editor survive a device reboot?<p>If an application stores something using <code>SharedPreferences.Editor</code>'s met... | <p>If you <code>commit()</code> or <code>apply()</code> the changes that you make in the <code>SharedPreferences.Editor</code>, then yes. <code>SharedPreferences</code> are saved in an XML file, and that file will survive an ordinary reboot.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do you return an object within an array.reduce?<p>I'm pretty new to JS and first time on here.</p>
<p>How do you return an object within an array.reduce?... | <p>If you want anything else/more than a value from the array, you'll benefit from using the second argument of <code>reduce</code>: the <em>initial</em> value of the accumulator. In this case the accumulator would be the currently "best" index, and so that accumulator initial value could be 0.</p>
<p>NB: ins... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python liste par compréhension<p>I would like to make my program in list comprehension but I can't do it.</p>
<pre><code>
n=int(input("Entrer la dimension d... | <p>If I understand your goal(to have a matrix where all the elements are zeros except where row and columns indexes are the same there should be ones) this could do the job.</p>
<pre><code>n = int(input("Dimension : "))
matrix = [[0 if row != column else 1 for column in range(n)] for row in range(n)]
print(matrix)
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
HttpClient GetStringAsync results are inconsistent<p>I have a very simple console application where the user can enter the name of a Twitch user to see if a ... | <p><code>Console.ReadKey()</code> is consuming the first character of your input, so the second time the string username will not contain "xqc", but "qc".</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scatterplot that is created according to color, shape and fill is not displayed when using ggplotly()<p>Im trying to create a scatter plot that codes my data... | <p>Just replace <code>plotOutput</code> by <code>plotlyOutput</code></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Azure Devops pipelines to trigger ONLY on Merge<p>I'm looking on a way to trigger a Azure pipeline ONLY on successful (or attempted) pull request merge.</p>
... | <blockquote>
<p>I'm looking on a way to trigger a Azure pipeline ONLY on successful (or attempted) pull request merge.</p>
</blockquote>
<p>There is no such out of box way to achieve this at this moment.</p>
<p>We could only set the CI trigger on the target branch, but we could set the condotion for the pipeline to avo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ruby YouTube Data API v3 insert caption always returns error<p>I am trying to use the Ruby SDK to upload videos to YouTube automatically. Inserting a video,... | <p>I looked at the OVERVIEW.md file included with the google-apis-youtube_v3 gem, and it referred to the <a href="https://github.com/googleapis/google-api-ruby-client/blob/main/docs/usage-guide.md" rel="nofollow noreferrer">Google simple REST client Usage Guide</a>, which in turn mentions that most object properties do... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Merge rows in pandas dataframe and sum them<p>suppose I have a dataframe as below:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<... | <p>try:</p>
<pre class="lang-py prettyprint-override"><code>df.groupby(df.Name.str.lower()).count()
</code></pre>
<p>Output:</p>
<pre class="lang-py prettyprint-override"><code> Name Date
Name
first 4 4
</code></pre>
<p>After that you can select the columns that you want like <code>['Date']<... |
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 convert 'char**' to 'double' in assignment in C++?<p>I am trying to limit user input execution to numbers only, when they enter a / b inste... | <p>I have just solved the Issue and make it possible to convert char** to double by using the Reference of <strong>Victor Gubin</strong> and <strong>Anonymous</strong> from the above comments on the questioned post.
Here is the code but if you found any bug please let me know with a fix.</p>
<pre><code>#include <i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to write DSL Highlight to NEST queries Highlight?<p>I want to write <a href="https://stackoverflow.com/a/45202880/18844847">this</a> DSL query into NEST ... | <p>You cannot pass string to property Fields.</p>
<p>Syntax for it is as below</p>
<pre><code>.Fields(
fs => fs
.Field(p => p.Name),
fs => fs
.Field(p => p.LeadDeveloper)
.PreTags("<name>")
.PostTags("</name>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to plot combo plot in R using ggplot<p>my data frame i am using is
<a href="https://i.stack.imgur.com/1lKFU.png" rel="nofollow noreferrer"><img src="http... | <p>As the message suggest you have to set the <code>group</code> aes and as you probably want colored lines you have to map on the <code>color</code> aes additionally. Also note, that your columns are not numerics but characters. Hence you have to convert them to numerics and instead format as percentages via the <code... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is "Process finished with exit code 500" ?<p>When I run App1 project to started another process(App2.exe), the program quickly exited itself, and then I... | <p>The above problem occurs when I run it in Rider, but it does not occur when I run it in Visual Studio.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
build regex match pattern for GitHub branches<p>I'm fairly new to bash scripting and regex, but I'm trying to learn. So far, I've gotten this:</p>
<pre><cod... | <p>You are not very clear on your requirements but from what I gather this should cover them all:</p>
<pre><code>^[[:alpha:]][[:alnum:]_-]+$
</code></pre>
<p><a href="https://regex101.com/r/M4ULDF/1" rel="nofollow noreferrer">Online demo</a></p>
<p>Explanation:</p>
<ul>
<li><code>^</code> - start matching from the ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error Using Emit from thread with flask socketio python3<p>I'm trying to build an anpplication, that serve a page via web with flask, meanwhile in background... | <p>The <code>emit()</code> function uses some defaults that come from the request context. If you want to use this function in a place where there is no request context then you have to provide more arguments. In particular, you need to add <code>room</code> to indicate who is the recipient of the message, and <code>na... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Oracle SQL conditional operator explanation<p>Please, may I ask if anyone can explain more on the following oracle sql conditional operator please ?
I only h... | <p>The decode is basically checking the day of the week and returns some magic number = 4, which seems to be some enumerator for status. Anyway, to add the Friday after 11 pm will be:</p>
<pre><code>SELECT CASE WHEN TO_CHAR(SYSDATE,'DY') = 'FRI' AND EXTRACT(HOUR FROM CAST(SYSDATE AS TIMESTAMP)) >= 23 THEN 4
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get id of specific record in a table - PHP<p>I am trying to change the value of the is_public column in the MySQL article table using a toggle switch... | <p>Well, You can send the article id in your form and then listen to it and do what you want with it. So,</p>
<pre><code>// As you are already in foreach loop so,
<form action="all-articles.php" method="post">
<label class="custom-toggle">
<?php if($article['is_public']): ?>
<in... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sysprep an Azure VM using PowerShell task in a pipeline<p>My (dotNET) application is built (using a Windows Hosted agent), from a build pipeline, and in the ... | <p>I tried this and got what I wanted:</p>
<pre><code>$sysprep= 'C:\Windows\System32\Sysprep\Sysprep.exe'
$arg1 = '/generalize'
$arg2 = '/oobe'
$arg3 = '/shutdown'
$arg4 = '/quiet'
& $sysprep $arg1 $arg2 $arg3 $arg4 -Wait
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Android HERE SDK lite: Place Here logo to another<p>Is it possible to place the HERE logo in the MapviewLiteView to another place instead of the lower right?... | <p>HERE SDK lite for Android doesn't offer class for LogoPosition changes. However premium does. </p>
<p>For more details please refer the different positions premium allow : </p>
<p><a href="https://developer.here.com/documentation/android-starter/api_reference_java/com/here/android/mpa/common/CopyrightLogoPosition.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make a button conditional in Oracle Forms<p>I am very new to oracle forms and I have to make a button conditional on my form.</p>
<p>The visibility of... | <p>Use the <code>set_item_property</code> built-in and its <code>displayed</code> property.</p>
<p>You didn't explain how to know who is who, so I'll guess that it is contained in a global variable, so you'd then</p>
<pre><code>if :global.user_role = 'super_admin' then
set_item_property ('employees.btn_create_depart... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In fluid, how do I use a widget only if it exists?<p>I am making a sitepackage to be compatible with TYPO3 9 & 10. However it is using the news extension... | <p>By default there is no such condition.</p>
<p>You might define a view helper to check the installation of an extension and the extension version. Or you use a view helper to check the existence of a class representing the view helper.</p>
<p>In <a href="https://extensions.typo3.org/extension/vhs" rel="nofollow noref... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I correctly type a set and implement it?<p>I want a typing for an object that replicates a set. For instance, I wish to have the transaction id as a ... | <p>Given the id is <code>const id: TransactionId = transactionDetails.id;</code> then the <code>id</code> should be used as a dynamic object key instead of the literal key <code>"id"</code>.</p>
<p>Example:</p>
<pre><code>const id: TransactionId = transactionDetails.id;
...
handleTransactionDataSync({ [id]:... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I get an error when trying to compare dates in Python pandas dataframe<p>I am trying to iterate through rows in a .csv file and perform some calculations if ... | <p>The variable <code>Flag</code> in you code is a <code>pandas Series</code>. You cannot evaluate it with <code>Flag>0</code>.</p>
<p>The error shows you the permitted operations on pandas Series i.e., <code>.empty(), .bool(), etc.</code>.</p>
<p>When you print the value of <code>Flag</code> it prints the Series ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
samesite none in thirdparty shopify app not working<p>we are trying to set the samesite=none;secure in shopify app which is opening in iframe but we realised... | <p>if you are using Shoify app gem, and dont want to upgrade your shopify_app or shopify api lib you can install this rails_sate_site_cookie gem</p>
<p><a href="https://github.com/pschinis/rails_same_site_cookie" rel="nofollow noreferrer">https://github.com/pschinis/rails_same_site_cookie</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ansible loop to create docker networks<p>Suppose I have my docker networks defined in a variable such as:</p>
<pre><code>docker_networks:
- name: default
... | <p>If you modify your <code>docker_networks</code> variable so that the value of the <code>ipam_options</code> key is a list of dictionaries:</p>
<pre><code>docker_networks:
- name: proxy
driver: bridge
ipam_options:
- subnet: '192.168.100.0/24'
- name: socket_proxy
driver: bridge
ipam_options... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can I submit a job that may be executed in different partitions<p>When using the parameter <code>-p</code> you can define the partition for your job.
In my c... | <p>The <code>--partition</code> option accepts a list of partition. So in your case you would write</p>
<pre><code>#SBATCH --partition=p1,p3
</code></pre>
<p>The job will start in the partition that offers the resources the earliest.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
OAuth issue in API gateway<p>I am facing the OAuth issue, details are below:
I am having two microservices:
registration-service(<a href="https://github.com/... | <p>Working after adding cors, complete code below for SecurityWebFilterChain's method :</p>
<pre><code>http
.exceptionHandling()
.authenticationEntryPoint((swe, e) -> {
return Mono.fromRunnable(() -> {
swe.getResponse().setStatusCode(HttpStatus.UNAUTHOR... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unexpected C behavior involving pointers<p>I'm tryng to let a <code>char*</code> variable point to a malloc'd string but something really wrong is happening ... | <p>Your <code>connection_t</code> merely has a plain <code>struct sockaddr addr</code> member, which is just the base structure. The actual data size needed varies based on the protocol. When I run your code, <code>con</code> is allocated at …29a0 and has 24 bytes, but the <code>strncpy</code> attempts to write 41 byte... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Counting text elements in pandas DataFrame where items are not strictly unique<p>I am attempting to count specific words or phrases per rows in a DataFrame, ... | <p>You can try using regular expression to extract various alternatives to string "burgers":</p>
<pre class="lang-py prettyprint-override"><code>tmp = df["Text"].str.findall(r"burgers\s*(legacy|V2)?").explode()
df = pd.concat([df, pd.crosstab(tmp.index, tmp).add_prefix("burgers "... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to read .xlsx data and push to array in .js script for photoshop<p>How to read .xlsx data and push to array in .js script for photoshop
defaultkrt0iuh8hl... | <p>If your.xlxs file is exported as a .csv it'll look like this:</p>
<pre><code>WXY-111,"Temp1, Temp2, Temp3, Temp4"
WXY-222,"Temp2, Temp3, Temp4, Temp5"
WXY-333,"Temp3, Temp4, Temp5, Temp6"
YX-111,"Temp4, Temp5, Temp6, Temp7"
XY-222,"Temp5, Temp6, Temp7, Temp8"
XY-333,... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Attach customer details to Stripe Payment Intent<p>I am migrating from the 'Card Element' to the 'Payment Element' and have got the payments working successf... | <p>Based on your code, your frontend is calling your backend to create the PaymentIntent here:</p>
<pre><code>const response = await fetch("/cart/create-payment-intent", { method: "POST", headers: { "Content-Type": "application/json" } });
</code></pre>
<p>However the user has no... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
can't display sub array length in vuejs<p>I have an array of categories. Categories can have some tasks and I want to count the number of tasks.</p>
<pre cla... | <p>I run your code in the snipped and work fine, but as @Laurens points you need to have the correct structure or check if exist or not like I show you in this example:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-cod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Place an element relative to another under a very specific circumstance<p>I want to place an element above the top right corner of a Youtube Video (an iframe... | <p>If you copy those <code>aspect-ratio</code> and <code>max-width</code> rules to an inner container, you can then have the X float relative to the video's width.</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... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Basic Working Example of an XXE Attack in HTML<p>I'm trying to run some tests with XXE attacks in an html page, but i'm having trouble coming up with a worki... | <p>See <a href="https://owasp.org/www-community/vulnerabilities/XML_External_Entity_(XXE)_Processing" rel="nofollow noreferrer">OWASP</a></p>
<p>Among the Risk Factors is:</p>
<blockquote>
<p>The application parses XML documents.</p>
</blockquote>
<p>Now, script elements are defined (in HTML 4 terms) as containing... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Console warning when migrating from the MaterialUI lab<p>When I run my MUI app, I get this error in the console</p>
<p><strong>Warning: forwardRef render fu... | <p>Don't import Lab components like this</p>
<p><code>import { LoadingButton } from '@mui/lab'</code></p>
<p>Use this:</p>
<p><code>import LoadingButton from '@mui/lab/LoadingButton'</code></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the best way to handle a JSON API response which returns 200 regardless of error or not<p>So I am making a Guzzle HTTP request to some unreliable sou... | <p><code>$result = json_decode($res);</code></p>
<p><code>if(!isset($result->error))...</code></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
make template class with std::vector<T> non-copyable when T is non-copyable<pre class="lang-cpp prettyprint-override"><code>#include <vector>
#include ... | <p>The special copy assignment operator is never a template.
In <a href="https://cppinsights.io/s/272f1dca" rel="nofollow noreferrer">cpp insights</a> we can see that the compiler will generate a non-template copy assignment operator in addition to the template operator you provided.</p>
<p>You can conditionally disabl... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the use of i in `printf("%d\n",(a->ptr)[i]);`?<p>Hey guys I am currently learning DSA and in ADT I have a problem:
This is a code that creates a cust... | <p>The data member ptr points to a dynamically allocated array</p>
<pre><code>a->ptr = (int *) malloc(tSize * sizeof(int));
</code></pre>
<p>To access elements of the array you can use the subscript operator</p>
<pre><code> printf("%d\n",(a->ptr)[i]);
</code></pre>
<p>To make it more clear consider the ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Parse csproj file using cake's ParseProject<p>Create minimal repro project:</p>
<pre class="lang-bash prettyprint-override"><code>dotnet new classlib --no-re... | <p>Out of box, the <code>ParseProject</code> alias within Cake (version 2.2.0), only knows how to parse Visual Studio Project files that are using the "old" format.</p>
<p>Since the Visual Studio Project file that you are creating is using the "new" format (i.e. it was generated using the dotnet CLI... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python float range as dictionary index<p>I need to use numeric (Float) ranges as a dictionary index. Consider my following code:</p>
<pre><code>def range_in... | <p>Well the obvious fix will be to adjust the comparison of <code>val</code> properly:</p>
<pre class="lang-py prettyprint-override"><code>if k1 <= val < k2:
</code></pre>
<hr>
<p>But beyond that, you are actually iterating through the dict's keys for each <code>val</code> - that's <code>O(N)</code> in the wor... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use retrofit to transfer parameters in parameters?<p>On the site jsonschema2pojo described the data that I need to transfer.
Using retrofit forward js... | <p>Please use this </p>
<pre><code>String mLat = "lat value"; // value of latitude
String mLong = "long value"; // value of longitude
NewOrderRequest newOrderRequest = new NewOrderRequest();
newOrderRequest.setPhone("911");
newOrderRequest.setDelivery(new Delivery(mLat, mLong)); //use this here
NetworkServic... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
overriding virtual function return type differs and is not covariant in Data Structure<p>When i am trying to compile i get a strange error : "overriding virt... | <p>While <code>BSTree<T></code> is derived from <code>BTree<T></code>, there is no relationship between <code>BSTree<T>::Node</code> and <code>BTree<T>::Node</code>. Therefore, a pointer to the latter cannot be converted to a pointer to the former. <code>BTree<T>::search</code> returns a p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
POST https://accounts.spotify.com/api/token 415 Unsupported Media when using fetch<p>I'm trying to make a request to get an authorization code from the spoti... | <p>I added "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" and encoded my json body and it's all working now</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
react native navigation after checking the authStatechanged using firebase<p>i'm try to start my application on a loadingScreen where it would check if there... | <p>after several tried using a <code>state</code>, I observed that the state doesnt update immediately Ex:</p>
<pre><code>state={
userState:'ha'
}
componentDidMount(){
console.log('up',this.state.userState)
f.auth().onAuthStateChanged(user=>this.setState({ userState: 'hi' }, () =>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Draw only rectangle's angles c# unity<p>I am trying to make a harmeless esp for Ghost Watcher (a new ghost game). However I have a question: how could I rend... | <p>The problem is in your math for finding the midpoints of the lines.</p>
<p><code>(x+w)/2</code> is incorrect (this is the average between X and width), you should instead use <code>x+(w/2)</code>. Likewise with Y.</p>
<p>Also, your line for P12 is +20, instead of -20.</p>
<pre class="lang-cs prettyprint-override"><c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spark Streaming subscribe multiple topics and write into multiple topics<p>I have some kafkas topics with the nomenclatures below:</p>
<pre><code>'ingestion_... | <p>The outgoing dataframe to <code>format("kafka")</code> can include a String column named <code>topic</code> which will determine where the <code>value</code> and/or <code>key</code> byte/string columns will be produced to, rather than using <code>option</code>, as documented...</p>
<p><a href="https://spar... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What does the index method does in postscript?<p>I don't understand what the index <code>method</code> does in postscript?</p>
<p>Let's take this code for e... | <p>Do you have a copy of the PostScript Language Reference Manual ? If you want to program in PostScript you're going to need it.</p>
<p>The index operator is defined on page 610 of the 3rd Edition PLRM:</p>
<p><strong>index</strong> anyn … any0 n index anyn … any0 anyn</p>
<p>removes the nonnegative integer n from ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Populating a dropdown list with a stored procedure (showing usernames) then showing the users full name instead of username - slow<p>I have a drop down -</p>... | <p>It is possible your context creation at each iteration may takes time. Could you try this :</p>
<pre><code> private void GetUsers()
{
OriginatorDropDown.Items.Clear();
OriginatorDropDown.DataSource = GetUserData();
OriginatorDropDown.DataBind();
using (PrincipalContext pc = new ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MUI-X DatePicker: onDaySelect/onChange does not return date of provided type<p>I want to create a DatePicker with which I can select multiple days.... (no ra... | <p>At first glance, the problem appears to be your adapter. You claim to be using Luxon. However, your <code><LocalizationProvider></code> <em>dateAdapter</em> property is set to use the <strong>date-fns</strong> adapter.</p>
<p>Replace the date-fns adapter with the Luxon adapter:</p>
<pre class="lang-js prettypr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
getting incorrect date while converting web api result<p>For a web service call, I am getting back <code>JSON</code> result where <code>sampleValues</code> r... | <p>Judging by your use of <code>TimeSpan.Zero</code>, you want to assume that the time is UTC. I would therefore recommend simply replacing the code with the following:</p>
<pre><code>DateTimeOffset.FromUnixTimeMilliseconds(1579862181821471800 / 1000000)
</code></pre>
<p>Where <code>1000000</code> is the factor betwe... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
remove list elements based on pattern match<p>I have some code that reads in many Excel files from a folder.</p>
<p>Sometimes, there is a file lock on one of... | <p>Right now you're finding strings that are exactly <code>\~$</code>, not <code>...\~$...</code>. What you need is:</p>
<pre><code>pattern = re.compile(r'.+?\\~\$.+')
</code></pre>
<p><code>.+</code> means match as many characters as few times as possible until <code>\~$</code> is found.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add a string to another from a function<p>I have a string called <code>x</code> and function called <code>my_func</code>. I want to add a string to th... | <p>Your variable <code>x</code> is local, it has to be inside the function for it to work:</p>
<pre><code>x = ""
def my_func(x):
x += "Hello World"
return x
x = my_func(x)
x = my_func(x)
print(x)
</code></pre>
<p>gives:</p>
<pre><code>Hello WorldHello World
</code></pre>
<p>The trick is to r... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Subsetting plots in R with pairs function<p>I have a simple question however I can't find the answer. I have a dataset in <code>R</code> with 1000 rows and 5... | <p>With <code>plot</code> and a <code>for</code> loop, you could do:</p>
<pre class="lang-r prettyprint-override"><code>par(mfrow = c(2, 2))
for (i in seq(ncol(data))[-1]){
plot(data[, 1], data[, i], xlab = "A", ylab = colnames(data)[i])
abline(lm(data[, 1] ~ data[, i]), col = "red")
}
</code></... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to get a week's date with autohotkey<p>i'm using autohotkey to work with date, i need to catch the day a week ago</p>
<p>example</p>
<p>if today is the... | <p>Just subtracting numbers would be bad when you encountered a change between months.<br>
Would have to create custom logic for that. </p>
<p>Luckily AutoHotkey's <code>+=</code> operator supports <a href="https://www.autohotkey.com/docs/commands/EnvAdd.htm" rel="nofollow noreferrer">date/time math</a>.<br>
So this i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: How to sum dict values with shared key<p>I have json format key value pairs need to sum only values of another key inside same set if same key.</p>
<... | <p>Here's what I came up with. It sorts the list. Then uses <code>itertools.groupby</code> to group by the key. Then builds a new dictionary with that group.</p>
<pre><code>obj=[{'A': 1, 'X': 5}, {'B' : 5, 'X': 2 },{'A': 1, 'X': 8}]
sorted_list = sorted(obj, key=lambda x: next(iter(x.items())))
res = []
for key,group i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I properly use Material UI breakpoints with styled components?<p>I have:</p>
<pre><code>const FooterBox = styled(Box)`
background: #4e738a;
left:... | <p>You got this error because you are using <strong>styled</strong> from the
<strong>@emotion</strong> package, to avoid this use <strong>styled</strong> from the <strong>@mui</strong> package.</p>
<p>This also fixes other issues with the MUI theme in Typescript:</p>
<ul>
<li><code>Property 'shapes' does not exist on t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do you find out the cause of rare crashes that are caused by things that are not caught by try catch (access violation, divide by zero, etc.)?<p>I am a .... | <p>C++ is meant to be a high performance language and checks are expensive. You can't run at C++ speeds and at the same time have all sorts of checks. It is by design.</p>
<p>Running .Net this way is akin to running C++ in debug mode with sanitizers on. So if you want to run your application with all the information yo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why isn't "--force-recreate" rebuilding my docker mysql image?<p>I had created a docker MySql 5.7 image, and then wanted to change a couple of names. My doc... | <p>Tell docker-compose to remove the image by passing in the <code>--rmi</code> flag to down: </p>
<p><code>docker-compose down --rmi all</code> </p>
<p>This tells compose to stop and remove all containers, networks, and remove all images used by any service in your docker-compose file. Additionally, you can pass <... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Load var n from localStorage and loop n times<p>I'm trying to learn JS and this is my little app.</p>
<p>Every time I press the "INSTANTIATE" button, it ins... | <p>First of all, you have to declare <code>i</code> outside your function (in case you haven't done it already) and give it a value of zero, if it isn't exist in the Local Storage:</p>
<pre class="lang-js prettyprint-override"><code>let i = localStorage.getItem("apples") || 0;
</code></pre>
<p>Then, create a loop, th... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't run jupyter notebook with pip<p>Just trying to run jupyter notebook with pip. What the hell is happening? I tried to run it like this "python -m notebo... | <p>Your local installation of jupyter via pip is conflicting with your Anaconda installation. There are some situations where you may need more than one instance of python (e.g. if you need to test code with different versions of python, or some applications require a separate instance, but you seem like you might want... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PHP to extract specific words<p>I have a string like the below in a variable called $CPU. The text is below, my target is to pull specific element of the bel... | <p>It's a JSON! So if it works for JS it will work for PHP:</p>
<pre><code>$arr = json_decode($CPU, true);
echo $arr[0]["entries"]["entry"][0];
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
<div class="snippet-code snippet-currently-hid... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
merge multiple Pandas dataframe<p>I have three dataframes that look like the following:</p>
<pre><code>df1 df2 df3
name ... | <p>For multiple <code>merge</code> you can use <a href="https://docs.python.org/3/library/functools.html#functools.reduce" rel="nofollow noreferrer"><code>functools.reduce</code></a>.</p>
<pre><code>from functools import reduce
df = reduce(lambda x,y : x.merge(y, on='name'), [df1, df2, df3])
# this work like this : df1... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is the use of (arr+2)[0] right?<p>I am a student who will be a freshman in an university after this summer vacation.I want to learn about computer programing... | <p><strong>Is the use of (arr+2)[0] right?</strong></p>
<p>Linguistically yes. But very questionable practice.</p>
<p>The beautiful invention of C is pointer arithmetic and that is exemplified by the definition of the subscript operator <code>[]</code> is that <code>E1[E2]</code> is identical to <code>(*((E1)+(E2)))</c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Overridden interface method that has parameters that are never used<p>New to Java coming from C++/Python and I found this in code today (not exactly this but... | <p><code>Why not have multiple methods then for the interface?</code></p>
<p><code>FilenameFilter</code> is a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html" rel="nofollow noreferrer">functional interace</a> and in functional interface you can't have more than 1 abstract meth... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ValueError:too many values to unpack<p>I'm a beginner and, when I try to transform date time to mins, I get the error:</p>
<pre><code>ValueError: too many va... | <p>You are getting the error because <code>t.strip().split(":")</code> returns 4 values and you are trying to put them into <code>m,s,l</code>.</p>
<p>You should replace your second line with:</p>
<pre class="lang-py prettyprint-override"><code>_,m,s,l = t.strip().split(":")
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Assigning value to char pointer directly after malloc is causing Segmentation error<p>I am trying to perform a simple string manipulation (strcat) on a char ... | <p>When you do</p>
<pre><code>str = "Batman";`
</code></pre>
<p><code>str</code> no longer points to the malloc'ed memory. It point to the string literal "batman". So you are not allowed to concatenate the other string.</p>
<p>A way to see this is to add some simple printing - try:</p>
<pre><code>char *str;
str = m... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Iam getting console output as [object HTMLLIElement]<pre><code>function render()
{
value="";
b="";
for(i=0;i<... | <p>when you append <code>value</code> to the variable <code>b</code></p>
<p><code>value</code> is <a href="https://www.w3schools.com/jsref/dom_obj_all.asp" rel="nofollow noreferrer">DOM object</a></p>
<p>so if you want the string for HTML you can use <code>outerHTML</code> property</p>
<pre><code>function render()
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How create dict from Pydantic (Enum)?<p>I have some object with Pydantic's class.
I have to create dict from object.</p>
<pre><code>from enum import Enum
fr... | <p>Use <code>use_enum_values = True</code> <a href="https://pydantic-docs.helpmanual.io/usage/model_config/#options" rel="nofollow noreferrer">option</a>.</p>
<blockquote>
<p>whether to populate models with the value property of enums, rather than the raw enum. This may be useful if you want to serialise model.dict() l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Show checkbox as if unchecked when printing?<p>I have a website with a list of checkboxes that can be used for printing as well. Though when printing it shou... | <p>I suggest following approach. </p>
<p>In print you want just the border square box which can be manually ticked, right? </p>
<p>So in print CSS you might just change the design of check boxes so that you hide the original checkbox html , doesn't matter if checked or not. And then just style or show a square border... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Limit of 16 cardreaders in pcsc on Ubuntu Server<p>I have 24 cardreaders in pcsc on Ubuntu server 20.04.
I have read that pcsc has a limit of 16 readers &... | <p>Editing a C header or source files has no effect on the running program.</p>
<p>After editing the source file I think you should recompile the project to facilitate the changes in the executables.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When to use Spring Prototype vs Request vs Session scope? Any real life example<p>I want to know when should I exactly use the <strong>prototype</strong>, <s... | <p>Here is an explanation of Spring bean scopes with associated examples:</p>
<p><strong>Prototype</strong></p>
<p>What-> it provides a different instance every time for each request<br>
When-> your bean contains a state (i.e. object attributes) which you want to keep isolated, and you want to be sure it does not get... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How exactly does shallow copy on Case Classes work in Scala?<p>I'm a beginner in Scala, and I'm confused on how shallow copy works for case class <code>var</... | <p>Your code is equivalent to the one in the linked <strong>question</strong> (as opposed to the answer), with </p>
<pre><code> entity2.unique = false
</code></pre>
<p>corresponding to</p>
<pre><code> p1.firstname = "raghu"
</code></pre>
<p>In the answer</p>
<pre><code> a1.l.remove(1)
</code></pre>
<p>doesn't rea... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I determine the number of runs I need to carry out in a netlogo to reduce the influence of randomization?<p><a href="https://i.stack.imgur.com/A4oCL.j... | <p>If each simulation is considered one observation in a sample, your sample size (number of simulations) should be large enough so that estimate of the parameter of interest approaches the true population value for the model (See Cowled, B.D., Garner, M.G., Negus, K., Ward, M.P., 2012. Controlling disease outbreaks in... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
encode a 0-1 matrix from an integer matrix numpy<p>So I have an <code>n*K</code> integer matrix [<em>Note</em>: its a representation of the number of samples... | <p>from @michael-szczesny comment</p>
<pre><code>a = np.array([[0,1,0,0,2,0],
[0,0,1,0,0,0],
[3,0,0,0,0,0],
])
b = (np.arange(1, a.max()+1)[:,None] <= a[:,None]).astype('uint8')
</code></pre>
<p>print(b)</p>
<pre><code>array([[[0, 1, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 0],
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to activate specific Anaconda env in Bash shell<p>How can I activate a specific Anaconda Python environment in a Bash shell script (using Git Bash comman... | <p>By executing test.sh by</p>
<pre><code>sh test.sh
</code></pre>
<p>you are explicitly running as a shell script, and <code>print("Hello")</code> is not a valid shell command. You should run it as a Python script. If Python is in your PATH, this would be done by</p>
<pre><code>python test.sh
</code></pre>
<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unexpected namespace declaration<p>I'm porting old transformations to a new transformation platform (based on Saxon 9.9). I have an issue where the new platf... | <p>If you want your result element(s) to be in that namespace then use e.g. <code>xmlns="http://root.invalid"</code> on the <code>xsl:stylesheet</code> or at least on the literal result <code>id</code> elements e.g. <code><id xmlns="http://root.invalid" .../></code>. Or use an <code>xsl:copy</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Errors Servlet.service() for servlet [dispatcherServlet] in context with path AND Syntax error in SQL statement<p>I'm following a course, and instead of givi... | <p>If you look in your error message you can see that there is a little asterisk <code>[*]</code> in it. This asterisk marks out where your syntax error is.</p>
<pre><code>Syntax error in SQL statement
"select user0_.id as id1_0_0_,
user0_.email as email2_0_0_,
user0_.name as name3_0_0_,
user0_.pa... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
value?.min != nil ? value!.min : nil not force unwrapping writing Optional(some number)<pre><code>func myFunc(array:[Int]) -> (min: Int, max: Int)?
{
... | <pre><code>value?.min != nil ? value!.min : nil
</code></pre>
<p>is a (conditional) <em>expression</em> and evaluates to some value which has a <em>type.</em></p>
<p>The first expression <code>value!.min</code> has the type <code>Int</code>, but the second expression <code>nil</code> is an optional and has the type <... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trying to determine length of time from a set date to current date from a table in SQL<p>I have an employees table:</p>
<p><a href="https://i.stack.imgur.co... | <p>You need to select the columns that you want. These appear to be:</p>
<pre><code>SELECT EmployeeName, Team, DATEDIFF(month, StartDate, getdate())
FROM employees
WHERE EmployeeName IN ('Luke', 'Helen');
</code></pre>
<p>The <code>DATEDIFF()</code> goes in the <code>SELECT</code>, not the <code>WHERE</code>.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to suppress the single quote character in an echo command?<p>If I execute this command directly from CLI, I don't have any problem:</p>
<pre><code>~ # a... | <p><code>NOVERBOSE</code> should be a flag that indicates the <em>desire</em> to suppress output, not the syntax to do so. You then test the value and redirect output (or not) as appropriate.</p>
<pre><code>if [[ $NOVERBOSE = [Yy]* ]]; then # e.g., y, Y, yes, Yes, etc
apt autoremove > /dev/null 2> /dev/null... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Attempting to Submit HTML Form to Database Has Blank Output<p><strong>I am new to PHP and web development, and trying to create an HTML form that will submit... | <p>The <a href="https://www.php.net/manual/en/function.isset.php" rel="nofollow noreferrer"><code>isset</code></a> function returns if the variable is declared or not -> the return type is a <strong>boolean</strong>.</p>
<pre class="lang-php prettyprint-override"><code>$test = [
"hello" => "wor... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ajax is not submiting proper value with GET method and with POST always blank,<p>I am trying to send data to my function in word press using ajax but its not... | <p>Need to remove following</p>
<pre><code>contentType : false,
processData: false,
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why selector "input:read-only, input:-moz-read-only" won't work on Google Chrome?<p>Why selector <code>input:read-only, input:-moz-read-only</code> won't wor... | <p>As @Paulie_D said, "... you can't combine vendor prefixed selectors. Separate them.".
Similar question was already <a href="https://stackoverflow.com/questions/16982449/why-isnt-it-possible-to-combine-vendor-specific-pseudo-elements-classes-into-on">answered on stackoverflow</a>.
I close the question.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multisite TYPO3 v9, distinct robots.txt for multiple domains on one rootpage<p>For marketing purposes do I maintain one identical website with two different ... | <p>I like to stay within the 'regular' solutions so I found a middleground:</p>
<p>in the backend you enter a <code>Route Type = Page, File or URL [uri]</code></p>
<p>with value <code>t3://page?type=201</code> so as to address a page type for robots</p>
<p>and with Typoscript you define your conditional robots file:... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Transform a map data structure on terraform<p>I'm struggling with my head trying to transform (or convert) the next terraform map:</p>
<pre><code> clients =... | <p>This took a while to figure out, and is also complex enough that explaining it would be a lot, but here is the solution. Given the above structure in the question defined in <code>locals</code> as <code>clients</code>:</p>
<pre><code>locals {
sites_per_client_reconstruct = flatten([
for client, client_attrs in... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filling gaps before, between and after spells (date ranges) in R<p>Imagine that you have a data frame of three study participants with their dates of entry (... | <p>Here is a <code>data.table</code> option:</p>
<pre><code>#calculate spell_start
ans <- placement_dates[participants, on=.(id), by=.EACHI,
.(spell_start=sort(unique(c(doe, placement_start, placement_end+1L))))]
#calculate and populate spell_end
ans[, spell_end := shift(spell_start, -1L) - 1L, id]
ans[is.na(s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to set the background color for files of different types in Visual Studio Code?<p><strong>settings.json</strong> allows to define the background color fo... | <p>The built-in features of VSCode do not allow you to customize the background color depending on the file type.
There is an extension <a href="https://marketplace.visualstudio.com/items?itemName=jsaulou.theme-by-language" rel="nofollow noreferrer">Theme by language</a>. It allows you to customize the theme of VSCode ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is clock_gettime() correctly implemented in MinGW GCC 8.2.0?<p>By chance, I found out about the existence of the <code>clock_gettime()</code> function for Li... | <p>That loop should get optimized out to nothing at all, so with a low resolution clock (resolution is not necessarily individual nanoseconds; it may advance in much larger units which <code>clock_getres</code> should be able to tell you) 0 is a plausible result. But you have a few other bugs in your code like mixing <... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dropdown does not show values<p>I am trying to create a drop down with multi select options (don't look at the content, its for tests only).</p>
<p>I added c... | <p>Be sure to implement your script tag for jQuery correct:</p>
<pre class="lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</code></pre>
<p>Then your code is running.</p>
<p><div class="snippet" data-lang="js" data-hid... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using asp-for TagHelper in Partial Page<p>I've created a ViewComponent to show Popups in my WebApp, this VC is only used as a shell for html (using bootstrap... | <p>The @page on the top of the partial is null, which is causing this error. </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex match word with alphabets + number but not just number<p>For example i've</p>
<pre><code>Jack_50 * 50
Debby_35 * 15
Ross_10 * 24
</code></pre>
<p>I wan... | <p>Try this:</p>
<pre><code>import re
s = 'Jack_50 * 50 Debby_35 * 15 Ross_10 * 24'
re.findall(r'[a-zA-Z_]+\d+', s)
</code></pre>
<p>Output:</p>
<pre><code>['Jack_50', 'Debby_35', 'Ross_10']
</code></pre>
<p>You can also try on every separate string like <code>Jack_50 * 50</code></p>
<p><strong>Explained</strong>
<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to fetch array data in angular<p>This is how i assigned my model in a variable in my component. Here i want to fetch data by calling familyHistoryModel.p... | <p>Did you try this?</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>this.familyHistoryModel.patientMedicalFamilyHistoryDiseases.map(x => x.diseaseID);</code></pre>
</div>
<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Await an array of Promises mapped from Object entries<p>With the following snippet code the function should await all the promises mapped from the Object ent... | <p>As the others have said - you are returning an array of arrays.
If your target is es2019 or later - you can replace the map call, with flatMap</p>
<pre><code>const tableBodyRows = await page.locator(`tbody >> tr`).elementHandles()
await Promise.all(
tableData[pageIndex].flatMap(({ node }, idx) =&... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can we cast and rename a jsonb field in one Postgres SQL query?<p>I have a field in a jsonb field in a Postgres table and want to do two things directly in t... | <p>The alias needs to go after the cast expression:</p>
<pre><code>SELECT (answers->'recommend'->> 'score')::int as "Recommendation Score"
FROM ...
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Best Practice to Remove Whitespace Variations from List of Strings<p>Is there a best practice to remove weird whitespace unicode characters from strin... | <p>Regex is your friend in cases like this, you can simply iterate over your list applying a regex substitution</p>
<pre><code>import re
r = re.compile(r"^\s+")
dirty_list = [...]
# iterate over dirty_list substituting
# any whitespace with an empty string
clean_list = [
r.sub("", s)
for s in dirty_list
]
</code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why internet connection status is not listened in Cubit Constructor when running code in flutter web<p>I use from <code>connectivity_plus</code> for listenin... | <p>Use <code>checkConnectivity</code> to check current status. Changes are only exposed to the stream.</p>
<pre><code>final connectivityResult = await Connectivity().checkConnectivity();
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I run .exe external application with C++ and VS? And continue execute my C++ code?<p>I solved it with command System(.. .exe);
And .exe application s... | <p>You can either <a href="https://en.wikipedia.org/wiki/Fork_(system_call)" rel="nofollow noreferrer">fork</a> your process, and start your application in the child process, or you can run a new <a href="https://en.wikipedia.org/wiki/Thread_(computing)" rel="nofollow noreferrer">thread</a> which will block untill your... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Efficiently loading both RAX and R8 with the same small positive number<p>Instead of writing <code>mov rax, 1</code> (7 byte encoding 48, C7, C0, 01, 00, 00,... | <p>If you need a REX prefix anyway, it doesn't really matter what bits are set in it. Almost all 64 bit instructions are as fast as their 32 bit counterparts; exceptions include the usual suspects (multiplications and divisions).</p>
<p>As for which of these two is faster: despite having a longer dependency chain, the... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Generate a Paseto V2 Public Key/Token in PHP, Verify in Node.js<p><strong>Preface:</strong></p>
<p>What is Paseto?: <a href="https://developer.okta.com/blog... | <p>In case anyone still needs an answer to this - using</p>
<pre><code>V2.bytesToKeyObject(publicKey)
</code></pre>
<p>is what worked for me.</p>
<p>So instead of using the crypto library's <code>createPublicKey</code> method, use paseto V2's <code>bytesToKeyObject</code> method to generate the key to feed into V2.ver... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert nested objects into an array of objects<p>I need to convert a deeply nested object of objects into an array of objects for each level until it has no... | <p>Here's a recursive option which utilizes the <code>flat</code> method to make things simpler:</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>const data = {
name: '1',
a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django user doesn't inherit its groups permissions<p>In my Django project my jack user is in a group called 'Personals'. 'Personals' group has a permission n... | <p>Use <a href="https://docs.djangoproject.com/en/4.0/ref/contrib/auth/#django.contrib.auth.models.User.get_all_permissions" rel="nofollow noreferrer"><code>User.get_all_permissions()</code></a> to get all permissions that the user has including permissions inherited from groups or use <a href="https://docs.djangoproje... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.