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,868,417 | How to prevent QPlainText area from scrolling to end of line?<p>When appending text longer than the widget's width with word wrap set to <code>NoWrap</code>, how do I prevent the view from moving to the end of the line like in the second image?</p>
<p>What I want:</p>
<p><a href="https://i.stack.imgur.com/Ve0SO.png" re... | <p>It is quite simple. Before adding the text, get the selection (anchor and cursor position) and after adding the text, just restore the selection.</p>
<pre class="lang-py prettyprint-override"><code>from PySide6 import QtWidgets as qtw
from PySide6 import QtCore, QtGui
def appendPlainTextAndKeepCursor(text_edit, tex... | How to prevent QPlainText area from scrolling to end of line? | qt|pyside | 1 | 64 | 2 | 72,895,714 | 72,895,714 | 1 | true | 2022-07-05T11:09:15.960Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to prevent QPlainText area from scrolling to end of line?<p>When appending text longer than the widget's width with word wrap set to <code>NoWrap</code>,... |
72,840,428 | pygame animation slow down not really working<p>I am coding a simple game and in this game you click a bubble and it pops. Well I wanted to add some more detail to it so I made 4 images for the frames and when a user clicks the bubble it does go through them just really fast. I have tried using a solution posted on her... | <p>The problem is that <code>self.index</code> is incremented twice. Once in <code>clickCheck</code> (very often) and once in <code>animate</code> (delayed). Remove <code>self.index += 1</code> from <code>clickCheck</code>.<br />
Your animation stops if the mouse is not on the bubble. The animation only runs once when ... | pygame animation slow down not really working | python|loops|animation|pygame|sprite | 1 | 64 | 1 | 72,841,442 | 72,841,442 | 1 | true | 2022-07-02T15:50:42.170Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pygame animation slow down not really working<p>I am coding a simple game and in this game you click a bubble and it pops. Well I wanted to add some more det... |
72,918,028 | Swift -How to check if Headphones are Plugged In when the VC First Appears<p>When a vc is first pushed on/presented, how can I check if headphones are already plugged in?</p>
<p>In the below code, if the headphones aren't plugged in when the vc first appears, if I then plug in headphones and unplug them, everything wor... | <p>You can use <code>currentRoute.outputs</code> on the <code>AVAudioSession</code> to check what outputs initially exist:</p>
<pre><code>/// All current connected output device port types.
var outputPorts: [AVAudioSession.Port] { AVAudioSession.sharedInstance().currentRoute.outputs.map { $0.portType } }
let areHeadph... | Swift -How to check if Headphones are Plugged In when the VC First Appears | ios|swift|uiviewcontroller|nsnotificationcenter|avaudiosession | 1 | 64 | 1 | 73,230,357 | 73,230,357 | 1 | true | 2022-07-09T00:07:54.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift -How to check if Headphones are Plugged In when the VC First Appears<p>When a vc is first pushed on/presented, how can I check if headphones are alread... |
73,003,536 | How to render DistanceJoint<p>I need to render a DistanceJoint, just a line connecting the 2 anchors, nothing fancy. I've seen something about a render method <a href="https://pub.dev/documentation/forge2d/latest/forge2d_browser/DistanceJoint/render.html" rel="nofollow noreferrer">here</a> but I coulen't figure out how... | <p>Since you have tagged the question with Flame I'm guessing that you are using <code>flame_forge2d</code>?</p>
<p>The link that you provide is for pure forge2d web, but you should be able to do it in a similar fashion in <code>flame_forge2d</code>.
I would try something like this in your <code>Forge2DGame</code>:</p>... | How to render DistanceJoint | flutter|dart|box2d|flame|forge2d | 2 | 64 | 1 | 73,041,515 | 73,041,515 | 1 | true | 2022-07-16T10:46:45.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to render DistanceJoint<p>I need to render a DistanceJoint, just a line connecting the 2 anchors, nothing fancy. I've seen something about a render metho... |
72,840,545 | How to improve VBA EXCEL code sum product<p>I hope you can help me to optimize this code block in VBA EXCEL.
When I execute the block of code with less than two thousand records, it takes between one minute to 3 minutes to execute, but the problem arises when I have to execute the code when there are more than 10 thous... | <p>I had a go at a few different things here (turning calculations off and splitting the formula and value past as well as doing this as a VBA operation).</p>
<p>Honestly none of them availed much on my test set (two columns of 20,000 random numbers).</p>
<p>This being said I think it might be worth you trying the arra... | How to improve VBA EXCEL code sum product | excel|vba|performance|sumproduct | 0 | 64 | 1 | 72,841,382 | 72,841,382 | 1 | true | 2022-07-02T16:06:34.430Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to improve VBA EXCEL code sum product<p>I hope you can help me to optimize this code block in VBA EXCEL.
When I execute the block of code with less than ... |
72,773,621 | converting pd.dataFrame to json and save it<p>I got a pandas dataFrame with 2 columns that looks like that:</p>
<pre><code>data = [[30222, 5], [10211, 2], [30333, 3]]
df = pd.DataFrame(data, columns=['id', 'weight'])
</code></pre>
<p>and I wish to have it as a json file of the following form:</p>
<pre><code>[
{"id... | <p>There is no need to make a dictionary - you can export directly using <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_json.html" rel="nofollow noreferrer"><code>to_json</code></a>. You need to make the "my_json" directory first.</p>
<pre><code>with TemporaryDirectory() as tempdir:... | converting pd.dataFrame to json and save it | python|json|pandas | 0 | 64 | 2 | 72,773,733 | 72,773,733 | 1 | true | 2022-06-27T14:18:09.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
converting pd.dataFrame to json and save it<p>I got a pandas dataFrame with 2 columns that looks like that:</p>
<pre><code>data = [[30222, 5], [10211, 2], [3... |
72,968,700 | React, website crashes while trying to use data from an API<p>I'm trying to build a project that uses infinite scrolling to display the user information in the ui taken from an external API. I've managed to fetch the data successfully from the API and also apply the infinite scrolling methodology after a lot of googlin... | <p>An explanation of what's happening is that your JSX is being rendered before the data is fetched, which is a normal behaviour in React, cause the callback of the <code>useEffect</code> and updating a state are asynchronous tasks.
One way to resolve this issue is by doing so:</p>
<ol>
<li>Change your state definitio... | React, website crashes while trying to use data from an API | javascript|reactjs | 0 | 64 | 1 | 72,968,824 | 72,968,824 | 1 | true | 2022-07-13T15:17:47.537Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React, website crashes while trying to use data from an API<p>I'm trying to build a project that uses infinite scrolling to display the user information in t... |
72,784,112 | make a single barplot from two dataframes of unequal length<p>I have two (in reality - more) dataframes:<br />
(edit - the current answer does not answer my question)</p>
<pre><code>sex <- data.frame(sex = c("M", "F")
,n = c(25, 30))
age <- data.frame(age = c("20-40&qu... | <p>This is mainly about preparing your data for the plot. This assumes a regular construction of your data frames. If you don't have that, then you need to make sure that they are structured accordingly.</p>
<p>Disclaimer: I cannot endorse this type of visualisation, the below is just about demonstrating one way to get... | make a single barplot from two dataframes of unequal length | r|ggplot2|dplyr|bar-chart|cbind | 0 | 64 | 3 | 72,786,228 | 72,786,228 | 1 | true | 2022-06-28T09:39:17.597Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
make a single barplot from two dataframes of unequal length<p>I have two (in reality - more) dataframes:<br />
(edit - the current answer does not answer my ... |
72,917,939 | Dart - Detect non-completing futures<p>I have a Dart console app that is calling into a third-party library.</p>
<p>When my console app calls the third-party library the call to the method returns however my CLI app then 'hangs' for 10 seconds or so before finally shutting down.</p>
<p>I suspect that the library has so... | <p>In general, it's impossible to find things that <em>doesn't</em> happen.</p>
<p>There is no way to find all futures in the program.</p>
<p>With a zone, you might be able to intercept all the callbacks being "registered" in the zone, but you can't know which of them must be called. A future can have both va... | Dart - Detect non-completing futures | dart|memory-leaks|future | 3 | 64 | 1 | 72,923,817 | 72,923,817 | 1 | true | 2022-07-08T23:42:31.797Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dart - Detect non-completing futures<p>I have a Dart console app that is calling into a third-party library.</p>
<p>When my console app calls the third-party... |
72,888,425 | Sticky item content in RecyclerView<p>What is the best way to stick the content of a recyclerview items to the side of the screen. So that when the element goes off screen its content sticks to the side and goes with its parent only after there is no room in the rest of the element for that child.</p>
<p>I've attached ... | <p>Try this code in your view holder</p>
<p>Kotlin</p>
<pre><code>itemView.viewTreeObserver.addOnScrollChangedListener {
val offset = -itemView.left.toFloat()
YOUR_RED_VIEW.translationX = offset.coerceAtLeast(0f)
//ELEVATION
YOUR_RED_VIEW.translationZ = if (offset < 0) 2f else 0f
... | Sticky item content in RecyclerView | android|android-recyclerview|linearlayoutmanager | 0 | 64 | 1 | 72,889,459 | 72,889,459 | 1 | true | 2022-07-06T18:37:29.033Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sticky item content in RecyclerView<p>What is the best way to stick the content of a recyclerview items to the side of the screen. So that when the element g... |
72,946,128 | I can't print keys and values in Perl<p>I have a data structure that I got from this code.</p>
<pre><code>my $name = $data->{Instances}->[0]->{Tags};
</code></pre>
<p>That data structure looks like this</p>
<pre><code>$VAR1 = [
{
'Key' => 'Name',
'Value' => 'fl-demo'
},
... | <p>The tags are returned as an array, not a hash. So you're looking at doing something like this, instead, to iterate over them:</p>
<pre class="lang-perl prettyprint-override"><code>foreach my $tag (@$name) {
my $key = $tag->{Key};
my $val = $tag->{Value};
print "$key => $val\n";
}
</cod... | I can't print keys and values in Perl | perl | 0 | 64 | 3 | 72,946,235 | 72,946,235 | 1 | true | 2022-07-12T01:26:03.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I can't print keys and values in Perl<p>I have a data structure that I got from this code.</p>
<pre><code>my $name = $data->{Instances}->[0]->{Tags}... |
72,905,820 | How to code a data validation loop that consist of two numbers?<p>Here is my code here I've already coded the validation loop but I'm supposed to code a data validation loop to ensure that the number of days must be between 2 and 40 (Both 2 and 40 are valid) It works so that any number less than two is invalid and prin... | <p>you've entered the wrong condition in your while loop, it should be</p>
<pre><code>while num_days < 2 and num_days > 40:
#rest of your code
</code></pre>
<p>EDIT
I know you said it worked but this is just a word of advice. When doing a project like this, it's best to put your calculations in a function and cal... | How to code a data validation loop that consist of two numbers? | python | 0 | 64 | 2 | 72,905,902 | 72,905,902 | 1 | true | 2022-07-08T01:34:37.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to code a data validation loop that consist of two numbers?<p>Here is my code here I've already coded the validation loop but I'm supposed to code a data... |
72,914,507 | How to write a formula in Google Spreadsheet that will count sum of multiplied values using VLOOKUP function<p>I have created a spreadsheet to track my crypto portfolio.</p>
<p>Here is the simple view of the task, that I'm trying to solve:</p>
<p><a href="https://i.stack.imgur.com/9kFHP.png" rel="nofollow noreferrer"><... | <p>try:</p>
<pre><code>=SUMPRODUCT(QUERY({TRANSPOSE(A3:C4),
IFNA(VLOOKUP(FLATTEN(A3:C3), F:G, 2, ))},
"select Col2*Col3"))
</code></pre>
<p><a href="https://i.stack.imgur.com/Z0wyI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z0wyI.png" alt="enter image description here" /></a></p>
<... | How to write a formula in Google Spreadsheet that will count sum of multiplied values using VLOOKUP function | google-sheets|google-sheets-formula|vlookup|transpose|flatten | 2 | 64 | 1 | 72,916,638 | 72,916,638 | 1 | true | 2022-07-08T16:42:16.623Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to write a formula in Google Spreadsheet that will count sum of multiplied values using VLOOKUP function<p>I have created a spreadsheet to track my crypt... |
72,922,124 | Using and developing own modules in Julia 1.6<p>I am having some difficulty using my own modules in my project. My approach is the following:</p>
<p>I start by creating a folder called <code>MyProject</code> and a folder <code>src</code> within the <code>MyProject</code> folder. Within <code>MyProject/src</code>, I gen... | <p><strong>A1</strong>. Yeah, that makes sense. Probably the nicest package for this kind of project is DrWatson.jl, which <a href="https://juliadynamics.github.io/DrWatson.jl/dev/project/#Including-Julia-packages/modules-in-src-1" rel="nofollow noreferrer">recommends (almost) exactly this approach.</a>.</p>
<p><stro... | Using and developing own modules in Julia 1.6 | module|julia | 1 | 64 | 1 | 72,925,748 | 72,925,748 | 1 | true | 2022-07-09T14:20:55.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using and developing own modules in Julia 1.6<p>I am having some difficulty using my own modules in my project. My approach is the following:</p>
<p>I start ... |
72,914,183 | React-select/async not showing options to filter<p>I am trying to get some data from mongodb to the select option then i can filter them then select an option but it doesn't display any data from the API</p>
<pre><code> const [selectedValue, setSelectedValue] = useState(null);
const [inputValue, setValue] = useState('... | <blockquote>
<p>Function that returns a promise, which is the set of options to be
used once the promise resolves.</p>
</blockquote>
<p>for async:</p>
<pre><code>const getData = async (inputValue) => {
let res = await axios.get("https://jsonplaceholder.typicode.com/users");
return res.data;
};
const ge... | React-select/async not showing options to filter | reactjs|react-select | 0 | 64 | 1 | 72,914,663 | 72,914,663 | 1 | true | 2022-07-08T16:11:37.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React-select/async not showing options to filter<p>I am trying to get some data from mongodb to the select option then i can filter them then select an optio... |
72,799,100 | Javascript style not overwriting css<p>I have a simple HTML drawer that contains product recommendations. Javascript is used to toggle it open and close. In the HTML, there are 2 prices, the regular price and the discounted price. Both are visible on load. The JS is supposed to hide the discounted price(current price),... | <p>Your script <strong>does basically work</strong> - provided the variables in your template have been
replaced by actual values before the markup is rendered into the DOM. I have modified your data a little bit to demonstrate the correct behaviour on some same-price and some differing-price <code>.price-box</code> ex... | Javascript style not overwriting css | javascript|html|css | 0 | 64 | 1 | 72,801,294 | 72,801,294 | 1 | true | 2022-06-29T09:35:07.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript style not overwriting css<p>I have a simple HTML drawer that contains product recommendations. Javascript is used to toggle it open and close. In ... |
72,776,636 | C code crashes when running strcpy() for the second time<p>I have a struct that looks like the following:</p>
<pre><code>typedef struct
{
char matrikelnr[10];
double note;
} Hashtable_Entry_t;
</code></pre>
<p>And then I try to fill the struct in the main:</p>
<pre><code>#include <stdio.h>
#include <st... | <pre class="lang-c prettyprint-override"><code>Hashtable_Entry_t* student;
Hashtable_Entry_t* student2;
</code></pre>
<p><code>student</code> and <code>student2</code> are <strong>uninitalised</strong> pointer. If you not initialize them then they will point to some random memory address.</p>
<p>Instead of using pointe... | C code crashes when running strcpy() for the second time | c|pointers|struct|printf|strcpy | -1 | 64 | 1 | 72,776,737 | 72,776,737 | 1 | true | 2022-06-27T18:10:45.090Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C code crashes when running strcpy() for the second time<p>I have a struct that looks like the following:</p>
<pre><code>typedef struct
{
char matrikelnr... |
72,814,533 | How to get product pairs using pandas for each customer<p>I want to get product pairs where consecutive products viewed by the customer in which the second product is part of the recommendations of first product.</p>
<p>e.g. Customer 1 viewed Product P1 and the recommendations for the product are R1-R2-R3-R4 (4 differe... | <p>IIUC, you can use a regex to rextract the matching recommendations, then <code>join</code>:</p>
<pre><code>g = df.groupby('customer_id')
regexes = g['product_id(viewed)'].agg(lambda x: '|'.join(x.astype(str)))
matches = (g['recommendation_items']
.apply(lambda s: s.str.extractall(fr'\b({regexes[s.name]})\... | How to get product pairs using pandas for each customer | python|regex|pandas|data-analysis|recommendation-engine | 2 | 64 | 1 | 72,814,899 | 72,814,899 | 1 | true | 2022-06-30T10:52:04.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get product pairs using pandas for each customer<p>I want to get product pairs where consecutive products viewed by the customer in which the second p... |
72,859,871 | Tkinter centering ctktoplevel window in middle of main window<p>There are tons of results on centering a top level window comparative to your screen size. However, to my knowledge, there is no information out there on how to center the top level window in the center of the main window. I could hard code it but it's ugl... | <pre><code>from tkinter import Toplevel, Button, Tk
root = Tk()
width = 960
height = 540
root.geometry("%dx%d" % (width, height))
def new_window() :
win = Toplevel()
win.geometry("%dx%d+%d+%d" % (480, 270, root.winfo_x() + width/4, root.winfo_y() + height/4))
#the geometry method can t... | Tkinter centering ctktoplevel window in middle of main window | python|tkinter|customtkinter | 0 | 64 | 2 | 72,886,615 | 72,886,615 | 1 | true | 2022-07-04T16:46:37.010Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Tkinter centering ctktoplevel window in middle of main window<p>There are tons of results on centering a top level window comparative to your screen size. Ho... |
72,394,101 | How do I read the last line of a text file in a C program?<p>I'm trying to study the C language and basically what I want to do is read a file and put it into a struct I created, and then later I'll be doing other things with the struct, but I want to get through the first part first. Let's say that I have a text file ... | <p>Compare these two programs, one (mis)using <code>feof()</code> and one not using it at all. The first corresponds closely to the code in the question — it ignores the return value from <code>fgets()</code> to its detriment. The second only tests the return value from <code>fgets()</code>; it has no need to use <co... | How do I read the last line of a text file in a C program? | c|newline|file-handling|feof | 1 | 64 | 1 | 72,395,061 | 72,395,061 | 1 | true | 2022-05-26T15:15:24.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I read the last line of a text file in a C program?<p>I'm trying to study the C language and basically what I want to do is read a file and put it int... |
72,398,946 | Scala akka event sourcing how to get a message back to root?<p>I'm currently <strong>struggling with reading the state of my actor</strong>, so in this case I just want to get the history parameter from my State class - for example print it when an endpoint is called.</p>
<p>I've successfully managed to do it with ? op... | <p>I've not worked with event sourcing in akka, but had a quick look in the documentations, and I though this migh help:</p>
<pre class="lang-scala prettyprint-override"><code>case class GetState(replyTo: ActorRef[StatusReply[AddPostDone]]) extends Command
// and in the match for commands:
...
case GetState(replyT... | Scala akka event sourcing how to get a message back to root? | scala|state|akka|event-sourcing | 0 | 64 | 2 | 72,399,735 | 72,399,735 | 1 | true | 2022-05-26T23:15:52.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scala akka event sourcing how to get a message back to root?<p>I'm currently <strong>struggling with reading the state of my actor</strong>, so in this case ... |
72,396,484 | Not able to convert list to JSON with GSON with message "declares multiple JSON fields"<p>I am trying to convert this list to json with the help of GSON</p>
<pre><code>[DataClass(label=valueOne, text=some.value, version=9.0, ui=null, ref=null, icon=android.graphics.drawable.BitmapDrawable@2f9631a), DataClass(label=valu... | <p>Gson uses 'type adapters' to perform the conversion from Java object to JSON and vice versa. If no custom type adapter has been provided for a type, and Gson does not provide a <a href="https://github.com/google/gson/blob/master/UserGuide.md#built-in-serializers-and-deserializers" rel="nofollow noreferrer">default o... | Not able to convert list to JSON with GSON with message "declares multiple JSON fields" | android|json|gson | 0 | 64 | 1 | 72,410,577 | 72,410,577 | 1 | true | 2022-05-26T18:32:27.077Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Not able to convert list to JSON with GSON with message "declares multiple JSON fields"<p>I am trying to convert this list to json with the help of GSON</p>
... |
72,269,335 | I want to avoid users entering +91 country code while registering in the flutter App using firebase Sign In with Phone Provider<p>I want to avoid users entering +91 country code while registering in the flutter App using firebase Sign In with Phone Provider.</p>
<p>In my App Users are forced to enter their country code... | <p>Try this code:</p>
<pre><code>TextFormField(
inputFormatters: [
FilteringTextInputFormatter.deny(RegExp(r'[+]')),
],
)
</code></pre> | I want to avoid users entering +91 country code while registering in the flutter App using firebase Sign In with Phone Provider | firebase|flutter | 1 | 64 | 1 | 72,269,447 | 72,269,447 | 1 | true | 2022-05-17T06:51:46.873Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I want to avoid users entering +91 country code while registering in the flutter App using firebase Sign In with Phone Provider<p>I want to avoid users enter... |
72,319,802 | Add objects from database to a List, using LINQ to SQL<p>I have a table <code>books</code> and i want to put all of its contents into a <code>List<book></code> (right now i'am stuck at adding a single element).
I tried</p>
<pre><code>public class DataContext
{
LINQtoSQLDataContext db = new LINQtoSQLDataContex... | <p>Just return the List of book as below:</p>
<pre class="lang-cs prettyprint-override"><code>public List<book> addBook()
{
return (from book in db.books
where book.bookID == 1
select book)
.ToList();
}
</code></pre>
<p>And it's weird to name the method <code>addBook</code> as the me... | Add objects from database to a List, using LINQ to SQL | c#|linq-to-sql | 1 | 64 | 3 | 72,319,904 | 72,319,904 | 1 | true | 2022-05-20T13:32:35.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add objects from database to a List, using LINQ to SQL<p>I have a table <code>books</code> and i want to put all of its contents into a <code>List<book>... |
72,253,273 | Sending commands to external program using JLine reader not working<p>I have a program that runs another Java program and sends commands to the program but it doesnt detect the commands. The program I am sending to the commands to uses JLine so I think that is the problem, it works for other programs that dont use it. ... | <p>I fixed it.
I ended up needing to add a newline to the writer before flushing.
so I have this now.</p>
<pre class="lang-java prettyprint-override"><code>dataOutputStream.write(command.getBytes());
dataOutputStream.write("\n".getBytes());
dataOutputStream.flush();
</code></pre>
<p>EDIT: The current answer d... | Sending commands to external program using JLine reader not working | java|jline | 0 | 64 | 1 | 72,254,087 | 72,254,087 | 1 | true | 2022-05-16T01:06:25.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sending commands to external program using JLine reader not working<p>I have a program that runs another Java program and sends commands to the program but i... |
72,383,477 | Why I can't find by id XML image<pre><code>public class MainActivity extends AppCompatActivity {
ListView listView;
Button buttonForCP;
ImageView img;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity... | <p>I assume <code>backButtonZer</code> is a <code>Button</code>, you need to replace <code>R.drawable.ic_img</code> with <code>R.id.backButtonZer</code></p>
<pre><code>backButtonZer = findViewById(R.id.backButtonZer);
</code></pre>
<hr />
<p>Update</p>
<p>To set background to the <code>Button</code> you can use <code>s... | Why I can't find by id XML image | java|android|xml|android-studio | 0 | 64 | 2 | 72,383,639 | 72,383,639 | 1 | true | 2022-05-25T19:55:43.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why I can't find by id XML image<pre><code>public class MainActivity extends AppCompatActivity {
ListView listView;
Button buttonForCP;
ImageVie... |
72,303,010 | Get certain attribute data from the result of a recursive query<p>The following example is used to populate a tree and use a table with a parent_id column.</p>
<p>The data is obtained with a recursive query.</p>
<pre><code>$data = [{
"id": 1,
"name": "parent 1"
"note"... | <p>You can use the <a href="https://laravel.com/docs/9.x/eloquent-resources" rel="nofollow noreferrer">API Resouce</a> recursively or use the recursive function to generate the hierarchy array.</p>
<p>Example with <strong>recursive</strong> function:</p>
<pre><code>function makeHierarchy($values)
{
$result = [];
... | Get certain attribute data from the result of a recursive query | laravel | 1 | 64 | 1 | 72,303,394 | 72,303,394 | 1 | true | 2022-05-19T10:34:46.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get certain attribute data from the result of a recursive query<p>The following example is used to populate a tree and use a table with a parent_id column.</... |
72,288,256 | How to transform the index in a integer in a forall loop?<pre><code>CREATE TYPE o_A AS OBJECT (A1 VARCHAR2 (4000));
CREATE OR REPLACE TYPE t_A IS TABLE OF o_A;
CREATE TABLE table_o_A
(
oA_id INTEGER GENERATED BY DEFAULT AS IDENTITY,
oA o_A,
PRIMARY KEY (oA_id)
);... | <blockquote>
<p>I thinks it doesn't work because i isn't an integer.</p>
</blockquote>
<p>No, this is a restriction on the <code>forall</code> syntax; <a href="https://docs.oracle.com/en/database/oracle/oracle-database/19/lnpls/FORALL-statement.html" rel="nofollow noreferrer">from the documentation</a>, your <code>i</c... | How to transform the index in a integer in a forall loop? | oracle | 2 | 64 | 1 | 72,290,243 | 72,290,243 | 1 | true | 2022-05-18T11:22:37.790Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to transform the index in a integer in a forall loop?<pre><code>CREATE TYPE o_A AS OBJECT (A1 VARCHAR2 (4000));
CREATE OR REPLACE TYPE t_A IS TABLE OF o... |
72,238,215 | Any short way to create a combinations of arrays with fixed length and sum?<p>For example:</p>
<pre><code>array = [4,0,0]
</code></pre>
<p>The generated arrays have to be of a fixed length and sum of the array has to be also fixed.
What would be the shortest and efficient way to get this output (imported functions are ... | <p>The following solution is not exactly what you are looking for, i.e., it does not output in the same order as you have mentioned, but the values returned inside the list are the same.</p>
<pre><code>from itertools import product
def findPairs(sum_value, len_value):
lst = range(sum_value + 1)
return [
... | Any short way to create a combinations of arrays with fixed length and sum? | python | 1 | 64 | 1 | 72,238,446 | 72,238,446 | 1 | true | 2022-05-14T07:33:51.637Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Any short way to create a combinations of arrays with fixed length and sum?<p>For example:</p>
<pre><code>array = [4,0,0]
</code></pre>
<p>The generated arra... |
72,261,522 | JQ output not correctly assinging to variable<p>Below jq query output comes correctly.</p>
<pre class="lang-sh prettyprint-override"><code>ROUTE_ID= jq -r '.[][]? | select(.pattern? == "*test.com/testcards/email/*").id' route.json
</code></pre>
<p>route.json file contains a json output.</p>
<p>But echo "... | <p>What you are currently doing is setting the environment variable ROUTE_ID to nothing for the execution of jq, eg:</p>
<pre><code>MY_ENV=abc command
</code></pre>
<p>Will set the environment variable "MY_ENV" to "abc" for the execution of command.</p>
<p>What you want to do is store the output of ... | JQ output not correctly assinging to variable | bash|shell | -2 | 64 | 1 | 72,261,779 | 72,261,779 | 1 | true | 2022-05-16T15:13:47.393Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JQ output not correctly assinging to variable<p>Below jq query output comes correctly.</p>
<pre class="lang-sh prettyprint-override"><code>ROUTE_ID= jq -r '.... |
72,241,341 | Multiple problems with Sobel algorithm in c<p>I'm trying to build an edge detection program using the code below. I have faced a variety of problems though, that I don't know how to solve.</p>
<pre><code>#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#define xrows 700
#define ycolumns 1244
... | <p>Defining your matrices as local variables with automatic storage uses close to 14MB of stack space. This can definitely cause a <strong>stack overflow</strong> on many platforms. Allocating the data from the heap is recommended.</p>
<p>Microsoft's Visual C compiler is configured to complain about <code>fscanf</code>... | Multiple problems with Sobel algorithm in c | c|visual-studio|sobel | 1 | 64 | 1 | 72,247,031 | 72,247,031 | 1 | true | 2022-05-14T14:53:48.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple problems with Sobel algorithm in c<p>I'm trying to build an edge detection program using the code below. I have faced a variety of problems though, ... |
72,303,956 | Python Append from a list to another on a condition<p>i'm a python newbie and i want to check if a each list element is present in another list(while respecting the index) and append this element to a third list. like this. if first element of 'listy'("11-02-jeej") contains first element of list_of_dates (&q... | <p>There are the following issues in your code:</p>
<ul>
<li><p>The input has a comma in the first string: "11-02,". As you expect this to be a prefix, I suppose that trailing comma should not be there: "11-02"</p>
</li>
<li><p>The <code>if</code> statement should be <em>inside</em> the inner loop, ... | Python Append from a list to another on a condition | python|list | 0 | 64 | 1 | 72,304,170 | 72,304,170 | 1 | true | 2022-05-19T11:44:38.257Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Append from a list to another on a condition<p>i'm a python newbie and i want to check if a each list element is present in another list(while respect... |
72,317,042 | How can I run a Foundry Function on Object only when clicking a button in Slate<p>I am using Slate, and running a Foundry Function on Object (FoO) based on input from users of the application. However, anytime a user changes one of the input, the function re-runs, which seems inefficient.</p>
<p>Is there a way to run t... | <p>Slate is pretty powerful, and we can leverage the event system to do this properly. As we noticed, the function runs <em>any time</em> a change happens to one of its input. So we have to control when those changes happen. The way to do is is to have the following logical sequence of events:</p>
<ul>
<li>Create a new... | How can I run a Foundry Function on Object only when clicking a button in Slate | palantir-foundry|foundry-slate|foundry-functions | 1 | 64 | 1 | 72,317,078 | 72,317,078 | 1 | true | 2022-05-20T10:02:01.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I run a Foundry Function on Object only when clicking a button in Slate<p>I am using Slate, and running a Foundry Function on Object (FoO) based on i... |
72,330,537 | How to check if a Button image is a certain image in tkinter?<p>I want when I click an image button it runs a function and check if the button image is, let's say, equal to <code>img1</code>:</p>
<p><code>Button</code> code</p>
<pre><code>b1 = Button(root, image=img1, bd=0, bg='#292424', activebackground='#292424',
... | <p>Why not made a function with a variable. After the first click the variable equal 1 and the second click the variable equals 0?</p>
<p><strong>Edit:</strong> I use this for my toggle button:</p>
<pre><code>self.intervention_conciliation = tk.Button(frame_1, text="Non",
... | How to check if a Button image is a certain image in tkinter? | python|tkinter | 0 | 64 | 1 | 72,330,795 | 72,330,795 | 1 | true | 2022-05-21T14:39:30.923Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check if a Button image is a certain image in tkinter?<p>I want when I click an image button it runs a function and check if the button image is, let'... |
72,395,145 | Synthetic event doesnt work as expected in function component<p>I have 2 examples, one with class component and one with function component doing exactly the same thing. Im using react 16.13.1. I know that if you dont persist the event you will get an error saying that the event target is null. This happens as expected... | <p>This all comes down to the timing for when <code>this.setState()</code> and <code>setState()</code> is called. In your class component, the additional arrow function declaration inside <code>this.setState</code> causes an additional delay that makes the call take longer than the <code>useState</code> hook in the fun... | Synthetic event doesnt work as expected in function component | reactjs|event-handling|synthetic | 1 | 64 | 1 | 72,396,232 | 72,396,232 | 1 | true | 2022-05-26T16:35:54.867Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Synthetic event doesnt work as expected in function component<p>I have 2 examples, one with class component and one with function component doing exactly the... |
72,341,141 | Creating ranges from sequential values, while maintaining other columns in pandas<p>I'm trying to find a way to consolidate sequential (consecutive?) numbers into a range, grouped by another column.</p>
<p>I've tried <em>pynumparser</em> and <em>itertools</em>, but I'm not clever enough to implement them to get the res... | <h2>How to group equal neighbors along a column</h2>
<h3>Test data</h3>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame({
'test_var': ['ABC', 'ABC', 'DEF', 'ABC', 'ABC', 'ABC', 'GHI', 'GHI'],
'F1': [1, 2, 3, 4, 6, 5, 1, 2],
'F2': [10, 11, 1, 13, 16, 14, 2, 1]
})
</code></pre>
<p>We suppose... | Creating ranges from sequential values, while maintaining other columns in pandas | python|pandas | 1 | 64 | 1 | 72,341,840 | 72,341,840 | 1 | true | 2022-05-22T20:39:33.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating ranges from sequential values, while maintaining other columns in pandas<p>I'm trying to find a way to consolidate sequential (consecutive?) numbers... |
72,294,903 | How to allow cors on nodeJS server<p>I have a super simple backend with node.js, and I have CORS enabled. However, I still can't get to allow sending any kind of data cross-origin.</p>
<p>This is my backend running on port 3000:</p>
<pre><code>const express = require('express');
const cors = require('cors');
const app... | <p>This is not the cors issue, simply change your <code>fetch</code> like a blow to get the expected result.</p>
<pre><code>fetch('http://localhost:3000/number')
.then(res => res.json()).then(data=>console.log(data));
</code></pre>
<p>this will give you <code>{number: 1}</code> as a result.</p> | How to allow cors on nodeJS server | node.js|rest|fetch|backend | 1 | 64 | 1 | 72,295,710 | 72,295,710 | 1 | true | 2022-05-18T19:24:43.503Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to allow cors on nodeJS server<p>I have a super simple backend with node.js, and I have CORS enabled. However, I still can't get to allow sending any kin... |
72,246,604 | How to update values of a JFrame main after using a JDialog of Java Swing?<p>I have a main window called MainFrame which is a jForm to which I update the data depending on a timer, but the problem is that I cannot update the data in the same MainFrame after using the jdialog, since I end up creating another duplicate w... | <p>Thanks for the update, and I found another solution without using an <code>OptionPane</code> from this question: <a href="https://stackoverflow.com/questions/10936306/programmatically-close-a-jpanel-which-is-displayed-in-jdialog">programmatically close a JPanel which is displayed in JDialog</a>.</p>
<p>I cannot repl... | How to update values of a JFrame main after using a JDialog of Java Swing? | java|swing | 1 | 64 | 1 | 72,246,802 | 72,246,802 | 1 | true | 2022-05-15T08:15:18.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to update values of a JFrame main after using a JDialog of Java Swing?<p>I have a main window called MainFrame which is a jForm to which I update the dat... |
72,301,363 | Prolog subsets generation<p>The problem of how to generate subsets is well answered by <a href="https://stackoverflow.com/questions/4912869/subsets-in-prolog">this</a> question. My question is about why my code does not. My own attempt at the problem was</p>
<pre><code>subset2(_, []).
subset2(Set, [S|Subset]) :- member... | <p>The line <code>not(member(S, Subset))</code> happens before Subset has any known value. In that case it's saying "one thing we know about Subset is that it's a list with S in it!". You're telling Prolog to put S into Subset, then asking if doing that failed.</p>
<p>e.g. it will fill in unknown variables in... | Prolog subsets generation | prolog | 1 | 64 | 1 | 72,310,486 | 72,310,486 | 1 | true | 2022-05-19T08:46:20.553Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Prolog subsets generation<p>The problem of how to generate subsets is well answered by <a href="https://stackoverflow.com/questions/4912869/subsets-in-prolog... |
72,263,574 | Matplotlib axline is vertical when it should be at an angle...until I change the dates/times for the chart<p>I'm trying to draw an angled line on a chart with Matplotlib, but there are times when it just draws a vertical line, incorrectly. It appears to be a problem with the dates/times. It's like there's a minimum tim... | <p>The reason why this happens is quite tricky to get without digging a bit deeper. When converted using <code>date2num</code>, timestamps become decimal numbers like <code>19126.661111111112</code>.</p>
<p>When drawing lines, <code>matplotlib</code> <a href="https://github.com/matplotlib/matplotlib/blob/9765379ce6e734... | Matplotlib axline is vertical when it should be at an angle...until I change the dates/times for the chart | python|matplotlib|charts|line | 1 | 64 | 1 | 72,263,967 | 72,263,967 | 1 | true | 2022-05-16T17:54:45.860Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Matplotlib axline is vertical when it should be at an angle...until I change the dates/times for the chart<p>I'm trying to draw an angled line on a chart wit... |
72,246,122 | How to get java web root path in JavaBean without having direct access to ServletContext<p>I have a JavaBean that is deployed in a Java web application which is based on a complex workflow framework such as CMN, BPMN, and DMN. The point here is that my JavaBean is invoked from a BPMN and it seems to me like it is in a ... | <p>If the JavaBean is CDI managed, you can inject the <code>ServletContext</code> with:</p>
<pre><code>@Inject
private ServletContext;
</code></pre>
<p>——</p>
<p>If you just want to read a json file in the java code, I would say that you maybe look at this: <a href="https://stackoverflow.com/questions/15749192/how-do-i... | How to get java web root path in JavaBean without having direct access to ServletContext | java|rest|servlets|javabeans | 0 | 64 | 1 | 72,246,267 | 72,246,267 | 1 | true | 2022-05-15T06:51:20.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get java web root path in JavaBean without having direct access to ServletContext<p>I have a JavaBean that is deployed in a Java web application which... |
72,332,604 | Replacing page elements dynamically through a greasemonkey script (even post page load)<p>I have the following javascript function:</p>
<pre><code>function actionFunction() {
let lookup_table = {
'imageurl1': "imageurl2",
};
for (let image of document.getElementsByTagName("img")) {
fo... | <p>Have you tried running your code in the browser's terminal to see if it works without greasemonkey involved?</p>
<p>As to your question - you could either use setInterval to run given code every x amount of time or you could use the MutationObserver to monitor changes to the webpage's dom. In my opinion setInterval ... | Replacing page elements dynamically through a greasemonkey script (even post page load) | javascript|jquery|ajax|greasemonkey | 0 | 64 | 1 | 72,332,966 | 72,332,966 | 1 | true | 2022-05-21T19:21:17.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replacing page elements dynamically through a greasemonkey script (even post page load)<p>I have the following javascript function:</p>
<pre><code>function a... |
72,365,120 | Hikari NoSuchMethodError on AWS EMR/Spark<p>I am trying to upgrade <code>EMR</code> from <code>5.13</code>to <code>5.35</code> using <code>spark-2.4.8</code>. The jar I'm trying to use has a dependency on <code>HikariCP:4.0.3</code> which is called to set the db pool-config <code>setKeepaliveTime</code>. While I can ru... | <p>Just in case, anyone else faces this, the fix was <a href="https://github.com/sbt/sbt-assembly#shading" rel="nofollow noreferrer">shading</a> (Process that allows renaming packages on the Uber jar), I basically had to make sure the dependency I use doesn't get overridden with the one that's stale in <code>EMR-5.35.0... | Hikari NoSuchMethodError on AWS EMR/Spark | apache-spark|amazon-emr|hikaricp | 1 | 64 | 1 | 72,370,939 | 72,370,939 | 1 | true | 2022-05-24T14:55:12.300Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hikari NoSuchMethodError on AWS EMR/Spark<p>I am trying to upgrade <code>EMR</code> from <code>5.13</code>to <code>5.35</code> using <code>spark-2.4.8</code>... |
72,386,650 | Javascript make calculations and filter list<p>I have below array -</p>
<pre><code>const data=[
{
month:"nov",
veryLate:3,
Late:5,
onTime:2
},
{
month:"dec",
veryLate:1,
Late:3,
onTime:16
},
{
month:"jan",
veryLate:28,
Late:1,
onTime:1
},
}
</code></pre>
<p>I want t... | <p>x.veryLate wont work in x it should be veryLate itself same for the others</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const data=[
{
month:"nov",
veryLate:3,
Late... | Javascript make calculations and filter list | javascript|jquery|reactjs | 0 | 64 | 4 | 72,386,742 | 72,386,742 | 1 | true | 2022-05-26T04:21:27.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript make calculations and filter list<p>I have below array -</p>
<pre><code>const data=[
{
month:"nov",
veryLate:3,
Late:5,
onTime:2... |
72,244,466 | How to handle the CSRF when implementing Google Identity Services popup code model?<p>On my site I have implemented Google Identity Services using a <a href="https://developers.google.com/identity/oauth2/web/guides/use-code-model#popup-mode" rel="nofollow noreferrer">popup code model</a>.</p>
<p>To prevent CSRF attacks... | <p>Think I figured this out.</p>
<p>But I would still love to hear from others to make sure this is correct.</p>
<p>In short, <a href="https://stackoverflow.com/a/22533680/1526396">this answer</a> outlines that the csrf protection comes from checking for the existance of the custom <code>X-Requested-With</code> header.... | How to handle the CSRF when implementing Google Identity Services popup code model? | google-authentication|google-identity | 0 | 64 | 1 | 72,247,897 | 72,247,897 | 2 | true | 2022-05-14T23:13:22.600Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to handle the CSRF when implementing Google Identity Services popup code model?<p>On my site I have implemented Google Identity Services using a <a href=... |
72,259,900 | Trying to push changes from STAGING site to LIVE site (both WordPress) but I'm trying to figure out which database items to choose from<p>I've cloned the existing <a href="http://www.DOMAINHERE.com" rel="nofollow noreferrer">www.DOMAINHERE.com</a> to a staging site staging.DOMAINHERE.com and made changes to the staging... | <p>Sad to say, there's no clean and guaranteed-trouble-free way to do what you want. WordPress's database code creates unique <code>id</code> numbers for rows in its tables: Post ids, metadata ids, option ids, and so forth. When you clone a site (to create a staging site) the two sites start operating independently an... | Trying to push changes from STAGING site to LIVE site (both WordPress) but I'm trying to figure out which database items to choose from | mysql|wordpress|mariadb|custom-wordpress-pages|staging | 1 | 64 | 1 | 72,260,245 | 72,260,245 | 2 | true | 2022-05-16T13:20:20.867Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trying to push changes from STAGING site to LIVE site (both WordPress) but I'm trying to figure out which database items to choose from<p>I've cloned the exi... |
72,262,813 | Invalid shorthand property initializer with a variable int<p>when I run my code, I get the following error:</p>
<p>Invalid shorthand property initializer.</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 p... | <p>First of all, there is no need to add <code>{</code>. Second, change <code>note_id=0</code> to <code>note_id==0</code> or <code>note_id===0</code> because <code>note_id=0</code> is not a boolean expression. I have used the code snippet below to test it and its working fine.</p>
<pre><code>function DisplyayNote() {
... | Invalid shorthand property initializer with a variable int | javascript|reactjs|react-hooks | 0 | 64 | 3 | 72,263,064 | 72,263,064 | 2 | true | 2022-05-16T16:49:43.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Invalid shorthand property initializer with a variable int<p>when I run my code, I get the following error:</p>
<p>Invalid shorthand property initializer.</p... |
72,263,740 | Aggregate function will not aggregate - while using sum function to aggregate dataset<p>I am new to snowflake and I am trying to write an SQL query that would sum up 2 rows based on the <code>ref</code> column. The sum function seems to not work as I think im missing something.</p>
<p>sample data (transaction)</p>
<pre... | <p>If what you want is the sum of <code>withdraw</code> and <code>pending</code> and the last <code>status</code> and <code>date</code> per <code>id</code> and <code>ref</code> then use window functions:</p>
<pre><code>SELECT DISTINCT
id,
SUM(withdraw) OVER (PARTITION BY id, ref) withdraw,
SUM(pen... | Aggregate function will not aggregate - while using sum function to aggregate dataset | sql|group-by|sum|snowflake-cloud-data-platform|window-functions | 1 | 64 | 1 | 72,263,840 | 72,263,840 | 2 | true | 2022-05-16T18:09:04.293Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Aggregate function will not aggregate - while using sum function to aggregate dataset<p>I am new to snowflake and I am trying to write an SQL query that woul... |
72,266,387 | Is there any other way to hide dropdown menu when clicked outside?<p>So, I am creating a dropdown menu in React and if I click outside the dropdown menu, it should close. For that, I am currently using click eventListeners. Is there any other way that can be used instead of using eventListeners? I tried with onFocus an... | <p>Yes there is. Use an overlay under the menu.</p>
<pre><code>function MyComponent() {
const [menuVisible, setMenuVisible] = useState(false);
return (
<div>
<button className='dropdown-button' onClick={() => setMenuVisible(true)}>Click me</button>
{menuVisible... | Is there any other way to hide dropdown menu when clicked outside? | reactjs|react-hooks | 1 | 64 | 1 | 72,266,558 | 72,266,558 | 2 | true | 2022-05-16T22:47:15.693Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there any other way to hide dropdown menu when clicked outside?<p>So, I am creating a dropdown menu in React and if I click outside the dropdown menu, it ... |
72,272,414 | Dynamic amount of css grid columns<p>right now I have a page with a grid of articles and a absolute positioned footer. What I am trying to accomplish, is that the article grid has a dynamic amount of columns, based on your window height, I thought about calculating the distance between the filter bar (above the article... | <p><strong>What you can do to solve this problem</strong></p>
<p>First you have to find out the <code>window.innerHeight</code> where one column fits right, then you increase the screen height with your inspect elements, set it to responsive and look at which height two columns fit right, for example if one column fits... | Dynamic amount of css grid columns | javascript|css|reactjs | 1 | 64 | 1 | 72,274,377 | 72,274,377 | 2 | true | 2022-05-17T10:30:16.067Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dynamic amount of css grid columns<p>right now I have a page with a grid of articles and a absolute positioned footer. What I am trying to accomplish, is tha... |
72,275,267 | Where should product information live when using Stripe?<p>What is the right place to store things like product price, title, description when using Stripe, when many products are present?</p>
<p>The app I'm building will potentially have hundreds of products and I would like to easily be able to list them, paginate, s... | <p>If it were me I would cache this information in my database and sync it in Stripe as needed.</p>
<p>You want the product and pricing information in Stripe since it's needed for their Product and Price APIs. It's used to display detailed information in email receipts or invoices, on hosted pages like Checkout and in ... | Where should product information live when using Stripe? | stripe-payments | 0 | 64 | 1 | 72,278,298 | 72,278,298 | 2 | true | 2022-05-17T13:51:39.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Where should product information live when using Stripe?<p>What is the right place to store things like product price, title, description when using Stripe, ... |
72,280,735 | Execute in a separate thread<p>I have a small application which is responsible for intercepting requests and responses. Forms them into a package and can save them to local storage. I'm using the Room library to save data locally.</p>
<p>My code (shown below) is working, but it has a small brake in the form of allowMai... | <p>You can use <a href="https://kotlinlang.org/docs/coroutines-overview.html" rel="nofollow noreferrer">Coroutines</a> to do background work.</p>
<pre><code> class PacketsLocalDataSource(private val context: Context) {
private val dao: PacketsDao by lazy{PacketsDatabase.getInstance(context).packetDao() }
fun s... | Execute in a separate thread | android|kotlin|android-room | 0 | 64 | 1 | 72,281,657 | 72,281,657 | 2 | true | 2022-05-17T21:14:07.020Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Execute in a separate thread<p>I have a small application which is responsible for intercepting requests and responses. Forms them into a package and can sav... |
72,286,605 | C# get Json value from a file<p>I have a json file and I want to deserialize it into an object, however, for this I need the value parameter of the method: <code>JsonConvert.DeserializeObject<Parametros>(parameter)</code></p>
<p>I don't know how to get it, I tried to convert it to JObject but it didn't work, any ... | <p>It should be like this.</p>
<pre><code>using Newtonsoft.Json;
string jsonTextFromFile = File.ReadAllText(JSON_FILE_PATH);
var parametrosObject = JsonConvert.DeserializeObject<Parametros>(jsonTextFromFile);
</code></pre>
<p>You don't need JObject at all.</p> | C# get Json value from a file | c#|json|deserialization | 0 | 64 | 2 | 72,286,836 | 72,286,836 | 2 | true | 2022-05-18T09:32:00.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# get Json value from a file<p>I have a json file and I want to deserialize it into an object, however, for this I need the value parameter of the method: <... |
72,347,607 | calculate roll_rank using prev value for each row<p>I have a table where we need to set and sum roll_rank except from roll_rank 0,1,2
we dont need to touch the rows where roll_rank in 0,1,2
we want to calculate sums of roll_rank by date where not roll_rank in 0,1,2.</p>
<p>example table:</p>
<pre><code>tmp:([]date:`dat... | <p>This might also achieve your desired result:</p>
<pre><code>update sums 1^deltas roll_rank by date from tmp
</code></pre> | calculate roll_rank using prev value for each row | kdb | 0 | 64 | 2 | 72,349,735 | 72,349,735 | 2 | true | 2022-05-23T11:15:18.780Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
calculate roll_rank using prev value for each row<p>I have a table where we need to set and sum roll_rank except from roll_rank 0,1,2
we dont need to touch t... |
72,370,560 | How to get the next line in a recursive function<p>I'm trying to create a recursive function, that will go through a file, and for each line, will create an instance of an object, give this object a name, list of attributes, and a previous name (all names are unique, so I don't need to worry about similarities).</p>
<p... | <p>Your first problem is that your recursion has no base case (i.e. terminating condition), and so <code>getTags</code> is being called until you fill up the call stack, at which point you get a segmentation violation. The way to fix this is to create a terminating condition which, in this case, would be when you exhau... | How to get the next line in a recursive function | c++|recursion|fstream|iostream | 0 | 64 | 1 | 72,370,697 | 72,370,697 | 2 | true | 2022-05-24T23:42:43.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get the next line in a recursive function<p>I'm trying to create a recursive function, that will go through a file, and for each line, will create an ... |
72,374,219 | Is it possible that TypeScript syntax conflict with EMCAScript?<p>Typescript used to say that "TypeScript is a typed superset of JavaScript."</p>
<p>But if ECMAScript add some new syntax, which is conflict with the existing syntax of TypeScript, the 'superset' relationship between TypeScript and JavaScript wi... | <blockquote>
<p>Will this happen?</p>
</blockquote>
<p>No one can predict the future, but with regard to decorators, note this from the TypeScript <a href="https://www.typescriptlang.org/docs/handbook/decorators.html#handbook-content" rel="nofollow noreferrer">decorators documentation</a>:</p>
<blockquote>
<p>NOTE: Dec... | Is it possible that TypeScript syntax conflict with EMCAScript? | javascript|typescript | 1 | 64 | 1 | 72,374,530 | 72,374,530 | 2 | true | 2022-05-25T08:22:11.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible that TypeScript syntax conflict with EMCAScript?<p>Typescript used to say that "TypeScript is a typed superset of JavaScript."</p>
<... |
72,378,193 | How does linux implement PROT_NONE mode of mprotect on x64 platform?<p>The method <code>mprotect</code> have a PROT_NONE option to disable memory access. It means "The memory cannot be accessed at all"</p>
<p>I wonder how it is implemented on x86/x64 platform.</p>
<p>According to the attributes R/W and XD of ... | <p>Note that mprotect is called from user space on virtual address regions. When protection is set to PROT_NONE, the _PAGE_PRESENT bit is cleared and the _PAGE_PROTNONE bit is set. Attempting to access the address will cause a page fault. <a href="https://www.kernel.org/doc/gorman/html/understand/understand006.html" ... | How does linux implement PROT_NONE mode of mprotect on x64 platform? | linux|memory-management|x86-64|virtual-memory|page-tables | 0 | 64 | 1 | 72,378,897 | 72,378,897 | 2 | true | 2022-05-25T13:03:43.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does linux implement PROT_NONE mode of mprotect on x64 platform?<p>The method <code>mprotect</code> have a PROT_NONE option to disable memory access. It ... |
72,378,833 | Replace First Two Characters of XML Tag Value Match with Static Value<p>I am trying to replace the first two characters of an XML tag <code><LineStyle><color></code> value match with <code>00</code> if the pattern match isn't <code>00</code>.</p>
<p><strong>XML</strong></p>
<pre><code><?xml version="... | <p>Use this Perl one-liner:</p>
<pre><code>perl -i.bak -0777 -pe 's{( <LineStyle> \s* <color> ) .. }{${1}00}gxms' in_file
</code></pre>
<p>The Perl one-liner uses these command line flags:<br />
<code>-e</code> : Tells Perl to look for code in-line, instead of in a file.<br />
<code>-p</code> : Loop over th... | Replace First Two Characters of XML Tag Value Match with Static Value | regex|xml|sed|grep|kml | 0 | 64 | 1 | 72,379,141 | 72,379,141 | 2 | true | 2022-05-25T13:47:13.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace First Two Characters of XML Tag Value Match with Static Value<p>I am trying to replace the first two characters of an XML tag <code><LineStyle>... |
72,382,321 | How to convert a hex list to a list of ASCII values?<p>Let's use as an example the hex string 0x790x760x7d0x7d0x80.</p>
<pre class="lang-py prettyprint-override"><code>ct=input()
hex_list=ct.split('0x')
print(hex_list)
ascii_values=[]
for i in hex_list:
if i!="" :
(ascii_values).append(ascii(i))
pr... | <p>This will convert from to a list of bytes to ASCII, but 0x80 is invalid ASCII character code. See below:</p>
<pre><code>ct = '0x790x760x7d0x7d0x80'
hex_list = ct.split('0x')
ascii_values=[]
for i in hex_list:
print(i)
if i != '':
try:
bytes_object = bytes.fromhex(i)
ascii_stri... | How to convert a hex list to a list of ASCII values? | python|hex|ascii | 2 | 64 | 2 | 72,382,487 | 72,382,487 | 2 | true | 2022-05-25T18:03:24.433Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert a hex list to a list of ASCII values?<p>Let's use as an example the hex string 0x790x760x7d0x7d0x80.</p>
<pre class="lang-py prettyprint-overr... |
72,395,287 | How do i delete a post in flask<p>I am not able to delete an individual post in flask.</p>
<pre><code>@app.route('/delete/<int:id>',methods=['GET','POST'])
def delete(id):
if request.method == 'GET':
p=Blog.query.filter_by(id=id)
db.session.delete(p)
db.session.commit()
return redi... | <p>You need to get the first item of the query using <code>.first()</code></p>
<pre class="lang-py prettyprint-override"><code>p=Blog.query.filter_by(id=id).first()
</code></pre> | How do i delete a post in flask | python|flask|sqlalchemy | 2 | 64 | 1 | 72,396,109 | 72,396,109 | 2 | true | 2022-05-26T16:46:22.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do i delete a post in flask<p>I am not able to delete an individual post in flask.</p>
<pre><code>@app.route('/delete/<int:id>',methods=['GET','POS... |
72,399,145 | Define enum as static property of class<p>I want to be able to define a class with a static property on it that contains an enum. I've got the JavaScript working here, I'm just trying to iron out the types. Simplified example below.</p>
<p>box.ts:</p>
<pre><code>enum Color {
RED,
GREEN,
BLUE,
}
export class Box ... | <p>See <a href="https://www.typescriptlang.org/docs/handbook/declaration-merging.html#merging-namespaces-with-classes" rel="nofollow noreferrer">Merging Namespaces with Classes</a> in the TypeScript Handbook (I've inlined the full documentation section at the end of this answer so that if the link changes, the content ... | Define enum as static property of class | typescript | 1 | 64 | 1 | 72,399,242 | 72,399,242 | 2 | true | 2022-05-26T23:50:46.930Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Define enum as static property of class<p>I want to be able to define a class with a static property on it that contains an enum. I've got the JavaScript wor... |
72,361,578 | How do I remove a common character from each element in my list?<p>I'm cleaning up my data after web scraping and the list has \n before each element.</p>
<p>SP500 = ['\nAAPL', '\nMSFT', '\nGOOG', '\nGOOGL', '\nAMZN', '\nTSLA'...]</p>
<p>How should I go about removing the \n from each element?</p> | <p>If you know it is always the same pattern, you can use str.removeprefix() available for python 3.9+, in your case:</p>
<pre><code>SP500 = [value.removeprefix('\n') for value in SP500]
</code></pre>
<p>If you know it's always the same length, you can do:</p>
<pre><code>SP500 = [value[2:] for value in SP500]
</code></... | How do I remove a common character from each element in my list? | python|html|list|beautifulsoup | -1 | 64 | 3 | 72,361,602 | 72,361,602 | 2 | true | 2022-05-24T10:50:25.117Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I remove a common character from each element in my list?<p>I'm cleaning up my data after web scraping and the list has \n before each element.</p>
<p... |
72,351,247 | Using Pythons library (Beautiful soup) how do I extract many elements from a website that have not got tags in common?<p>This is the website <a href="https://interestingengineering.com/real-life-use-every-element-periodic-table" rel="nofollow noreferrer">https://interestingengineering.com/real-life-use-every-element-pe... | <p>Another option could be:</p>
<ul>
<li>Loop all "<code>p</code>" tags and compare if the "<code>Where It's Used:</code>" text is inside the <code>p</code> tag; if so, add it to a separate list.</li>
</ul>
<p>Code:</p>
<pre><code>import requests
from bs4 import BeautifulSoup
# Url of the page to g... | Using Pythons library (Beautiful soup) how do I extract many elements from a website that have not got tags in common? | python|web-scraping|beautifulsoup | 2 | 64 | 2 | 72,351,647 | 72,351,647 | 2 | true | 2022-05-23T15:37:45.943Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using Pythons library (Beautiful soup) how do I extract many elements from a website that have not got tags in common?<p>This is the website <a href="https:/... |
72,276,018 | Rotate Object every few seconds<p>I took this Pen: <a href="https://codepen.io/golle404/pen/BoqrEN" rel="nofollow noreferrer">https://codepen.io/golle404/pen/BoqrEN</a> and wanted to make it move every few seconds.</p>
<p>I tried this:</p>
<pre><code>setTimeout(function() {
document.getElementById("move")... | <p>You can use a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes" rel="nofollow noreferrer">keyframe</a> animation for this.</p>
<p>For example:</p>
<pre class="lang-css prettyprint-override"><code>@keyframes rotation {
0%, 100% {
transform: rotateX(90deg) translateZ(-150px);
}
33.333%... | Rotate Object every few seconds | javascript|html|css | 1 | 64 | 2 | 72,276,359 | 72,276,359 | 2 | true | 2022-05-17T14:40:14.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rotate Object every few seconds<p>I took this Pen: <a href="https://codepen.io/golle404/pen/BoqrEN" rel="nofollow noreferrer">https://codepen.io/golle404/pen... |
72,257,097 | Bash : Split Array into KV pairs<p>I am working on a script, where via JQ I am getting Environment variables and I need them in KV pairs for other type of file. Currently, i have the elements as follows in a Bash array</p>
<pre><code>DD_TRACE_CLI_ENABLED:true
PRODUCT:buy_box
TRACE_ID:$NOMAD_ALLOC_ID
</code></pre>
<p>No... | <p>bash array:</p>
<pre class="lang-bash prettyprint-override"><code>env_params_as_array=(
DD_TRACE_CLI_ENABLED:true
PRODUCT:buy_box
TRACE_ID:"$NOMAD_ALLOC_ID"
)
</code></pre>
<p>printing it the way you want:</p>
<pre class="lang-bash prettyprint-override"><code>for p in "${env_params_as_arra... | Bash : Split Array into KV pairs | bash|shell | 0 | 64 | 1 | 72,257,547 | 72,257,547 | 2 | true | 2022-05-16T09:37:08.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bash : Split Array into KV pairs<p>I am working on a script, where via JQ I am getting Environment variables and I need them in KV pairs for other type of fi... |
72,393,919 | How to call the Win32 GetCurrentDirectory function from C#?<p>The prototype of <code>GetCurrentDirectory</code></p>
<pre><code>DWORD GetCurrentDirectory(
[in] DWORD nBufferLength,
[out] LPTSTR lpBuffer
);
</code></pre>
<p><code>DWORD</code> is <code>unsigned long</code>, <code>LPTSTR</code> is a pointer to wchar ... | <p>You simply need to remove <code>out</code> on the <code>StringBuilder</code> parameter:</p>
<pre><code>[DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
public static extern uint GetCurrentDirectory(uint nBufferLength, StringBuilder lpBuffer);
</code></pre>
<p>And then pre-... | How to call the Win32 GetCurrentDirectory function from C#? | c#|winapi|com-interop | 0 | 64 | 1 | 72,394,097 | 72,394,097 | 2 | true | 2022-05-26T15:02:11.580Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to call the Win32 GetCurrentDirectory function from C#?<p>The prototype of <code>GetCurrentDirectory</code></p>
<pre><code>DWORD GetCurrentDirectory(
[... |
72,356,890 | How to define the different template structs with different enums<p>I've two enums as below:</p>
<pre><code>enum TTT {t = 2};
enum XXX {x = 2};
</code></pre>
<p>I'm trying to make some struct to help me get the name of an enum. Here is what I've done:</p>
<pre><code>template<TTT>
struct StrMyEnum {
static ch... | <p><code>StrMyEnum</code> identifies the name of the template.<br />
You can have a general declaration for it, and then some specializations.<br />
But you cannot have a second set of declaration + specializations (like you did with the set for <code>XXX</code>).</p>
<p>What you can do is have one template parametrize... | How to define the different template structs with different enums | c++|c++11|templates|enums|c++14 | 2 | 64 | 2 | 72,357,086 | 72,357,086 | 2 | true | 2022-05-24T03:28:08.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to define the different template structs with different enums<p>I've two enums as below:</p>
<pre><code>enum TTT {t = 2};
enum XXX {x = 2};
</code></pre... |
72,272,463 | How to query graphql endpint from a class based react component<p>The Load product is maybe we call it hook whose purpose of the life is fetch the data from a graphql backend</p>
<p>Here its how LOAD_PRODUCT LOOKS LIKE</p>
<pre><code>import { gql } from '@apollo/client'
export const LOAD_PRODUCTS = gql`
query{
... | <p>You can also query a graphql endpoint using the <a href="https://www.apollographql.com/docs/react/api/react/components/#query" rel="nofollow noreferrer">Query</a> component or the <a href="https://www.apollographql.com/docs/react/api/react/hoc" rel="nofollow noreferrer">HOC</a>. But note that since class based compo... | How to query graphql endpint from a class based react component | javascript|reactjs|react-hooks | 0 | 64 | 1 | 72,290,317 | 72,290,317 | 2 | true | 2022-05-17T10:33:14.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to query graphql endpint from a class based react component<p>The Load product is maybe we call it hook whose purpose of the life is fetch the data from ... |
72,261,564 | What causes the "only arrays and iterables are allowed" error in this Angular 13 app?<p>I am working on an e-commerce app who's front-end is made in Angular 13.</p>
<p>I am trying to fetch products from an API and display them as cards.</p>
<p>For this purpose, in <code>app\app.module.ts</code> I have:</p>
<pre><code>i... | <p>The reason is that <code>https://dummyjson.com/products</code> returns an object with the fields <code>products, total, skip, limit</code>. What you probably meant was:</p>
<pre><code>public getProducts(): Observable<Product[]>{
return this.http.get<Product[]>(`${this.apiURL}/products`).pipe(map(respon... | What causes the "only arrays and iterables are allowed" error in this Angular 13 app? | javascript|angular|angular13 | -3 | 64 | 1 | 72,261,653 | 72,261,653 | 2 | true | 2022-05-16T15:16:54.790Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What causes the "only arrays and iterables are allowed" error in this Angular 13 app?<p>I am working on an e-commerce app who's front-end is made in Angular ... |
72,266,121 | Creating a valid filename with dir and fullfile<p>I keep running across this error in my code:</p>
<pre><code>Path = 'C:\Users\18606\OneDrive\Documents\Spheroids For Brandon\Spheroids\1-8WT';
Content = dir(Path);
SubFold = Content([Content.isdir]); % Keep only the directories
MyData = [];
for k = 3:length(SubFold)
... | <p>Reading in files sequentially is indeed usually done through looping over a <code>dir()</code> call, i.e. your strategy is valid. What's going wrong here, is that <code>Path</code> is a path to a directory, not a file. <code>SubFold</code> then are only <em>directories</em> as they are found on the <code>Path</code>... | Creating a valid filename with dir and fullfile | matlab|file-io | 0 | 64 | 1 | 72,268,560 | 72,268,560 | 2 | true | 2022-05-16T22:05:00.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating a valid filename with dir and fullfile<p>I keep running across this error in my code:</p>
<pre><code>Path = 'C:\Users\18606\OneDrive\Documents\Spher... |
72,254,885 | Adding a suffix that includes superscript text to axis text in ggplot<p>I want to have my x-axis show the scale with an added "m<sup>2</sup>" at the end of each axis text using the <code>scales::label_number()</code> function. Reproducible code:</p>
<pre><code>tibble(x = 1:10, y = 1:10) |>
ggplot(aes(x, y... | <p>Use unicode for ^2: "m\u00B2" or m^2: "\u33A1"</p>
<pre class="lang-r prettyprint-override"><code>library(tibble)
library(ggplot2)
tibble(x = 1:10, y = 1:10) |>
ggplot(aes(x, y)) +
scale_x_continuous(label = scales::label_number(suffix = "m\u00B2"))
</code></pre>
<p><img src... | Adding a suffix that includes superscript text to axis text in ggplot | r|ggplot2 | 2 | 64 | 2 | 72,254,986 | 72,254,986 | 2 | true | 2022-05-16T06:24:02.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding a suffix that includes superscript text to axis text in ggplot<p>I want to have my x-axis show the scale with an added "m<sup>2</sup>" at th... |
72,241,156 | Using the dynamic_cast operator<p>I'm trying to understand dynamic type casting.
How to properly implement the DrawAnimals and Talk To Animals functions using dynamic_cast?</p>
<p>DrawAnimals draws animals that can be drawn. Such animals implement the Drawable interface.
TalkToAnimals conducts a conversation with anima... | <p>I am going to explain for <code>DrawAnimals</code> and you can extended to other functions by yourself.</p>
<p>What you did here:</p>
<pre><code>void DrawAnimals(const std::vector<const Animal*>& animals, ostream& out) {
/*if (const Animal* r = dynamic_cast<const Animal*>(&animals)) {
... | Using the dynamic_cast operator | c++|inheritance|dynamic-cast | 0 | 64 | 1 | 72,241,320 | 72,241,320 | 2 | true | 2022-05-14T14:32:28.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using the dynamic_cast operator<p>I'm trying to understand dynamic type casting.
How to properly implement the DrawAnimals and Talk To Animals functions usin... |
72,319,379 | Python - To create 2 new column with 25th and 75th percentile of several row values<p>Here is how my df kind of looks like (with many more rows, and many more columns):</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">Index</th>
<th style="text-align: center;">WTG1<... | <p>I think you could transpose the DataFrame and apply <code>df.describe()</code></p>
<pre><code>import pandas as pd
df = pd.DataFrame({'WTG1': [61.25, 19.69, 59.51, 131.81],
'WTG2': [-7.57, 25.95, 81.22, 154.07],
'WTG3': [7.18, 28.67, 78.22, 142.92]
})
print(df)... | Python - To create 2 new column with 25th and 75th percentile of several row values | python|pandas|dataframe|statistics|percentile | 2 | 64 | 1 | 72,319,683 | 72,319,683 | 2 | true | 2022-05-20T13:02:35.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python - To create 2 new column with 25th and 75th percentile of several row values<p>Here is how my df kind of looks like (with many more rows, and many mor... |
72,239,252 | Remove item from Nested list Java Stream<p>I'll appreciate some help with this please. Assuming I have</p>
<pre><code> "bookingId": 4,
"flights": [
{ ...
"flightNumber": "AUS382",
},
{ ... | <p>Assuming you have a class <code>PassengerBooking</code> with a <code>List</code> of objects <code>Flight</code>, and that the <code>passengerBooking</code> variable represents a <code>List</code> of objects <code>PassengerBooking</code>.</p>
<p>You could traverse the items of your <code>List</code>. Then, for each <... | Remove item from Nested list Java Stream | java|java-8 | 1 | 64 | 1 | 72,239,806 | 72,239,806 | 3 | true | 2022-05-14T10:15:51.873Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove item from Nested list Java Stream<p>I'll appreciate some help with this please. Assuming I have</p>
<pre><code> "bookingId": 4,
... |
72,251,493 | Cannot use None as a query value error when i try to view page without search query<p>I have a working search form in my base.html but when itry to access the listing page without passing a search query i get a "Cannot use None as a query value" error.
views.py</p>
<pre><code>def listing(request):
if... | <p>You can't search by <code>None</code> in that way, but you can simply check first if <code>search</code> has a value other than <code>None</code> before you actually try it:</p>
<p>Replace</p>
<pre class="lang-py prettyprint-override"><code>propertys = Paginator(Property.objects.filter(property_name__icontains =sear... | Cannot use None as a query value error when i try to view page without search query | django|django-views | 1 | 64 | 1 | 72,251,623 | 72,251,623 | 3 | true | 2022-05-15T19:19:28.033Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cannot use None as a query value error when i try to view page without search query<p>I have a working search form in my base.html but when itry to access th... |
72,258,610 | Is it semantically correct to have multiple (inner) elements with the same ID in one HTML page under different shadow roots?<p>I'm using Stencil to build web components and recently had a little talk with a colleague about <code>shadowRoot</code> and implications. Suppose I have the following simple component with a <c... | <p>Different shadow trees may contain elements with the same id since, as you said, shadow trees are essentially "microcosms".</p>
<p>Using the HTML Living Standard to prove this:</p>
<p><a href="https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute" rel="nofollow noreferrer">The id Attribute</a></... | Is it semantically correct to have multiple (inner) elements with the same ID in one HTML page under different shadow roots? | html|web-component|shadow-root | 0 | 64 | 2 | 72,259,454 | 72,259,454 | 3 | true | 2022-05-16T11:39:29.107Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it semantically correct to have multiple (inner) elements with the same ID in one HTML page under different shadow roots?<p>I'm using Stencil to build web... |
72,259,509 | how to check the diffrence between dates<p>I created a function to check the difference between a particular date and the current date, everything is working perfectly for past dates. But, when it comes to future dates, it gives the correct difference eg. the 18th of May is two days after the 16th of May, so the differ... | <p>The best tip was given already: use <code>></code> and <code><</code> to compare dates. Here is an example to get you started:</p>
<pre><code>// function GetDateDiff to get the difference to the current date including negative values
function GetDateDiff(date) {
// get current date
var currentDate = new Da... | how to check the diffrence between dates | javascript | 3 | 64 | 2 | 72,259,740 | 72,259,740 | 3 | true | 2022-05-16T12:50:30.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to check the diffrence between dates<p>I created a function to check the difference between a particular date and the current date, everything is working... |
72,288,169 | `magrittr` pipe into apply<p>How do you pipe an object into a specific place in an <code>apply</code> call, that isn't the first input? The <code>magrittr</code> dot placeholder does not seem to work for this.</p>
<pre><code> dat <- 1:10
locs <- list(c(1, 2),
c(3, 4),
c(5, 6))
... | <p>Here are two ways, with the <code>magrittr</code> and native pipes.</p>
<pre class="lang-r prettyprint-override"><code>suppressPackageStartupMessages(library(magrittr))
dat <- 1:10
locs <- list(c(1, 2),
c(3, 4),
c(5, 6))
foo <- function(x, y, z) {
out <- mean(c(x[y], x[z]))
... | `magrittr` pipe into apply | r|pipe|tidyverse|magrittr | 6 | 64 | 2 | 72,288,410 | 72,288,410 | 3 | true | 2022-05-18T11:16:27.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
`magrittr` pipe into apply<p>How do you pipe an object into a specific place in an <code>apply</code> call, that isn't the first input? The <code>magrittr</c... |
72,330,377 | Delete only user input, not the entire screen<p>Is there any way to remove only the user input and not the entire program? Here's the program</p>
<pre><code>#include <stdio.h>
int main() {
int a;
printf("text");
scanf("%d", &a);
}
</code></pre>
<p>If I were to do <code>clrscr(... | <p>There are 2 possible approaches to your problem:</p>
<ul>
<li><p>you can try and prevent user input from echoing to the terminal. This requires changing the configuration of the terminal using system specific calls such as <a href="https://linux.die.net/man/3/tcgetattr" rel="nofollow noreferrer"><code>tcgetattr()</c... | Delete only user input, not the entire screen | c | 3 | 64 | 1 | 72,330,734 | 72,330,734 | 3 | true | 2022-05-21T14:16:39.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Delete only user input, not the entire screen<p>Is there any way to remove only the user input and not the entire program? Here's the program</p>
<pre><code>... |
72,331,363 | Is numpy ndarray homogeneous and rectangular (sub-arrays must be the same length) because it uses C array under the hood?<p>Numpy ndarray must have all elements of the same type and all sub-arrays on the same level must be of the same length. Those properties are also properties of C multidimensional arrays. Is it the ... | <blockquote>
<p>Is it the case that numpy ndarray have those properties purely because it is implemented on top of C array?</p>
</blockquote>
<p>No. Using C internally is not really what cause Numpy to make this choice. Indeed, Numpy array are just a raw <em>contiguous</em> memory buffer internally (allocated dynamical... | Is numpy ndarray homogeneous and rectangular (sub-arrays must be the same length) because it uses C array under the hood? | python|c|numpy|multidimensional-array|numpy-ndarray | 3 | 64 | 1 | 72,331,924 | 72,331,924 | 3 | true | 2022-05-21T16:24:53.997Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is numpy ndarray homogeneous and rectangular (sub-arrays must be the same length) because it uses C array under the hood?<p>Numpy ndarray must have all eleme... |
72,390,650 | How to create an array of merged items from 2 corresponding items, each from another additional array, using (mainly) array methods?<p>I've converted CSV based text files to arrays containing headers and rows, and now I want to convert them into the below given solution. Can anybody do this using methods like <code>map... | <p>You could map the rows and reduce the row into an object:</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 header = ['a', 'b', 'c', 'd'];
const rows = ['1,2,3,4', '5,6,... | How to create an array of merged items from 2 corresponding items, each from another additional array, using (mainly) array methods? | javascript|arrays|merge|mapping|reduce | 1 | 64 | 6 | 72,390,717 | 72,390,717 | 3 | true | 2022-05-26T10:52:58.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create an array of merged items from 2 corresponding items, each from another additional array, using (mainly) array methods?<p>I've converted CSV bas... |
72,270,806 | What is the difference between Memgraph Docker images?<p>I can see that Memgraph has a couple of Docker images available on the Docker Hub. There is: <code>memgraph-platform</code>, <code>memgraph-mage</code> and <code>memgraph</code> image. What is the difference between those three?</p> | <p>Depending on the image you install you get various products:</p>
<ul>
<li>If you run <code>memgraph</code> image you will install MemgraphDB and mgconsole (command-line interface for running queries)</li>
<li>If you run <code>memgraph-mage</code> image you will install MemgraphDB, mgconsole and <a href="https://mem... | What is the difference between Memgraph Docker images? | docker|graph-databases|docker-image|memgraphdb | 2 | 64 | 1 | 72,271,179 | 72,271,179 | 3 | true | 2022-05-17T08:40:58.300Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the difference between Memgraph Docker images?<p>I can see that Memgraph has a couple of Docker images available on the Docker Hub. There is: <code>m... |
72,389,237 | How to notify a store owner when the estimated delivery time is over in an e-commerce app using firebase<p>I need some ideas on how I can approach for a feature in a firebase based multi vendor e-commerce app. I want to send a notification to the store owner when the estimated delivery time is over.</p>
<p>When users p... | <blockquote>
<p>But should I schedule the time using a cloud function for every orders
or there are other ways to accomplish this?</p>
</blockquote>
<p>The notification sending should be triggered by a back-end and Cloud Functions is clearly the most convenient one. You could set up your own server to do so but using a... | How to notify a store owner when the estimated delivery time is over in an e-commerce app using firebase | android|firebase|kotlin|google-cloud-firestore|firebase-notifications | 0 | 64 | 1 | 72,390,621 | 72,390,621 | 3 | true | 2022-05-26T08:54:43.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to notify a store owner when the estimated delivery time is over in an e-commerce app using firebase<p>I need some ideas on how I can approach for a feat... |
72,332,381 | How to avoid sharing Email on algolia, Using Firbase Functions<p>I am using Firebase functions to create Algolia indices for the full-text search app</p>
<p>here is how I create an index when someone post on Firebase:</p>
<pre><code>export const onListingCreated = functions.firestore
.document('Listings/{listingId}')... | <p>In your case <code>snap.data().AdTitle</code> is the string <code>House</code> and you are spreading over the string which makes your output object look like that.
Once you spread a string it is converted to an array. For example <code>House</code> is converted to <code>["H", "o", "u",... | How to avoid sharing Email on algolia, Using Firbase Functions | firebase|google-cloud-firestore|algolia | 1 | 64 | 1 | 72,332,969 | 72,332,969 | 3 | true | 2022-05-21T18:48:23.960Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to avoid sharing Email on algolia, Using Firbase Functions<p>I am using Firebase functions to create Algolia indices for the full-text search app</p>
<p>... |
72,277,241 | How do I change array values with dict keys?<p>I have an 3d array that looks like this
With the shape (20001, 128, 128)</p>
<pre><code>array([[[48, 48, 48, ..., 48, 48, 48],
[48, 48, 48, ..., 48, 48, 48],
[48, 48, 48, ..., 48, 48, 48],
...,
[[12, 12, 12, ..., 12, 12, 12],
[12, 12,... | <p>You should reverse your original dictionary:</p>
<pre><code>lookup_dict = {1: [1, 39],
2: [2, 5, 9, 20, 32, 42, 47, 72, 88, 91, 95],
3: [3, 49, 55],
4: [4, 24, 34, 40, 53, 76, 81, 90, 96],
5: [6, 17, 30, 48, 83],
6: [7, 13, 15, 16, 27, 44, 51, 54, 56, 75],
7: [8, 50],
8: [10, 19, 22, 35, 61, 63, 65],
9: [11,... | How do I change array values with dict keys? | python|arrays|numpy|dictionary | 1 | 64 | 2 | 72,280,389 | 72,280,389 | 3 | true | 2022-05-17T15:59:21.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I change array values with dict keys?<p>I have an 3d array that looks like this
With the shape (20001, 128, 128)</p>
<pre><code>array([[[48, 48, 48, .... |
72,292,237 | simultaneously need to exit current perl script while opening the pdf file<p>I have a script to open the pdf file (Not in Adobe Acrobat application) instead Sumatra application (Pdf viewer).</p>
<pre><code>system("start Sumatra C:/Users/test/Desktop/19June.pdf");
exit;
</code></pre>
<p>The problem is once we ... | <p>Use <code>exec</code> instead of <code>system</code>. <code>exec</code> replaces the current process with the one given, while <code>system</code> will start a new process and wait for it to exit.</p> | simultaneously need to exit current perl script while opening the pdf file | perl | 0 | 64 | 1 | 72,292,446 | 72,292,446 | 4 | true | 2022-05-18T15:44:30.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
simultaneously need to exit current perl script while opening the pdf file<p>I have a script to open the pdf file (Not in Adobe Acrobat application) instead ... |
72,355,975 | Argument to for_each() function appears to be the wrong type<p>I'm working thru some programming exercises on Exercism when I ran into this problem. It's not clear to me why the type of the closure set to <code>for_each()</code> even matters.<br><br>Here's the entire Rust program:</p>
<pre><code>use std::collections::H... | <p><a href="https://doc.rust-lang.org/stable/std/collections/struct.HashSet.html#method.insert" rel="nofollow noreferrer"><code>HashSet::insert()</code></a> returns <code>bool</code> (<code>true</code> if the value was already in the set).</p>
<p><a href="https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#me... | Argument to for_each() function appears to be the wrong type | rust | 2 | 64 | 1 | 72,355,998 | 72,355,998 | 4 | true | 2022-05-24T00:14:06.663Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Argument to for_each() function appears to be the wrong type<p>I'm working thru some programming exercises on Exercism when I ran into this problem. It's not... |
72,377,354 | Convert an array of object to a list of a class<p>I have an array of objects like:</p>
<pre><code>object[]
</code></pre>
<p>All elements of the array if compatible with a type, that I will call</p>
<pre><code>MyClass
</code></pre>
<p>How can I convert this object[] to a List ?</p> | <p>You can use LINQ's <code>Cast</code> and <code>OfType</code> methods, depending on what you want to happen if your array contains an element that is <em>not</em> of type <code>MyClass</code>.</p>
<p>If you want to throw an exception upon encountering an invalid element, use:</p>
<pre><code>var myList = myArray.Cast&... | Convert an array of object to a list of a class | c# | 0 | 64 | 2 | 72,377,490 | 72,377,490 | 4 | true | 2022-05-25T12:06:58.410Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert an array of object to a list of a class<p>I have an array of objects like:</p>
<pre><code>object[]
</code></pre>
<p>All elements of the array if comp... |
72,316,273 | Call constructor inside a call to another constructor<p>Suppose I have classes A, B:</p>
<pre><code>class A
{
int a;
public:
A(int a) : a(a) { }
};
class B
{
A a;
public:
B(A a) : a(a) { }
};
</code></pre>
<p>And I want to create an instance of B as:</p>
<pre><code>int i = 1;
B b(A(i));
</code></pre>... | <p>The <strong>problem</strong> is that <code>B b(A(i));</code> is a function declaration and not a declaration for a variable named <code>b</code> of type <code>B</code>.</p>
<p>This is due to what is called <a href="https://en.wikipedia.org/wiki/Most_vexing_parse" rel="nofollow noreferrer">most vexing parse</a>. In p... | Call constructor inside a call to another constructor | c++|constructor | 0 | 64 | 2 | 72,316,459 | 72,316,459 | 4 | true | 2022-05-20T09:04:42.317Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Call constructor inside a call to another constructor<p>Suppose I have classes A, B:</p>
<pre><code>class A
{
int a;
public:
A(int a) : a(a) { }
};
... |
72,387,108 | Why System.Delegate can not be used as event?<h1>Main Question</h1>
<pre><code>event System.Delegate d;
</code></pre>
<p>Code above will raise error:</p>
<blockquote>
<p>Compiler Error CS0066<br />
'event': event must be of a delegate type</p>
</blockquote>
<p>Why System.Delegate can not be used as event?<br />
If I wa... | <p><code>System.Delegate</code> is a class, not a delegate.</p>
<p>An event is a member of a type. All members must have their own data type specified. You can use <code>Object</code> for fields and the like if you want to be able to refer to any type, or you can use a base type to refer to any derived type. Delegate t... | Why System.Delegate can not be used as event? | c#|events|delegates | 1 | 64 | 1 | 72,387,125 | 72,387,125 | 4 | true | 2022-05-26T05:28:58.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why System.Delegate can not be used as event?<h1>Main Question</h1>
<pre><code>event System.Delegate d;
</code></pre>
<p>Code above will raise error:</p>
<bl... |
72,242,049 | Prevent DefaultAntiforgery from logging errors<p>Is there a way to stop DefaultAntiforgery from logging errors? I see it takes an ILoggerFactory as parameter, which is a public type, but I don't know how to set it up since DefaultAntiforgery is internal.</p> | <p>I don't think this is a DI issue, but rather a configuration issue. What you want should be possible by <a href="https://docs.microsoft.com/en-us/dotnet/core/extensions/logging?tabs=command-line#configure-logging" rel="noreferrer">configuring logging</a></p>
<p>Try something like this in your appsettings.json:</p>
<... | Prevent DefaultAntiforgery from logging errors | asp.net-core|dependency-injection|antiforgerytoken | 1 | 64 | 1 | 72,279,617 | 72,279,617 | 5 | true | 2022-05-14T16:20:47.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Prevent DefaultAntiforgery from logging errors<p>Is there a way to stop DefaultAntiforgery from logging errors? I see it takes an ILoggerFactory as parameter... |
72,297,989 | Fetch but only get status?<p>When a new domain is attached, I made a logic to check whether the domain works normally through fetch.</p>
<pre><code>fetch("https://" + domain).then((result)=>{
const isOk = result.status === 200
...
})
</code></pre>
<p>However, I thought it would be inefficient to fetch the... | <p>You can request only the headers, as opposed to the whole page, using the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD" rel="nofollow noreferrer"><code>HEAD</code></a> method. The server should return the same headers as it would if the <code>GET</code> method was used, but no body. You ca... | Fetch but only get status? | javascript|http|fetch | 2 | 64 | 1 | 72,298,012 | 72,298,012 | 6 | true | 2022-05-19T02:29:53.357Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fetch but only get status?<p>When a new domain is attached, I made a logic to check whether the domain works normally through fetch.</p>
<pre><code>fetch(&qu... |
72,397,277 | Could I write these event listeners in a more efficient way?<p>Hi I have created 9 event listeners that are very similar and I would like to write them in a more efficient manner if possible. each button opens up the same hidden form and populates the dropdown menu with a different value.</p>
<pre><code>const ordermulc... | <p>This is simple, use loops!</p>
<p>Collect all your IDs in an array:</p>
<pre><code>const ids = ['Mulch', 'prem-topsoil', 'screened-topsoil']; // and so on...
</code></pre>
<p>Loop through this array:</p>
<pre><code>ids.forEach((value, i) => {
// todo
});
</code></pre>
<p>For each iteration you have to get the... | Could I write these event listeners in a more efficient way? | javascript|loops|event-listener | -2 | 64 | 3 | 72,397,466 | 72,397,466 | -2 | true | 2022-05-26T19:47:02.733Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Could I write these event listeners in a more efficient way?<p>Hi I have created 9 event listeners that are very similar and I would like to write them in a ... |
72,334,293 | Angular: Wait for ActivatedRoute to be processed?<p><strong>TL;DR: How can I tell when the ActivatedRoute has finished parsing the QueryParams, even if there are none?</strong></p>
<p>In my Angular 13 application, I have a need to obtain an optional query parameter before I initialise a service which communicates with ... | <p>The working solution was to listen for the <code>ActivationEnd</code> router event, which fires after the router has finished initializing.</p>
<p>Thanks to <a href="https://stackoverflow.com/a/72334405/1872867">@Joosep Parts</a> for tipping me off about Router.events</p>
<pre><code>private initialized = false;
pub... | Angular: Wait for ActivatedRoute to be processed? | angular | -1 | 64 | 2 | 72,334,469 | 72,334,469 | -1 | true | 2022-05-22T01:50:57.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular: Wait for ActivatedRoute to be processed?<p><strong>TL;DR: How can I tell when the ActivatedRoute has finished parsing the QueryParams, even if there... |
72,773,592 | I want to set a limit for the rows only upto 5 rows which will get added from the django.models admin panel<p>I have a table in my models file and I want to design it such that there is a limit to only 5 rows in the table. When the limit is exceeded error has to show and input should not take.I am new to Django so if a... | <p>You could set a restriction on that particular model by overriding the <code>has_add_permission()</code> in the <code>admin.py</code> file. For example:</p>
<p><code>admin.py</code> file:</p>
<pre><code># Let's say you have a model called Post
from django.contrib import admin
from .models import Post
MAX_OBJECTS = ... | I want to set a limit for the rows only upto 5 rows which will get added from the django.models admin panel | python|django | 0 | 64 | 1 | 72,774,195 | 72,774,195 | 1 | true | 2022-06-27T14:16:39.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I want to set a limit for the rows only upto 5 rows which will get added from the django.models admin panel<p>I have a table in my models file and I want to ... |
72,958,558 | How do I stop r from using the first row of data as the column name?<p>I'm extremely new to using R and I keep running into an issue with my current data set. The data set consists of several txt files with 30 rows and 3 columns of numerical data. However, when I try to work with them in r, it automatically makes the f... | <p>You say:</p>
<blockquote>
<p>After this point it just says that there are 29 rows and 1 column, which is not what I want!</p>
</blockquote>
<p>What that is telling you is that you don't have a tab-separated file. There's not a way to tell which delimiter is being assumed, but it's not a tab. You can tell that by pay... | How do I stop r from using the first row of data as the column name? | r|columnname | 0 | 64 | 2 | 72,958,919 | 72,958,919 | 1 | true | 2022-07-12T21:25:07.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I stop r from using the first row of data as the column name?<p>I'm extremely new to using R and I keep running into an issue with my current data set... |
72,784,641 | Return rows depends on timestamp between them<p>The problem is that I want to get every n'th record from table but based on datetime.</p>
<p>I have table where I add record every 30 minutes with current state for each of my Sub objects, something like below:</p>
<div class="s-table-container">
<table class="s-table">
<... | <p>Thanks to @ourmandave's comments, I was able to resolve the problem. I didn't notice that I can use <code>DATEDIFF</code> with <code>%</code>.</p>
<p>So, to get entries only one per two hours, I simply write the query like that. So, obviously:</p>
<pre><code>SELECT *
FROM [dbo].[Table] WHERE DateDiff(Minute, 0, Ti... | Return rows depends on timestamp between them | sql|tsql|row-number | 0 | 64 | 1 | 72,802,096 | 72,802,096 | 1 | true | 2022-06-28T10:17:01.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Return rows depends on timestamp between them<p>The problem is that I want to get every n'th record from table but based on datetime.</p>
<p>I have table whe... |
72,806,159 | Unable to get 'checked' property of checkbox<p>I am working on a web-application using Vite, JavaScript, jQuery, and Bootstrap. I need to check if a checkbox is checked using JS or jQuery. I have been using the jQuery <code>.is(':checked')</code> function all over the app, and it's working perfectly, but for some reaso... | <p>The <code>id</code>s that you are using to target the checkboxes are the same as those of the wrapping <code><div></code> elements. <code>id</code> attributes <em><strong>must</strong></em> be unique. Try altering the wrapping <code><div></code> elements to use a different <code>id</code> from that of th... | Unable to get 'checked' property of checkbox | javascript|html|jquery|checkbox|bootstrap-5 | 0 | 64 | 1 | 72,806,266 | 72,806,266 | 1 | true | 2022-06-29T18:22:54.587Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to get 'checked' property of checkbox<p>I am working on a web-application using Vite, JavaScript, jQuery, and Bootstrap. I need to check if a checkbox... |
72,945,282 | cat to combine heredoc and file<p>I'm trying to and failing to understand why this doesn't work. I'm trying to use <code>cat</code> to combine an existing file and a heredoc into one file:</p>
<pre><code># test.txt
Hi there
</code></pre>
<pre><code>$ cat test.txt <<END > /tmp/combined.txt
This is heredoc
END
<... | <p><code>cat</code> echos the contents of its input filename arguments <em>or</em> standard input (which is where the text of a heredoc is made available to be read) if none are given, but not both. However, if one of the arguments is <code>-</code>, that one is treated as reading from standard input:</p>
<pre class="l... | cat to combine heredoc and file | bash|shell|unix|cat | 0 | 64 | 1 | 72,945,359 | 72,945,359 | 1 | true | 2022-07-11T22:29:21.150Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cat to combine heredoc and file<p>I'm trying to and failing to understand why this doesn't work. I'm trying to use <code>cat</code> to combine an existing fi... |
72,876,646 | Evaluate a symbolic expression inside a MathematicalProgram constraint<p>I want to use a symbolic expression as a <code>MathematicalProgram</code> constraint but am unsure how to achieve this. My best go so far is the following (simplified example):</p>
<pre><code>x = Variable("x")
expression = x**2
prog = M... | <p><code>@Hongkai Dai</code>'s answer with the <code>ExpressionConstraint</code> in C++ led me in the right direction. There is such a constraint in <code>pydrake</code> (see <a href="https://drake.mit.edu/pydrake/pydrake.solvers.mathematicalprogram.html?highlight=expressionconstraint#pydrake.solvers.mathematicalprogra... | Evaluate a symbolic expression inside a MathematicalProgram constraint | drake | 1 | 64 | 2 | 72,927,490 | 72,927,490 | 1 | true | 2022-07-06T00:02:38.977Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Evaluate a symbolic expression inside a MathematicalProgram constraint<p>I want to use a symbolic expression as a <code>MathematicalProgram</code> constraint... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.