question_id int64 37.6M 73.2M | input_text stringlengths 88 52.4k | output_text stringlengths 37 35.6k | title stringlengths 15 150 | tags stringlengths 1 107 | q_score int64 -19 397 | view_count int64 3 879k | answer_count int64 1 21 | accepted_answer_id int64 37.6M 73.8M | answer_id int64 37.6M 73.8M | a_score int64 -5 1.29k | is_accepted bool 1
class | creation_date stringlengths 20 24 | input_text_instruct stringlengths 251 52.6k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
72,946,630 | How to make a Chunks in Unity 2D<p><em><strong>Create 2D Top Down Chunks</strong></em></p>
<p><strong>I was wondering how I can make a chunk system in Unity2D. My map is too big, I want to make a system of chunks, to unload and load the parts of the map, as the player progresses.</strong></p>
<p>I need to do this for t... | <p>The problem in the question can be solved with a lot of strategies, but all of them require good programming experience.
I can give you an idea to send you on a good path, but without writing code, because for each project the code would change.
Think you have 4 parts. These parts are rectangular or square and form ... | How to make a Chunks in Unity 2D | c#|unity3d | -2 | 54 | 1 | 72,946,694 | 72,946,694 | 1 | true | 2022-07-12T03:09:58.003Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make a Chunks in Unity 2D<p><em><strong>Create 2D Top Down Chunks</strong></em></p>
<p><strong>I was wondering how I can make a chunk system in Unity2... |
72,997,216 | How to parse a string containing equal signs to object<p>I have a string variable</p>
<pre><code>let stringValue = "{DATA={VERSION=1.1, STATE=true, STATUS=ONLINE}}"
</code></pre>
<p>I would like to parse it to object as <code>result</code> where <code>result</code> will be:</p>
<pre><code>let result = {"... | <p>Under the assumption that keys and string values are fully capitalized:</p>
<ul>
<li><p>I used the regex <code>/[A-Z]+/g</code> and <code>.match(regex)</code> to get an array of every all caps word in the string.</p>
</li>
<li><p>Create a <code>Set</code> out of the the array to remove duplicates and avoid repeating... | How to parse a string containing equal signs to object | javascript|node.js|typescript | -1 | 54 | 1 | 72,998,567 | 72,998,567 | 1 | true | 2022-07-15T16:41:28.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to parse a string containing equal signs to object<p>I have a string variable</p>
<pre><code>let stringValue = "{DATA={VERSION=1.1, STATE=true, STAT... |
72,895,922 | Gremlin / tinkerpop: insert key:value property constant in every vertex and edge traversed then return path<p>Using AWS Neptune with Gremlin query language (last version).</p>
<p>Using sample data inserted this way:</p>
<pre><code>g.addV('test_report').property('name', 'REF').property('creationDateTime','2022-07-01 00:... | <p>Your case sounds somewhat similar to <a href="https://groups.google.com/g/gremlin-users/c/isqd0DcllPI" rel="nofollow noreferrer">one that came up on the Gremlin Users list recently</a>.</p>
<p>Using the air-routes data set, we can add additional key/value pairs to a result set using a query such as this one.</p>
<pr... | Gremlin / tinkerpop: insert key:value property constant in every vertex and edge traversed then return path | graph|gremlin|tinkerpop|amazon-neptune|gremlinpython | 1 | 54 | 1 | 72,899,941 | 72,899,941 | 1 | true | 2022-07-07T10:04:45.457Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Gremlin / tinkerpop: insert key:value property constant in every vertex and edge traversed then return path<p>Using AWS Neptune with Gremlin query language (... |
73,017,944 | Sorting dictionary by value in python under multiple constraints<p>Consider the dictionary below: Let's call it <code>hmap</code><br />
This is a dictionary where they key is of type <code>int</code> and the values are <code>tuples</code></p>
<pre><code>{1: (80, 40, 120), 2: (60, 20, 80), 3: (80, 50, 130), 4: (60, 90, ... | <ol>
<li><p>Tell <code>key</code> to ignore the first element using slicing to create a new tuple without the first element:</p>
<pre class="lang-py prettyprint-override"><code>dict(sorted(hmap.items(), key=lambda x: x[1][1:], reverse=True))
</code></pre>
<p>outputs</p>
<pre class="lang-py prettyprint-override"><code>{... | Sorting dictionary by value in python under multiple constraints | python|python-3.x|sorting|dictionary | 0 | 54 | 1 | 73,018,002 | 73,018,002 | 1 | true | 2022-07-18T06:09:49.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sorting dictionary by value in python under multiple constraints<p>Consider the dictionary below: Let's call it <code>hmap</code><br />
This is a dictionary ... |
72,789,084 | Kubernetes: cannot see network policies created with calico<pre><code>apiVersion: projectcalico.org/v3
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
</code></pre>
<p>By using <code>kubectl get networkpolicy</code>, I can see only the policies created by <code>networking.k8s.io/v1</code> and ... | <p><code>kubectl get XXX</code> does not display all the resources in the cluster, in your case you cannot see CRD</p>
<ul>
<li>You can find your object with <code>kubectl get crds</code></li>
<li>Then <code>kubectl get <crd name> -A</code></li>
</ul>
<hr />
<p>In your case it would be:</p>
<pre class="lang-bash ... | Kubernetes: cannot see network policies created with calico | kubernetes | 0 | 54 | 1 | 72,789,801 | 72,789,801 | 2 | true | 2022-06-28T15:15:18.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kubernetes: cannot see network policies created with calico<pre><code>apiVersion: projectcalico.org/v3
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
... |
72,798,118 | 2D numpy array: Remove lines that contain only empty tuples<p>I have a 2d numpy array that contains tuple with two elements: an int and an str.</p>
<p>An example on how the 2d array may look:</p>
<pre class="lang-py prettyprint-override"><code>matrix = np.array(
[[(1, 'foo'), (), (4, 'bar')],
[(),(),()],
[(1, 'foo'),... | <p>The problem here is that tuples are Sequence Types. When you try to apply <code>matrix == ()</code>, Numpy makes a comparison of matrices, and so <code>matrix == ()</code> return a simple <code>false</code>.</p>
<p>This explains the error <code>axis 1 is out of bounds for array of dimension 0</code>, since <code>fal... | 2D numpy array: Remove lines that contain only empty tuples | python|arrays|numpy|matrix | 0 | 54 | 3 | 72,798,816 | 72,798,816 | 2 | true | 2022-06-29T08:25:14.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
2D numpy array: Remove lines that contain only empty tuples<p>I have a 2d numpy array that contains tuple with two elements: an int and an str.</p>
<p>An exa... |
72,806,207 | How can I loop through a linked list and print each piece of data that matches the input?<p>I'm working on this method but am running into an issue. When I enter a word that matches the data in an index of the linked list, it only prints the first index of the Linked List the same number of times that the word I entere... | <p>If <code>strTemp.contains(strInput)</code> is not satisfied <code>temp = temp.next;</code> will not get executed hence while loop will get stuck. Take <code>temp = temp.next;</code> outside of the if statement.</p> | How can I loop through a linked list and print each piece of data that matches the input? | java|loops|linked-list | -3 | 54 | 2 | 72,806,234 | 72,806,234 | 2 | true | 2022-06-29T18:26:24.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I loop through a linked list and print each piece of data that matches the input?<p>I'm working on this method but am running into an issue. When I e... |
72,804,301 | How to stored different typed functions under the same object key?<p>I store values and individual typed functions in an array of objects. When looping the array all the types of all typed functions in the array are required for any value. How can I write it more specific?</p>
<p><a href="https://www.typescriptlang.org... | <p>This is a shortcoming of Typescript and a design limitation. It correctly types <code>item.value</code> as <code>boolean | string[]</code> and conversely it correctly types <code>item.render</code> as <code>typeof arrayToString | typeof booleanToString</code>. However, in order to ensure type-safety, Typescript does... | How to stored different typed functions under the same object key? | javascript|reactjs|typescript | 2 | 54 | 2 | 72,808,954 | 72,808,954 | 2 | true | 2022-06-29T15:45:19.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to stored different typed functions under the same object key?<p>I store values and individual typed functions in an array of objects. When looping the a... |
72,811,737 | Google Apps Script - Calling a function involving moving files across Google Share Drive folders<p>I'm not familiar with Google Apps Script and I'm having trouble figuring out how to call a function.</p>
<p>The below function is intended to move a file from the Google Shared Drive folder its current in to a new folder ... | <ul>
<li>With minor modifications to the code provided, I was able to make it work on my end:</li>
</ul>
<h2>Changes:</h2>
<pre><code>//I've removed the curly brackets from this function signature.
function moveFilesBetweenSharedDrives(parentFolderId, destinationFolderId, fileId) {
...
</code></pre>
<pre><code>//To c... | Google Apps Script - Calling a function involving moving files across Google Share Drive folders | google-apps-script|google-sheets | 2 | 54 | 1 | 72,813,655 | 72,813,655 | 2 | true | 2022-06-30T07:18:55.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google Apps Script - Calling a function involving moving files across Google Share Drive folders<p>I'm not familiar with Google Apps Script and I'm having tr... |
72,815,285 | Type of argument depending on value of other one<ul>
<li>The following function admit a generic called <code>T</code>.</li>
<li>The property <code>key</code> only admit a string that should be a key of <code>T</code>. We will use <code>Obj</code> as <code>T</code>.</li>
<li>The property <code>value</code> should admit ... | <p>(Aside: I am renaming your types to conform with common TypeScript naming conventions: your <code>Obj</code> type will become <code>T</code>, to make it obvious that this is a generic type parameter and not a specific type; and, your <code>obj</code> type will become <code>Obj</code>, to make it obvious that this is... | Type of argument depending on value of other one | typescript | 1 | 54 | 2 | 72,816,614 | 72,816,614 | 2 | true | 2022-06-30T11:50:17.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Type of argument depending on value of other one<ul>
<li>The following function admit a generic called <code>T</code>.</li>
<li>The property <code>key</code>... |
72,824,743 | Fill in space between elements when using border-radius<p>When I create a grid using a large enough border-radius property on the grid cells and a gap property, gaps appear at the corners inbetween the elements (the red background).
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="f... | <p>Use a gradient coloration:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3... | Fill in space between elements when using border-radius | css | 2 | 54 | 3 | 72,826,368 | 72,826,368 | 2 | true | 2022-07-01T05:28:38.110Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fill in space between elements when using border-radius<p>When I create a grid using a large enough border-radius property on the grid cells and a gap proper... |
72,829,939 | access input form in angular and insert data on it<p>I'm trying to create edit option in angular, but what i need is when i click edit data of this selected item send to form and then display it in inputs form with the ability to edit them</p>
<p>what i did is send the id in the endpoint , then using api i return this ... | <p>First of all you should create a class/interface for the invoice and don't use any iff possible ,</p>
<p>Than , in the subscription you could do something like this.</p>
<pre><code>this.editStudentForm.patchValue({
serialNumber : response.serialNumber,
status : response.status
customerSerialNumber : response.costum... | access input form in angular and insert data on it | angular|typescript|angular13 | -1 | 54 | 1 | 72,831,236 | 72,831,236 | 2 | true | 2022-07-01T13:21:19.867Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
access input form in angular and insert data on it<p>I'm trying to create edit option in angular, but what i need is when i click edit data of this selected ... |
72,832,568 | Why is my Swift app created text file visible/accessible in the simulator, but not the iOS device itself?<p>I would like my Swift app to be able to write a file (myDebug.log) that is viewable by a user on their iOS device.</p>
<p>The code I am using is below. While the code can be cleaner and more efficient, right now ... | <p>In the Info section you need to add an entry for <code>Supports Document Browser</code> and set its value to <code>YES</code>.</p>
<p>From documentation:</p>
<blockquote>
<p>To allow other apps to open and edit the files stored in your app’s Documents folder, set this key to YES. This key also lets users set the app... | Why is my Swift app created text file visible/accessible in the simulator, but not the iOS device itself? | ios|swift|nsfilemanager | 2 | 54 | 1 | 72,832,906 | 72,832,906 | 2 | true | 2022-07-01T17:04:13.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is my Swift app created text file visible/accessible in the simulator, but not the iOS device itself?<p>I would like my Swift app to be able to write a f... |
72,840,124 | Image Successfully Downloads From Node Server But Does Not Display<p>I have a folder on my node server called <code>/pictures/renamed</code>. In it, I'm trying to save an image and it does successfully save it however it doesn't display anything except a message that says "It appears that we don't support this fil... | <p>That's because the response is an html document (telling you that you are redirected) rather than actual jpg data. <br>It looks something like this in a text editor:<br>
<code><html><body>You are being <a href="https://images.unsplash.com/photo-1656712193135-ef15d7ea27d6?ixlib=rb-1.2.1&amp;dl... | Image Successfully Downloads From Node Server But Does Not Display | javascript|node.js|fs | 2 | 54 | 1 | 72,840,384 | 72,840,384 | 2 | true | 2022-07-02T15:07:20.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Image Successfully Downloads From Node Server But Does Not Display<p>I have a folder on my node server called <code>/pictures/renamed</code>. In it, I'm tryi... |
72,849,195 | How to edit intermediate table Django?<p>So i'm trying to make 2 models like so</p>
<pre><code>class Product(models.Model):
name = models.CharField(max_length=70)
availability = models.ManyToManyField(Store)
class Store(models.Model):
name = models.CharField(max_length=150)
location = models.CharField(... | <p>You can specify a <a href="https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ManyToManyField.through" rel="nofollow noreferrer"><strong><code>through=…</code></strong> model <sup>[Django-doc]</sup></a>:</p>
<pre><code>class Product(models.Model):
name = models.CharField(max_length=70)
... | How to edit intermediate table Django? | python|django|django-models | 2 | 54 | 1 | 72,849,216 | 72,849,216 | 2 | true | 2022-07-03T19:03:42.537Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to edit intermediate table Django?<p>So i'm trying to make 2 models like so</p>
<pre><code>class Product(models.Model):
name = models.CharField(max_l... |
72,860,867 | What is the simplest way to secure my lambda's functionURL?<p>I have a lambda that needs to be accessed by a user. They must be able to visit the URL in a browser. What is the simplest way to secure the functionURL so that if the URL were to leak, there would be another layer of security that would need to be gone thro... | <p>Lambda function URLs only support <code>AWS_IAM</code> and <code>NONE</code> for the <code>AuthType</code> parameter, as mentioned in the <a href="https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html" rel="nofollow noreferrer">documentation</a>.</p>
<blockquote>
<p>I can't use AWS_IAM as the requirement is th... | What is the simplest way to secure my lambda's functionURL? | amazon-web-services|authentication|aws-lambda|authorization | 0 | 54 | 1 | 72,860,956 | 72,860,956 | 2 | true | 2022-07-04T18:40:02.560Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the simplest way to secure my lambda's functionURL?<p>I have a lambda that needs to be accessed by a user. They must be able to visit the URL in a br... |
72,863,828 | Ansible - How to build dynamic inventory group from inventory host file<p>Below is sample inventory host file:</p>
<pre><code>cat inventory.hosts
[dev_flipkart_app]
myhost6 ansible_user=fappuser
myhost9 ansible_user=fappuser
[dev_amazon_app]
myhost1 ansible_user=aappuser
[dev_snapdeal_app]
myhost4 ansible_user=sappuse... | <p>You seem to have noticed that <code>hosts:</code> can be a jinja2 expression, but then stopped short of realizing that <code>hosts:</code> can be a jinja2 expression</p>
<pre class="lang-yaml prettyprint-override"><code>- hosts: "{{ appname | split(',') | map('regex_replace', '(.+)', ENV ~ '_\\1_app') }}"
... | Ansible - How to build dynamic inventory group from inventory host file | ansible|ansible-inventory | 1 | 54 | 2 | 72,864,277 | 72,864,277 | 2 | true | 2022-07-05T03:53:44.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ansible - How to build dynamic inventory group from inventory host file<p>Below is sample inventory host file:</p>
<pre><code>cat inventory.hosts
[dev_flipk... |
72,868,572 | Debounce function not working properly when input is changed at fast pace<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function Test() {
// const [value, setValue] = useState('... | <p>The issue has to do on how react works (which is complicated), every time you call the setValue function and runs the rest of the debounce logic, this dispatches a command to update the value sometime in the future (very small time, almost instantly, but it is still asynchronous and not in the current execution loop... | Debounce function not working properly when input is changed at fast pace | javascript|reactjs|debounce | 1 | 54 | 1 | 72,868,769 | 72,868,769 | 2 | true | 2022-07-05T11:20:36.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Debounce function not working properly when input is changed at fast pace<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-ba... |
72,872,380 | How do I filter my dataset based on going from one value to another within a specific number of days?<p>I'm trying to figure out how to subset my dataframe to include values that go from 0 to -5 in <em>3 days or less</em>. I can't seem to figure out how to code the "3 days or less" part to my filter function.... | <p>Is this what you are looking for:</p>
<pre><code>data %>%
group_by(group_id = as.integer(gl(n(),3,n()))) %>%
filter(value == 0 | value <=-5) %>%
ungroup() %>%
select(-group_id)
</code></pre>
<pre><code> date value
<chr> <dbl>
1 2020-06-09 0
2 2020-06-10 -7
3... | How do I filter my dataset based on going from one value to another within a specific number of days? | r|date|dplyr|filter|lubridate | 1 | 54 | 1 | 72,873,021 | 72,873,021 | 2 | true | 2022-07-05T15:57:21.040Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I filter my dataset based on going from one value to another within a specific number of days?<p>I'm trying to figure out how to subset my dataframe t... |
72,892,300 | can I use C# IDisposable to automate job when exit the scope?<p>Can I use IDisposable to do automate job when triggers in exiting the scope?
This case, I am using IDisposable to only do some job in the end of method, not 'disposing' resources.
This is one of my code :</p>
<pre><code>public class ScopeTimer : IDisposabl... | <p>Yes you can do that. Even <a href="https://blog.stephencleary.com/" rel="nofollow noreferrer">Stephen Cleary</a> does it in <a href="https://github.com/StephenCleary/AsyncEx" rel="nofollow noreferrer">Nito.AsyncEx</a> like:</p>
<pre><code>SemaphoreSlim _syncRoot = new();
...
using var lockHandle = this._syncRoot.L... | can I use C# IDisposable to automate job when exit the scope? | c#|idisposable | 1 | 54 | 1 | 72,892,785 | 72,892,785 | 2 | true | 2022-07-07T04:30:15.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
can I use C# IDisposable to automate job when exit the scope?<p>Can I use IDisposable to do automate job when triggers in exiting the scope?
This case, I am ... |
72,895,202 | How to use assert with condition to check on every element in a matrix in Python?<p>I am checking if a matrix is positive definite by computing the eigenvalues of the matrix.</p>
<pre><code>matrix = np.array([[0.0070123 , 0.00578589, 0.01867008, 0.00351521, 0.00151787],
[0.00578589, 0.00590836, 0.01657745, 0.003... | <p>You can do this using <code>np.all</code> which returns <code>True</code> if all elements of an array are <code>True</code> and returns <code>False</code> otherwise. More details in the <a href="https://numpy.org/doc/stable/reference/generated/numpy.all.html" rel="nofollow noreferrer">docs</a>:</p>
<p>The following ... | How to use assert with condition to check on every element in a matrix in Python? | python|python-3.x|numpy|matrix|assert | 0 | 54 | 2 | 72,895,449 | 72,895,449 | 2 | true | 2022-07-07T09:14:32.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use assert with condition to check on every element in a matrix in Python?<p>I am checking if a matrix is positive definite by computing the eigenvalu... |
72,896,085 | Multiple words in single keyword and counting them in the data in python<p>I'm trying to run the following code in python in order to count the keywords in the specific values of my dictionary. Suppose my <code>keywords = ['is', 'my']</code> and it works fine for me but when my keywords are <code>keywords = ['is', 'my ... | <p>The substring "my name" is also splitted in get_keyword_counts so there is no actual value "my name", they are apart: "my" and "name". I guess you want to count it as a whole, so there is what you need:</p>
<pre><code>def get_keyword_counts(text: str, keywords: List[str]) ->... | Multiple words in single keyword and counting them in the data in python | python|python-3.x|google-colaboratory|keyword-search | 0 | 54 | 2 | 72,896,334 | 72,896,334 | 2 | true | 2022-07-07T10:16:41.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple words in single keyword and counting them in the data in python<p>I'm trying to run the following code in python in order to count the keywords in t... |
72,905,771 | Error In SwiftUI with a conditional binding must have a Optional Type, not string<p>I am making an app using Sign In With Apple, and when I put in my "on completion" part of the code, it isn't working. I've tried to put an optional "?" behind the errored part, but it isn't working. Looking around SO... | <p>Declare it as optional</p>
<pre><code>struct LoginView: View {
@EnvironmentObject var userAuth: UserAuth
@State var currentNonce: String? // << here !!
</code></pre> | Error In SwiftUI with a conditional binding must have a Optional Type, not string | swiftui|sign-in-with-apple | 3 | 54 | 1 | 72,906,485 | 72,906,485 | 2 | true | 2022-07-08T01:26:29.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error In SwiftUI with a conditional binding must have a Optional Type, not string<p>I am making an app using Sign In With Apple, and when I put in my "o... |
72,909,351 | Ansible "replace" regexp (one OR the other)<p>I'm trying to replace a value in a config file, using the <em><strong>replace</strong></em> module.
However, I was wondering if there is an OR function or similar.</p>
<p>Currently, I have the following play:</p>
<pre class="lang-yaml prettyprint-override"><code>- name: Rep... | <p>if you want to use regex the or is <code>|</code></p>
<pre><code>- name: Replace "DebugLevel" variable-value"
replace:
path: /etc/zabbix/zabbix_proxy.conf
regexp: '^# DebugLevel=3|^DebugLevel=.*'
replace: 'DebugLevel=3'
</code></pre> | Ansible "replace" regexp (one OR the other) | replace|ansible | 1 | 54 | 2 | 72,909,614 | 72,909,614 | 2 | true | 2022-07-08T09:27:19.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ansible "replace" regexp (one OR the other)<p>I'm trying to replace a value in a config file, using the <em><strong>replace</strong></em> module.
However, I ... |
72,914,776 | Why is Set() repeating values?<p>I´m trying to use Set() in js to retrieve some 'unique data', but it keeps returning repeated values to me.</p>
<p>Console debug:
<a href="https://i.stack.imgur.com/firQN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/firQN.png" alt="Console debug" /></a></p>
<p>Code... | <h3>Sounds like you are trying to avoid duplicating users?</h3>
<p>It is clever to try to use a set, because sets do avoid duplication, but unfortunately they only work in the way you intended if the element is a primitive data type such as <code>String</code> or <code>Number</code>, and not if it is an object, i.e. of... | Why is Set() repeating values? | javascript | -1 | 54 | 3 | 72,915,170 | 72,915,170 | 2 | true | 2022-07-08T17:08:38.793Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is Set() repeating values?<p>I´m trying to use Set() in js to retrieve some 'unique data', but it keeps returning repeated values to me.</p>
<p>Console d... |
72,916,194 | Toggle Button function doesn't maintain current State<p>I have two functions <strong>displayDataGraph</strong> and <strong>displayDataTable</strong> that displays data as a table and graph. I have a button that toggles between graph and table display.The graph is the default view and the switch to the table view happen... | <p>You need to be able to save the desired view state across page refreshes. As Lauren Groh mentions, can you save it in Session Storage?</p>
<p>When your page loads it sounds like the css display property for the <strong>dataTable</strong> is being set to <code>none</code> and the css display property on the <strong>d... | Toggle Button function doesn't maintain current State | javascript|state | 0 | 54 | 2 | 72,916,649 | 72,916,649 | 2 | true | 2022-07-08T19:32:29.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Toggle Button function doesn't maintain current State<p>I have two functions <strong>displayDataGraph</strong> and <strong>displayDataTable</strong> that dis... |
72,921,787 | Rust Book Example: Does dbg! return ownership or not?<p>I am new to rust and am following along with the official guide and have a question about the following section in chapter 5.2:</p>
<pre><code>#[derive(Debug)] struct Rectangle {
width: u32,
height: u32, }
fn main() {
let scale = 2;
let rect1 = Re... | <p>The point is that <code>dbg!</code> <em>takes</em> the ownership and then <em>returns</em> it back as a value it evaluates to. It works as something like this function:</p>
<pre><code>fn dbg<T: Debug>(val: T) -> T {
// some debug printing of `val`
val
}
</code></pre>
<p>(The real implementation is a... | Rust Book Example: Does dbg! return ownership or not? | rust | 2 | 54 | 2 | 72,922,177 | 72,922,177 | 2 | true | 2022-07-09T13:33:56.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rust Book Example: Does dbg! return ownership or not?<p>I am new to rust and am following along with the official guide and have a question about the followi... |
72,922,661 | How to use sympy to find the relationship between X and Y<p>I am new to sympy. My ultimate goal is to plot y with respect to x.</p>
<p>Y is the known formula of k, m, ω</p>
<p><img src="https://i.stack.imgur.com/RbM7u.png" alt="check the y formula" /></p>
<p>and <code>x = ω*(m/k)**0.5</code> is also known.</p>
<p>I wan... | <p>This is an implicit definition of <code>y</code> and <code>x</code> in terms of parameters <code>omega</code>, <code>k</code> and <code>m</code>. Since <code>omega</code> and x are directly proportional, I would recommend solving for <code>omega</code> in terms of <code>x</code> and then replacing <code>omega</code>... | How to use sympy to find the relationship between X and Y | python|sympy | 1 | 54 | 1 | 72,922,821 | 72,922,821 | 2 | true | 2022-07-09T15:30:58.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use sympy to find the relationship between X and Y<p>I am new to sympy. My ultimate goal is to plot y with respect to x.</p>
<p>Y is the known formula... |
72,929,030 | Regex match at least two or one word<p>I'd like to create regex to find at least two words or one</p>
<p>For ex</p>
<p>I have this phrases</p>
<pre><code>I will buy a car
I will buy a horse
I will buy an electronic device
I will buy chip electronic
a device electronic will buy by my uncle
</code></pre>
<p>And I'm using... | <p>For the first pattern, you can use a backreference if that is supported with a negative lookahead (note that there is also a typo in your pattern <code>eletronic</code> missing a <code>c</code> char)</p>
<p>For the example I have omitted matching a newline for <code>\W</code></p>
<pre><code>\b(buy|electronic)(?:[^\w... | Regex match at least two or one word | regex | 1 | 54 | 3 | 72,929,106 | 72,929,106 | 2 | true | 2022-07-10T13:55:54.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex match at least two or one word<p>I'd like to create regex to find at least two words or one</p>
<p>For ex</p>
<p>I have this phrases</p>
<pre><code>I w... |
72,933,442 | Firebase hosting test hosting configuration settings<p>I am looking for a method to test the current provided hosting configuration for Firebase Hosting, the <code>firebase.json</code> file seems to deploy correctly, but there doesn't seem to be a way to see this configuration on the cloud once its deployed:</p>
<p>fir... | <p>The <a href="https://firebase.google.com/docs/hosting/full-config#where-to-define-config" rel="nofollow noreferrer">documentation</a> states:</p>
<blockquote>
<p>You can check the deployed firebase.json content using the <a href="https://firebase.google.com/docs/reference/hosting/rest/v1beta1/sites.releases/list?api... | Firebase hosting test hosting configuration settings | firebase|firebase-hosting | 0 | 54 | 1 | 72,933,620 | 72,933,620 | 2 | true | 2022-07-11T03:34:32.543Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firebase hosting test hosting configuration settings<p>I am looking for a method to test the current provided hosting configuration for Firebase Hosting, the... |
72,950,121 | Passing array to a function and using that array in an Enhanced for loop<p>When I pass the array "bucky" to the change function and in the change function if I use an enhanced for loop, the variable counter gives the error "The value of the local variable counter is not used"</p>
<p>But if I put the... | <p>Question is about updating original array values, then you have to use normal for loop so that each index values can be updated:</p>
<pre><code>class apples{
public static void main(String[] args) {
int bucky[]={3,4,5,6,7};
bucky = change(bucky);
for(int b:bucky) {
System.out.println(b);
}
}
... | Passing array to a function and using that array in an Enhanced for loop | java | 2 | 54 | 1 | 72,950,479 | 72,950,479 | 2 | true | 2022-07-12T09:34:43.797Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing array to a function and using that array in an Enhanced for loop<p>When I pass the array "bucky" to the change function and in the change f... |
72,954,735 | How to correctly submit an array of jobs using slurm<p>I'm trying to submit an array of jobs using <code>slurm</code>, but it's not working as I expected. My bash script is <code>test.sh</code>:</p>
<pre><code>#!/bin/bash ... | <p>You just need to submit the script with <code>sbatch test.sh</code>. Using <code>--wrap</code> in the way you've done it just runs <code>test.sh</code> as a simple Bash script, so none of the Slurm-specific parts are used.</p> | How to correctly submit an array of jobs using slurm | bash|slurm | 0 | 54 | 1 | 72,961,961 | 72,961,961 | 2 | true | 2022-07-12T15:22:14.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to correctly submit an array of jobs using slurm<p>I'm trying to submit an array of jobs using <code>slurm</code>, but it's not working as I expected. My... |
72,964,776 | Azure Cognitive Search analyzer vs. normalizer, when you should you use each<p>I am learning Azure Cognitive Search and got a bit confused about Analizer and Normilizer.
<a href="https://docs.microsoft.com/en-us/azure/search/search-analyzers" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/search/searc... | <p>The simplest explanation is to use an analyzer for properties containing blocks of text. The normalizer is more suitable for properties with short content that you typically would use for filtering or sorting like City, Country, Name, etc.</p>
<p>A block of text will have content in a specific language. A language-s... | Azure Cognitive Search analyzer vs. normalizer, when you should you use each | azure|azure-cognitive-search | 0 | 54 | 2 | 72,978,039 | 72,978,039 | 2 | true | 2022-07-13T10:30:11.913Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Azure Cognitive Search analyzer vs. normalizer, when you should you use each<p>I am learning Azure Cognitive Search and got a bit confused about Analizer and... |
72,986,571 | How do I resolve Uncaught Error: Too many re-renders. React limits the number of renders to prevent an infinite loop while setting a state?<p>I am getting an object <code>location</code> from another page like this.</p>
<pre><code>const location = useLocation();
</code></pre>
<p>I am trying to set a variable like this.... | <p>It seems you are running the code as an unintentional side effect and the condition is malformed.</p>
<p>Use the <code>useEffect</code> hook with correct dependencies to issue the side-effect to update state.</p>
<p>Example:</p>
<pre><code>useEffect(() => {
if (location.state !== null) {
setcompanyOneAlread... | How do I resolve Uncaught Error: Too many re-renders. React limits the number of renders to prevent an infinite loop while setting a state? | javascript|reactjs|react-hooks|react-router | 1 | 54 | 2 | 72,986,733 | 72,986,733 | 2 | true | 2022-07-14T20:55:51.910Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I resolve Uncaught Error: Too many re-renders. React limits the number of renders to prevent an infinite loop while setting a state?<p>I am getting an... |
72,988,056 | Try/catch statement with return on class method<p>So I have a method inside my class, that does a <code>GET</code> request and then there are error handlers and various other components, but then if the response is good, it will be returned inside <code>// THE 200 RESPONSE IS HERE</code>.</p>
<p>How would I be able to ... | <blockquote>
<pre class="lang-php prettyprint-override"><code>if (json_last_error() === JSON_ERROR_NONE) {
</code></pre>
</blockquote>
<p>PHPStorm doesn't know that this statement is redundant (you've already told <code>json_decode()</code> to throw exceptions) so all it sees is a potential logic path missing a return ... | Try/catch statement with return on class method | php|phpstorm | 1 | 54 | 2 | 72,988,222 | 72,988,222 | 2 | true | 2022-07-15T01:03:02.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Try/catch statement with return on class method<p>So I have a method inside my class, that does a <code>GET</code> request and then there are error handlers ... |
73,005,348 | Iterating and looping over multiple columns in glm in r using a name from another variable<p>I am trying to iterate over multiple columns for a glm function in R.</p>
<pre><code>view(mtcars)
names <- names(mtcars[-c(1,2)])
for(i in 1:length(names)){
print(paste0("Starting iterations for ",names[i]))
... | <p><code>mpg ~ cyl + paste0(names[i])</code> or even <code>mpg ~ cyl + names[i]</code> is not a valid syntax for a formula. Use</p>
<pre><code>reformulate(c("cyl", names[i]), "mpg")
</code></pre>
<p>instead, which dynamically creates a formula from variable names.</p> | Iterating and looping over multiple columns in glm in r using a name from another variable | r|loops|glm | 0 | 54 | 3 | 73,005,393 | 73,005,393 | 2 | true | 2022-07-16T15:15:51.073Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Iterating and looping over multiple columns in glm in r using a name from another variable<p>I am trying to iterate over multiple columns for a glm function ... |
73,010,448 | How to replace cost of an item with the previous cost of the same item in a dataframe using Pandas?<p>Suppose I have the following dataframe:</p>
<pre><code>data = {'ID': ['A', 'B', 'C', 'A', 'C', 'O', 'B', 'A', 'B', 'O'], 'Item':['Apple','Banana','Carrot','Apple', 'Carrot', 'Orange', 'Banana', 'Apple', 'Banana', 'Oran... | <p>You can use <code>groupby</code> on Item as well. This gives you output in the same order you expected</p>
<pre><code>data['Cost'] = data.groupby('Item')['Cost'].shift(fill_value=0)
data[data['Cost'] != 0]
</code></pre>
<p>This gives us expected output:</p>
<pre><code> ID Item Cost
3 A Apple 10
4 C Carr... | How to replace cost of an item with the previous cost of the same item in a dataframe using Pandas? | python|pandas|dataframe|csv|data-preprocessing | 0 | 54 | 2 | 73,010,745 | 73,010,745 | 2 | true | 2022-07-17T08:55:56.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to replace cost of an item with the previous cost of the same item in a dataframe using Pandas?<p>Suppose I have the following dataframe:</p>
<pre><code>... |
73,019,187 | LINQ with joins and group generates enormous query and is slow<p>My Entity structure is as follows:</p>
<pre class="lang-cs prettyprint-override"><code>public class DisbursementItem
{
public int DisbursementNumber;
public int IDDisbursementItem;
public int IDReceiptItem;
public decimal Amount;
publi... | <p>Easiest way is to add all fields which are needed for result to grouping key. Rewritten query to Query syntax for readability and maintainability:</p>
<pre class="lang-cs prettyprint-override"><code>DateTime from;
DateTime to;
var query =
from di in context.DisbursementItem
where di.Disbursement_IDDisburse... | LINQ with joins and group generates enormous query and is slow | c#|sql-server|entity-framework|linq|entity-framework-6 | 0 | 54 | 2 | 73,021,344 | 73,021,344 | 2 | true | 2022-07-18T08:12:53.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
LINQ with joins and group generates enormous query and is slow<p>My Entity structure is as follows:</p>
<pre class="lang-cs prettyprint-override"><code>publi... |
72,908,580 | Create a string from array of operators and operands<p>I am trying to make a tool to create MySQL query with javascript. So I have separate input boxes to fill the operator and operands. The example array looks like this.</p>
<pre><code>var array = [ "OR", ["<", "col1", "col2"... | <p>You can try to convert it using below recursive approach:</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 array = [ "OR", ["<", "col1", "col2"], [ "AND", ["==", "co... | Create a string from array of operators and operands | javascript|mysql|reactjs|typescript | 1 | 54 | 2 | 72,908,682 | 72,908,682 | 2 | true | 2022-07-08T08:18:47.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create a string from array of operators and operands<p>I am trying to make a tool to create MySQL query with javascript. So I have separate input boxes to fi... |
72,821,637 | Comparing two text files and the matches go to a new file<p>In python I would like to find a way to compare two text files and read one line by line and find it's match if any in the other file. If they match I would like to take that string and write it to a new file.</p>
<p>I do not know how I would even start this t... | <p>Try something like this.</p>
<pre><code>with open('file1.txt') as file1:
with open('file2.txt') as file2:
newfile = open('newfile.txt','w')
for range(len(file1.readlines())):
s1 = file1.readline()
s2 = file2.readline()
if s1 == s2:
... | Comparing two text files and the matches go to a new file | python|data-structures|compare | 2 | 54 | 2 | 72,821,749 | 72,821,749 | 2 | true | 2022-06-30T20:26:48.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Comparing two text files and the matches go to a new file<p>In python I would like to find a way to compare two text files and read one line by line and find... |
72,803,352 | Python turtle module is not responding to the keystroke that is being issued<p>So far, my snake game is doing somewhat okay. One issue is that for some reason the "turtle" isn't responding to the keystrokes, and I really don't know why. I tried a lot of different stuff but it was all useless. The main problem... | <p>This is a good example of the importance of minimizing the code when you debug. Consider the code here:</p>
<pre class="lang-py prettyprint-override"><code>def start_game(screen, snake):
game_on = True
while game_on: # infinite loop
screen.update()
time.sleep(0.1)
snake.move()
def co... | Python turtle module is not responding to the keystroke that is being issued | python|python-3.x|turtle-graphics|2d-games|python-turtle | 2 | 54 | 2 | 72,804,368 | 72,804,368 | 2 | true | 2022-06-29T14:43:50.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python turtle module is not responding to the keystroke that is being issued<p>So far, my snake game is doing somewhat okay. One issue is that for some reaso... |
72,816,493 | Multiple stop and step values for dynamic range<pre><code>step = [0.1,0.2,0.3,0.4,0.5]
static = []
for x in step:
range = np.arrange(5,10 + x, x)
static.append(range)
# this return a list that looks something like this [[5.,5.1,5.2,...],[5.,5.2,5.4,...],[5.,5.3,5.6,...],...]
</code></pre>
<p>Im trying to create... | <p>Using a list of steps and a list of "milestones" that we are going to use to determine the start and end points of each <code>np.arange</code>, we can do this:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
def dynamic_range(milestones, steps) -> list:
start = milestones[0]
... | Multiple stop and step values for dynamic range | python | 1 | 54 | 2 | 72,816,685 | 72,816,685 | 2 | true | 2022-06-30T13:14:39.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple stop and step values for dynamic range<pre><code>step = [0.1,0.2,0.3,0.4,0.5]
static = []
for x in step:
range = np.arrange(5,10 + x, x)
stat... |
72,995,461 | Use arrays' position as function parameters<p>I'm trying to pass positions of a list of arrays in a function, but I'm definitely missing something.</p>
<p>This is my script :</p>
<pre><code>// function to display the results
function display(array){
var source = SpreadsheetApp.openBy... | <p>There are so many ways to do this:</p>
<p>First:</p>
<pre><code>function myTest() {
let i = 0;
let arrays = rechershe(); // will display arrays[0][0]
i++;
next(arrays,i);
}
function next(arrays,i) {
display(arrays[i][0]);
}
</code></pre>
<p>Or:</p>
<pre><code>function myTest() {
let i = 0;
let arrays... | Use arrays' position as function parameters | javascript|arrays|google-apps-script|google-sheets | 0 | 54 | 1 | 72,996,015 | 72,996,015 | 2 | true | 2022-07-15T14:20:48.797Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use arrays' position as function parameters<p>I'm trying to pass positions of a list of arrays in a function, but I'm definitely missing something.</p>
<p>Th... |
72,804,591 | TypeError: Cannot read properties of undefined in permissions.length<p>The full error is</p>
<pre><code>if(command.permissions.length){
^
TypeError: Cannot read properties of undefined (reading 'length')
</code></pre>
<p>There is a <a href="https://stackoverflow.com/questions/66329415/discord-bot... | <p>The error means that in at least one of your command files, the exported object has no <code>permissions</code> array, or <code>permissions</code> is not an array.</p>
<p>It's probably a good idea to check if <code>command.permission</code> exists and if not, just skip that part. The optional chaining operator (<cod... | TypeError: Cannot read properties of undefined in permissions.length | javascript|node.js|discord.js|bots | 1 | 54 | 1 | 72,804,741 | 72,804,741 | 2 | true | 2022-06-29T16:06:05.437Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TypeError: Cannot read properties of undefined in permissions.length<p>The full error is</p>
<pre><code>if(command.permissions.length){
... |
72,806,087 | Edit CSV filename in Python to append to the current filename<p>I'm trying to change the name of my csv file with python. So I know that when I want a filename it gives gives a path for instance</p>
<blockquote>
<p>C:/user/desktop/somefolder/[someword].csv</p>
</blockquote>
<p>so what I want to do is to change this fil... | <p>Here is the solution (no extra libs needed):</p>
<pre><code>import os
somenumber = 1 # use number generated in your code
fpath = "C:/user/desktop/somefolder"
for full_fname in os.listdir(fpath):
# `someword` is a file name without an extension in that context
someword, fext = os.path.splitext(fu... | Edit CSV filename in Python to append to the current filename | python|pandas|csv|filenames | 2 | 54 | 1 | 72,806,248 | 72,806,248 | 2 | true | 2022-06-29T18:15:57.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Edit CSV filename in Python to append to the current filename<p>I'm trying to change the name of my csv file with python. So I know that when I want a filena... |
72,990,874 | Replacing Unwrap()s with ? - compiler complaining on functions that do return Result or Option<p>I'm only a few days into my Rust journey and going over my now functionally completed first project, working on <a href="https://dmerej.info/blog/post/killing-unwrap/" rel="nofollow noreferrer">exercising</a> <code>unwrap()... | <blockquote>
<p><code>from_utf8</code> returns <code>Result<&str, Utf8Error></code>, but trying:</p>
<pre class="lang-rust prettyprint-override"><code>let json = str::from_utf8(&buf)?;
</code></pre>
<p>Has a compiler error of <code>This function should return Result or Option to accept ?</code>. But it do... | Replacing Unwrap()s with ? - compiler complaining on functions that do return Result or Option | rust | 1 | 54 | 2 | 72,990,945 | 72,990,945 | 2 | true | 2022-07-15T08:03:54.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replacing Unwrap()s with ? - compiler complaining on functions that do return Result or Option<p>I'm only a few days into my Rust journey and going over my n... |
73,004,663 | Why is the else condition triggered when the when condition is fulfilled?<p><a href="https://i.stack.imgur.com/XPllA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XPllA.png" alt="enter image description here" /></a></p>
<pre><code>select t.customer_type, t.balance_no
from test12 t
where t.customer_... | <p>Your condition and its case expression are evaluated for every row in the table (that matched the customer type, if the optimiser filters that first). It isn't matching both the <code>when</code> and <code>else</code> for any single row.</p>
<ul>
<li>For the row with 'AZN' neither the <code>when</code> or <code>else... | Why is the else condition triggered when the when condition is fulfilled? | sql|oracle|case | 0 | 54 | 2 | 73,005,004 | 73,005,004 | 2 | true | 2022-07-16T13:37:13.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is the else condition triggered when the when condition is fulfilled?<p><a href="https://i.stack.imgur.com/XPllA.png" rel="nofollow noreferrer"><img src=... |
72,828,070 | Equivalent Operation to b"" for an already defined string Python<p>I am able to define a bytes string as follows:</p>
<pre><code>string = b"0x340xEF"
</code></pre>
<p>I want to cast an already made string. Let us call it <code>string</code> into a bytes string. How do I perform this? <code>bytes(string)</code... | <p>You need to encode the string to be able to convert it to bytes:</p>
<pre><code>string = "b0x340xEF".encode("latin-1")
print(string)
</code></pre>
<p><strong>Output:</strong></p>
<pre><code>b'b0x340xEF'
</code></pre> | Equivalent Operation to b"" for an already defined string Python | python | 1 | 54 | 1 | 72,828,098 | 72,828,098 | 2 | true | 2022-07-01T10:43:04.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Equivalent Operation to b"" for an already defined string Python<p>I am able to define a bytes string as follows:</p>
<pre><code>string = b"0x340xEF&quo... |
72,959,555 | Cannot make the unit test work as expected<p>I'm struggling to make the unit test for my event subscriber work as expected. So here is the test:</p>
<pre><code>$user = new User();
$user->email = self::EMAIL;
$user->subscribed_to_mailing_list = TRUE;
$this->userRepository->expects($this->once())
->... | <p>Assertion fails, because user is not returned from repository in your subscriber service.
You should inject to your subscriber userRepository mock and then return user from it, for example:</p>
<pre><code> $this->userRepository
->expects($this->once())
->method('getById')
->... | Cannot make the unit test work as expected | php|symfony|symfony5 | 0 | 54 | 1 | 72,964,184 | 72,964,184 | 2 | true | 2022-07-13T00:08:14.403Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cannot make the unit test work as expected<p>I'm struggling to make the unit test for my event subscriber work as expected. So here is the test:</p>
<pre><co... |
72,817,600 | C Makefile: How to build environment variable into executable<p>I'm trying to get an environment variable passed from the shell into an executable when it gets compiled, and be able to access that variable. For example, say I wanted to build the time something was compiled into the application when it gets built so I c... | <p>You can use the <code>-D</code> option to create preprocessor variables on the command line.</p>
<pre><code>CC=gcc
CFLAGS=-I
BUILD_TIME=`date`
example: example.c
$(CC) -D "BUILD_TIME=\"$(BUILD_TIME)\"" -o example example.c
</code></pre>
<pre class="lang-c prettyprint-override"><code>#incl... | C Makefile: How to build environment variable into executable | c|makefile|environment-variables | 1 | 54 | 2 | 72,817,645 | 72,817,645 | 2 | true | 2022-06-30T14:30:24.833Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C Makefile: How to build environment variable into executable<p>I'm trying to get an environment variable passed from the shell into an executable when it ge... |
72,860,816 | Regex Reverse Search on a String<p>I'm trying to extract the second last value in a string so I can return the value "<strong>Minute</strong>". I'm using Zapier which only allows regex.</p>
<p><strong>Example string:</strong></p>
<pre><code>Week,Day,Hour,Another,Hour,Minute,Second
</code></pre>
<p>I've got a ... | <p>You can use the following regex:</p>
<pre><code>[^,]+(?=(?:,[^,]+){1}$)
</code></pre>
<p>It extracts the first non-comma values <code>[^,]+</code> occurring after a comma, a sequence of non-comma values and the end of string <code>(?:,[^,]+){1}$</code>. If you want preceeding values, it's sufficient to increment the... | Regex Reverse Search on a String | regex | 1 | 54 | 3 | 72,860,888 | 72,860,888 | 2 | true | 2022-07-04T18:33:24.400Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex Reverse Search on a String<p>I'm trying to extract the second last value in a string so I can return the value "<strong>Minute</strong>". I'm... |
72,950,594 | Delete doc Firebase v9 React v18, indexOf issue<pre><code>//Delete document
const deleteAnime = (e) => {
e.preventDefault()
deleteDoc(doc(db,"Users", uid,"anime",anime.id))
}
</code></pre>
<p>This is the code to delete the document, where anime.id is document id</p>
<pre><code>{anime.map(f... | <p>The mistake is you are trying to access id from anime but it's an array not an object so i would suggest get the index of the clicked item and there will be no need to use form at all if you are not submitting any details from input.</p>
<p>Also you don't need to define key in every element as it will be need only o... | Delete doc Firebase v9 React v18, indexOf issue | reactjs|firebase|react-native|google-cloud-firestore | 0 | 54 | 1 | 72,952,453 | 72,952,453 | 2 | true | 2022-07-12T10:10:52.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Delete doc Firebase v9 React v18, indexOf issue<pre><code>//Delete document
const deleteAnime = (e) => {
e.preventDefault()
deleteDoc(doc(db,"Use... |
72,861,776 | Why is \r not giving the same results on mac vscode as windows vscode<p>The following code should print the number of seconds passing from 0-10 and works as intended on windows vscode, however on mac's vscode the output takes 10 seconds as it should but only outputs</p>
<blockquote>
<p>10 second has passed</p>
</blockq... | <p>You are suffering from buffering. By disabling buffering on stdout, the text will be output immediately on calling <code>printf</code>. Here is the code:</p>
<pre><code>#include<stdio.h>
#include<unistd.h>
int main() {
setbuf(stdout, NULL);
for(int i = 0;i<=10;i++)
{
printf("... | Why is \r not giving the same results on mac vscode as windows vscode | c|macos|visual-studio-code | 1 | 54 | 1 | 72,861,814 | 72,861,814 | 2 | true | 2022-07-04T20:32:37.250Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is \r not giving the same results on mac vscode as windows vscode<p>The following code should print the number of seconds passing from 0-10 and works as ... |
72,920,507 | number multiplied by 1.0 getting different result than not multiplying it by 1.0 c#<p>I was showing my cousin some of the beginner code that I was doing 6 months ago when I started coding and I encountered something strange that I can't explain to myself now that I know more about coding.</p>
<pre><code>int countLight ... | <p>In statements like this:</p>
<pre><code>double percentLight = countLight / count * 100;
</code></pre>
<p>The expression on the right side is done using <strong>integer arithmetics</strong>, because all the values are intergers.
If <code>count</code> is larger than <code>countLight</code>, then <code>countLight / cou... | number multiplied by 1.0 getting different result than not multiplying it by 1.0 c# | c# | 1 | 54 | 2 | 72,920,579 | 72,920,579 | 2 | true | 2022-07-09T10:09:12.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
number multiplied by 1.0 getting different result than not multiplying it by 1.0 c#<p>I was showing my cousin some of the beginner code that I was doing 6 mo... |
72,805,735 | c# create a .forEach() Method using actions<p>I'm trying to create a method that loops through an array and executes some actions I wrote with a lambda expression. Somehow I don't think I understood how to use actions correctly because my code just results in a bunch of "null" objects.</p>
<p>Does somebody kn... | <p>In your delegate, setting <code>x = ...</code> only changes the value of that local parameter: it does nothing to the array itself. You would end up with the same problem if you used a <code>for</code> loop like this:</p>
<pre><code>var a = new[] { 1, 2, 3};
for (int i = 0; i < a.Length; i++)
{
var x = a[i];... | c# create a .forEach() Method using actions | c#|lambda|foreach | -1 | 54 | 1 | 72,805,862 | 72,805,862 | 2 | true | 2022-06-29T17:42:29.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
c# create a .forEach() Method using actions<p>I'm trying to create a method that loops through an array and executes some actions I wrote with a lambda expre... |
72,948,333 | How to build a tessellated rectangle<p>i am trying to build a tessellated rectangle based from the answer to this question.</p>
<p><a href="https://stackoverflow.com/questions/62258532/how-to-build-data-for-a-tessellated-rectangle">How to build data for a tessellated rectangle</a></p>
<p>My final result has only the ha... | <p>The problem is with indices... You ported <a href="https://stackoverflow.com/questions/62258532/how-to-build-data-for-a-tessellated-rectangle">my old code</a> which uses direct indices but you use VBO instead which uses logical indices ... so the remedy is just divide all indices by 8 (stride size) at the end of Gen... | How to build a tessellated rectangle | c++|opengl | 1 | 54 | 1 | 72,950,478 | 72,950,478 | 2 | true | 2022-07-12T07:09:22.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to build a tessellated rectangle<p>i am trying to build a tessellated rectangle based from the answer to this question.</p>
<p><a href="https://stackover... |
72,801,382 | Conditional formatting comparing tables for missing rows and/or changes<p>I'm being dumb here. I don't know what I'm forgetting.</p>
<p>I have two tables on two sheets with similar structures. I would like to have the following conditional formatting rules: -</p>
<ul>
<li>By matching on the first three columns, highlig... | <p>For the first part of the question, you can use Countifs (or Match if you prefer) but must <a href="https://superuser.com/questions/1517823/how-can-i-use-conditional-formatting-in-an-excel-table-using-structured-referenc">use Indirect for each table reference</a>:</p>
<pre><code>=COUNTIFS(INDIRECT("Table2[Colum... | Conditional formatting comparing tables for missing rows and/or changes | excel|conditional-formatting | 1 | 54 | 1 | 72,802,331 | 72,802,331 | 2 | true | 2022-06-29T12:23:03.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Conditional formatting comparing tables for missing rows and/or changes<p>I'm being dumb here. I don't know what I'm forgetting.</p>
<p>I have two tables on ... |
72,980,248 | Different ways to instantiate classes<p>Aside from personal preference is there any difference between:</p>
<pre><code>SomeClass SomeInstance = new SomeClass();
SomeClass SomeInstance = new();
</code></pre>
<p>and</p>
<pre><code>var SomeInstance = new SomeClass();
</code></pre> | <p><code>new()</code> was introduced in C#9 for use with type inference so you don't have to keep specifying it if the type is already known.
Example is if you are creating a</p>
<p><code>new List<Something>() { new Something()}</code></p>
<p>then each <code>new Something()</code> can be changed to <code>new()</c... | Different ways to instantiate classes | c#|constructor|new-operator|var | 0 | 54 | 1 | 72,980,578 | 72,980,578 | 2 | true | 2022-07-14T12:08:24.413Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Different ways to instantiate classes<p>Aside from personal preference is there any difference between:</p>
<pre><code>SomeClass SomeInstance = new SomeClass... |
72,823,070 | Anti_join between df1 and df2 but how to change all mismatch in df2 to NA<p>Below are my two dataframes, df1 and df2</p>
<pre><code>df1 <- data.frame(id=c("632592651","633322173","634703802","634927873","635812953","636004739","636101211","63... | <p>One potential solution for dealing with conflicts is to use the <a href="https://github.com/moodymudskipper/powerjoin" rel="nofollow noreferrer">powerjoin package</a>, e.g.</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
df1 <- data.frame(id=c("632592651","633322173","6... | Anti_join between df1 and df2 but how to change all mismatch in df2 to NA | r|rename|anti-join | 2 | 54 | 2 | 72,823,116 | 72,823,116 | 2 | true | 2022-06-30T23:42:36.017Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Anti_join between df1 and df2 but how to change all mismatch in df2 to NA<p>Below are my two dataframes, df1 and df2</p>
<pre><code>df1 <- data.frame(id=c... |
72,771,184 | Javascript math recursive function optimisation<p>This is what I've got</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 base = 10000
let yearly = 31557600
let apy = 0.09
l... | <p>Well it can be transformed to an equation, but not a linear one.</p>
<p>Here, is the approach:</p>
<p>I will rename the base as b0, and the new base as b1</p>
<p>b1 = b0 * (1 + (apy/yearly)</p>
<p>and after loop is incremented new base will be updated, let's call the new b1 as b2:</p>
<p>b2 = b1 * (1 + (apy/yearly))... | Javascript math recursive function optimisation | javascript|recursion|math | 0 | 54 | 2 | 72,771,425 | 72,771,425 | 2 | true | 2022-06-27T11:16:28.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript math recursive function optimisation<p>This is what I've got</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data... |
72,975,786 | using string from char() in `";displayname;"` in plot<p><strong>update:</strong> <br />
I've isolated the issue of why the <code>legend()</code> wasn't working. The question regarding that: <br />
<a href="https://stackoverflow.com/questions/73001779/does-legend-require-implicit-variables-which-get-lost-in-different-sc... | <p>You can use <a href="https://octave.sourceforge.io/octave/function/sprintf.html" rel="nofollow noreferrer"><code>sprintf()</code></a> to explicitly build strings. Use <code>%s</code> to denote a string variable to add: <code>sprintf(";%s;", cur(1, :))</code>.</p>
<p>Using array concatenation you could do <... | using string from char() in `";displayname;"` in plot | plot|octave|legend | 0 | 54 | 1 | 72,976,062 | 72,976,062 | 2 | true | 2022-07-14T05:50:11.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
using string from char() in `";displayname;"` in plot<p><strong>update:</strong> <br />
I've isolated the issue of why the <code>legend()</code> wasn't worki... |
72,872,724 | how to pass params to bash file from terraform<p>I am using cloud-init to run commands on my instance using user-data. I want to create password for jupyter notebook that I want to start as systemd.</p>
<p>this is my terraform main.tf</p>
<pre><code>resource "oci_core_instance" "jupyterlab_instance"... | <p>In this case I would suggest using the <code>templatefile</code> built-in function [1]. In order to do that, there has to be a slight modification in both the resource and the user data script. In the resource block, it has to be changed to:</p>
<pre><code>resource "oci_core_instance" "jupyterlab_inst... | how to pass params to bash file from terraform | bash|jupyter-notebook|terraform|terraform-provider-oci | 0 | 54 | 1 | 72,873,327 | 72,873,327 | 2 | true | 2022-07-05T16:25:38.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to pass params to bash file from terraform<p>I am using cloud-init to run commands on my instance using user-data. I want to create password for jupyter ... |
73,007,550 | esLint gives error The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype<p>I am using esLint for my angular project it throw an error for below code</p>
<pre class="lang-js prettyprint-override"><code>private calculateFieldValue(value: any): any {
let... | <p>Although you do have a <code>hasOwnProperty</code> check, it doesn't enclose the whole of the loop body; <code>isEmptyObject = true;</code> will run even if the <code>value[0]</code> doesn't have that property. The linter wants you to only run statements in the body if the <code>hasOwnProperty</code> succeeds.</p>
<... | esLint gives error The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype | angular|typescript|eslint|lint|jslint | -2 | 54 | 1 | 73,007,581 | 73,007,581 | 2 | true | 2022-07-16T20:44:46.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
esLint gives error The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype<p>I am using esLint for my angu... |
72,810,472 | Highlight cells in a sheet based on corresponding cell values in another sheet with a macro<p>I would like to create a macro that would highlight certain cells of a sheet based on another sheet values.</p>
<p>I have two Sheets in my excel file:</p>
<p>"<em>Check</em>" and "<em>Formula</em>"</p>
<p>I... | <p>If you do not prefer Conditional Formatting, please use the next VBA code. It will place the range to be processed (from ) in an array, iterate between all array elements and create a <code>Union</code> Range to be colored at the end:</p>
<pre><code>Sub HighlightCells()
Dim shCh As Worksheet, shF As Worksheet, last... | Highlight cells in a sheet based on corresponding cell values in another sheet with a macro | excel|vba|excel-formula | 0 | 54 | 2 | 72,811,801 | 72,811,801 | 2 | true | 2022-06-30T04:55:42.370Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Highlight cells in a sheet based on corresponding cell values in another sheet with a macro<p>I would like to create a macro that would highlight certain cel... |
72,977,909 | Populating array with items from another array throws TypeMismatch Error<p>for belows code the line <code>vItemsNotInMaster(k) = vCheckItems(i)</code> throws a type mismatch error once the array <code>vItemsNotInMaster</code> shall be populated. I am not sure why - as the caller sub and function array variables are all... | <p>As I said in my comment, replacing <code>vItemsNotInMaster(k) = vCheckItems(i)</code> with <code>vArray3(k) = vCheckItems(i)</code> will solve the problem.</p>
<p>But if you need learning arrays manipulation, the next more compact code returns the same in less code lines number:</p>
<pre><code>Public Sub Testing_()
... | Populating array with items from another array throws TypeMismatch Error | arrays|excel|vba|types | 1 | 54 | 3 | 72,978,685 | 72,978,685 | 2 | true | 2022-07-14T09:02:02.650Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Populating array with items from another array throws TypeMismatch Error<p>for belows code the line <code>vItemsNotInMaster(k) = vCheckItems(i)</code> throws... |
72,799,895 | Multiple lists share same reference<p>Ive got a function named <strong>allAppointmentList</strong> to get Appointments from the server using a GET method in AppointmentProvider class.
In my <strong>MyAppointments</strong> class I have initialized 2 lists named as appointment and allAppointments as below,</p>
<pre><code... | <p>Your problem is probably that you think this creates new lists:</p>
<pre class="lang-dart prettyprint-override"><code> appointments = appointmentProvider.allAppointmentList;
allAppointments = appointmentProvider.allAppointmentList;
</code></pre>
<p>My guess is that <code>appointmentProvider.allAppointmentList</co... | Multiple lists share same reference | list|flutter|dart|pass-by-reference|statefulwidget | 0 | 54 | 2 | 72,800,093 | 72,800,093 | 3 | true | 2022-06-29T10:32:16.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple lists share same reference<p>Ive got a function named <strong>allAppointmentList</strong> to get Appointments from the server using a GET method in ... |
72,835,978 | Really confused about sort in JS<p>today I was writing some code and I realized I cannot do
<code>x.push(5, 9).sort(); //wrong</code>
nor can I do
<code>x.sort(x.push(5, 9)); //wrong</code>
and had to do</p>
<pre><code>x.push(5, 9);
x.sort();
</code></pre>
<p>I was wondering isn't there a way to make it one line?>
a... | <p><code>.push</code> returns the new length of the array, not the mutated array. If you want to push and sort at the same time, consider creating a new array, then sorting that.</p>
<pre><code>const sortedArr = [...arr, 5, 9].sort();
// or, .sort((a, b) => a - b)
</code></pre>
<p><code>.sort()</code> without any ar... | Really confused about sort in JS | javascript | 3 | 54 | 2 | 72,836,002 | 72,836,002 | 3 | true | 2022-07-02T02:03:46.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Really confused about sort in JS<p>today I was writing some code and I realized I cannot do
<code>x.push(5, 9).sort(); //wrong</code>
nor can I do
<code>x.so... |
72,846,727 | Writing bytes without padding<p>Given these 2 numbers (milliseconds since Unix epoch), 1656773855233 and 1656773888716, I'm trying to write them to a binary object. The kicker is that I want to write them to a 11 byte object.</p>
<p>If I accept that the timestamps can only represent dates before September 7th 2039, the... | <p>Use a bit shift to combine both times into the same int, before converting that to <code>bytes</code>:</p>
<pre><code>x = (receive_time << 41) + event_time
b = x.to_bytes(11, 'big')
with open("test.bin", "wb") as f:
f.write(b)
</code></pre> | Writing bytes without padding | python|bit | 0 | 54 | 1 | 72,846,810 | 72,846,810 | 3 | true | 2022-07-03T13:03:23.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Writing bytes without padding<p>Given these 2 numbers (milliseconds since Unix epoch), 1656773855233 and 1656773888716, I'm trying to write them to a binary ... |
72,876,703 | R: How to use mathematical notation in ggplot labels within a shiny app?<p>I am trying to use mathematical notation/symbols in the labels of a <code>ggplot2</code> figure within a <code>shiny</code> app.</p>
<p>The minimal example below uses <code>shiny</code>'s <a href="https://shiny.rstudio.com/gallery/mathjax.html" ... | <p><em>"While one can typically use latex2expr or manually create expressions for a ggplot figure, I'm not sure how to approach this when the figure is produced within shiny."</em> It works exactly the same way.</p>
<pre class="lang-r prettyprint-override"><code>library(shiny)
library(ggplot2)
ui <- fluid... | R: How to use mathematical notation in ggplot labels within a shiny app? | r|ggplot2|shiny|latex|mathjax | 0 | 54 | 1 | 72,876,791 | 72,876,791 | 3 | true | 2022-07-06T00:11:29.663Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R: How to use mathematical notation in ggplot labels within a shiny app?<p>I am trying to use mathematical notation/symbols in the labels of a <code>ggplot2<... |
72,897,668 | Deoptimizations kill the performance with binary trees<p>I need some help to optimize the code below. I can't understand how to rewrite the code to avoid the deoptimizations.
Below is the code that works very slow on the Node platform. I took it from benchmarksgame-team binary-trees benchmark and added minor changes.</... | <p>(V8 developer here.)</p>
<p>The premise of this question is incorrect: <strong>a few deopts don't matter, and don't move the needle regarding performance.</strong> Trying to avoid them is an exercise in futility.</p>
<p>The first step when trying to improve performance of something is to profile it. In this case, a ... | Deoptimizations kill the performance with binary trees | javascript|node.js|optimization|v8 | 0 | 54 | 1 | 72,902,968 | 72,902,968 | 3 | true | 2022-07-07T12:16:52.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deoptimizations kill the performance with binary trees<p>I need some help to optimize the code below. I can't understand how to rewrite the code to avoid the... |
72,923,297 | loop checking number of words from array bash<p>I need help with checking a number next to a word from an array, here is the output from the array:</p>
<pre><code>declare -a my_array=([0]="user.name 16" [1]="user.name2 11" [2]="user.name3 7" [3]="user.name 2"
</code></pre>
<p>as ... | <p>From comments posted by OP in response to @KamilCuk, looks like the request is to loop over the element (each is "name NN") and select all the items where NN < 20</p>
<p>Solution is to iterate over the elements, extract the NN from each item, and perform an action based on the NN value. See below.</p>
<... | loop checking number of words from array bash | arrays|linux|bash|loops | -2 | 54 | 3 | 72,924,424 | 72,924,424 | 3 | true | 2022-07-09T17:09:34.857Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
loop checking number of words from array bash<p>I need help with checking a number next to a word from an array, here is the output from the array:</p>
<pre>... |
72,927,456 | Fromula to find value in y axis for given value in x axis<p><a href="https://i.stack.imgur.com/uvnkD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uvnkD.png" alt="enter image description here" /></a></p>
<pre><code>var x1 =10;
var x2 =100;
var y1 =2;
var y2 =15;
var x_inp =60;
var y_out =???
</cod... | <p>This is a math problem, but computers help to solve it using linear forumla (as suggested by @cmgchess in comments):</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var x1 =... | Fromula to find value in y axis for given value in x axis | javascript | -3 | 54 | 1 | 72,927,568 | 72,927,568 | 3 | true | 2022-07-10T09:27:57.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fromula to find value in y axis for given value in x axis<p><a href="https://i.stack.imgur.com/uvnkD.png" rel="nofollow noreferrer"><img src="https://i.stack... |
72,977,106 | jq | get the paths value after filtered paths<p>Let's say I have the following JSON:</p>
<pre class="lang-json prettyprint-override"><code>{
"A": {
"ID": "something"
},
"B": {
"ID": "something-else"
},
"C": {
"ID": &qu... | <p>It should be possible to do with <code>getpath/1</code>. Collect the paths matching your condition and extract the value at each path to see if matches your condition</p>
<pre class="lang-none prettyprint-override"><code>( paths | select(.[-1] == "ID")) as $p |
if getpath($p) == "something" th... | jq | get the paths value after filtered paths | json|path|jq | 1 | 54 | 3 | 72,977,182 | 72,977,182 | 3 | true | 2022-07-14T07:58:08.360Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jq | get the paths value after filtered paths<p>Let's say I have the following JSON:</p>
<pre class="lang-json prettyprint-override"><code>{
"A":... |
72,977,134 | SQLSTATE[42S22]: Column not found: 1054 Unknown column 'role_user.id' in 'on clause'<p>I just want to get count from users based on roles table, but I when I try to code, I get the error message <code>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'role_user.id' in 'on clause'</code></p>
<p><strong>this is the ... | <p>Are you sure your role_user table has an <code>id</code> field?</p>
<p>It looks like the table relates <code>users</code> to <code>roles</code> so I imagine it only has <code>user_id</code> and <code>role_id</code>.</p>
<p>Your join probably needs to be</p>
<pre><code>->join('roles', 'role_user.role_id', '=', 'ro... | SQLSTATE[42S22]: Column not found: 1054 Unknown column 'role_user.id' in 'on clause' | mysql|sql|laravel | -1 | 54 | 1 | 72,977,193 | 72,977,193 | 3 | true | 2022-07-14T08:00:08.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'role_user.id' in 'on clause'<p>I just want to get count from users based on roles table, but I when I... |
72,982,603 | Problem with conditional rendering with React<p>I don't really have an error but I'm not getting the desired outcome. I have a Flask API as my backend. It returns JSON data, this data is then passed to the React frontend to be displayed after certain actions such as a button click.</p>
<p>The Flask backend is working f... | <p>First of all, you set the initial value of the <code>data</code> state to an array, but use it as an object. <code>( data.members )</code></p>
<p>If the data come from API is an object not an array, You need to set it as an object.</p>
<pre><code>const [data, setData] = useState({})
</code></pre>
<p>Then you can che... | Problem with conditional rendering with React | javascript|reactjs | 0 | 54 | 2 | 72,982,707 | 72,982,707 | 3 | true | 2022-07-14T14:56:50.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Problem with conditional rendering with React<p>I don't really have an error but I'm not getting the desired outcome. I have a Flask API as my backend. It re... |
72,972,854 | how can I save as much memory as possible by compressing the texture<p>I made a script to download some images from the web on click page, and when I moved to the second page, a second set of images was downloaded, but the problem is that the image size is relatively large, and when there are more than one image, it co... | <p>Try compressing the images, it makes a big difference
You can use this code
I found it in this <a href="https://github.com/yasirkula/UnityTextureOps" rel="nofollow noreferrer">TextureOps</a> add-on</p>
<pre><code>public static Texture2D Scale( Texture sourceTex, int targetWidth, int targetHeight, TextureFormat forma... | how can I save as much memory as possible by compressing the texture | c#|unity3d | 2 | 54 | 2 | 72,988,366 | 72,988,366 | 3 | true | 2022-07-13T21:30:54.177Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how can I save as much memory as possible by compressing the texture<p>I made a script to download some images from the web on click page, and when I moved t... |
72,993,611 | Python cant re-enter readline<p>I'm new to python and I'm trying to make a GUI window with Tkinter that executes a command. I wrote the code underneath but it wont work. What is wrong with it? The required imports are imported like tk and ttk.</p>
<p>This is the tkinter window code:</p>
<pre><code>root = Tk()
root.geom... | <p>From running the code you share, where the tk window will not run, the first clear error is that you haven't included a root.mainloop() statement</p>
<p>below is the code as I have tweaked it to make it run:</p>
<pre><code>from tkinter import *
from tkinter import ttk
PlayerPoints = 100
def AddPoints():
Point... | Python cant re-enter readline | python|tkinter | 2 | 54 | 1 | 72,993,780 | 72,993,780 | 3 | true | 2022-07-15T11:56:43.653Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python cant re-enter readline<p>I'm new to python and I'm trying to make a GUI window with Tkinter that executes a command. I wrote the code underneath but i... |
73,000,611 | Shared variables in two threads<p>I'm writing a ros node with two threads to support client dynamic reconfiguration in C++. One thread is responsible for subscribing to a topic <code>/error</code> which is float, taking the sum of value <code>sum_of_error</code>, and incrementing <code>batch_size</code>. Another thread... | <pre><code> while (batch_size < BATCH) {
}
</code></pre>
<p>The apparent intent of this is to wait until another execution thread increments <code>batch_size</code> until it reaches <code>BATCH</code>.</p>
<p>However because this access to <code>batch_size</code> is not synchronized, at all, this results in u... | Shared variables in two threads | c++|multithreading|mutex|ros | 2 | 54 | 1 | 73,000,633 | 73,000,633 | 3 | true | 2022-07-16T00:04:08.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Shared variables in two threads<p>I'm writing a ros node with two threads to support client dynamic reconfiguration in C++. One thread is responsible for sub... |
73,007,451 | Svelte's reactivity not working on class variables<p>So for form actions, I made a class to make things cleaner, but there's a problem. Whenever any errors/success messages are set in the class, Svelte does not automatically rerender the changes.</p>
<p>Frontend:</p>
<pre><code><script>
import Form from '@/p... | <p>Reactivity only works for code within components, outside you need to use stores or events to signal changes.</p> | Svelte's reactivity not working on class variables | javascript|svelte|inertiajs | 0 | 54 | 1 | 73,007,740 | 73,007,740 | 3 | true | 2022-07-16T20:27:52.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Svelte's reactivity not working on class variables<p>So for form actions, I made a class to make things cleaner, but there's a problem. Whenever any errors/s... |
73,008,720 | Why no matches regex?<p>I created regex, using regex101 and it shows, that is all ok.
<a href="https://regex101.com/r/gLF7yl/1" rel="nofollow noreferrer">https://regex101.com/r/gLF7yl/1</a></p>
<p>But when I use it in my code, it doesn`t work.</p>
<p>Here is my code:</p>
<pre><code>foreach ($varsArray as $var) {
... | <p>The reason this is happening is because of the escaping required when you have a string that contains a variable instantiation. Your strings actually look like this:</p>
<pre><code>\$_['heading_title'] = 'Запрашиваемая страница не найдена!';
</code></pre>
<p>So you need to update your regex to include the added slas... | Why no matches regex? | php|regex | -2 | 54 | 1 | 73,008,777 | 73,008,777 | 3 | true | 2022-07-17T01:36:54.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why no matches regex?<p>I created regex, using regex101 and it shows, that is all ok.
<a href="https://regex101.com/r/gLF7yl/1" rel="nofollow noreferrer">htt... |
73,014,477 | What is the cost for this Firestore onSnapshot listener?<p>I'm trying to get the sync status of a collection in Firestore. with the following query snapshot.</p>
<pre><code>firebase.firestore().collection("cities").onSnapshot(
{ includeMetadataChanges: true },
(querySnapshot) => {
setHasPendingWrit... | <p>It will cost you initially one read for every document in "cities", then one read every time one of those documents is added, updated, or deleted as long as the listener is still active. It is not different than any other listening query.</p>
<p>Specifying <code>includeMetadataChanges</code> doesn't cost ... | What is the cost for this Firestore onSnapshot listener? | javascript|firebase|google-cloud-firestore | 0 | 54 | 1 | 73,014,555 | 73,014,555 | 3 | true | 2022-07-17T18:48:36.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the cost for this Firestore onSnapshot listener?<p>I'm trying to get the sync status of a collection in Firestore. with the following query snapshot.... |
73,009,039 | SVG two paths in a single one axis<p>I have been new to SVG and trying to figure out how can I make different paths in an SVG in a single axis/single line.</p>
<p><a href="https://i.stack.imgur.com/u33uG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u33uG.png" alt="Here these words are created usin... | <p>Your first move command in each path specifies the starting y position. Each path shows a different y position. All four paths should probably have their first y value be the same say 150; however, some of the commands that follow are using absolute positioning. Changing the Y value will distort your shapes. If you ... | SVG two paths in a single one axis | html|css|svg | 1 | 54 | 1 | 73,009,298 | 73,009,298 | 3 | true | 2022-07-17T03:19:04.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SVG two paths in a single one axis<p>I have been new to SVG and trying to figure out how can I make different paths in an SVG in a single axis/single line.</... |
72,996,325 | How to replace <w:sdt> Xml in Word Doc using Apache POI as XWPFSDT and XWPFSDTContent object is read-only<p>In previous code we would use XWPFSParagraph and Runs to find Merge Tokens that we would replace with data in our database. However, now we need to use Content Controls and do the same thing. The problem with Par... | <p><code>XWPFSDT</code> as well as <code>XWPFSDTCell</code> are in experimental state up to now. They don't even have access to their underlying <code>CTSdtBlock</code>, <code>CTSdtRun</code> and <code>CTSdtCell</code> classes. I don't know why. So extending them to provide writing into the <code>CTSdtBlock</code>, <co... | How to replace <w:sdt> Xml in Word Doc using Apache POI as XWPFSDT and XWPFSDTContent object is read-only | apache-poi | 0 | 54 | 1 | 73,005,126 | 73,005,126 | 3 | true | 2022-07-15T15:28:54.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to replace <w:sdt> Xml in Word Doc using Apache POI as XWPFSDT and XWPFSDTContent object is read-only<p>In previous code we would use XWPFSParagraph and ... |
72,850,570 | Garbage value in an array where array length and input is defined<p>I am a beginner, and I am trying to learn C++.</p>
<p>For now, all I am trying to do is input 3 numbers, and print them back.</p>
<pre><code>#include <iostream>
using namespace std;
int main(){
int n[2];
cout << "Enter three ... | <p>This <code>for</code></p>
<pre><code>for (int j=0;j<=2;j++){
cin>>n[j];
}
</code></pre>
<p>expects that the array has at least three elements with indices in the range [0, 2].</p>
<p>However you declared an array with two elements</p>
<pre><code>int n[2];
</code></pre>
<p>If you are going to inp... | Garbage value in an array where array length and input is defined | c++|arrays | 0 | 54 | 1 | 72,850,606 | 72,850,606 | 3 | true | 2022-07-03T23:32:57.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Garbage value in an array where array length and input is defined<p>I am a beginner, and I am trying to learn C++.</p>
<p>For now, all I am trying to do is i... |
73,016,773 | Is there a way to convert a string into bits in MicroPython?<p>While using MicroPython, I recently copied my "toBits()" function from python. My code is this:</p>
<pre><code>def tobits(s):
bits = ""
for c in s:
bits2 = ''.join(format(ord(i), '08b') for i in c)
bits = bits + b... | <p>Just figured this out, I ended up replacing the bits2 line with:</p>
<pre><code>bits2 = ''.join('{:08b}'.format(ord(i)) for i in c)
</code></pre> | Is there a way to convert a string into bits in MicroPython? | python|micropython|raspberry-pi-pico | 1 | 54 | 2 | 73,025,501 | 73,025,501 | 3 | true | 2022-07-18T02:32:19.450Z | 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 a string into bits in MicroPython?<p>While using MicroPython, I recently copied my "toBits()" function from python. My co... |
73,007,118 | Collectors group by characteristic and minimum value of a field of said characteristic<p>Title is sort of confusing but I'm not sure how to explain my problem in a simple sentence.</p>
<p>I have a homework task to group an arraylist of rectangles by length (same as perimeter in this case) using streams and collectors a... | <blockquote>
<p>group an arraylist of rectangles by <code>length</code> (same as <strong>perimeter</strong> in this case) using streams and collectors and to calculate <strong>minimum</strong> <code>width</code> for each group.</p>
</blockquote>
<p>As you've noticed, <em>collector</em> <code>minBy()</code> produces <co... | Collectors group by characteristic and minimum value of a field of said characteristic | java|java-stream|collectors | 1 | 54 | 2 | 73,007,187 | 73,007,187 | 3 | true | 2022-07-16T19:32:56.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Collectors group by characteristic and minimum value of a field of said characteristic<p>Title is sort of confusing but I'm not sure how to explain my proble... |
72,780,250 | Unexpected `;` when trying to trim extra endlines<p>I'm learning how to use <code>erb</code> (and ruby for that matter) and having a hard time replicating examples from <a href="https://puppet.com/docs/puppet/5.5/lang_template_erb.html" rel="nofollow noreferrer">this</a> site where the authors demonstrate that you can ... | <p>If you check out the <a href="https://ruby-doc.org/stdlib-3.1.2/libdoc/erb/rdoc/ERB.html" rel="nofollow noreferrer">ERB class doc</a>, you'll see there's an optional <code>trim_mode</code> keyword argument in <code>ERB.new</code>, and one of its possible values is:</p>
<pre><code>- omit blank lines ending in -%>... | Unexpected `;` when trying to trim extra endlines | ruby|erb | 1 | 54 | 1 | 72,783,039 | 72,783,039 | 4 | true | 2022-06-28T02:53:54.107Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unexpected `;` when trying to trim extra endlines<p>I'm learning how to use <code>erb</code> (and ruby for that matter) and having a hard time replicating ex... |
72,876,717 | Window closes only after clicking exit button multiple times?<p>When I try to exit the window by clicking the X at the top corner, the program wouldn't end and just continue running. Only after repeatedly clicking the X button, the window managed to close. Why is this the case?</p>
<p>main.cpp:</p>
<pre><code>#include ... | <p>Those two loops will not exit <em>just</em> because you clicked exit:</p>
<pre><code> while (accumulator >= deltaTime) {
while (SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_QUIT:
gameLoopRunning = false;
}
accumulator... | Window closes only after clicking exit button multiple times? | c++|sdl-2|timedelta | 0 | 54 | 1 | 72,876,767 | 72,876,767 | 4 | true | 2022-07-06T00:14:06.650Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Window closes only after clicking exit button multiple times?<p>When I try to exit the window by clicking the X at the top corner, the program wouldn't end a... |
72,935,780 | Parse data from one format to another Typescript<p>I need to parse some data got from BE from one format to another to can inject it into a table component. The format received is:</p>
<pre><code>{
"displayName": "Income",
"baseVersionSum": null,
"comparisonVersionSum"... | <p>Nice challenge ! Here is a solution with a recursive function that creates a new object and adds to it recursively by going through each child of the initial object and calling itself for that child and the child in that position in the new object:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-co... | Parse data from one format to another Typescript | javascript|reactjs|arrays|typescript|reduce | 1 | 54 | 2 | 72,935,953 | 72,935,953 | 4 | true | 2022-07-11T08:39:21.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Parse data from one format to another Typescript<p>I need to parse some data got from BE from one format to another to can inject it into a table component. ... |
72,953,728 | Replace string in text file with PowerShell<p>I am attempting to replace a string in a text file on a specific line number using PowerShell but the command is removing a majority of the content. I would like to leverage the line number because the string to be replaced occurs on several lines but only want the string o... | <p>Well, seeing that this is a <em>JSON</em> you're working with, I would treat it as such:</p>
<pre><code>$content = Get-Content "file.txt" -Raw | ConvertFrom-Json
$content.S3.Endpoint = "bucket.s3.us-west-1.vpce.amazonaws.com"
$content | ConvertTo-Json | Set-Content "file.txt"
</code></p... | Replace string in text file with PowerShell | powershell | 1 | 54 | 1 | 72,953,988 | 72,953,988 | 4 | true | 2022-07-12T14:10:26.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace string in text file with PowerShell<p>I am attempting to replace a string in a text file on a specific line number using PowerShell but the command i... |
72,976,604 | Performance of numpy all/any vs testing a single element<p>I create an array that does not contain a single zero (let's ignore that it does, with zero probability, as <code>np.random.rand()</code> samples [0,1) uniformly). I want to check whether all values are equal to zero (for some other purpose the arrays may conta... | <p>When you write <code>a == 0</code>, numpy creates a new array of type boolean, compares each element in <code>a</code> with 0 and stores the result in the array. This allocation, initialization, and subsequent deallocation is the reason for the high cost.</p>
<p>Note that you don't need the explicit <code>a == 0</co... | Performance of numpy all/any vs testing a single element | python|numpy|performance|any | 1 | 54 | 1 | 72,976,775 | 72,976,775 | 4 | true | 2022-07-14T07:12:58.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Performance of numpy all/any vs testing a single element<p>I create an array that does not contain a single zero (let's ignore that it does, with zero probab... |
72,982,164 | OOP Fortran : Is it possible to avoid select type and call suboutine directly?<p>This question follows <a href="https://stackoverflow.com/q/72935168/7462275">Fortran : Is it possible to overload a procedure in a abstract interface?</a>.</p>
<p>Following the second option suggested by Federico Perini in its answer, I wr... | <p>Not. While you can't reference the type-bound procedures for a polymorphic object where the declared type is abstract, if you know the name of the specific procedure you can call it directly, passing the "this" argument explicitly.</p>
<p>The problem, though, is that the declared type of "this" i... | OOP Fortran : Is it possible to avoid select type and call suboutine directly? | oop|module|fortran | 1 | 54 | 1 | 72,982,774 | 72,982,774 | 4 | true | 2022-07-14T14:27:37.593Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
OOP Fortran : Is it possible to avoid select type and call suboutine directly?<p>This question follows <a href="https://stackoverflow.com/q/72935168/7462275"... |
72,942,981 | Setting a specific day in the date powershell<p>I am creating an automated script to generate a new one year client secret for Azure apps and want to set the EndDateTime for the client secret to always be the first of the month one year from the end date for consistency.
Example, the client secret for an app ends on 8/... | <p>Just an example ...</p>
<pre><code>$GivenDate = Get-Date -Day 11 -Month 12 -Year 2022
$FirstOfNextMonth = $GivenDate.AddDays(- $GivenDate.Day + 1 ).AddMonths(1)
$FirstOfNextMonthNextYear = $FirstOfNextMonth.AddYears(1)
$GivenDate
$FirstOfNextMonth
$FirstOfNextMonthNextYear
</code></pre> | Setting a specific day in the date powershell | powershell | 1 | 54 | 1 | 72,943,452 | 72,943,452 | 4 | true | 2022-07-11T18:18:22.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Setting a specific day in the date powershell<p>I am creating an automated script to generate a new one year client secret for Azure apps and want to set the... |
72,822,007 | Having trouble creating a stacked bar chart<p>I'm a total newbie to R. I'm trying to create a stacked bar chart based on this code:</p>
<pre><code>activity <- c("mean_fairly_active", "mean_fairly_active", "mean_fairly_active",
"mean_fairly_active", "mean_fa... | <p>You have a few issues to address:</p>
<ol>
<li>You need to convert <code>minutes</code> to numeric, since it is currently a character vector, and R doesn't know you intend these character strings to be interpreted as numbers.</li>
<li>The weekdays are converted to a factor variable inside ggplot, and will therefore ... | Having trouble creating a stacked bar chart | r|ggplot2|stacked-bar-chart | 1 | 54 | 1 | 72,822,083 | 72,822,083 | 4 | true | 2022-06-30T21:04:52.770Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Having trouble creating a stacked bar chart<p>I'm a total newbie to R. I'm trying to create a stacked bar chart based on this code:</p>
<pre><code>activity ... |
72,776,954 | How to filter only when date is not null using optional condition<p>I am a little confused about how I can use the date as an optional condition.
if there is a date then <= of date, if the date is null then don't filter based on date.
My code is like this</p>
<pre><code>DateTime date= DateTime.UtcNow.AddDays(-10);
... | <p>I'd do the following logic:</p>
<pre><code>(date==null || (c.EVENT_DATE >= date))
</code></pre> | How to filter only when date is not null using optional condition | c# | 1 | 54 | 3 | 72,777,036 | 72,777,036 | 4 | true | 2022-06-27T18:42:07.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to filter only when date is not null using optional condition<p>I am a little confused about how I can use the date as an optional condition.
if there is... |
72,777,710 | Why is the command handler in discord.js not working?<p>So, I was developing a Discord Bot and wanted to use the Command Handler but there is something wrong with the for cycle.</p>
<p>Index.js code:</p>
<pre><code>client.commands = new Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => ... | <p>It's because of an error:</p>
<p>you typed
<code>module.export = {</code></p>
<p>instead of
<code>module.exports = {</code></p>
<p>here it is !</p> | Why is the command handler in discord.js not working? | javascript|node.js|discord.js | -1 | 54 | 1 | 72,778,128 | 72,778,128 | -1 | true | 2022-06-27T20:01:00.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is the command handler in discord.js not working?<p>So, I was developing a Discord Bot and wanted to use the Command Handler but there is something wrong... |
72,776,549 | How do I join with a column I modified in the SELECT statement?<p>I'm trying to join a table with zip codes and population sizes with a table of demographic information for clients. The issue is that the zip code column in the demographic table is not formatted in a number so I had to reformat it. It was originally for... | <p>Another option (just for fun) is to use a CROSS APPLY to get the derived value ZIP</p>
<p>One should note: Scalar-Valued Functions can be a performance drain</p>
<pre><code>SELECT R.ID
, R.program
, R.Status
, R.Street
, R.City
, C.Zip
, R.County
, R.Name
, Z.[Total Population... | How do I join with a column I modified in the SELECT statement? | sql|sql-server|join | -1 | 55 | 3 | 72,776,635 | 72,776,635 | 0 | true | 2022-06-27T18:02:54.527Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I join with a column I modified in the SELECT statement?<p>I'm trying to join a table with zip codes and population sizes with a table of demographic ... |
72,774,839 | Find the third vertex of an equilateral trainable given two N-dimensional verteces in python<h2><strong>Given:</strong></h2>
<p>Two vertices of an equilateral trainable as A,B ∊ R<sup>N</sup> when N > 1.</p>
<h2><strong>Goal:</strong></h2>
<p>Find the third vertex Z ∊ R<sup>N</sup> in which <code>||A-B|| = ||A-Z|| =... | <p>You can use a general function to find a perpendicular to a vector based on <a href="https://math.stackexchange.com/a/3175858">this method</a>. Then you just add a perpendicular vector of the right length to the midpoint of the first two vertices. As noted in comments, there are an infinite number of vertices that w... | Find the third vertex of an equilateral trainable given two N-dimensional verteces in python | python|numpy|math|geometry|triangle | -2 | 55 | 1 | 72,778,534 | 72,778,534 | 0 | true | 2022-06-27T15:42:57.773Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find the third vertex of an equilateral trainable given two N-dimensional verteces in python<h2><strong>Given:</strong></h2>
<p>Two vertices of an equilatera... |
72,785,081 | Jquery - Variable not updating into another variable<p>first of all i'm not a programmer of any kind, so i please need you to fix my issue.</p>
<p>I have a contact form which have inside a place where i can add more input fields till a maximum of 10.
Each field i add it has inside the code a class that i called "p... | <p>It's because you have not used the updated value there.</p>
<p>First, you assign a value to <code>window.s</code>, and then you create a variable that uses the value of <code>window.s</code> from the initial state, and on each addition, it just appends the same <code>fieldHtml</code>. So, you are getting the same va... | Jquery - Variable not updating into another variable | javascript|html|jquery|forms|variables | 0 | 55 | 2 | 72,785,266 | 72,785,266 | 0 | true | 2022-06-28T10:46:56.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Jquery - Variable not updating into another variable<p>first of all i'm not a programmer of any kind, so i please need you to fix my issue.</p>
<p>I have a c... |
72,784,824 | Invalid JSON error when using var_dump or echo in functions.php<p>i have a customized Logic for my CF7 Form with the Hook before_mail_sent, whoever when i try to dump my Form Data like below i get this error in the Console on submit:</p>
<pre><code>{code: 'invalid_json', message: 'The response is not a valid JSON respo... | <p>It seems the action is being called in the middle of AJAX request and var_dump() messes up the JSON response.</p>
<p>you need to replace</p>
<pre><code>var_dump($posted_data);
</code></pre>
<p>with</p>
<pre><code>error_log( print_r( $posted_data, true ) );
</code></pre>
<p>and remove <code>die();</code></p>
<p>and c... | Invalid JSON error when using var_dump or echo in functions.php | wordpress|contact-form-7 | 0 | 55 | 1 | 72,785,825 | 72,785,825 | 0 | true | 2022-06-28T10:29:51.713Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Invalid JSON error when using var_dump or echo in functions.php<p>i have a customized Logic for my CF7 Form with the Hook before_mail_sent, whoever when i tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.