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,770,572 | Appending new keys and values to a dictionary in a nested for loop without overwriting old entries<p>I have two data sources (<code>Subjects</code>) which are loaded via <code>np.loadtxt</code> into Python.</p>
<p>The loop <code>for ROI in ROIs</code> is nested in the loop <code>for Subject in Subjects</code>.</p>
<p>M... | <p>You can solve this by:</p>
<pre><code> if ROI not in PLE_dict:
PLE_dict[ROI] = [PLE[0]]
else:
PLE_dict[ROI].append(PLE[0])
</code></pre>
<p>Running</p>
<pre><code>PLE_dict = {}
for Subject in range(2):
for ROI in range(2):
if ROI not in PLE_dict:
... | Appending new keys and values to a dictionary in a nested for loop without overwriting old entries | python|dictionary|for-loop | 0 | 70 | 1 | 72,770,819 | 72,770,819 | 1 | true | 2022-06-27T10:28:11.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Appending new keys and values to a dictionary in a nested for loop without overwriting old entries<p>I have two data sources (<code>Subjects</code>) which ar... |
72,792,346 | How can I save turtle output as an image?<p>I have a code and draw circles. I would like to save the output as image. I am able to save the output as .svg file. But when i try to open, it only shows white page. I also tried to turn it to .jpg or .jpeg version. Again I see only the white screen. How can I solve the pro... | <p>This is a good example of why a minimal example is critcal in debugging. Once you remove all of the irrelevant drawing code, you're left with:</p>
<pre class="lang-py prettyprint-override"><code>def fiber_circle(fiber):
# ...
fiber = Turtle()
# now start drawing...
# ...
fiber = SvgTurtle(width, height)... | How can I save turtle output as an image? | python|svg|turtle-graphics|python-turtle | 1 | 70 | 1 | 72,792,474 | 72,792,474 | 1 | true | 2022-06-28T19:47:13.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I save turtle output as an image?<p>I have a code and draw circles. I would like to save the output as image. I am able to save the output as .svg fi... |
72,810,534 | ios swift11 tableView not showing custom cells<p>I'm new to learning swift.
When I run my code I expect to see an email address in a cell with a Detail disclosure to the right of it. Instead, I see blank cells.</p>
<p>Main.storyboard</p>
<p><img src="https://i.stack.imgur.com/MpVD8.png" alt="This is what my main storyb... | <p>It looks like you forgot to assign the <strong>Custom Class</strong> for your table view controller.</p>
<p>Your image shows this:</p>
<p><a href="https://i.stack.imgur.com/tjq9O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tjq9O.png" alt="enter image description here" /></a></p>
<p>But it shou... | ios swift11 tableView not showing custom cells | ios|swift|iphone | 0 | 70 | 2 | 72,818,062 | 72,818,062 | 1 | true | 2022-06-30T05:06:24.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ios swift11 tableView not showing custom cells<p>I'm new to learning swift.
When I run my code I expect to see an email address in a cell with a Detail discl... |
73,026,168 | how to make recursive function that find the index of the biggest number in array?<p>I'm trying to find the index of the biggest number in array, by using a recursive function, but it doesn't work for me.</p>
<p>I wrote this code in "Online C Complier":</p>
<pre><code>#include <stdio.h>
int max(int arr[... | <p>For starters the first function parameter should have qualifier <code>const</code> because the passed array is not being changed within the function.</p>
<p>This part of the function</p>
<pre><code>int temp = max(arr, n-1);
if (arr[temp] > arr[n]) {
return temp;
}
else {
return n;
}
</code></pre>
<p>is in... | how to make recursive function that find the index of the biggest number in array? | arrays|c|recursion|max|function-definition | 3 | 70 | 1 | 73,026,347 | 73,026,347 | 1 | true | 2022-07-18T17:16:20.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to make recursive function that find the index of the biggest number in array?<p>I'm trying to find the index of the biggest number in array, by using a ... |
72,910,809 | My seaborn colorbar overlaps my heatmap and I can't move it<p>I have a heatmap which displays two distinct sets of data and thus requires two separate colorbars. This all works beautifully and looks great apart from the fact that the Blues colorbar overlaps the heatmap. I just need to shift it slightly further left but... | <p>Swapping the two lines detailing the heatmap plots (starting with <code>sb.heatmap</code>) fixed it.</p> | My seaborn colorbar overlaps my heatmap and I can't move it | python|seaborn|heatmap | -1 | 70 | 1 | 72,935,019 | 72,935,019 | 1 | true | 2022-07-08T11:36:21.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
My seaborn colorbar overlaps my heatmap and I can't move it<p>I have a heatmap which displays two distinct sets of data and thus requires two separate colorb... |
72,900,115 | How do I get this div to show again using JavaScript<p>I have made a TODO app and added a counter to keep a count of the items in the list. If the counter hits zero, I've set it to re-show a message 'You currently have no tasks. Use the input field above to start adding.'</p>
<pre><code>if(count === 0){
noTasksText.c... | <p>Upon setting <code>innerHTML</code> by using <code>+= innerHTML</code> the node <code>noTasksText</code> is lost, because browser processes the whole new set <code>innerHTML</code> and creates new objects. You can either retrieve <code>noTasksText</code> again after that, or append nodes using <code>todoContainer.ap... | How do I get this div to show again using JavaScript | javascript | 1 | 70 | 2 | 72,900,406 | 72,900,406 | 1 | true | 2022-07-07T15:00:11.613Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I get this div to show again using JavaScript<p>I have made a TODO app and added a counter to keep a count of the items in the list. If the counter hi... |
72,898,440 | Get values by key from JSON Multi-dimensional Array<p><strong>JSON:</strong></p>
<pre><code>[{"id":141741,"name":"Group","nodeTypeId":3,"deleted":false,"hasNodeAccesses":false,"children": [{"id":141742,"name":"Division",... | <p>With your current implementation, you are getting JsonNode object and you are reading it's <code>name</code> property, but you are not reading that property for it's chlildren (inner objects).</p>
<p>You have to query all nested objects recursivly and get a value of field <code>name</code>.</p>
<p>In my opinion the ... | Get values by key from JSON Multi-dimensional Array | java|json|rest|multidimensional-array | 0 | 70 | 2 | 72,899,055 | 72,899,055 | 1 | true | 2022-07-07T13:10:58.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get values by key from JSON Multi-dimensional Array<p><strong>JSON:</strong></p>
<pre><code>[{"id":141741,"name":"Group","... |
73,005,525 | Deleting items from list in angular<p>I want to remove an item from the product list. In my code, it deletes the other items, not the specific one that i want to delete.. I already assigned which id to delete but it doesn't. I don't know why it deletes the others.. Please help. Thank you</p>
<p><strong>Service</strong... | <p>You should do 2 things:</p>
<ol>
<li>Find the index of the item that you want to remove</li>
<li>Pass second parameter to <code>splice()</code> that specifies the number of items that should be removed. In this use case, second parameter should be <code>1</code>, since you want to remove only one item.</li>
</ol>
<p... | Deleting items from list in angular | javascript|angular|typescript | 1 | 70 | 2 | 73,005,618 | 73,005,618 | 1 | true | 2022-07-16T15:40:11.383Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deleting items from list in angular<p>I want to remove an item from the product list. In my code, it deletes the other items, not the specific one that i wan... |
72,933,811 | IdThreadComponent (Indy 9) in Delphi 2007 Error<p>I'm using IdTCPClient and IdThreadComponent to get some information for a barcode reader. This code, with some changes is working in Delphi 11 and Indy 10 but not in Delphi 2007 and Indy 9:</p>
<pre><code>procedure TPkgSendF1.IdThreadComponent1Run(Sender: TIdCustomThrea... | <p>Anonymous methods did not exist yet in Delphi 2007, they were introduced in Delphi 2010. As such, <code>TThread.Queue()</code> in D2007 only had 1 version that accepted a <code>TThreadMethod</code>:</p>
<pre><code>type
TThreadMethod = procedure of object;
</code></pre>
<p>Which means you need to wrap the call to ... | IdThreadComponent (Indy 9) in Delphi 2007 Error | delphi|indy | 0 | 70 | 1 | 72,943,014 | 72,943,014 | 1 | true | 2022-07-11T04:42:57.773Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
IdThreadComponent (Indy 9) in Delphi 2007 Error<p>I'm using IdTCPClient and IdThreadComponent to get some information for a barcode reader. This code, with s... |
72,974,745 | Color code of lines based on an array using Matplotlib<p>I am drawing multiple horizontal and vertical lines using <code>ax.hlines()</code> and <code>ax.vlines()</code> respectively. I want to assign values to these lines using the array <code>P</code> and the order of assignment is presented in the expected output.</p... | <p>Values bar is added following @Davide_sd.</p>
<p>I'm not sure if this sovles your problem.</p>
<pre><code>import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import numpy as np
from matplotlib.colors import Normalize
from matplotlib import cm
fig,ax = plt.subplots(1)
n... | Color code of lines based on an array using Matplotlib | python|numpy|matplotlib | 0 | 70 | 2 | 72,975,844 | 72,975,844 | 1 | true | 2022-07-14T03:05:53.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Color code of lines based on an array using Matplotlib<p>I am drawing multiple horizontal and vertical lines using <code>ax.hlines()</code> and <code>ax.vlin... |
72,862,062 | Understanding Keras subclass method in Tensorflow's deep learning pipeline<p>I am trying to make a model in tensorflow using the keras subclasses method.</p>
<p>Q1) I am correctly calling layers as <code>layers = []</code> and then using <code>layers.append(GTLayer....)</code> ?</p>
<p>Q2) calling GTLayer in <strong>i... | <h3>Q1</h3>
<p>No. There are two possibilities here</p>
<p><strong>1 - If you want to access a standard <code>layers</code> property of Keras models:</strong></p>
<ul>
<li>Only <code>Model</code> has a <code>layers</code> property, a <code>keras.layers.Layer</code> doesn't have this property</li>
<li>You are not suppos... | Understanding Keras subclass method in Tensorflow's deep learning pipeline | python|tensorflow|keras | 0 | 70 | 1 | 73,038,911 | 73,038,911 | 1 | true | 2022-07-04T21:12:19.723Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Understanding Keras subclass method in Tensorflow's deep learning pipeline<p>I am trying to make a model in tensorflow using the keras subclasses method.</p>... |
72,890,459 | Will assigning a long string to an int stop SSMS processing and prevent a disastrous "naked" F5 from running wild<p>Today in SSMS I misplaced my pointer and clicked the Execute button instead of the Database drop-down (they're adjacent on the screen). Fortunately no damage done, but it scared me that I might have execu... | <p>Per the comment, one option is to add <code>set noexec on</code> to the top of the query window. This setting persists across batches. It is evaluated at execution time and can therefore be run conditionally (unlike many other <code>set</code> statements).</p>
<p>As noted by Randy in Marin, this is still not complet... | Will assigning a long string to an int stop SSMS processing and prevent a disastrous "naked" F5 from running wild | sql-server|ssms | 1 | 70 | 2 | 72,899,890 | 72,899,890 | 1 | true | 2022-07-06T22:20:06.500Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Will assigning a long string to an int stop SSMS processing and prevent a disastrous "naked" F5 from running wild<p>Today in SSMS I misplaced my pointer and ... |
72,954,510 | Updating bookmarks in a range with strings, dependent on cell values in a range - VBA<p>I am trying to print information to a series of bookmarks in a word document. The information I want to print is dependent on the values held in cells in a range.</p>
<p><strong>For example:</strong></p>
<ul>
<li>I have 5 bookmarks ... | <p>For example:</p>
<pre><code>Dim r As Long
For r = 1 To 5
With ws.Range("A" & r)
Select Case .Value
Case Is >= 10
Call UpdateBookmark(wdDoc, "p" & r, .Value & " (Excess)")
Case Is >= 5
Call UpdateBookmark(wdDoc, "p" & r, .... | Updating bookmarks in a range with strings, dependent on cell values in a range - VBA | excel|vba|ms-word | -1 | 70 | 2 | 72,958,458 | 72,958,458 | 1 | true | 2022-07-12T15:06:31.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Updating bookmarks in a range with strings, dependent on cell values in a range - VBA<p>I am trying to print information to a series of bookmarks in a word d... |
72,960,977 | type 'Rx<Text>' is not a subtype of type 'Widget' in type cast<…><p>I want to make the Widget obserable in flutter when using get <code>get: ^4.3.8</code>, the controller code like this:</p>
<pre><code>class MainController extends GetxController {
Widget childWidget = Text("Loading...").obs as Widget;
}
</c... | <p>You can try this like :</p>
<pre><code> Rx<Widget> childWidget = Text("Loading...").obs;
</code></pre>
<p>and to use this obs widget in widget tree like :</p>
<pre><code>GetBuilder<MainController>(
init: MainController(),
builder: (controller) {
return Scaffold(
... | type 'Rx<Text>' is not a subtype of type 'Widget' in type cast<…> | flutter|flutter-getx | 0 | 70 | 3 | 72,961,044 | 72,961,044 | 1 | true | 2022-07-13T04:31:43.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
type 'Rx<Text>' is not a subtype of type 'Widget' in type cast<…><p>I want to make the Widget obserable in flutter when using get <code>get: ^4.3.8</code>, t... |
72,970,072 | Remove small objects from binary image with skimage<p>I have the following binary image and I want to remove the spots with a value 0 inside the area of the pixels with value 1.</p>
<p>I tried following code from the skimage package:</p>
<pre><code>im1 = morphology.remove_small_objects(img_test, 500, connectivity=1)
</... | <pre><code>import numpy as np
import matplotlib.pyplot as plt
# image posted by OP
URL = "https://i.stack.imgur.com/Pa7Io.png"
# Read image
from skimage import io
from skimage.filters import threshold_otsu
from skimage.color import rgb2gray
image = rgb2gray(io.imread(URL)[21:899, 555:1125, :3]) #index cut ... | Remove small objects from binary image with skimage | python|image|image-processing|scikit-image | 0 | 70 | 1 | 72,984,212 | 72,984,212 | 1 | true | 2022-07-13T17:04:52.730Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove small objects from binary image with skimage<p>I have the following binary image and I want to remove the spots with a value 0 inside the area of the ... |
72,985,267 | Extracting dataframe values using indices in R<p>I have 100+ files and have starting and ending coordinates for each file. So based on starting and ending coordinates, I want to extract the regions from all data sets and want to store in file. I have used following approach but its not giving me the expected out put.
... | <p>in Base R you could do:</p>
<pre><code> fun <- function(path, start, end){
id <- basename(path)
dat <- read.table(path, header = TRUE)
p <- ncol(dat)
n <- nrow(dat)
neg <- if(start<0) -start else 0
add <- matrix(nrow = n, ncol = neg)
if (start < 1) start <- 1
if (end &g... | Extracting dataframe values using indices in R | r|dataframe|for-loop | 0 | 70 | 2 | 72,985,778 | 72,985,778 | 1 | true | 2022-07-14T18:39:43.033Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Extracting dataframe values using indices in R<p>I have 100+ files and have starting and ending coordinates for each file. So based on starting and ending c... |
73,001,903 | Logical errors in Tic-Tac-Toe game<p>I am trying to make a Tic-Tac-Toe game. I have written the code which I believe should work fine, but instead it is throwing logical errors.</p>
<pre><code>#include <stdio.h>
#define size 9
char game_logic();
int game_win();
char array[size] = { '1', '2', '3', '4', '5', '6'... | <p>There are at least these major problems:</p>
<ul>
<li><p>the test in the <code>do ... while</code> loop is incorrect: the loop iterates while <code>(game_win() != 1 || game_win() != 2 || game_win != 3)</code>... the third test compare the function name with <code>3</code> not return value of the function call, and e... | Logical errors in Tic-Tac-Toe game | c|loops|error-handling|logic|tic-tac-toe | 1 | 70 | 2 | 73,002,306 | 73,002,306 | 1 | true | 2022-07-16T06:02:10.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Logical errors in Tic-Tac-Toe game<p>I am trying to make a Tic-Tac-Toe game. I have written the code which I believe should work fine, but instead it is thro... |
72,929,340 | Fastest algorithm to win a combination game<p>I was playing a game called <a href="https://play.google.com/store/apps/details?id=com.ilyin.alchemy&hl=en_IN&gl=US" rel="nofollow noreferrer">Alchemy Merge</a>, where you have to combine different elements to create a new one. It starts with 4 basic elements <em>i.... | <p>This is a graph problem, more specifically the graph is a directed, acyclic graph (DAG),
where each node is an element, and outgoing edges go to the element(s) that are needed
to build that element. If the same element is needed multiple times, that just means there
are two edges connecting the two nodes. The "... | Fastest algorithm to win a combination game | algorithm|time-complexity | 1 | 70 | 2 | 72,929,821 | 72,929,821 | 1 | true | 2022-07-10T14:43:44.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fastest algorithm to win a combination game<p>I was playing a game called <a href="https://play.google.com/store/apps/details?id=com.ilyin.alchemy&hl=en_... |
72,911,905 | How do I create a dockerfile and docker-compose.yml from the commands?<p>I have a problem. I have the following commands.</p>
<pre><code>docker pull tensorflow/serving
docker run -it -v \folder\model:/model-p 8601:8601 --entrypoint /bin/bash tensorflow/serving
tensorflow_model_server --rest_api_port=8601 --model_name... | <p>Dockerfile (name it with capital D so it's recognized by docker-compose with just . (dot) since it's in the same folder):</p>
<pre><code>FROM tensorflow/serving
EXPOSE 8601
RUN tensorflow_model_server --rest_api_port=8601 --model_name=model --model_base_path=/model/
</code></pre>
<p>docker-compose.yml:</p>
<pre><cod... | How do I create a dockerfile and docker-compose.yml from the commands? | docker|tensorflow|docker-compose|dockerfile|tensorflow-serving | 0 | 70 | 1 | 72,912,021 | 72,912,021 | 1 | true | 2022-07-08T13:09:21.193Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I create a dockerfile and docker-compose.yml from the commands?<p>I have a problem. I have the following commands.</p>
<pre><code>docker pull tensorfl... |
72,789,961 | Image not moving onclick<p>I'm trying make this image move 16px every click, but it's not moving. I've tried this:</p>
<p>But that only moves it once. So I tried something different that I found online.</p>
<p><strong>Here is my code:</strong></p>
<p>Html:</p>
<p><div class="snippet" data-lang="js" data-hide="false" da... | <p>You can create a function that get the direction of the translation and the number of pixels to increment, then return a function that set style.transform of the element clicked, using a closure you can update the amount of pixels to translate, try this:</p>
<p><div class="snippet" data-lang="js" data-hide="false" d... | Image not moving onclick | javascript|html|css|image | 1 | 70 | 2 | 72,790,123 | 72,790,123 | 1 | true | 2022-06-28T16:16:01.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Image not moving onclick<p>I'm trying make this image move 16px every click, but it's not moving. I've tried this:</p>
<p>But that only moves it once. So I t... |
72,831,919 | Multiple Index Array - Ruby<p>i have a project of a game, in it i need to impress the letter selected if the letter selected is present in the secret word, but when i try to catch the index of the select letter, like "a", in the secret word "programador, the code returns me all the index of the word &quo... | <p>In your code, <code>total_encontrado</code> is <code>2</code>, which is greater than or equal to <code>1</code>. As a result, the condition you give to <code>#select</code> is always true, so it selects every character with its index. You then map that to just the indices.</p>
<p>Instead, you likely want to select o... | Multiple Index Array - Ruby | arrays|ruby | 1 | 70 | 4 | 72,832,039 | 72,832,039 | 1 | true | 2022-07-01T16:02:10.433Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple Index Array - Ruby<p>i have a project of a game, in it i need to impress the letter selected if the letter selected is present in the secret word, b... |
72,903,110 | Remove string from the beginning and the end of line keeping the ones in the middle (sed)<p>I am have the following text:</p>
<pre><code>>seq1
--A--CGT-A--
>seq2
-GA-T-A-CC--
</code></pre>
<p>I would like to remove all "-" from the beginning and the end of the lines, i.e., keeping the "-" betw... | <p>You can use</p>
<pre class="lang-bash prettyprint-override"><code>sed 's/^-*\|-*$//g' file
sed -E 's/^-*|-*$//g' file
sed -E 's/^-+|-+$//g' file
</code></pre>
<p>Each of the commands removes hyphens from the start and from the end of the lines. Note the <code>g</code> flag that enables multiple matching on the same ... | Remove string from the beginning and the end of line keeping the ones in the middle (sed) | sed | -1 | 70 | 2 | 72,903,140 | 72,903,140 | 1 | true | 2022-07-07T19:13:07.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove string from the beginning and the end of line keeping the ones in the middle (sed)<p>I am have the following text:</p>
<pre><code>>seq1
--A--CGT-A-... |
72,939,171 | Save Looping SQL Query Results as a single table file<p>I am trying to use a SQL query for the first time and the problem I have with my python code is that I can't save the SQL results coming from the loop as a single output file. After each loop, it just creates a new output with column names and values etc and write... | <p>That is because of the way you are handling your loop you see friendo. You are creating a new csv file for each looped object. That is why you have multiple CSVs. Why dont you try something like this?</p>
<p>First you create and empty df, object. But with all the definitions like wanted column index, and whatsoevers... | Save Looping SQL Query Results as a single table file | python|sql|pandas|dataframe|arraylist | 0 | 70 | 1 | 72,939,288 | 72,939,288 | 1 | true | 2022-07-11T13:13:43.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Save Looping SQL Query Results as a single table file<p>I am trying to use a SQL query for the first time and the problem I have with my python code is that ... |
72,943,459 | Can't wrap firebase function using firebase-function-testing<p>When I use the <code>wrap</code> function from <code>firebase-functions-test</code> I got this error message</p>
<p>Error Message</p>
<blockquote>
<p>TypeError: Cannot read properties of undefined (reading 'length')</p>
</blockquote>
<blockquote>
<p>at isV2... | <p>In the file function, I have used two methods of export,
so in the test file when I call <code>firestoreFunction.firestoreFunction</code>
it will be <strong><code>undefined</code></strong>.</p>
<p>Changing the function file has solved it.</p>
<pre><code>const firestoreFunction = functions.firestore.document('/collec... | Can't wrap firebase function using firebase-function-testing | google-cloud-functions | 0 | 70 | 1 | 72,947,604 | 72,947,604 | 1 | true | 2022-07-11T19:05:25.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't wrap firebase function using firebase-function-testing<p>When I use the <code>wrap</code> function from <code>firebase-functions-test</code> I got this... |
72,993,927 | Is it possible to grant a stored procedure execution rights that the user executing it does not have<p>I want to limit the number of times a certain user can execute a stored procedure per hour. To this end I am trying to use the performance stats to determine how many times the stored procedure has been executed in th... | <p>As I mentioned in the comments, I would suggest using some basic logging.
Firstly, let's set up the tables that would be needed with minimal columns:</p>
<pre class="lang-sql prettyprint-override"><code>CREATE TABLE dbo.ExecutionLimit (ProcedureSchema sysname NOT NULL,
ProcedureName ... | Is it possible to grant a stored procedure execution rights that the user executing it does not have | sql-server|azure|stored-procedures|permissions | 0 | 70 | 1 | 72,995,831 | 72,995,831 | 1 | true | 2022-07-15T12:21:26.573Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to grant a stored procedure execution rights that the user executing it does not have<p>I want to limit the number of times a certain user can... |
73,007,468 | Is a unique_ptr with custom deleter never invoked when initialized with nullptr<p>In scenarios where you interface with C libraries which manage the creation/deletion of pointers, I saw a recent buggy code where a struct was managed by a unique_ptr before the pointer was actually pointing to a valid memory location, so... | <blockquote>
<p>[...] what actually happens, is the destructor never invoked because it is UB to change the memory location of unique_ptr's managed raw ptr?</p>
</blockquote>
<p>You never change the pointer managed by the <code>std::unique_ptr</code> to anything other than null and that's why the <code>delete_foo</code... | Is a unique_ptr with custom deleter never invoked when initialized with nullptr | c++|undefined-behavior|unique-ptr | 0 | 70 | 1 | 73,007,577 | 73,007,577 | 1 | true | 2022-07-16T20:30:14.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is a unique_ptr with custom deleter never invoked when initialized with nullptr<p>In scenarios where you interface with C libraries which manage the creation... |
73,005,195 | JavaFX program to JAR, been trying to do this for days<p>Can anyone help me convert this javaFX application into an actual application using JAR, becuase ive been trying to convert it to a JAR for days and it just comes up with error after error. I just want to make an exe but i know how to do that, the JAR ive been tr... | <p>I recommend taking a look at this Github repo: <a href="https://github.com/wiverson/maven-jpackage-template" rel="nofollow noreferrer">https://github.com/wiverson/maven-jpackage-template</a></p>
<p>It contains a working projekt using Maven, JavaFX 17 and Java 17. Running <em>maven install</em> creates an installer a... | JavaFX program to JAR, been trying to do this for days | github|javafx | -1 | 70 | 2 | 73,005,412 | 73,005,412 | 1 | true | 2022-07-16T14:53:12.433Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaFX program to JAR, been trying to do this for days<p>Can anyone help me convert this javaFX application into an actual application using JAR, becuase ive... |
72,844,162 | Can Optional Chaining be alternative of 'in' operator in Javascript<p>I often saw <code>in</code> operator in some library of Javascript.
but I think <code>in</code> operator has risk of causing human errors.
because we have to write property name as string type.</p>
<p>I think optional chaining could be alternative of... | <p>AFAIK, <code>in</code> is used to get to know whether the property exists in an object or its prototype or not.</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 address... | Can Optional Chaining be alternative of 'in' operator in Javascript | javascript|in-operator|optional-chaining | 0 | 70 | 2 | 72,844,195 | 72,844,195 | 1 | true | 2022-07-03T05:43:13.580Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can Optional Chaining be alternative of 'in' operator in Javascript<p>I often saw <code>in</code> operator in some library of Javascript.
but I think <code>i... |
72,940,106 | Powershell string to unix time with correct timezone<p>I'm collecting a timestamp value and trying to transform it to a Unix format.</p>
<p>To do that, I'm using ParseExact method, like so:</p>
<pre><code>$FILETIME = "20220709101112"
$EPOCHTIME = [datetime]::ParseExact($FILETIME,"yyyyMMddHHmmss",$nu... | <p>Ok, so here's one way to do it (borrowing from <a href="https://stackoverflow.com/a/246529/3156906">https://stackoverflow.com/a/246529/3156906</a>).</p>
<p>The key is to find the TimeZoneInfo for the timezone the <code>$FILETIME</code> string is local to, and use <em>that</em> to convert the local time to UTC before... | Powershell string to unix time with correct timezone | powershell|parsing|timezone|unix-timestamp|epoch | 0 | 70 | 2 | 72,945,413 | 72,945,413 | 1 | true | 2022-07-11T14:24:27.813Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Powershell string to unix time with correct timezone<p>I'm collecting a timestamp value and trying to transform it to a Unix format.</p>
<p>To do that, I'm u... |
72,395,716 | How come the difference between 'View page source' and document.querySelector("html").innerHTML?<p>I want to extract subtitles from this YouTube page (<a href="https://www.youtube.com/watch?v=35PinDPNPw0&ab_channel=CrashCourse" rel="nofollow noreferrer">link</a>).<br />
I found <em>timedtext</em>, when looking via ... | <p><em><a href="https://stackoverflow.com/questions/72395716/how-come-the-difference-between-view-page-source-and-document-queryselectorh#comment127893245_72395716">As I commented</a></em>, if you want to extract the subtitles <em>using this way</em>, consider instead search for the script tag that has the <code>ytInit... | How come the difference between 'View page source' and document.querySelector("html").innerHTML? | javascript|web-scraping|youtube | -1 | 70 | 1 | 72,397,434 | 72,397,434 | 1 | true | 2022-05-26T17:21:12.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How come the difference between 'View page source' and document.querySelector("html").innerHTML?<p>I want to extract subtitles from this YouTube page (<a hre... |
72,251,676 | Using sub-select in FROM clause inside JPA @NamedQuery<p>In my app I need to use @NamedQuery to find the type of the most frequent operation assigned to specific account</p>
<pre><code>@Entity
@Table(name="\"ACCOUNTOPERATION\"")
@NamedQuery(name="AccountOperation.findTypeOfMostFrequentOperation... | <p><a href="https://github.com/me3eh/java_biznesowa/blob/zad_4_zapytania/src/main/java/model/AccountOperation.java" rel="nofollow noreferrer">Link to source</a></p>
<p>In JPQL, you cannot use subqueries. To resolve this issue, you need to use some keywords like ALL, ANY, which work similiar.</p>
<p>So in your situation... | Using sub-select in FROM clause inside JPA @NamedQuery | sql|maven|jpa|h2|jpql | 0 | 70 | 2 | 72,468,751 | 72,468,751 | 1 | true | 2022-05-15T19:44:24.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using sub-select in FROM clause inside JPA @NamedQuery<p>In my app I need to use @NamedQuery to find the type of the most frequent operation assigned to spec... |
72,255,931 | ERROR TypeError: _co.saveXML is not a function<p>In my client Angular project I have a component called report-viewer. Inside it I have a form, EmailSettings, which is called when a button from component is pressed.</p>
<p><a href="https://i.stack.imgur.com/UMbRV.png" rel="nofollow noreferrer"><img src="https://i.stack... | <p>As I already stated in the comments section you will have to declare a component. Just adding a decorator is not enough.
Every class you add @Component(...) to needs to be added to the declarations array of a module.</p>
<p>I assume you just have one single AppModule class. So you will need to add your component to ... | ERROR TypeError: _co.saveXML is not a function | angular|typescript|angular-components | 0 | 70 | 1 | 72,256,638 | 72,256,638 | 1 | true | 2022-05-16T08:04:05.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ERROR TypeError: _co.saveXML is not a function<p>In my client Angular project I have a component called report-viewer. Inside it I have a form, EmailSettings... |
72,359,967 | Get first LinkedHashMap key based on value in Java<p>I use the following <code>LinkedHashMap</code> and get the occurences of numbers as <code><number, occurences></code>.</p>
<pre><code>Map<Integer, Integer> map = new LinkedHashMap<>();
</code></pre>
<p>The values stored in the map are as in the foll... | <p>Rather than checking <code>containsValue</code> first, use <a href="https://docs.oracle.com/en/java/javase/17/docs/api//java.base/java/util/Optional.html#orElse(T)" rel="nofollow noreferrer"><code>orElse</code></a> on the optional returned by <code>findFirst</code>, which is one fewer iteration through the map.</p>
... | Get first LinkedHashMap key based on value in Java | java|stream|hashmap|java-stream|linkedhashmap | 2 | 70 | 1 | 72,360,097 | 72,360,097 | 1 | true | 2022-05-24T08:55:57.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get first LinkedHashMap key based on value in Java<p>I use the following <code>LinkedHashMap</code> and get the occurences of numbers as <code><number, oc... |
72,370,536 | ForEach loop with dynamic variable<p>I need to show two different images depending on an @State bool, so that when the user presses the image it shows the second image and when the user releases it goes back to showing the first image. This all works perfectly, however I have a situation where I need to do the same thi... | <p>try something like this approach, to be able to "press" on your<br />
<code>DynamicBtn</code> and show a particular image, and then release the "press" to display the original image:</p>
<pre><code>struct MainView: View {
let users = [User(name: "Tim"), User(name: "John"),... | ForEach loop with dynamic variable | button|dynamic|swiftui | 0 | 70 | 1 | 72,371,944 | 72,371,944 | 1 | true | 2022-05-24T23:38:34.300Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ForEach loop with dynamic variable<p>I need to show two different images depending on an @State bool, so that when the user presses the image it shows the se... |
72,258,194 | Data type assignment TS+Vue3<p>In my components, i want to use <code><script setup lang="ts"></code> . But I ran into a type problem.
Example of a normal component <code><script lang="ts"></code>:</p>
<pre><code>props: {
modelValue: {
type: [Boolean, String, Number, Array as ()... | <p>To combine types in TypeScript, use <a href="https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types" rel="nofollow noreferrer">union types</a>. For instance, this constructor array:</p>
<pre class="lang-js prettyprint-override"><code>[Boolean, String, Number, Array as () => Array<string... | Data type assignment TS+Vue3 | typescript|vue.js|vuejs3 | 0 | 70 | 1 | 72,267,806 | 72,267,806 | 1 | true | 2022-05-16T11:04:20.333Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Data type assignment TS+Vue3<p>In my components, i want to use <code><script setup lang="ts"></code> . But I ran into a type problem.
Example... |
72,338,922 | Count the number of terms that are not atoms in a nested list<p>I have these facts:</p>
<pre><code>vehicle(car,blue,[wheel,horn,optional(radio)]).
vehicle(motorcycle,blue,[wheel,optional(navigation),horn]).
vehicle(truck,white,[wheel,horn,optional(trailer)]).
</code></pre>
<p>I want to count all optional items (all &qu... | <p>One possible solution would be the following:</p>
<pre><code>count(C) :-
findall(X, vehicle(_, blue, X), Ls),
countOpt(Ls, 0, C).
countOpt([], X, X) :- !.
countOpt([H|T], C, NewC) :-
countOpt(T, C, NewC1),
findall(Opt, member(optional(Opt), H), Opts),
printOpts(Opts),
length(Opts, Length),
... | Count the number of terms that are not atoms in a nested list | prolog | 1 | 70 | 2 | 72,339,024 | 72,339,024 | 1 | true | 2022-05-22T15:27:34.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Count the number of terms that are not atoms in a nested list<p>I have these facts:</p>
<pre><code>vehicle(car,blue,[wheel,horn,optional(radio)]).
vehicle(mo... |
72,298,692 | remove gibberish prefix from a string<pre><code>a = "aajfkdfvf_valid_name0"
b = "gdhdhsdsdeeeeex_valid_name1"
</code></pre>
<p>How do I remove the gibberish from my string before valid so that I have something like this -</p>
<pre><code>valid_name0
valid_name1
</code></pre> | <p>If your strings always contains <code>valid</code> word, then you can try something like -</p>
<pre><code>a = "aajfkdfvf_valid_name0"
b = "gdhdhsdsdeeeeex_valid_name1"
for s in (a, b):
print(s[s.rfind('valid'):])
</code></pre>
<p>So, even if the prefix contains <code>_</code> or substring <c... | remove gibberish prefix from a string | python | 0 | 70 | 5 | 72,298,747 | 72,298,747 | 1 | true | 2022-05-19T04:35:07.403Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
remove gibberish prefix from a string<pre><code>a = "aajfkdfvf_valid_name0"
b = "gdhdhsdsdeeeeex_valid_name1"
</code></pre>
<p>How do I ... |
72,268,413 | How to call a method service injected in another constructor service PHP Symfony<p>So I'm really trying to figure it out how can I do that in Symfony 5.</p>
<p>I have an services named PaymentRequestService which have the entire logic for requests to another application (based on microservices).
I injected PaymentReque... | <p>I dont argue the architecture you want to use... but you would do it this way:
(PHP 8 syntax)</p>
<pre><code>class PaymentService
public function __construct(private PaymentRequestService $requestService)
{}
public function getRequest(): PaymentRequestService
{
return $this->requestSe... | How to call a method service injected in another constructor service PHP Symfony | php|symfony | 1 | 70 | 3 | 72,280,226 | 72,280,226 | 1 | true | 2022-05-17T05:00:16.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to call a method service injected in another constructor service PHP Symfony<p>So I'm really trying to figure it out how can I do that in Symfony 5.</p>
... |
72,321,691 | Likelihood of Collision<p>I want to hash an internal account number and use the result as a unique public identifier for an account record. The identifier is limited to 40 characters. I have approximately 250 records with unique account numbers.</p>
<p>What is less likely to result in a collision.</p>
<ol>
<li>Taking ... | <p>These approaches are identical (*), so you should use the second one. There is no reason to inject SHA-1 into the system. Any selection of bits out of SHA-256 are independent and "effectively random."</p>
<p>An alternate solution that may be convenient is to <a href="https://stackoverflow.com/a/64013733/97... | Likelihood of Collision | cryptography|hash-collision | 0 | 70 | 2 | 72,321,966 | 72,321,966 | 1 | true | 2022-05-20T15:53:14.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Likelihood of Collision<p>I want to hash an internal account number and use the result as a unique public identifier for an account record. The identifier is... |
72,243,239 | How can I turn my navbar links into a dropdown menu with HTML CSS and JavaScript?<p>I am trying to turn the first two links of my navbar into dropdown menus. I want to make it so that when you click on them, the dropdown menu shows and the arrow icon turns from a downward pointing arrow to an upwards pointing one.</p>
... | <p>I wrote you a possible Vanilla JS approach to handle the behaviour you are looking for:</p>
<ol>
<li>First select all the <code>li</code> elements in your list;</li>
<li>Add a <code>click</code> event listener;</li>
<li>On each click it adds or remove the classes that show the modal and rotate the arrow, based on a ... | How can I turn my navbar links into a dropdown menu with HTML CSS and JavaScript? | javascript|html|css|onclick | 0 | 70 | 1 | 72,243,518 | 72,243,518 | 1 | true | 2022-05-14T19:18:26.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I turn my navbar links into a dropdown menu with HTML CSS and JavaScript?<p>I am trying to turn the first two links of my navbar into dropdown menus.... |
72,316,312 | How can I click on any of the categories in the list and be redirected to all active listings in that category? Django<p>I<code>m working on a django project (i</code>m newb) and I`ve made a html page displaying a list of available categories. I want to make each a link and when the user clicks it he/she should be redi... | <p>You need to add a url for the listing list, and then a view that handles it, as well as a template.</p>
<p>in <code>urls.py</code>:</p>
<p><code>path('category/<int:category_id>', views.listing_list, name="listing_list"),</code></p>
<p>in <code>views.py</code> (make sure to set the template name in t... | How can I click on any of the categories in the list and be redirected to all active listings in that category? Django | python|html|django|model | 0 | 70 | 1 | 72,317,545 | 72,317,545 | 1 | true | 2022-05-20T09:07:20.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I click on any of the categories in the list and be redirected to all active listings in that category? Django<p>I<code>m working on a django project... |
72,280,265 | Extract uppercase words till the first lowercase letter<p>I need to extract the first part of a text, which is uppercase till the first letter lowercase.</p>
<p>For example, I have the text: "IV LONG TEXT HERE and now the Text End HERE"</p>
<p>I want to extract the "IV LONG TEXT HERE".</p>
<p>I have... | <p>You could use str_extract, with a pattern to match a single uppercase char and optionally match spaces and uppercase chars ending with another uppercase char.</p>
<pre><code>\b[A-Z](?:[A-Z ]*[A-Z])?\b
</code></pre>
<p><strong>Explanation</strong></p>
<ul>
<li><code>\b[A-Z]</code> A word boundary to prevent a partial... | Extract uppercase words till the first lowercase letter | r|regex | 0 | 70 | 3 | 72,280,315 | 72,280,315 | 1 | true | 2022-05-17T20:24:50.427Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Extract uppercase words till the first lowercase letter<p>I need to extract the first part of a text, which is uppercase till the first letter lowercase.</p>... |
72,349,686 | Is Reentrant Lock a Object level lock or Class level lock?<p>I see in many tutorials for Reentrant lock, they create a new Reentrant lock and resource is injected, lock and unlock of reentrant lock is called in try/finally block. I don't understand the connection between this lock and resource which is used in the thre... | <p>In one sense, a <code>ReentrantLock</code> is neither a class-level nor an object-level lock. In a more practical sense, it's the same as either of them.</p>
<p>Really, you should forget about "class level" and "object level" locking. Those are not useful distinctions.</p>
<p>You can use <em>any<... | Is Reentrant Lock a Object level lock or Class level lock? | java|multithreading|reentrantlock | -1 | 70 | 1 | 72,352,475 | 72,352,475 | 1 | true | 2022-05-23T13:48:32.197Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is Reentrant Lock a Object level lock or Class level lock?<p>I see in many tutorials for Reentrant lock, they create a new Reentrant lock and resource is inj... |
72,250,149 | Find HTML Table header index<p>I need to find .10,.20,.30 up to .50 In a table header.
The search parameters are base on a formula and will eventually determine what column to filter.
I found this snippet from a previous similar post, but when I insert my table, I would get no results.</p>
<p>What could be the correct ... | <ol>
<li><p>Add thead</p>
</li>
<li><p>Search for th instead of td</p>
</li>
<li><p>Cache the selected THs</p>
</li>
<li><p>Be more specific with your selectors, use <code>$('#myTable thead th')</code> instead of <code>$('th')</code> since you might target unwanted <code>TH</code> Elements in your DOM</p>
</li>
<li><p>... | Find HTML Table header index | javascript|html|jquery | 0 | 70 | 1 | 72,250,217 | 72,250,217 | 1 | true | 2022-05-15T16:26:11.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find HTML Table header index<p>I need to find .10,.20,.30 up to .50 In a table header.
The search parameters are base on a formula and will eventually determ... |
72,322,537 | Any way to build an array of pointers from a tuple of different objects (but derived from the same base class)?<p>Good morning all!</p>
<p>reading stack overflow for a long time, but this is my first post here.</p>
<p>For some reasons I would like to do something like this:</p>
<pre><code>class Base{
...
}
class A ... | <p>It is possible to create an array of pointers to tuple members using various compile time programming techniques. Below is one implementation. There may be a less verbose way of doing this, but I am no expert on this kind of stuff:</p>
<pre><code>#include <iostream>
#include <string>
#include <array&g... | Any way to build an array of pointers from a tuple of different objects (but derived from the same base class)? | c++|arrays|pointers|tuples|metaprogramming | -1 | 70 | 1 | 72,323,474 | 72,323,474 | 1 | true | 2022-05-20T17:10:16.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Any way to build an array of pointers from a tuple of different objects (but derived from the same base class)?<p>Good morning all!</p>
<p>reading stack over... |
72,320,645 | Combining the Results of Several Loops Together<p>I wrote the following code that generates a single random number, subtracts this random number from some constant, records this result - and then repeats this process 100 times:</p>
<pre><code># 1 random number
results <- list()
for (i in 1:100) {
iteration = i... | <p>Your initial objective can be simplified like this:</p>
<pre><code>results <- list()
for (i in seq_len(100)) {
#Samples from 1 to 20 numbers, averages them
a <- unlist(lapply(seq_len(20), function(x) mean(rnorm(x, 10, 2))))
#Creates names for this vector
names(a) <- paste0(rep("number_i_",... | Combining the Results of Several Loops Together | r|loops|random | 0 | 70 | 1 | 72,321,975 | 72,321,975 | 1 | true | 2022-05-20T14:31:26.623Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combining the Results of Several Loops Together<p>I wrote the following code that generates a single random number, subtracts this random number from some co... |
72,392,438 | In R, how to find the location of a word in a string?<p>How can I find the first location of specific words in a dataframe cell, and save the output in a new column in the same dataframe?</p>
<p>Ideally I want the first match for each of the words in dictionary.</p>
<pre><code>df <- data.frame(text = c("omg cok... | <p>Here's a simple for loop:</p>
<pre><code>for(i in dict) {
df[[i]] = stringi::stri_locate_first_fixed(df$text, i)[, 1]
}
df
# text coke pepsi fanta
# 1 omg coke is so awsme 5 NA NA
# 2 ... | In R, how to find the location of a word in a string? | r|text|nlp|text-mining|quanteda | 1 | 70 | 3 | 72,392,613 | 72,392,613 | 1 | true | 2022-05-26T13:14:33.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In R, how to find the location of a word in a string?<p>How can I find the first location of specific words in a dataframe cell, and save the output in a new... |
72,265,567 | Why use async.gather in Python?<p>Let's say we have</p>
<pre><code>await async_function_one_with_large_IO_request()
await async_function_two_with_large_IO_request()
</code></pre>
<p>versus</p>
<pre><code>asyncio.gather(
async_function_one_with_large_IO_request(),
async_function_two_with_large_IO_request())
</code>... | <blockquote>
<p>In the first version, once we hit the 'large io request' part of function one, it's gonna move onto running function_two, that's the whole point of await, right?</p>
</blockquote>
<p>That's incorrect. In your first version, <code>async_function_two_with_large_IO_request</code> (which I will call <code>f... | Why use async.gather in Python? | python|python-asyncio | 0 | 70 | 1 | 72,265,661 | 72,265,661 | 1 | true | 2022-05-16T20:59:35.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why use async.gather in Python?<p>Let's say we have</p>
<pre><code>await async_function_one_with_large_IO_request()
await async_function_two_with_large_IO_re... |
72,298,446 | How to properly trim the edge of an input range track in CSS?<p>I am trying to build a slider component that looks similar to this:
<a href="https://i.stack.imgur.com/yx8kM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yx8kM.png" alt="Slider with 5 dots - normal" /></a></p>
<p>But the slider thumb ... | <p>I would probably just draw the groove separately instead of trying to make it work like this.</p>
<p>Also:</p>
<ul>
<li>You can just <code>bind</code> the <code>value</code> of the input.</li>
<li>It helps to have a container element which is used to dictate the overall size</li>
<li>Flexbox in combination with <cod... | How to properly trim the edge of an input range track in CSS? | html|css|svelte | 0 | 70 | 1 | 72,303,590 | 72,303,590 | 1 | true | 2022-05-19T03:56:51.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to properly trim the edge of an input range track in CSS?<p>I am trying to build a slider component that looks similar to this:
<a href="https://i.stack.... |
72,365,997 | How to share my own custom fucntions on AWS lambda nodejs<p>I Currently have a project in AWS with several lambda functions, most of the functions in NodeJS, I want to know if is there a way to create a lambda layer with <strong>my own code functions</strong> that I use in different lambdas without publish it in npm, I... | <ol>
<li>create a folder in your local machine called nodejs</li>
<li>put your "shared" logic in that folder like /nodejs/shared.js</li>
<li>you can zip this nodejs folder and upload as a layer</li>
<li>in your lambda code require the shared.js as <code>const shared = require('/opt/nodejs/shared.js'</code>)</... | How to share my own custom fucntions on AWS lambda nodejs | node.js|amazon-web-services|aws-lambda|aws-lambda-layers | 0 | 70 | 1 | 72,368,707 | 72,368,707 | 1 | true | 2022-05-24T15:59:48.960Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to share my own custom fucntions on AWS lambda nodejs<p>I Currently have a project in AWS with several lambda functions, most of the functions in NodeJS,... |
72,241,558 | Flink TumblingEventTimeWindows how achievement without overlap?<p>There is this text in <a href="https://www.oreilly.com/library/view/stream-processing-with/9781491974285/" rel="nofollow noreferrer">Stream Processing with Apache Flink</a> page 211</p>
<blockquote>
<p>“The WindowAssigner determines for each arriving ele... | <p>The <code>TimeWindow</code> object isn't very important. It is a simple structure that holds the start and end timestamps for the window, and nothing else. It's name makes it sound important, but it's just used to encode a copy of the information describing the time interval the incoming event is being assigned to.<... | Flink TumblingEventTimeWindows how achievement without overlap? | apache-flink | 0 | 70 | 1 | 72,246,687 | 72,246,687 | 1 | true | 2022-05-14T15:18:34.283Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flink TumblingEventTimeWindows how achievement without overlap?<p>There is this text in <a href="https://www.oreilly.com/library/view/stream-processing-with/... |
72,337,785 | gameObject.GetComponent<T> != null is always true. How?<ol>
<li><p>I have a list of 3 game objects. Only ONE game object has a Light component attached.</p>
</li>
<li><p>I'm iterating through the list of all game objects like this</p>
<pre><code> foreach (var eachGameObject in objs) //eachGamObject represents one of t... | <p>Try to Add where (generic type constraint),like this:</p>
<pre><code> public List<T> FindInScene<T>() where T :Component
{
var objs = FindObjectsOfType<GameObject>();
List<T> list = new List<T>();
foreach (var eachGameObject in objs)
{
i... | gameObject.GetComponent<T> != null is always true. How? | c#|unity3d | 0 | 70 | 2 | 72,350,567 | 72,350,567 | 1 | true | 2022-05-22T13:00:15.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
gameObject.GetComponent<T> != null is always true. How?<ol>
<li><p>I have a list of 3 game objects. Only ONE game object has a Light component attached.</p>
... |
72,257,475 | ZPL Barcode missing front 2 digit<p>I am trying to print an EAN barcode vertically on a label with below ZPL code:</p>
<pre><code>^FO895,273^BY3^BUB,200,Y,N
^FO895,261^FD9827755779090^FS
</code></pre>
<p>I'm expecting the output as <strong>9827755779090</strong>. However, it prints out as <em><strong>277557790900</stro... | <p><code>^BE</code> is the EAN command. It will calculate the check digit for you.</p>
<blockquote>
<p>^BE; EAN-13 Bar Code. Description: The ^BE command is similar to the
UPC-A bar code. It is widely used throughout Europe and Japan in the
retail marketplace. The EAN-13 bar code has 12 data characters, one
more data c... | ZPL Barcode missing front 2 digit | label|barcode|zebra-printers|zpl|barcode-printing | 0 | 70 | 2 | 72,265,275 | 72,265,275 | 1 | true | 2022-05-16T10:05:40.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ZPL Barcode missing front 2 digit<p>I am trying to print an EAN barcode vertically on a label with below ZPL code:</p>
<pre><code>^FO895,273^BY3^BUB,200,Y,N
... |
72,371,790 | Replacing character in string doesn't do anything<p>I have a list like this,</p>
<pre><code>['Therefore', 'allowance' ,'(#)', 't(o)o', 'perfectly', 'gentleman', '(##)' ,'su(p)posing', 'man', 'his', 'now']
</code></pre>
<p>Expected output:</p>
<pre><code>['Therefore', 'allowance' ,'(#)', 'too', 'perfectly', 'gentleman',... | <p>You can use <a href="https://docs.python.org/3/library/re.html#re.sub" rel="nofollow noreferrer"><code>re.sub</code></a>. In particular, note that it can take a function as <code>repl</code> parameter. The function takes a match object, and returns the desired replacement based on the information the match object ha... | Replacing character in string doesn't do anything | python | -3 | 70 | 3 | 72,371,887 | 72,371,887 | 1 | true | 2022-05-25T03:54:50.370Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replacing character in string doesn't do anything<p>I have a list like this,</p>
<pre><code>['Therefore', 'allowance' ,'(#)', 't(o)o', 'perfectly', 'gentlema... |
72,267,688 | Bind Command To ContextMenu Item<p>I am getting this error/warning:</p>
<pre><code>System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=DrivesListView'
</code></pre>
<p>When I press 'Refresh', the command does not fire. I am guessing since it is a ContextMenu, I need to somehow acce... | <p>As stated in <a href="https://docs.microsoft.com/en-us/dotnet/desktop/wpf/controls/contextmenu?view=netframeworkdesktop-4.8" rel="nofollow noreferrer">the documentation</a>, <em>[the] menu [...] is specific to the context of the control</em>.<br />
In other words, the <code>ContextMenu</code> has the same data conte... | Bind Command To ContextMenu Item | c#|wpf | 0 | 70 | 2 | 72,271,163 | 72,271,163 | 1 | true | 2022-05-17T02:55:12.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bind Command To ContextMenu Item<p>I am getting this error/warning:</p>
<pre><code>System.Windows.Data Error: 4 : Cannot find source for binding with referen... |
72,290,820 | How do I optimize this MYSQL JOIN Query?<p>I am having a hard time dealing with query optimization and I believe the one am currently using can be improved a lot.</p>
<p>I have 4 tables;</p>
<pre><code>Artist (14,930 rows)
</code></pre>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>artist_id<... | <p>I would simply use a subquery in select clause for aggregation:</p>
<pre><code>SELECT artist.*, country.*, (
SELECT COUNT(*)
FROM song
WHERE song.song_artist_id = artist.artist_id
) AS total_songs, (
SELECT SUM(song_plays)
FROM song
WHERE song.song_artist_id = artist.artist_id
) AS total_play... | How do I optimize this MYSQL JOIN Query? | mysql|sql|database|query-optimization | 1 | 70 | 2 | 72,291,171 | 72,291,171 | 1 | true | 2022-05-18T14:13:52.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I optimize this MYSQL JOIN Query?<p>I am having a hard time dealing with query optimization and I believe the one am currently using can be improved a... |
72,340,028 | Console log in Reduce() returning NaN<p>This function sums the lengths of all array elements and it works by returning the final value, but using console.log returns the length of the first element and NaN for the rest. Why?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="fa... | <h2>Your issue</h2>
<p><code>a</code> will always have the value that is returned from the previous iteration or the initial value <code>0</code>. Therefore in the first iteration it is <code>0 + b.length</code> which results in <code>2</code>. But then you don't return anything, therefore the return type is <code>unde... | Console log in Reduce() returning NaN | javascript|reduce | -1 | 70 | 1 | 72,340,047 | 72,340,047 | 1 | true | 2022-05-22T17:53:40.607Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Console log in Reduce() returning NaN<p>This function sums the lengths of all array elements and it works by returning the final value, but using console.log... |
72,322,480 | When trying to update view faced an error "property defined on _CA Layer View"<p>I am new to Swift and trying to make a first app on SwiftUI on developer.apple and faced a problem when trying to update a view. I was trying to find a mistake, but I did everything step by step and code is same with sample code. I can not... | <p>My guess is that the 'DailyScrum.swift' file is probably missing some code.
Fix <code>DailyScrum.swift</code> file like the following code.</p>
<pre class="lang-swift prettyprint-override"><code>extension DailyScrum {
struct Attendee: Identifiable {
let id: UUID
var name: String
init(id: UUID = UU... | When trying to update view faced an error "property defined on _CA Layer View" | swift|swiftui|updateview | -2 | 70 | 1 | 72,407,655 | 72,407,655 | 1 | true | 2022-05-20T17:04:28.030Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When trying to update view faced an error "property defined on _CA Layer View"<p>I am new to Swift and trying to make a first app on SwiftUI on developer.app... |
72,247,622 | Basic tab navigation is not working in HTML<p>I am showing only one <code>navcontent</code>. I already have Facebook and Instagram contents in my page, that is not the problem here.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class... | <p>If by <code>media</code> in <code>onclick="socialMedia(media, 'Twitter')"</code> you meant the clicked element, then it should be <code>this</code>. Then you can reference it like <code>media.className</code> in the function.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" ... | Basic tab navigation is not working in HTML | javascript|html|css|tabs | 1 | 70 | 2 | 72,247,805 | 72,247,805 | 2 | true | 2022-05-15T10:59:08.640Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Basic tab navigation is not working in HTML<p>I am showing only one <code>navcontent</code>. I already have Facebook and Instagram contents in my page, that ... |
72,249,505 | Is there any better way to refactor an array of objects in javascript?<p>I have a an array of objects like this:</p>
<pre class="lang-js prettyprint-override"><code>[{
grade: 1,
title: 'TitleA',
code_no: 1,
code_name: 'A',
business_number: '',
total_sales_count: 213,
general_number: 0,
r... | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment" rel="nofollow noreferrer">Destructure</a> the props that are meant to added to new objects, and capture the other properties with the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Referen... | Is there any better way to refactor an array of objects in javascript? | javascript | 0 | 70 | 3 | 72,249,651 | 72,249,651 | 2 | true | 2022-05-15T15:06:39.357Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there any better way to refactor an array of objects in javascript?<p>I have a an array of objects like this:</p>
<pre class="lang-js prettyprint-override... |
72,272,196 | how do i get all images in a grid the same height using css?<p><a href="https://i.stack.imgur.com/F8DXz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F8DXz.png" alt="see how the one image is the wring height" /></a></p>
<p>I am trying to get all images are the same height but I don't know what is w... | <p>Adding on @The Duo's answer, be sure to add image <code>width</code> and <code>height</code> attributes to avoid <a href="https://web.dev/cls/" rel="nofollow noreferrer">CLS</a>.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class... | how do i get all images in a grid the same height using css? | html|css|css-grid | 2 | 70 | 2 | 72,274,595 | 72,274,595 | 2 | true | 2022-05-17T10:17:23.930Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how do i get all images in a grid the same height using css?<p><a href="https://i.stack.imgur.com/F8DXz.png" rel="nofollow noreferrer"><img src="https://i.st... |
72,270,050 | How to handle the error if `To` number is valid or not?<p>What im trying to do is to throw an error message if the user has entered an invalid number.</p>
<p>controller/auth.js</p>
<pre><code> const otp = await client.verify
.services(serviceId)
.verifications.create({ to: phone, channel: "sms" });
... | <p>You can use the <a href="https://www.twilio.com/lookup" rel="nofollow noreferrer">Twilio Lookup API</a> (it has a free tier) to validate the structural integrity of the entered phone number. You can also use the Lookup API to see what carrier the number is hosted with and if the number is a landline, mobile, or VoiP... | How to handle the error if `To` number is valid or not? | node.js|twilio | 0 | 70 | 1 | 72,277,020 | 72,277,020 | 2 | true | 2022-05-17T07:47:40.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to handle the error if `To` number is valid or not?<p>What im trying to do is to throw an error message if the user has entered an invalid number.</p>
<p... |
72,320,883 | How to write a Python type hint that specifies a Callable that takes certain parameters or 0 parameters?<p>I have the following code</p>
<pre class="lang-py prettyprint-override"><code>def func1(f: Callable):
def decorator(*args, **kwargs):
# do something
return f(*args, **kwargs)
return decora... | <blockquote>
<p>I want to specify that func1 takes a Callable that has either 1 parameter of a certain type (in this case, a str), or no parameters at all</p>
</blockquote>
<p>Use the union of the two signatures:</p>
<pre><code> func : Callable[[str], Any] | Callable[[], Any])
</code></pre> | How to write a Python type hint that specifies a Callable that takes certain parameters or 0 parameters? | python|python-typing | 1 | 70 | 1 | 72,321,288 | 72,321,288 | 2 | true | 2022-05-20T14:47:22.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to write a Python type hint that specifies a Callable that takes certain parameters or 0 parameters?<p>I have the following code</p>
<pre class="lang-py ... |
72,358,373 | how to run bash for loop and using GNU parallel?<p>I have a bash loop where I am passing variables to a script. I want to run these in parallel with GNU parallel</p>
<pre class="lang-bash prettyprint-override"><code>for FILE_NAME in FILE1 FILE2 FILE3;
do
./SCRIPT -n $FILE_NAME
done
</code></pre>
<p>where I want th... | <p>Try like this:</p>
<pre><code>parallel ./SCRIPT -n {} ::: FILE1 FILE2 FILE3
</code></pre>
<p>Or, more succinctly if your files are really named like that:</p>
<pre><code>parallel ./SCRIPT -n {} ::: FILE*
</code></pre> | how to run bash for loop and using GNU parallel? | bash|for-loop|gnu-parallel | 4 | 70 | 1 | 72,360,836 | 72,360,836 | 2 | true | 2022-05-24T06:53:21.790Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to run bash for loop and using GNU parallel?<p>I have a bash loop where I am passing variables to a script. I want to run these in parallel with GNU para... |
72,400,230 | Replicate Excel custom table using css + html<p>I want to replicate a table using CSS + HTML</p>
<p>So everything goes well until last part.</p>
<p>Table:</p>
<p><a href="https://i.stack.imgur.com/SOmJ5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SOmJ5.png" alt="enter image description here" /></... | <p>Here is an easy solution. You can follow it.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>#page {
background: #ffffff;
width: 878px;
margin: 0 auto;
margin-top:... | Replicate Excel custom table using css + html | html|css | 0 | 70 | 2 | 72,401,176 | 72,401,176 | 2 | true | 2022-05-27T03:42:27.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replicate Excel custom table using css + html<p>I want to replicate a table using CSS + HTML</p>
<p>So everything goes well until last part.</p>
<p>Table:</p... |
72,401,327 | Split a number in a string<p>I have a column called "Site" with value as following:</p>
<pre><code>Clj2
Cob
Cob2
Abt 234
Abt4
Bani
</code></pre>
<p>I would like to take only the alpha chars into a new column "Sitename" without numbers or spaces which means the result should be like this:</p>
<pre><c... | <p>You can try with a regex that will match everything except the first characters like this:</p>
<pre><code>SELECT CASE WHEN PATINDEX('%[^A-Za-z]%', site) = 0
THEN site
ELSE SUBSTRING(site, 1, PATINDEX('%[^A-Za-z]%', site)-1)
END
FROM TableUser
</code></pre>
<p>If there's no other chara... | Split a number in a string | sql|sql-server | 0 | 70 | 2 | 72,402,001 | 72,402,001 | 2 | true | 2022-05-27T06:29:34.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Split a number in a string<p>I have a column called "Site" with value as following:</p>
<pre><code>Clj2
Cob
Cob2
Abt 234
Abt4
Bani
</code></pre>
<p... |
72,401,595 | Extract boolean element from JSON with custom policy<p>I want to ask if there is a way to extract a boolean element from a JSON response from REST API.</p>
<p>I have a claim that contains a JSON:</p>
<pre><code>{
"customerEntity": {
"role": {
"id": 1
}
}... | <p>The simplest solution would be to map the response to a claim from the REST API technical profile.</p>
<p>I'll add a simple example that I used for testing</p>
<p><strong>Technical Profile</strong></p>
<pre class="lang-xml prettyprint-override"><code> <TechnicalProfile Id="TestEchoJson">
... | Extract boolean element from JSON with custom policy | json|azure-ad-b2c|azure-ad-b2c-custom-policy | 1 | 70 | 1 | 72,402,202 | 72,402,202 | 2 | true | 2022-05-27T06:58:33.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Extract boolean element from JSON with custom policy<p>I want to ask if there is a way to extract a boolean element from a JSON response from REST API.</p>
<... |
72,357,214 | What Sign in method to use best?<p>We are having a flutter app (ios, android, web), where users are signed in via username & password.
We are also using google firebase since its powerful and easy to integrate.</p>
<p>The username and password mainly <strong>belongs</strong> to the website where we are gathering da... | <p><strong>SOLUTION</strong></p>
<p>Create a Firebase Cloud Function just like described in <a href="https://firebase.google.com/docs/functions/get-started" rel="nofollow noreferrer">Firebase Cloud Functions</a>.</p>
<p>Be aware that if you want to create a customtoken, the cloud functions need rights. On initializeApp... | What Sign in method to use best? | firebase|flutter | 2 | 70 | 1 | 72,404,864 | 72,404,864 | 2 | true | 2022-05-24T04:28:01.487Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What Sign in method to use best?<p>We are having a flutter app (ios, android, web), where users are signed in via username & password.
We are also using ... |
72,371,729 | Running mvn clean install deletes data in the database<p>I'm fairly new at maven spring boot.</p>
<p>I'm running <code>mvn clean install</code> then <code>mvn spring-boot:run</code>
I'm then able to go an http post and insert data into the database. I can do an http get and see the data. I can view the data in mysql.</... | <p><code>spring.jpa.hibernate.ddl-auto = create</code> -– Hibernate first drops existing tables, then creates new tables. <a href="https://docs.spring.io/spring-boot/docs/1.1.0.M1/reference/html/howto-database-initialization.html" rel="nofollow noreferrer">Click here</a> for more details.</p>
<p>Remove / comment this p... | Running mvn clean install deletes data in the database | java|spring|spring-boot|maven|spring-data-jpa | 2 | 70 | 1 | 72,371,782 | 72,371,782 | 2 | true | 2022-05-25T03:43:48.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Running mvn clean install deletes data in the database<p>I'm fairly new at maven spring boot.</p>
<p>I'm running <code>mvn clean install</code> then <code>mv... |
72,331,781 | Instantiate generic interface that has generic property<p>I'm trying to refactor a very specific code to make it more generic, so we can expand the use case, but I'm struggling when dealing with generic types. The code in question is (just adding the signature and the parts I need help):</p>
<pre><code>public class Dat... | <p>Although, <code>PersonData</code> inherits from <code>Data</code>, When they are used <code>Data</code> isn't <code>PersonalData</code> they share properties since one is the inheriter.</p>
<p>Here's your problem:</p>
<pre><code>public class EntityManager
{
private IEntityProvider<Data> entityProvider;
... | Instantiate generic interface that has generic property | c#|.net | 0 | 70 | 2 | 72,332,007 | 72,332,007 | 2 | true | 2022-05-21T17:22:21.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Instantiate generic interface that has generic property<p>I'm trying to refactor a very specific code to make it more generic, so we can expand the use case,... |
72,357,576 | cut command to remove seconds from time. shell scripting<p>Lets say we got date and time to a log in the format of</p>
<pre><code>2022-05-18-11:57:140100
</code></pre>
<p>I need to remove seconds from this time. It means the final output should be like</p>
<pre><code> 2022-05-18-11:57
</code></pre>
<p>I tried the follo... | <p><em><strong>1st solution:</strong></em> With GNU <code>awk</code> you can simply do it like following. Simple explanation would be, set <code>FS</code> and <code>OFS</code> as <code>:</code> and then in main block of <code>awk</code> program decrease <code>NF</code> with 1 and print the line.</p>
<pre><code>echo &qu... | cut command to remove seconds from time. shell scripting | linux|shell|awk|sed|cut | 0 | 70 | 3 | 72,357,590 | 72,357,590 | 2 | true | 2022-05-24T05:25:27.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cut command to remove seconds from time. shell scripting<p>Lets say we got date and time to a log in the format of</p>
<pre><code>2022-05-18-11:57:140100
</c... |
72,291,344 | Perform Memory Allocation To Store Data Obtained In Interrupt Handler<p>I am writing a program that uses PortAudio to get audio input from the computer into my program. PortAudio, in their <a href="http://www.portaudio.com/docs/v19-doxydocs/writing_a_callback.html" rel="nofollow noreferrer">Writing a Callback</a> tutor... | <p>Generally to avoid dynamically-allocated memory, we'll employ the use of various 'static containers.' Things like a <a href="https://en.wikipedia.org/wiki/Circular_buffer" rel="nofollow noreferrer">circular buffer</a> of pre-allocated and reserved data, or a blit buffer (two static buffers, where new data is added t... | Perform Memory Allocation To Store Data Obtained In Interrupt Handler | c++|dynamic-memory-allocation|interrupt|portaudio | 2 | 70 | 1 | 72,291,553 | 72,291,553 | 2 | true | 2022-05-18T14:45:06.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Perform Memory Allocation To Store Data Obtained In Interrupt Handler<p>I am writing a program that uses PortAudio to get audio input from the computer into ... |
72,262,825 | CORS Preflight Request: Must all Headers in `Access-Control-Request-Headers` be permitted for 2XX response?<p>I was writing an integration test leveraging v5.3.20 of Spring Framework's <a href="https://github.com/spring-projects/spring-framework/blob/v5.3.20/spring-web/src/main/java/org/springframework/web/cors/Default... | <p>If the <code>Access-Control-Allow-Headers</code> in the preflight response are a strict subset of the <code>Access-Control-Request-Headers</code> in the preflight request, the client will <em>not</em> make the subsequent request. This server behaviour is fine, it is up to the client to draw the correct conclusion.</... | CORS Preflight Request: Must all Headers in `Access-Control-Request-Headers` be permitted for 2XX response? | spring|cors | 0 | 70 | 1 | 72,262,940 | 72,262,940 | 2 | true | 2022-05-16T16:50:31.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CORS Preflight Request: Must all Headers in `Access-Control-Request-Headers` be permitted for 2XX response?<p>I was writing an integration test leveraging v5... |
72,264,026 | Linked List reversing and inserting new node to the reversed linked list<p>I'm learning DSA, and I was trying to implement the reverse operation of a linked list, but apparently the <code>create</code> method that I've written is not working after executing the <code>reversal</code> operation.</p>
<p>Here is the code:<... | <p>In your <code>reversal</code> method you should keep 3 temporary nodes:</p>
<ul>
<li>one to iterate the list (as you're doing).</li>
<li>one maintaining the head of the reversed list.</li>
<li>one to create a new node for the reversed list at each iteration of the list traversal.</li>
</ul>
<p>During each loop, the ... | Linked List reversing and inserting new node to the reversed linked list | java|data-structures|linked-list|reverse | 1 | 70 | 1 | 72,264,205 | 72,264,205 | 2 | true | 2022-05-16T18:34:05.307Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Linked List reversing and inserting new node to the reversed linked list<p>I'm learning DSA, and I was trying to implement the reverse operation of a linked ... |
72,378,913 | Having problems with functions in Pascal<p>Here is the code:</p>
<pre><code>Uses crt;
Type
mang = array[1..255] of Integer;
Var
N, X, Y : Integer;
A : mang;
Procedure Nhap(Var A : mang; Var N : Integer);
Var
i : Integer;
Begin
Clrscr;
Write('So luong phan tu: ');
Readln(N);
For i :... | <p>You have declared <code>KTMangTang</code> and <code>KTMangDX</code> as functions taking two parameters and returning a <code>BOOLEAN</code>. You have <em>called</em> them with <em>no</em> parameters. This doesn’t work. The errors in the compilation specifically tell you this.</p> | Having problems with functions in Pascal | boolean|pascal|freepascal | -1 | 70 | 1 | 72,379,230 | 72,379,230 | 2 | true | 2022-05-25T13:51:21.907Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Having problems with functions in Pascal<p>Here is the code:</p>
<pre><code>Uses crt;
Type
mang = array[1..255] of Integer;
Var
N, X, Y : Integer;
... |
72,335,021 | Linux How to take hostfile as an input from user and call it into script<p>I am using the below script for pinging the multiple Linux hosts which works perfectly fine if it put the <code>hostfile</code> by hardcoding into script itself but i want that to be on user input based.</p>
<p>While i am using <code>read</code>... | <p>As mentioned in the comment and also a good practice to use <code>while</code> over <code>for</code>, please refer for <a href="http://mywiki.wooledge.org/BashFAQ/001" rel="nofollow noreferrer">bash manual</a> here.</p>
<p>I just modified it with <code>while</code>, hopefully it should the Job for you!</p>
<pre><cod... | Linux How to take hostfile as an input from user and call it into script | linux|bash|user-input | 2 | 70 | 3 | 72,338,754 | 72,338,754 | 2 | true | 2022-05-22T05:31:32.293Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Linux How to take hostfile as an input from user and call it into script<p>I am using the below script for pinging the multiple Linux hosts which works perfe... |
72,262,906 | In Angular, how to display original data and filtered data on the same page?<p>Let's say I have some data from a service call, and I store it as <code>originalData</code>.</p>
<p>Now in addition, I must filter the data and also display that filtered data. The way I'm doing that is like this:</p>
<pre><code>this.service... | <h2>Transforming data</h2>
<p>You want to just transform the existing data. Here are two very simple examples on how to do that, both synchronously and asynchronously. Since usually the data from a service is async.</p>
<h3>Synchronous</h3>
<p>For synchronous data you can just use a function that takes your data as a p... | In Angular, how to display original data and filtered data on the same page? | angular | 1 | 70 | 1 | 72,263,393 | 72,263,393 | 2 | true | 2022-05-16T16:57:01.593Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In Angular, how to display original data and filtered data on the same page?<p>Let's say I have some data from a service call, and I store it as <code>origin... |
72,281,442 | How to implement Ruby's unpack in Rust?<p>I'm struggling to figure out how to implement the following <code>unpack('IIII')</code> Ruby statement in Rust.</p>
<pre class="lang-rb prettyprint-override"><code>require 'digest'
md5_digest_unpacked = Digest::MD5.digest(someString + "\x00").unpack('IIII')
</code></... | <p>As far as I know Rust does not have a drop-in replacement for unpack, but there are two ways to get equivalent behavior here.</p>
<h3>The Safe Way</h3>
<pre class="lang-rs prettyprint-override"><code>use std::mem;
use std::convert::TryInto;
let mut dest = [0u32; 4];
let mut iter = digest.0.chunks(mem::size_of::<... | How to implement Ruby's unpack in Rust? | rust | 0 | 70 | 1 | 72,281,674 | 72,281,674 | 2 | true | 2022-05-17T22:44:02.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to implement Ruby's unpack in Rust?<p>I'm struggling to figure out how to implement the following <code>unpack('IIII')</code> Ruby statement in Rust.</p>... |
72,310,792 | JsonConverter - WebApi - Case Sensitivity - Polymorphic<p>I'm using a JsonConverter to deal with a polymorphic collection:</p>
<pre><code>class ItemBatch
{
List<ItemBase> Items { get; set; }
}
// For type discrimination of ItemBase
class ItemTypes
{
public int Value { get; set; }
}
[JsonConverter(typeof... | <p>Newtonsoft was case insensitive.</p>
<p>With System.Text.Json you have to pull some more levers.</p>
<p><a href="https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to?pivots=dotnet-6-0#case-insensitive-deserialization" rel="nofollow noreferrer">https://docs.mi... | JsonConverter - WebApi - Case Sensitivity - Polymorphic | json|asp.net-web-api|blazor|system.text.json | 0 | 70 | 2 | 72,310,834 | 72,310,834 | 2 | true | 2022-05-19T20:36:07.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JsonConverter - WebApi - Case Sensitivity - Polymorphic<p>I'm using a JsonConverter to deal with a polymorphic collection:</p>
<pre><code>class ItemBatch
{
... |
72,249,686 | Construct an adjency matrix from a matrix that represents a graph with R<p>I have a matrix like this:</p>
<pre><code>
1 0 1 0 1 1
1 1 1 0 0 1
1 0 1 1 1 1
0 0 0 1 0 0
0 1 1 1 0 1
1 1 0 1 1 1
</code></pre>
<p>where the 1 represents a node and the 0 represents that there's no node, so for example from (1, 1) we can go to ... | <p>Create a data frame with one row per entry of the matrix and the corresponding row and column number and then subset that data frame down to the entries that are 1. (@Andrew Gustar deleted his post but that post shows that the row and col columns of d could also have been expressed as <code>d <- as.data.frame(wh... | Construct an adjency matrix from a matrix that represents a graph with R | r|graph | 2 | 70 | 2 | 72,250,061 | 72,250,061 | 2 | true | 2022-05-15T15:30:42.370Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Construct an adjency matrix from a matrix that represents a graph with R<p>I have a matrix like this:</p>
<pre><code>
1 0 1 0 1 1
1 1 1 0 0 1
1 0 1 1 1 1
0 0... |
72,321,979 | Replacing existing column in dask map_partitions gives SettingWithCopyWarning<p>I'm replacing column <code>id2</code> in a <code>dask</code> dataframe using <code>map_partitions</code>. The result is that the values are replaced but with a <code>pandas</code> warning.</p>
<p>What is this warning and how to apply the <c... | <p>A quick fix is to add copy of the dataframe:</p>
<pre class="lang-py prettyprint-override"><code>def func2(df):
df = df.copy() # will make a copy of the dataframe
df['id2'] = df['balance2'] + 1
return df
</code></pre>
<p>However, as I understand, copying of the dataframe is not required as the delayed na... | Replacing existing column in dask map_partitions gives SettingWithCopyWarning | python|pandas|dataframe|dask|dask-dataframe | 3 | 70 | 1 | 72,323,195 | 72,323,195 | 2 | true | 2022-05-20T16:18:58.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replacing existing column in dask map_partitions gives SettingWithCopyWarning<p>I'm replacing column <code>id2</code> in a <code>dask</code> dataframe using ... |
72,328,616 | Matplotlib save animaiton as video but get empty content<p>I am trying to make an animation with continue rotating an image, but the output video file has empty content(Only axis left), how to fix it?</p>
<pre class="lang-py prettyprint-override"><code>import math
import numpy as np
import matplotlib.pyplot as plt
fro... | <p>I applied some edits to your code:</p>
<ul>
<li>replaced <code>self.degree</code> with <code>i</code>: <code>i</code> increases by 1 in each iteration, no need for another counter</li>
<li>moved <code>ax.grid(False)</code> and <code>ax.axis(False)</code> (and added <code>ax.clear()</code>) within <code>__call__</cod... | Matplotlib save animaiton as video but get empty content | python|matplotlib|animation|video|visualization | 2 | 70 | 1 | 72,328,838 | 72,328,838 | 2 | true | 2022-05-21T10:13:24.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Matplotlib save animaiton as video but get empty content<p>I am trying to make an animation with continue rotating an image, but the output video file has em... |
72,238,260 | Difference between += and = 1+ in Java<p>Me and my friend have been working on a problem for school. We are traversing a graph with DFS and are counting the number of nodes in each given component. We get widely different results and have identified where the difference lies.</p>
<p>When going into the next recursion, ... | <pre><code> componentSize += DFS_visit(nextNodeToVisit);
</code></pre>
<p>means</p>
<pre><code> componentSize = componentSize + DFS_visit(nextNodeToVisit);
</code></pre>
<p>Compare that with</p>
<pre><code> componentSize = DFS_visit(nextNodeToVisit) + 1;
</code></pre>
<p>See the difference?</p>
<p>In general <code>a ... | Difference between += and = 1+ in Java | java|recursion|graph|syntax|depth-first-search | -1 | 70 | 1 | 72,238,313 | 72,238,313 | 3 | true | 2022-05-14T07:42:48.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Difference between += and = 1+ in Java<p>Me and my friend have been working on a problem for school. We are traversing a graph with DFS and are counting the ... |
72,263,502 | Filtering list violates open–closed principle<p>I wrote a method that filters list by parameters, it works pretty good. But I'm worried about <strong>violation of "<em>open–closed principle</em>"</strong>.</p>
<blockquote>
<p><strong>Open–closed principle</strong> states that "software entities (classes,... | <p>If you want the filtering logic to be extensible, you could create a base class for filter criteria:</p>
<pre><code>public abstract class FilterCriteria
{
IEnumerable<Meetings> Filter(IEnumerable<Meetings> meetings, string input);
}
</code></pre>
<p>For each criteria, you'd create a class that derives... | Filtering list violates open–closed principle | c#|linq|.net-core|design-patterns | 1 | 70 | 1 | 72,263,808 | 72,263,808 | 3 | true | 2022-05-16T17:48:22.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filtering list violates open–closed principle<p>I wrote a method that filters list by parameters, it works pretty good. But I'm worried about <strong>violati... |
72,293,741 | Create dictionary from 2 columns of Dataframe<p>I have a dataframe:</p>
<pre><code>df = pd.DataFrame({
'ID': ['1', '4', '4', '3', '3', '3'],
'club': ['arts', 'math', 'theatre', 'poetry', 'dance', 'cricket']
})
</code></pre>
<p>Note: Both the columns of the data frame can have repeated values.</p>
<p>I want to create ... | <p>Try <code>groupby()</code> and then <code>to_dict()</code>:</p>
<pre><code>grouped = df.groupby("ID")["club"].apply(set)
print(grouped)
> ID
1 {arts}
3 {cricket, poetry, dance}
4 {math, theatre}
grouped_dict = grouped.to_dict()
print(grouped_dict)
... | Create dictionary from 2 columns of Dataframe | python|pandas|dataframe|dictionary | 0 | 70 | 2 | 72,293,785 | 72,293,785 | 3 | true | 2022-05-18T17:42:55.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create dictionary from 2 columns of Dataframe<p>I have a dataframe:</p>
<pre><code>df = pd.DataFrame({
'ID': ['1', '4', '4', '3', '3', '3'],
'club': ['arts... |
72,338,050 | What is this ES6 syntax/style of function declaration called?<p>I tried looking at <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions" rel="nofollow noreferrer">MDN on arrow functions</a>, that links to an article <a href="https://hacks.mozilla.org/2015/06/es6-in-depth-... | <p>First of all, <code>takeStockForBowl</code> is really hard to read.</p>
<p>To understand what's happening here, we need to understand two things:</p>
<ul>
<li>Arrow functions</li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator" rel="nofollow noreferrer">Comma ... | What is this ES6 syntax/style of function declaration called? | javascript|ecmascript-6 | 0 | 70 | 1 | 72,338,120 | 72,338,120 | 3 | true | 2022-05-22T13:34:49.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is this ES6 syntax/style of function declaration called?<p>I tried looking at <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference... |
72,380,845 | Is there a way to rerun a python program from within the same program?<p>I'm making a mini python based game where if the game is lost I ask the user to 'rerun the program' to play the game again.</p>
<p>I'm trying to find a more elegant way to achieve this using code. Is there a way I can do this programmatically? It'... | <p>You can create a function of the game and run it, like this:</p>
<pre><code>def game():
print('GAME STUFF')
active = True
while active:
game()
restart = input("\n Do you want to restart the program? [y/n] > ")
if restart.lower() == "n":
active = False
</code></pre>
... | Is there a way to rerun a python program from within the same program? | python | 0 | 70 | 1 | 72,380,965 | 72,380,965 | 3 | true | 2022-05-25T15:56:45.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to rerun a python program from within the same program?<p>I'm making a mini python based game where if the game is lost I ask the user to 'rer... |
72,381,873 | How could i manipulate a list comprehension?<p>First time posting, sorry if I am doing something wrong or am unclear about my question</p>
<p>I'm pretty new to Haskell and I am having a hard time figuring out how could I manipulate a list comprehension to show me what I want. I have two functions that give me lists of ... | <p>This is e membership check, so you can implement this as:</p>
<pre><code>[ x `elem` list2 | x <- list1 ]
</code></pre>
<p>But simpler is probably to work with <a href="https://hackage.haskell.org/package/base-4.16.1.0/docs/Prelude.html#v:map" rel="noreferrer"><strong><code>map :: (a -> b) -> [a] -> [b]</... | How could i manipulate a list comprehension? | haskell|list-comprehension | 2 | 70 | 1 | 72,381,949 | 72,381,949 | 3 | true | 2022-05-25T17:20:58.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How could i manipulate a list comprehension?<p>First time posting, sorry if I am doing something wrong or am unclear about my question</p>
<p>I'm pretty new ... |
72,395,705 | c++: arithmetic operator overload<p>I have a class called <code>HealthPoints</code> that has <code>hp</code> and <code>max_hp</code> members. I want to overload the <code>+</code> operator so it will work like this:</p>
<pre class="lang-cpp prettyprint-override"><code>HealthPoints healthPoints1;
healthPoints1 -= 150; /... | <p>In this statement:</p>
<p><code>healthPoints2 = healthPoints1 + 160;</code></p>
<p>Your <code>+</code> operator is creating a new <code>HealthPoints</code> object that is a copy of <code>healthPoints1</code>, thus the object's <code>m_maxHP</code> is set to <code>100</code>. Then you are adding <code>160</code> to t... | c++: arithmetic operator overload | c++|c++11|operator-overloading | 1 | 70 | 2 | 72,397,515 | 72,397,515 | 4 | true | 2022-05-26T17:19:19.650Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
c++: arithmetic operator overload<p>I have a class called <code>HealthPoints</code> that has <code>hp</code> and <code>max_hp</code> members. I want to overl... |
72,361,092 | Passing parameter pack in constexpr<p>i am trying to determine the size of all passed objects at compile time and then abort the build process via static_assert when a maximum size is exceeded.</p>
<pre class="lang-cpp prettyprint-override"><code>#include <iostream>
template<class T>
class Test
{
public:
... | <p>Function arguments are not <code>constexpr</code> expressions (for good reasons) even if part of <code>constexpr</code> or <code>consteval</code> functions.</p>
<p>If you are willing to make <code>Test::size</code> static, independent of objects:</p>
<pre><code>#include <iostream>
template<class T>
clas... | Passing parameter pack in constexpr | c++|c++17|constexpr|parameter-pack | 6 | 70 | 1 | 72,361,743 | 72,361,743 | 4 | true | 2022-05-24T10:13:12.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing parameter pack in constexpr<p>i am trying to determine the size of all passed objects at compile time and then abort the build process via static_ass... |
72,291,071 | How to make a data model change in a Flutter app in production?<p>I am developing my first mobile app with Flutter and I have a doubt.</p>
<p>Suppose the app receives a JSON like this:</p>
<pre><code>{
"_id": "123",
"name": "X",
}
</code></pre>
<p>To receive it and send it th... | <p>There are countless versioning ideas and frameworks out there, but the basics are:</p>
<ul>
<li>Update your data to the new model</li>
<li>Create a second end point that delivers the new data model to your app</li>
<li>Keep the old endpoint, reading from the new data structure, so old apps will still work!</li>
<li>... | How to make a data model change in a Flutter app in production? | json|flutter|model|production | 2 | 70 | 1 | 72,291,187 | 72,291,187 | 5 | true | 2022-05-18T14:28:18.247Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make a data model change in a Flutter app in production?<p>I am developing my first mobile app with Flutter and I have a doubt.</p>
<p>Suppose the app... |
72,245,076 | How to read from a .txt file into an array of objects<p>I have the following sample data in a .txt file</p>
<pre><code>111, Sybil, 21
112, Edith, 22
113, Mathew, 30
114, Mary, 25
</code></pre>
<p>the required output is</p>
<pre><code>[{"number":"111","name":"Sybil","age"... | <p>Not too sure about the requirements. If you just need to know how to get the values out, then use <code>String.split()</code> combined with <code>Scanner.nextLine()</code>.</p>
<p>Codes below:</p>
<pre><code> private void loadFile() throws FileNotFoundException, IOException {
File txt = new File("Users.t... | How to read from a .txt file into an array of objects | java|arrays | 1 | 70 | 3 | 72,245,166 | 72,245,166 | 5 | true | 2022-05-15T02:02:35.790Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to read from a .txt file into an array of objects<p>I have the following sample data in a .txt file</p>
<pre><code>111, Sybil, 21
112, Edith, 22
113, Mat... |
72,861,848 | how to change one button text color to red and rest of button text color to black after click in React<p>I'm having a question about how to change one button text color to red and rest of button text color to black at the same time after click in React. All buttons must be created within a map function. I created a san... | <p>selected index should be stored in parent component:</p>
<pre><code>// Parent component
export default function App() {
const [clickedIndex, setClickedIndex] = React.useState(null);
const fake = [1, 2, 3, 4, 5];
const click = (index) => {
console.log("clicked " + index);
setClickedIndex(i... | how to change one button text color to red and rest of button text color to black after click in React | reactjs|react-native | 1 | 70 | 2 | 72,861,953 | 72,861,953 | 1 | true | 2022-07-04T20:42:50.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to change one button text color to red and rest of button text color to black after click in React<p>I'm having a question about how to change one button... |
72,850,195 | Lists and lambda with 0<p>I am new in python. I want to give condition to 2 lists one of which might have zeros (x):</p>
<pre><code>b=[64989000.0,44560000.0,36546000.0,36616000.0,32730000.0,30790000.0, 33820000.0,34528000.0,34206000.0,34163000.0,28811000.0]
x=[5650000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0... | <p>The code works now. The problem was the memory was full and package not updating the code that is why no change was happening. So i restarted the system and it updated for changes.</p> | Lists and lambda with 0 | python|list | 1 | 70 | 1 | 72,894,975 | 72,894,975 | 1 | true | 2022-07-03T22:03:08.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Lists and lambda with 0<p>I am new in python. I want to give condition to 2 lists one of which might have zeros (x):</p>
<pre><code>b=[64989000.0,44560000.0,... |
72,933,317 | Why is my variable is unbound in one inner function but not the other?<p>In the code below, why does the first version of <code>say</code> work but the second version throws "local variable 'running_high' referenced before assignment"?</p>
<pre><code>def announce_highest(who, last_score=0, running_high=0):
... | <p>There's one key difference between your two solutions which is causing them to behave differently: In the second solution, you assign a value to <code>running_high</code> on the third line:</p>
<pre class="lang-py prettyprint-override"><code> def say(*scores):
gain = scores[who] - last_score
if g... | Why is my variable is unbound in one inner function but not the other? | python | 0 | 70 | 1 | 72,933,344 | 72,933,344 | 1 | true | 2022-07-11T03:06:07.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is my variable is unbound in one inner function but not the other?<p>In the code below, why does the first version of <code>say</code> work but the secon... |
72,850,548 | How to allow nullable boolean URI parameter?<p>I want to let users retrieve data in three ways:</p>
<ul>
<li>If <code>isEven = null</code> (default) then both even and odd numbers are returned.</li>
<li>If <code>isEven = true</code> then even numbers are returned.</li>
<li>If <code>isEven = false</code> then odd numbe... | <p>If you have do it via path you could:</p>
<pre><code>[Route("{isEven}")]
[HttpGet]
public IActionResult GetData(bool isEven) => DoGetData(isEven);
[HttpGet]
public IActionResult GetData() => DoGetData(isEven: null);
</code></pre>
<p>This gives you:</p>
<pre><code>.../api/Mathematics/GetData/true
...... | How to allow nullable boolean URI parameter? | c#|asp.net-core | 0 | 70 | 1 | 72,851,132 | 72,851,132 | 1 | true | 2022-07-03T23:25:16.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to allow nullable boolean URI parameter?<p>I want to let users retrieve data in three ways:</p>
<ul>
<li>If <code>isEven = null</code> (default) then bo... |
73,009,345 | Create a Customer User Defined function for replacing the missing rows using Mean Median Mode<p>I tried to create a custom user defined function in python for replacing the missing values in a dataset by using Mean value,Median Value and Mode Value. But I am unable to get the required Output.</p>
<p>Condition:</p>
<p>N... | <p>Hope this will help you,</p>
<pre><code>import pandas as pd
def conditional_impute(df,column_name,choice):
try:
if choice == 'mean':
mean_value = df[column_name].mean()
df[column_name].fillna(value=mean_value, inplace=True)
elif choice == 'median':
median_valu... | Create a Customer User Defined function for replacing the missing rows using Mean Median Mode | python|python-3.x|dataframe|user-defined-functions | 0 | 70 | 1 | 73,012,211 | 73,012,211 | 1 | true | 2022-07-17T04:56:16.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create a Customer User Defined function for replacing the missing rows using Mean Median Mode<p>I tried to create a custom user defined function in python fo... |
72,947,333 | apache poi read excel from rows<p>My Entity class</p>
<pre><code>@Data
@Entity
@Table(name = "rates")
public class ExchangeRate {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@OneToOne
@JsonIgnore
private LocalCurrency loc... | <p>LocalCurrency (This may be differ, modify as per your requirement)</p>
<pre><code>public class LocalCurrency {
String currency;
@Override
public String toString() {
return String.format("{LocalCurrency: {currency: %s}}", currency);
}
}
</code></pre>
<p>ExchangeRate</p>
<pre><code>p... | apache poi read excel from rows | java|excel|spring|spring-boot | 0 | 70 | 1 | 72,976,724 | 72,976,724 | 1 | true | 2022-07-12T05:15:58.617Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
apache poi read excel from rows<p>My Entity class</p>
<pre><code>@Data
@Entity
@Table(name = "rates")
public class ExchangeRate {
@Id
@Gene... |
72,786,519 | How to get StrikeThrough on a String ? Not a TextView, EditText or a View. But like String a = "my text" and then pass it to SQLite as a String<p>I have this method which works fine for an EditText or a view.</p>
<pre><code>public SpannableString strikeThrough(String txt){
SpannableString spannableString = new Spa... | <p>Instead of storing a strike-through string inside the array, Create a <code>class</code> having two members a <code>String</code> and a <code>boolean</code>, and make the boolean <code>true</code> for the string you want to strike through.</p>
<pre class="lang-java prettyprint-override"><code>class Message {
pri... | How to get StrikeThrough on a String ? Not a TextView, EditText or a View. But like String a = "my text" and then pass it to SQLite as a String | java|android | 0 | 70 | 2 | 72,787,069 | 72,787,069 | 1 | true | 2022-06-28T12:34:03.683Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get StrikeThrough on a String ? Not a TextView, EditText or a View. But like String a = "my text" and then pass it to SQLite as a String<p>I have this... |
72,805,581 | Maintaining react state with a hierarchical object using react hooks (add or update)<p>I have an a state object in React that looks something like this (book/chapter/section/item):</p>
<pre><code> const book = {
id: "123",
name: "book1",
chapters: [
{
id: "123"... | <p>for adding new Section</p>
<pre><code>setSelectedBook( book =>{
let selectedChapter = book.chapters.find(ch => ch.id === selectedChapterId )
selectedChapter.sections=[...selectedChapter.sections, newSection ]
return {...book}
})
</code></pre>
<p>For updating a section's name</p>
<pre><code>setSele... | Maintaining react state with a hierarchical object using react hooks (add or update) | javascript|reactjs|use-state | 0 | 70 | 3 | 72,805,960 | 72,805,960 | 1 | true | 2022-06-29T17:28:21.440Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Maintaining react state with a hierarchical object using react hooks (add or update)<p>I have an a state object in React that looks something like this (book... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.