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:
Why aren't my `assertEquals` statements all displaying something?<p>The following is a snippet from my JUnit5 test class.</p>
<pre><code>@Test
@DisplayName(&... | <p>As highlighted in the comments section above, an exception is thrown if <code>assertEquals</code> fails. This prevents any following statements from being reached.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex for URLs outside square bracket in text PHP<p>I have this:</p>
<pre><code>[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9... | <p>You can match from an opening till closing square bracket, and then make use of <a href="https://stackoverflow.com/questions/24534782/how-do-skip-or-f-work-on-regex">SKIP FAIL</a> using php.</p>
<p>You might also shorten the pattern a bit. You have the whole first part in a character class <code>[(http(s)?):\/\/(ww... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add existing has_many (current_user) on record save<p>I'm trying to save a new record and on that record save, associate a has_many to it. </p>
<p><strong>b... | <p>There are a few different ways to associate the two. In the <code>create</code> action (instead of the <code>new</code> action) you can do something like this... </p>
<pre><code> @building = Building.new(building_params)
@building.users << current_user
if @building.save
# do something
else
# d... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I need to see how many times the next number is greater than the before one<pre><code>function gameHistory(gamePoints){
let points = gamePoints.split(&q... | <p>The code is comparing strings after the split. Change them to numbers with a map...</p>
<pre><code>let points = gamePoints.split(", ").map(str => +str);
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Excel Search Vertically<p>I am building a "Routing Check" for the ground shipment.
please see the example 1 below.</p>
<ul>
<li><p>Group by the &qu... | <p>You can use a formula like <code>=IF(COUNTIFS(A:A,A2,B:B,"Last Leg")=0,"Missing Last Leg","OK")</code> where Column A is HB Column and Column B is the Leg Check Column.</p>
<p>The <code>COUNTIFS</code> function will check the combination of the criteria of whether your HB and Last Leg O... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wait function not happening in parallel<p>I have some piece of asynchronous code which is currently being executed one by one. I understand there is a way to... | <p>You are very close to what you are looking for. You need to use <code>Promise.all</code> and use map inside it.</p>
<p>By the way the current version using <code>forEach</code> is not correct as promise doesn't value <code>forEach</code>. You should use <code>for...of</code></p>
<pre><code>async function someAsync... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace Symbol Keys in Object With Text<p>I have the following object like this:</p>
<pre><code>{ where: { [Symbol(or)]: [ [Object], [Object] ] },hooks: true... | <p>Solved with the following function:</p>
<pre><code>const cleanObject = (obj) => {
try {
const keys = Reflect.ownKeys(obj);
const ret = {};
keys.forEach((key) => {
let val = obj[key];
if (Object.prototype.toString.call(val) === '[object Object]') {
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to exclude auto-generated files when importing classes from one C# project to another?<p>Is it possible to exclude auto-generated files when i... | <p>You can't conditionally import the types, but you can add an <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/extern-alias" rel="nofollow noreferrer">extern alias</a> to the types in your First project when importing it to the second project.</p>
<p>Add the following snippet to yo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
a = b = 0 in Python<p>I was practicing some algorithms, and I once saw this code</p>
<pre><code>class ListNode:
def __init__(self, val=0, next=None):
... | <p>what you need to understand is that both <code>head</code> and <code>new_LN</code> are pointers to an object and not the object itself, so at the beginning of the code when the line <code>head = new_LN = ListNode(0)</code> is called a new ListNode object is created and both <code>head</code> and <code>new_LN</code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pytest assert for timeout?<p>Is there a way to assert that a Pytest test case has failed due to a pytest timeout? I want to run a longevity test that I expec... | <p>Unfortunately, the <a href="https://pypi.org/project/pytest-timeout/" rel="nofollow noreferrer">pytest-timeout plugin</a>, which provides the <code>@pytest.mark.timeout</code> marker, does not offer the means to catch the timeout (<a href="https://github.com/pytest-dev/pytest-timeout/blob/e1c17ed8ac1937403d9dbeba972... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pointer losing visibility during cross-class access<p>I have an issue where class <strong>GUI_System</strong> accesses a member of class <strong>ThreadManger... | <p>I downloaded your project and had a look at it. The primary issue seems to be that you are storing a pointer to a method on a forward-declared type. The size and/or padding for such values is unknown without the definition of what it points to.</p>
<p>Here is your <code>ThreadManger</code> [sic] stripped back:</p>
<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Websocket Json Data to DataFrame<p>I am learning how to work with APIs and web sockets in finance.
My goal for this code is to access data and create a DataF... | <p>You should create empty <code>DataFrame</code> at start as global variable and later use <code>.append()</code> to add new rows to this dataframe.</p>
<p>Minimal working example (but without API)</p>
<pre><code>example_data = {
'echo_req': {'ticks': 'R_100'},
'msg_type': 'tick',
'subscription': {'id': '2... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I show current age using liquid?<p>I have a Jekyll website about my pets. I want it to automatically update my pet's age based on their birthday. I ca... | <p>You can either use JS with libraries like <em>moment</em> to compute the birthday client-side, like 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>const pet_birthday_... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CSS to get rid of white space in Wordpress Twenty Nineteen theme?<p>My page at <a href="https://www.risingtidescoffeecompany.com/home/" rel="nofollow norefer... | <p>From the inspector it looks like your problem is the top margin imposed by the following css, (line 5196)</p>
<pre><code>/* Blocks */
/* !Block styles */
.entry .entry-content > *,
.entry .entry-summary > * {
margin: 32px 0;
max-width: 100%;
}
</code></pre>
<p>And it reapears in the media query, (line 52... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Complicated function Google Sheets: Vacation tracker<p>I am working in <a href="https://docs.google.com/spreadsheets/d/1ZuBO56trreSpwriLjolxp-EHWSFwaLAoa33EX... | <p>Try below formula. Add another condition and give criteria <code>Vacation</code>.</p>
<pre><code>=IF(A5<>"",sumifs('Leave responses'!H:H,'Leave responses'!D:D,">="&$E$2,'Leave responses'!D:D,"<="&$G$2,'Leave responses'!D:D,"<=" &now(), 'Leave respons... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reverse Proxy Rules Removed automatically from Cpanel httpd.conf file after server update<p>I am getting en error in Apache since long time.
And the issue is... | <p>This issue has been resolved now, with the help of Cpanel support team.</p>
<p><strong>#Cpanel_Reply</strong></p>
<p>The most common reason that a configuration setting would get removed from WHM/Cpanel when rebuilding the httpd.conf file is because the modification was done directly to the configuration file. When ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Locality Sensitive Hashing in Spark for single DataFrame<p>I've read the Spark section on Locality Sensitive Hashing and still don't understand some of it:</... | <p>Here is a bit of scala code that performs a <code>LSH</code>. Basically, the lsh needs an assembled vector that you can construct with a <code>VectorAssembler</code>.</p>
<pre class="lang-scala prettyprint-override"><code>// contructing the dataframe
val data= """1 11.6133 48.1075
2 11.6142 48.1066
3 11.610... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Programmatically scroll uiscrollview to bottom as uilabel grows in height<p>I am using <code>SFSpeechRecognizer</code> to transcribe audio to text. As the au... | <p>Again, the first thing you need to do is layout your subviews after updating the text so your computations are based on the new text.</p>
<p>Rather than jumping through a lot of hoops and trying to compute the contentOffset I would suggest using <code>scrollToRectVisible(_:animated:)</code>.</p>
<pre><code> view.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript/Css matrix3d onscroll function shrinks element when rotating<p>I am trying to make a function that uses Css matrix3d to transform elements on scro... | <p>Matrix rotation is not just a linear interpolation of the values.</p>
<p>You already have a correct implementation of single axis rotation, implying modifying both the scale and skew values:</p>
<pre><code>function rotateZ(angle) {
const theta = (Math.PI / 180) * angle;
const matrix = identity();
matrix[0] ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filtering values of an array using pixel positions from an image<p>I have a image in greyscale. I have the value of each pixel saved to a text document that ... | <p>what you wanted is not called "filtering" but a <a href="https://www.google.com/search?q=numpy+slice" rel="nofollow noreferrer">"numpy slice"</a>:</p>
<pre><code>x, y, w, h = cv2.selectROI(my_frame)
roi = my_frame[y:y+h, x:x+w]
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CultureInfo: Compare including parent<p>I was wondering if there was an easy solution to this problem. We have a database with some strings in different lang... | <p>It looks like there is no build-in solution to this problem. So, I've made a solution to this problem myself with an extension-method:</p>
<pre><code>public static class CultureInfoExtensions
{
public static bool MatchesWith(this CultureInfo cultureInfo, CultureInfo matchCandidate)
{
if (cultureInfo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filter multidimensional numpy array using the percentile of each slice<p>I have a numpy array of shape x,y,z which represents z matrixes of x by y. I can sli... | <p>You can pass arrays to <code>np.clip</code>, so it is possible to have different limits across the <code>z</code> dimension of <code>mx</code>:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
# Create random mx
x, y, z = 10, 11, 12
mx = np.random.random((x, y, z))
# Calculate the percentile... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Plot line plot using rows of dataframe and include specific columns by position/number in python pandas<p>df</p>
<pre><code>SKU A B Jan_Sales Feb_Sal... | <p>Add <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iloc.html" rel="nofollow noreferrer"><code>DataFrame.iloc</code></a> for remove first and second columns, here <code>A</code> and <code>B</code>:</p>
<pre><code>df.set_index("SKU").iloc[:, 2:].T.plot()
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ConcurrentHashMap - do we synchronize methods which access the map<p>I am new to java and Multithreading.</p>
<p>I have created the below class where I am us... | <p>As you are using the thread id as the key to the Map, you do <em>not</em> need to synchronise these methods, because two threads will never try to use the same key. You <em>do</em> need to use a <code>ConcurrentHashMap</code>, because two threads modifying a <code>HashMap</code> or other non thread safe <code>Map</c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NextJs: 404 page back button returns back to 404 page<p>I have a condition inside my lifecycle method of <strong>user</strong> Page such that if the user ent... | <p>Router.push will add the new URL into the history stack, however, Router.replace will redirect to the 404-page without adding a new URL entry into the history stack. So the back button will redirect to the last successful entry in the history stack, <a href="https://nextjs.org/docs/api-reference/next/router#routerre... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ActiveMQ Artemis: Postgres DB persistence: Auto commit<p>In my project I am using postgres DB for message storage.</p>
<p>ActiveMQ Artemis is used as a embed... | <p>The solution of the issue is to use dedicated datasource for Artemis.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Div containing images takes more space than required<p>I am creating a footer section, and for some reason the <code>div</code> inside a section is taking mo... | <p>You didn't explain what kind of result that you were after, but I assume you want all of the flex children to share the same width: Just add <code>flex-basis: 100%</code> to give the flex children the same "weight" when determining their lengths.</p>
<p><div class="snippet" data-lang="js" data-hide="false"... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to push new data input to top on the list<p>hello how to push new data to the top list using vue.js and laravel, I tried but still failed, I hope someone... | <p>Assuming your list simply loops through your comments array, you need to push the response at the first position of the list:</p>
<pre><code>onSubmit() {
this.showLoader = true
this.form.post('add-comment')
.then(response => {
this.comments.unshift(response);
});
},
</code></p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Express-session not sending secure cookie to localhost<p>Regular cookies via <code>res.cookie(..., {secure: true})</code> works, but express-session does not... | <p>I did some more digging and it turns out that this is a known issue with express-session: <a href="https://github.com/expressjs/session/issues/837" rel="nofollow noreferrer">https://github.com/expressjs/session/issues/837</a></p>
<p>Basically, the docs around secure cookies has changed. It used to be that the server... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Differences github merge "pull-request" and gitlab merge "merge-request"<p>For a better understanding of these operations I would like to know how exactly gi... | <p>There is no difference between PRs and MRs. The terminology "Pull request" is a reference to how git is used for example in kernel development. Say you are a developer, and I am the maintainer. For you to get changes incorporated, you would generate a diff patch and email it to me, so that I can review it, and reque... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trying to refactor css toggle switch slider checkbox svgs for its on/off states in alpine and tailwind, to smaller, cleaner, more maintainable code<p>Our sys... | <p>Is it necessary to use Tailwind for this issue?
<br>
Hope this custom checkbox could help you:</p>
<p><strong>HTML</strong></p>
<pre class="lang-html prettyprint-override"><code><main> <!-- or use any html wrapper element -->
<input type="checkbox" id="customCheckbox">
<l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert 4 byte array to float<p>I have a 4 byte array I need to convert into a float. The python code to convert the array looks like this:</p>
<pre><code>im... | <p>Usually all utilities needed to work with bytes in dart can be found at <code>dart:typed_data</code>. The following code would be equivalent to the python one.</p>
<pre class="lang-dart prettyprint-override"><code>import 'dart:typed_data';
void main() {
final data = [125, 29, 2, 64];
final bytes = Uint8List.fro... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Make a dict of list of lists from dict of lists<p>I have a <code>dict</code></p>
<pre class="lang-py prettyprint-override"><code>context = {
"x":... | <p>You can extract the data from your dict, put them in a list, then add the list to your dict.</p>
<pre class="lang-py prettyprint-override"><code>context = {
"x":["col1", "col2", "col3"],
"a":["val1","val2","val3"],
"b":["val4","val5","val6"]
}
data = [context.pop("a"), co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to checked mat-checkbox in angular 14<p>Trying to check the mat checkbox by passing the values, But it is not working. If i click the button checkbox sho... | <p>Your code is using too many variables, and they are not mapped between parent and child component accordingly, thus you are not seeing updated checkboxes on clicking the button.</p>
<p>Here are some of things I did to get it working:</p>
<ol>
<li>Moved checkbox options to child component, since that's where the mat ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Oracle APEX interactive grid does not change when underlying materialized view changes<p>I have an interactive grid based on materialized view. Query is very... | <p>As far as I can tell, it is the second option you mentioned. Apex uses the "old" materialized view definition for the page and is unaware of any changes you've made. It displays the old layout. However, it <em>would</em> break if you added a NOT NULL column and tried to save a newly added row to the current grid.</p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding NSG rules to enable high availability on Azure PostgreSQL Flexible Server<p>I am trying to enable ZoneRedundant High Availability on our Azure Postgre... | <p>• As per the statement from the Microsoft documentation, it is imminent that all the resources dealing with or related to the Azure PostgreSQL Database – Flexible Server should be deployed <em><strong>within the same virtual network</strong></em>. The statement accordingly states that for Azure PostgreSQL Database... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why can't i access a function of a web control?<p>i have the next question:</p>
<p>I've got an .aspx which contains a lot of web controls, this is the one i ... | <p>so.. very curious thing.</p>
<p>when you have a form which contains a lot of user controls, you need to wait for the metadata file to reload the new methods you've created.</p>
<p>So i closed my visual studio and re opeened a minutes later and the bug desapeared.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Express-Gateway, serve same API path/route, but under different ServiceEndpoints<p>I have a server in Node.js + Express, that exposes some APIs both to publi... | <p>I solved in this way: using <code>-rewrite</code> policy.</p>
<ul>
<li>I prefix my clients' requests with <code>/test</code> or <code>/prod</code></li>
<li>Use the prefix to match <code>path</code> the correct apiEndpoint</li>
<li>rewrite the request, deleting the prefix</li>
<li>choose the serviceEndpoint and go on... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Write a String init in swift<p>In my code, an array of <code>[Int]</code> of size 3 has a special meaning. I want to get its string representation.</p>
<p>T... | <p>First of all there is a backslash missing in the String Interpolation line.</p>
<p>Just call <code>self.init</code> with <code>r</code> as parameter. Technically it's a <em>convenience initializer</em>.</p>
<pre><code>extension String {
public init(point: [Int]) {
assert(point.count == 3)
let r... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Poll a particular directory in S3 for new files using Java<p>I have to write a Java code which will poll S3 directory at regular interval of time to get the ... | <p>Regularly scanning an Amazon S3 bucket is not efficient — buckets can be quite large, requiring many API calls, and work is performed even if no new files have been added.</p>
<p>The better way to implement this is:</p>
<ul>
<li>Configure an <strong>Amazon S3 Event</strong> that will trigger an AWS Lambda function... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What does it mean that Mercurial stores branch information as a permanent part of each commit?<p>My understanding is that <strong>Git</strong> is sort of a l... | <ol>
<li>Both Git and HG use DAG (Directed Acyclic Graph) topology, which is <strong>not</strong> just "linked list"</li>
<li>Yes, in core Mercurial (not in evolve extension in game) existing branches can't be removed (see <code>hg help branch</code>), but <strong>it's nohow related</strong> to <em>storing ad... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add missing indicator columns using the tidymodels recipes package<p>I'd like to create a recipe using the <a href="https://tidymodels.github.io/recipes/inde... | <p>It's possible to do this by creating a custom step. Following the process as described in one of the <a href="https://tidymodels.github.io/recipes/articles/Custom_Steps.html" rel="nofollow noreferrer">vignettes</a>, create functions defining the step, then define <code>prep</code> and <code>bake</code> methods for t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Node Server .env file undifined in server.js<p>The below screenshot shows my file structure in VS code. I have used <code>npm concurrent</code> to run both b... | <p>You can specify the path where the <code>.env</code> file is to <code>dotenv</code> package.</p>
<p>Please modify the following line of code to</p>
<pre class="lang-js prettyprint-override"><code>require("dotenv").config();
</code></pre>
<p>like this:</p>
<pre class="lang-js prettyprint-override"><code>req... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
RTK query Error encountered handling the endpoint<p>I'm using next.js with RTK query. I created api, configured endpoints with <code>queryFn</code> instead o... | <p>A <code>queryFn</code> has to return an object in either the shape <code>{ data: something }</code> or <code>{ error: something }</code>. It should not <code>throw</code> anything.</p>
<p>That said, you are doing a <em>lot</em> of stuff here just to do an api request. While it is certainly possible to go to that len... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Implementing multiple navigation actions on a single menuitem button in Kotlin(android)<p>I am trying to implement a way for the <code>menuitem</code> button... | <p>Simply tie the <code>menuitems</code> to the destination fragments you have.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating a new control property for certain amount of time in C# Winform<p>Say if I want to create a multiple button on my form based on a loop value of 3 th... | <p>Try the following on a form with no controls in a button click event.</p>
<p><a href="https://i.stack.imgur.com/GhEhb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GhEhb.png" alt="enter image description here" /></a></p>
<pre><code>int top = 10;
int heightPadding = 30;
for (int index = 0; index... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I fix "require is not defined" error with Webpack and Babel?<p>I keep getting error <code>Uncaught ReferenceError: require is not defined</code> in br... | <p>There're a few things on your code needing changed. First of all, you can't <code>target</code> to build for <code>node</code> while you run that code on browser which is wrong. Secondly, <code>path</code> is designed and built to run on node server specifically, however, there's a fallback for path on browser thoug... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jQuery Json Object .each() loop is returning undefined<p>I've seen similar posts for this issue, but haven't found a solution that worked for me.</p>
<p>My ... | <p>When you call <a href="https://api.jquery.com/jquery.each/" rel="nofollow noreferrer"><code>$.each</code></a> on an object, the first parameter of the callback is the property name and the second one its value. So, when you do:</p>
<pre><code>$.each(data.director, function(i, term) {
$('#acf-field_5dc7e03cd489d... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Stack below the AppBar and not behind<p>I cant seem to find the answer to this simple problem but I dont understand why my Stack is BELOW the appbar and not ... | <p>Please try below code and check output</p>
<pre><code> SafeArea(
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
elevation: 1,
leading: Icon(Icons.arrow_back_ios),
backgroundColor: Colors.transparent,
),
body: Stack(
children: <Widge... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Difference between privileged and capabilities<p>I am trying to authorize kubernetes pod with Capability in securityContext.</p>
<p><a href="https://kubernet... | <p>Setting privileged should modify:</p>
<p>1-capabilities: removing any capability restrictions</p>
<p>2-devices: the host devices will be visible</p>
<p>3-seccomp: removing restrictions on allowed syscalls</p>
<p>4-apparmor/selinux: policies aren't applied</p>
<p>5-cgroups: I don't believe the container is limited wi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Postgresql WHERE clause using conditional sub-queries<p>I have a situation where each of the clients has users and each user can access to information about ... | <p>I think something like this would work for you:</p>
<pre><code>SELECT s.name, s.id
FROM sites s
LEFT JOIN users_have_sites uhs ON uhs.site_id = s.id
LEFT JOIN users u ON u.id = uhs.user_id AND u.username = 'JohnBrown'
WHERE (CASE WHEN (SELECT u.level FROM users WHERE u.username = 'JohnBrown') = 'ROLE_SYSTEM_ADMIN'
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can i change JPasswordField into String<p>I want to connect my IDE to Oracle SQL Developer.
Therefore I have to use this line of code:</p>
<pre><code>Co... | <pre><code>String passText = new String(pass.getPassword());
</code></pre>
<p>See <a href="https://stackoverflow.com/questions/983964/why-does-jpasswordfield-getpassword-create-a-string-with-the-password-in-it">Link</a> for more information.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reversing a circular doubly linked list<p>I'm attempting to implement a reverse() function on a circular doubly linked list. </p>
<p>Here is my code:</p>
<... | <p>The algorithm works fine, you just need to change the head pointer to the correct value. When you reverse a linked list the head points to the last node, similarly in this case too the head should point to the last node.</p>
<pre><code>public void reverseCDLL() {
if (head != null) {
Node current = head... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Compress CSV to ZIP in dbfs (databricks file storage)<p>I'm trying to compress a csv, located in an azure datalake, to zip. The operation is done with python... | <p>No, this is not possible to do like you did. The main reason is that <a href="https://docs.databricks.com/data/databricks-file-system.html#local-file-api-limitations" rel="nofollow noreferrer">local DBFS API has limitations</a> - it doesn't support random writes that is required when you're creating a zip file.</p>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PL/SQL cursor fetch and loop UPDATE returning last row result<p>I got 3 tables:</p>
<pre><code>BOOK(bookid primary,nbloans)
COPIES(copyid primary,bookid REF... | <p>Your UPDATE statement is:</p>
<pre><code>UPDATE BOOK SET NBLOANS=rec1.countloans;
</code></pre>
<p>This will set the value of NBLOANS to <code>rec1.countloans</code> on every row in the table.</p>
<p>Perhaps you meant</p>
<pre><code>UPDATE BOOK
SET NBLOANS = rec1.countloans
WHERE BOOKID = rec1.Books;
</code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to show loading progress or spinner in the middle of the screen with React Native?<p>I am developing React Native app.</p>
<p>I was able to solve all pr... | <p>So in your case you can do several things</p>
<ol>
<li>You can use React Native Activity Indicator -> <a href="https://facebook.github.io/react-native/docs/activityindicator" rel="noreferrer">View</a></li>
<li>You can use Overlay Library -> react-native-loading-spinner-overlay -> <a href="https://github.com... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to choose a random color for each ball that will show up every time?<p>This is a simple python "flappy bird" game. I am struggling with choosin... | <p>There are at least three ways you can generate random color values in Python turtle:</p>
<pre><code>>>> import turtle
>>> from random import random
>>> turtle.colormode() # confirm the default
>>> 1.0
>>> turtle.dot(20, (random(), random(), random()))
</code></pre>
<p>An... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to print the decimal value of a `std::bitset` bigger than a `unsigned long long`?<p>I'm programming a class to handle integers with a bitset with more bi... | <p>After loosing two nights on it, I've finally found a way of printing it. It's not the most efficient way and I'm gonna rewrite it until I'm satisfied with the speed.</p>
<pre class="lang-cpp prettyprint-override"><code>std::ostream& operator<<(std::ostream& os, const RossInt& value) {
RossInt ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filling up pandas columns from left to right<p>I am currently working on a pandas problem and I would like to know whether there is an easy fix for this prob... | <p>Use custom function <code>justify</code>, only convert DataFrame to numpy array:</p>
<pre><code>#https://stackoverflow.com/a/44559180/2901002
df = pd.DataFrame(justify(df.to_numpy(),invalid_val=np.nan), columns=df.columns)
#pandas < 0.24
#df = pd.DataFrame(justify(df.values,invalid_val=np.nan), columns=df.column... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to split an alphanumeric string by its characters using regex?<p>I have a series of strings in the form of</p>
<pre><code>10a99b5c
55
2a3b1
g
</code></p... | <p>Try this:</p>
<pre><code>$input = ['10a99b5c','55','2a3b1','g'];
$regEx = '~([a-z]\d*)~';
foreach($input as $str){
$res[] = preg_split($regEx,$str,-1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
}
echo '<pre>';
var_export($res);
</code></pre>
<p>The result for the examples above:</p>
<pre><code>arra... |
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 Insert a dynamic number of rows into SQL Server in C#<p>I'm using C# and ADO.NET to insert a dynamic number of rows into a SQL Server... | <p>At a minimum batch the inserts in a SqlTransaction, and put the SqlConnection in a <code>using</code> block. The transaction ensures that the rows are either all inserted or none are, and improves performance by eliminating the commit and log flush after each row.</p>
<pre><code>using (var sc = DBManager.CreateCon... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
BindingResolutionException: Target class [path\to\class] does not exist (Laravel 6)<p>I'm using Laravel 6 and php 7 along with ReactJS. I'm following <a href... | <p>It looks like you're using an out of date tutorial. If you Google for <code>barryvdh/laravel-cors</code>, you'll see that the repository has been renamed to <code>fruitcake/laravel-cors</code>. </p>
<pre><code>composer require fruitcake/laravel-cors
</code></pre>
<p>I suspect that the dependency therefore didn't i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
static member std::function of template class gets empty despite initalization<p>Consider the following class:</p>
<pre class="lang-cpp prettyprint-override"... | <p>The problem is related to the order of initialization of static variables which I guess is solved differently for the templated instantiated static variables compared to <code>Test<double></code> on different compilers.</p>
<pre><code>inline static Holder f;
</code></pre>
<p>is a static variable, so somewhere ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL Server Group By and Count<p>I am trying to do a count of invoices by country within region. Below is a view of my table structure and required output. I ... | <p>I would imagine all you need is this, Once you have this data you can count the totals for a region and also do a grand total in the calling code.</p>
<p><a href="https://i.stack.imgur.com/mD54p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mD54p.png" alt="enter image description here" /></a></p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to match a word based on slash in regular expression<p>I am trying to match a word with regex. for example, I want to match only first 2 folders in below... | <p>You can use</p>
<pre class="lang-none prettyprint-override"><code>^/[^/]+/[^/]+
^(?:/[^/]+){2}
</code></pre>
<p>Or, if you need to escape slashes:</p>
<pre class="lang-none prettyprint-override"><code>^\/[^\/]+\/[^\/]+
^(?:\/[^\/]+){2}
</code></pre>
<p>See the <a href="https://regex101.com/r/56MarG/1" rel="nofollow ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Polymorphism in Relationship Sqlalchemy<p>I have a SqlAchemy Model that have a relationship with a Single Table Inheritance, like this:</p>
<pre><code>@Sche... | <p>I found the solution adding <code>'with_polymorphic': '*'</code> in <code>__mapper_args__</code> like this: </p>
<pre><code>@declared_attr
def __mapper_args__(cls):
return {
'polymorphic_identity': cls.__name__,
'polymorphic_on': cls.type,
'with_polymorphic': '*'
}
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PHP | Calculate remaining days but taking leap years into account<p>small problem to calculate the remaining days of the month starting today just I write:</... | <p>Stop using the functions and start using the DateTime class!!!
This code should explain itself.</p>
<pre><code><?php
$x = new DateTime('2020-02-17'); // create your date
$y = clone $x; // copy the date
$y->modify('last day of this month'); // alter the copy to the last da... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JS Select an option base on the label value/innerText<p>HTML</p>
<pre><code><input class="jet-form__field text-field " value="" name=&... | <p>I updated</p>
<blockquote>
<p>flclosing.selectedIndex = roundedPrice;</p>
</blockquote>
<p>to</p>
<blockquote>
<p>flclosing.selectedIndex = roundedPrice / 1000 - 4;</p>
</blockquote>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does SAP CCV2 force a single repo for Spartacus applications?<p>CCV2, the deployment system for SAP Commerce seems to impose a very restrictive constraint (I... | <p>Digging through <a href="https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/1be46286b36a4aa48205be5a96240672/dca0bfe88429408380fedf316e9c6f14.html?version=v2105&q=git" rel="nofollow noreferrer">the docs</a> today, I found that submodules are supported!</p>
<blockquote>
<p>All customizations are stored in ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wait for recursive function to complete javascript<p>I'm quite rusty on my javascript and I'm using the code from this answer in a text game to animate text.... | <p>I added an if statement inside of the setTimeout so that when the last letter shows, the button will show at the same time. If I added it as an else if of the existing if statement, it waited the interval time after the last letter was shown to show the button.</p>
<p><div class="snippet" data-lang="js" data-hide="f... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I ignore exceptions during deserialization of bad JSON?<p>I am consuming an API that is supposed to return an object, like</p>
<pre><code>{
"some... | <p>This solution uses a custom <code>JsonConverter</code> in <strong>System.Text.Json</strong>. </p>
<p>If <code>some_object</code> is an array then it will return an empty object (or null if you prefer), and <strong>no exception will be thrown</strong>. Otherwise it will correctly deserialize the json.</p>
<pre><c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using a flag in a Makefile target<p>Suppose I have a Makefile like this:</p>
<pre><code>(more Makefile code)
%_dev.pdf: %.csv
# do stuff that
%_prod.p... | <p>Your code is valid. </p>
<p>Instead of dealing with suffixes you can just build into another directory:</p>
<pre><code>MODE := dev # Immediate assignment, make MODE=prod overrides it.
build_dir := ${MODE}
${build_dir}/%.pdf : %.csv | ${build_dir}
# commands
${build_dir} :
mkdir -p $@
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filtering many-to-many relationthip<p>I make api with <code>rest-framwork</code> for <code>django 3</code></p>
<p>I have a model which has many-to-many rela... | <p>By default <a href="https://django-filter.readthedocs.io/en/master/ref/filters.html#modelmultiplechoicefilter" rel="nofollow noreferrer"><code>ModelMultipleChoiceFilter</code></a> using for ManyToManyField:</p>
<pre><code>class TextFilter(filters.FilterSet):
t_text = filters.CharFilter(lookup_expr='contains') #... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
unique and replace in python<p>I have huge dataset with more than 100 columns that contain non-null values that I want to replace (and leave all the null val... | <p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.mask.html" rel="nofollow noreferrer"><code>DataFrame.mask</code></a>:</p>
<pre><code>c = ['col1','col2','col3']
df_2[c] = df_2[c].mask(df_2[c] != 0, 1)
</code></pre>
<p>Or compare by not equal with <a href="http://pandas.pydata... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Inserting a New Column into a CSV File<p>I need to insert a new column in front of the first column in a CSV file. I'm trying to use an <code>awk</code> solu... | <p>I would harness GNU <code>AWK</code> for this task following way, let <code>file.csv</code> content be</p>
<pre><code>A,B,C,D,E,F
1,2,3,4,5,6
2,3,4,5,6,7
3,4,5,6,7,8
4,5,6,7,8,9
</code></pre>
<p>then</p>
<pre><code>awk 'BEGIN{FS=OFS=","}{print NR==1?"col":"0", $0}' file.csv
</code></pre... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firebase - search data by phone number<p>I am making a site with a lesson schedule for teachers. For recording, a person indicates his phone number. I have b... | <p>Firebase can only order/filter on a value at a fixed path under each direct child node of the location you query. So you can for example filter on the keys/dates right under <code>user1</code>, or you can search for the <code>Phone</code> value for a specific date, but you <strong>cannot</strong> search across all p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Group By combination of month and year together to obtain counts for every month-year combination in Snowflake SQL<p>Is there a way of getting counts grouped... | <p>Assuming that month and year are separate columns and both are numeric, one way to get the results would be:</p>
<pre><code>WITH SOMEDATA (ID, MONTH, YEAR, QUANTITY) AS
( SELECT * FROM VALUES
(1,7,2022,53)
,(2,4,2022,64)
,(3,2,2022,67)
,(4,9,2022,57)
,(5,2,2022,65)
,(6,5,2022,85)
,(7,11,2022,31)
,(8,11,2022,66)
,(9,... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Similar time submissions for tests<p>I have a dataframe for each of my online students shaped like this:</p>
<pre><code>df=pd.DataFrame(columns=["Class&... | <p>This solution implements a rolling time list. The logic is this – keep adding entries as long as all the entries in the list are within the time window. When you detect that some of the entries are not in the time window relative to the most current (to be added) entry then that indicates that you have a unique ch... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Panning is not working with hovering on lines - plotly js<p>Panning is not working while hovering on a marker.</p>
<p>To reproduce the problem please check t... | <p>Try setting <code>xaxis.uirevision</code> to any truthy value and keep it the same between re-renders. See <a href="https://plotly.com/javascript/reference/layout/#layout-uirevision" rel="nofollow noreferrer">https://plotly.com/javascript/reference/layout/#layout-uirevision</a></p>
<p><div class="snippet" data-lang=... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding elements from one numpy array to another numpy array<p>Good morning,</p>
<p>I am trying to add elements from <strong>one numpy array</strong> to the o... | <p>If you want to do it in <code>numpy</code> you can use <a href="https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html" rel="nofollow noreferrer"><code>numy.concatenate</code></a> with <code>axis=0</code> and if you want in <code>list</code> you can use <code>list_1 + list_2</code>.</p>
<pre><code>J... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flex column text is not proper on the right side<p>I have made a flex column but the arrow on the right side is not proper, and it's hidden. It should be lik... | <p>Use <code>flex-row-reverse</code> class that bootstrap 4 provides.</p>
<p><a href="https://jsfiddle.net/qf5r18ca/" rel="nofollow noreferrer">https://jsfiddle.net/qf5r18ca/</a></p>
<pre><code><div class="d-none d-md-flex flex-row-reverse" id="arright">
<i class="fa fa-arrow-left" aria-hidden="true">&l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular 7, ng-bootstrap rendering modal template<p>I have been researching this for a few days and I still haven't been able to resolve this issue. I want to... | <p>I have made some changes according to your requirements just follow below code</p>
<p>first created <code>NgbdModalContent</code> component file</p>
<pre><code>import {Component, Input} from '@angular/core';
import {NgbModal, NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'ngbd-modal-... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error: Cannot find module './App' at webpackMissingModule<p>I'm converting my .js files to .tsx because I want to work with TypeScript.</p>
<p>I added TypeSc... | <p>You need to inform webpack it needs to parse <code>tsx</code> files as well. I'm not familiar with Create-React-App, but if you run <code>yarn eject</code> you will have access to the webpack.config.js file.</p>
<p>In the field <code>resolve</code>just add <code>tsx</code>:</p>
<p><div class="snippet" data-lang="js"... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django: cleaned_data for special characters and punctuation marks<p>I want to validate the Name field in my form.</p>
<p>Now I have in my <code>forms.py</cod... | <p>I think, you can do it manually, by making a list of special characters and punctuation marks, and do iteration for every character of <code>name</code> field, an example here:</p>
<pre>
def clean_name(self):
name = self.cleaned_data['name']
<strong>
special_puncs = ['!', '@', '#', '$', '%', '&', '*', '... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Access centrality measures attributes in list of networks<p>I am studying the evolution of weighted and undirected networks over time. I have managed to crea... | <p>You cannot see the graphs because <code>graph.cc</code> is not a graph it's a list.<br />
To create a data.frame with the centrality measures wrap the code that works in the single case as a function and <code>lapply</code> it to the graphs' list.</p>
<pre class="lang-r prettyprint-override"><code>suppressPackageSta... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Gdb and dollars in identifiers<p>I'd like to debug a program that uses the dollars in identifiers extension.</p>
<p>Take </p>
<pre><code>#include <stdio... | <p><code>gdb</code> interprets the initial <code>$</code> in <code>p $a</code> before parsing the expression to print.</p>
<p>Note however that it only does this for the initial <code>$</code>: if the <code>$</code> sign appears in the middle of a symbol, (eg: <code>p a$1</code>) the variable is printed correctly.</p>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Running powershell through c# recently getting error Access is denied<p>This program has been running successfully for over 4 years. Just recently (8/4/2022)... | <p>So, Darin lead me to the correct answer, and it was probably deprecation per <a href="https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps</a>.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why in Maven Error 'java: cannot find symbol'?<p>I am using Intellij Idea to build a java maven project from a MAC OS machine. When I am trying to run 'compi... | <p>How I solved the problem:</p>
<p>Added a dependency in pom for the library from which the <code>FieldUtilsExt.getFieldsWithAnnotation (...)</code> method was used</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Basechart (Ng2-Charts) Canvas max width <= 16384px in Firefox?<p>I prepared this eg in stackblitz - <a href="https://stackblitz.com/edit/github-nlvlrr-mwudnj... | <h3>16384 x 2 = 32768</h3>
<p>If you type <code>devicePixelRatio</code> in your browser's console you'll probably find <code>2</code>. You are most likely on a high-res monitor.</p>
<p><em>Chart.js</em>, that is used behind the hood of your <em>Ng2-Charts</em> library, does have a <a href="https://www.chartjs.org/docs/... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I cannot convert a String to Integer in in Java in Eclipse<p>I was trying to make a little program where you can input a number and it would be displayed on ... | <p>Only guessing. </p>
<p>Maybe you have to <code>trim()</code> whitespaces from the beginning and end of a string before parsing?</p>
<pre><code>Integer.parseInt(window.enterpoint.getText().trim())
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Matplotlib and coordinate system<p>Until now I worked in the R environment and create the chart as the chart shown below.</p>
<pre><code>library("rJava&... | <p><a href="https://i.stack.imgur.com/mjFQv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mjFQv.png" alt="Result" /></a><strong>This is what i got using your provided data, not exactly the same</strong></p>
<pre><code># Importing libraries
import matplotlib.pyplot as plt
import numpy as np
# p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Delete duplicate value-items from multiple keys in python dictionary and append to a new dictioanry<p>The original dictionary:</p>
<pre><code>d = {'x1': ['P... | <p>This is one approach using <code>itertools</code> & <code>collections</code>. </p>
<p><strong>Ex:</strong></p>
<pre><code>from itertools import chain
from collections import Counter
d = {'x1': ['P1', 'P2', 'P3', 'P4', 'P5'], 'x2': ['P1', 'P2', 'P6', 'P7', 'P8'], 'x3': ['P1', 'P2', 'P6', 'P9', 'P10']}
d_mod = {... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bootstrap 4 navbar becomes transparent when page is refreshed<p>I have used bootstrap 4.3.1 navbar fixed-top and transparent and while scrolled down it chang... | <p>Thanks for responding,</p>
<p>When I removed this part of code, it worked, I don't understand the link between swiper slider and navbar transparent on refresh issue,</p>
<pre><code> <section id="news">
<link rel="stylesheet" href="https://unpkg.com/swiper/css/swiper.min.css">
<style>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
One key and two values (react)<p>i am trying to merge a javascript array, these have a common value and share the index </p>
<p>for example </p>
<pre><code... | <p>Use set for 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>let objectA = ["name a", "value a"]
let objectB = ["value a", "value extension a"]
let result = new Set([... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cURL command to GitLab API in GitLab pipeline succeeds with [0 bytes data] when cURL contains variable<p>I have a GitLab pipeline that should generate a file... | <p>Interesting issue.</p>
<p>I setup a <a href="https://gitlab.com/computerfoo/apitest" rel="nofollow noreferrer">test repo</a> in which I was able to work around this issue by replacing the JSON-bash-escaping with a form which is - IMO - way easier to handle.</p>
<p>Sidenote: The <code>-w</code> in your curl command r... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firebase + Proguard/R8<p>I am currently working on setting up Firebase (FCM) in my project and have encountered a problem when I run my R8-obfuscated app, th... | <p>Finally got it fixed, next proguard rules did a trick for me:</p>
<pre><code># Firebase
-keep class com.google.android.gms.** { *; }
-keep class com.google.firebase.** { *; } // especially this one
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Keywords Must Be Strings When Passing Variable As Parameter<p>I'm trying to pass a variable as a keyword argument like this:</p>
<pre class="lang-py prettypr... | <p>The issue here was that occasionally I was passing <code>None</code> as the variable which was returning the error. In the test I added in a proper string parameter and all was fine!</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why the summation of normal distribution is different in numpy?<p>I just want to check why the result is different.</p>
<p>Suppose <strong><em>X</em></stron... | <p>What is equal here is the distribution of the two variables and this can be proven (see e.g. <a href="https://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables</a>).</p>
<p>To be convinced that the... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
After updating Android studio to chipmunk existing project not working<p>Hello friend i am working on flutter project now recently i update my android studio... | <p>You can go to the File -> invalid caches and restart. Then open any file from android folder and when you open any file then you can see hint like open for editing in android studio.</p>
<p>EDIT</p>
<p>create a file in android studio inside android name
<a href="https://i.stack.imgur.com/8dWBx.png" rel="nofollow... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Default values for each key in a where-clause<p>Given a table:</p>
<pre><code>ID VALUE
1 1
2 2
</code></pre>
<p>I need to set 0 for every ID in where-cla... | <p>You didn't mention your DBMS, but the following is standard ANSI SQL:</p>
<pre><code>select l.id, coalesce(t.value, 0) as value
from (
values (1),(2),(3),(4)
) as l(id)
left join the_table t on t.id = l.id;
</code></pre>
<p>It's possible without a join, but that doesn't make it prettier:</p>
<pre><code>with i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.