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,922,139 | Use JcaPEMWriter to export PEM file?<p>I am trying to figure out how to export private key from the <code>X509Certificate</code> instance as a PEM string encoded.</p>
<p>What I have done to far is to export certificate as PEM encoded:</p>
<pre><code>import org.bouncycastle.jce.provider.BouncyCastleProvider
import org.b... | <p>Just pass your private key to the <code>JcaPEMWriter::writeObject</code> :</p>
<pre><code>JcaPEMWriter(sw).use {
w -> w.writeObject(keyPair.private)
}
println(sw.toString())
</code></pre>
<p>which gives :</p>
<pre><code>-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIK2XWix+f1aRSh7sH4NSYQeCBsCfOBjFATKiJLnD4UPdoAoGC... | Use JcaPEMWriter to export PEM file? | java|kotlin|x509certificate|x509 | 0 | 56 | 1 | 72,922,737 | 72,922,737 | 1 | true | 2022-07-09T14:23:27.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use JcaPEMWriter to export PEM file?<p>I am trying to figure out how to export private key from the <code>X509Certificate</code> instance as a PEM string enc... |
72,924,466 | orderby with multiple data received from query in flutter firestore<p>i have 2 collections .
first collection:
Categories - with the field 'position' and the field 'name'
for example:</p>
<ul>
<li>pos: 1 ----- name: vegetables</li>
<li>pos: 2 ----- name: fruits</li>
</ul>
<p>The other collection are my products with in... | <p>There's no specific API that allows this type of query, so your options are:</p>
<ol>
<li>Retrieve the results one by one (or in batches of up to 10 using an <code>IN</code> query on the document ID) and then re-order them in your application code.</li>
<li>Retrieve the results one by one in the right order already.... | orderby with multiple data received from query in flutter firestore | android|flutter|google-cloud-firestore | 0 | 56 | 1 | 72,924,723 | 72,924,723 | 1 | true | 2022-07-09T20:36:02.560Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
orderby with multiple data received from query in flutter firestore<p>i have 2 collections .
first collection:
Categories - with the field 'position' and the... |
72,926,876 | Pymunk change color of the shape on collision<p>I am using pymunk for my pinball game.
I am using four circle shapes, three as a bumper and one as a ball.</p>
<p>I need to change color of the shape that has collided with the ball.</p>
<p><a href="https://i.stack.imgur.com/EYDtw.png" rel="nofollow noreferrer"><img src="... | <p>The second argument in the collision handler callback is the arbiter. The <a href="http://www.pymunk.org/en/latest/pymunk.html#pymunk.Arbiter" rel="nofollow noreferrer"><code>pymunk.Arbiter</code></a> object encapsulates a pair of colliding shapes. With <a href="http://www.pymunk.org/en/latest/pymunk.html#pymunk.Arb... | Pymunk change color of the shape on collision | python|pygame|simulation|collision-detection|pymunk | -1 | 56 | 1 | 72,926,939 | 72,926,939 | 1 | true | 2022-07-10T07:37:49.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pymunk change color of the shape on collision<p>I am using pymunk for my pinball game.
I am using four circle shapes, three as a bumper and one as a ball.</p... |
72,930,375 | Webscraping challenges in Python<p>I am trying to webscrape this <a href="https://www.bis.org/cbspeeches/index.htm?m=1123" rel="nofollow noreferrer">link</a> in Python. The ideal output is a dataframe with 4 columns: date, author, title and text. So far, I got down to author, title and date in the following way:</p>
<p... | <p>You are close to your goal, simply handle the requests to the texts in your for loop:</p>
<pre><code>for card in soup.select('.documentList tbody tr'):
r = BeautifulSoup(requests.get(f"https://www.bis.org{card.a.get('href')}").content)
data.append({
'date': card.select_one('.item_date').get... | Webscraping challenges in Python | python|web-scraping|beautifulsoup | 1 | 56 | 2 | 72,930,464 | 72,930,464 | 1 | true | 2022-07-10T17:06:04.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Webscraping challenges in Python<p>I am trying to webscrape this <a href="https://www.bis.org/cbspeeches/index.htm?m=1123" rel="nofollow noreferrer">link</a>... |
72,936,231 | Behavior of Dataset.map in Tensorflow<p>I'm trying to take variable length tensors and split them up into tensors of length 4, discarding any extra elements (if the length is not divisible by four).</p>
<p>I've therefore written the following function:</p>
<pre><code>def batches_of_four(tokens):
token_length = tokens... | <p>You should use <code>tf.shape</code> to get the dynamic shape of a tensor in <code>graph</code> mode:</p>
<pre><code>token_length = tf.shape(tokens)[0]
</code></pre>
<p>And another problem you have is using a scalar tensor as the number of splits in <code>graph</code> mode. That won't work either.</p>
<p>Try this:</... | Behavior of Dataset.map in Tensorflow | python|tensorflow|tensor|tensorflow-datasets | 1 | 56 | 1 | 72,937,310 | 72,937,310 | 1 | true | 2022-07-11T09:19:46.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Behavior of Dataset.map in Tensorflow<p>I'm trying to take variable length tensors and split them up into tensors of length 4, discarding any extra elements ... |
72,925,873 | What can be done if we want to update a record locked by other program or application in RPGLE<p>Suppose I want to update a record , but that record is being locked by some other application or program , what can be done to make sure that I can update that record in the next iteration?</p> | <p>If this program was running in batch and it was critical that the record in question gets updated, you could use the (E) extender on your Chain and monitor for the %Error. Something like this:</p>
<pre><code>// This record MUST be updated
Dou %Error = *Off;
Chain(E) (FileKey) CriticalFile
Enddo;
// At this point,... | What can be done if we want to update a record locked by other program or application in RPGLE | ibm-midrange|rpgle|rpg | 1 | 56 | 3 | 72,941,689 | 72,941,689 | 1 | true | 2022-07-10T02:56:55.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What can be done if we want to update a record locked by other program or application in RPGLE<p>Suppose I want to update a record , but that record is being... |
72,937,144 | Latex2exp (TeX command) affects label alignment in ggplot?<p>A geom_boxplot that has x-axis labels with linebreaks ("\n") works great.</p>
<pre><code>library(ggplot2)
library(latex2exp)
theme_set(theme_grey())
set.seed(10)
df <- data.frame(y=rnorm(120),
x=rep(c("bar",
... | <p>You can obtain that plot using html or markdown math expression along with functions from <code>ggtext</code> package.</p>
<pre class="lang-r prettyprint-override"><code>library(ggplot2)
library(ggtext)
set.seed(10)
df <- data.frame(
y = rnorm(120),
x = rep(
c(
"bar",
... | Latex2exp (TeX command) affects label alignment in ggplot? | r|ggplot2|latex2exp | 1 | 56 | 1 | 72,942,626 | 72,942,626 | 1 | true | 2022-07-11T10:30:11.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Latex2exp (TeX command) affects label alignment in ggplot?<p>A geom_boxplot that has x-axis labels with linebreaks ("\n") works great.</p>
<pre><co... |
72,952,190 | Extract all values as one column of a raster?<p>If I have this stack with three layers.</p>
<pre><code> library(terra)
y <- rast(ncol=10, nrow=10, nlyr=3, vals=rep(1:3, each=100))
</code></pre>
<p>I would like to extract the values in one column as follows:</p>
<pre><code> pixels 1 from lyr.1
pixels 1 fr... | <p>You can convert the SpatRaster to a data frame with the cell index and then manipulate it (e.g. with <code>tidyverse</code>) to suit your needs:</p>
<pre class="lang-r prettyprint-override"><code>library(terra)
#> terra 1.5.34
y <- rast(ncol=10, nrow=10, nlyr=3, vals=rep(1:3, each=100))
df <- as.data.fra... | Extract all values as one column of a raster? | r|raster | 0 | 56 | 2 | 72,952,457 | 72,952,457 | 1 | true | 2022-07-12T12:17:54.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Extract all values as one column of a raster?<p>If I have this stack with three layers.</p>
<pre><code> library(terra)
y <- rast(ncol=10, nrow=... |
72,956,856 | How to use focus() on QButton (<q-btn>)?<p>I have a form developed in Quasar + Vue 3, and would like to programmatically set focus on the Submit button so that the user can press ENTER to submit.</p>
<pre class="lang-js prettyprint-override"><code><q-btn ref="btn" />
</code></pre>
<p>I thought using ref... | <p>Retrieve the native DOM element by using <code>$el</code> and set <code>focus()</code> on that:</p>
<pre class="lang-js prettyprint-override"><code>this.$refs.btn.$el.focus()
</code></pre>
<p>Some Quasar component have built-in focus() methods, like QInput and QSelect, but QButton does not.</p>
<p>However, since the... | How to use focus() on QButton (<q-btn>)? | vuejs3|quasar-framework | 0 | 56 | 1 | 72,956,857 | 72,956,857 | 1 | true | 2022-07-12T18:27:33.400Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use focus() on QButton (<q-btn>)?<p>I have a form developed in Quasar + Vue 3, and would like to programmatically set focus on the Submit button so th... |
72,961,624 | How to call nested function independently in Python script<p>In the below Python code, I am trying to call the nested function (at step2) independently but getting an error. Condition is step1 should execute before step2, this is to ensure that c1 gets the same value of p1</p>
<pre><code>import datetime
def neighbor()... | <p>The nested function is only available to the function in whose scope you defined it, just like if you declare a local variable inside a function (and indeed, a function is really just a variable whose value is a "callable").</p>
<p>One way to enforce this is to put the definitions in a class.</p>
<pre><cod... | How to call nested function independently in Python script | python|python-3.x|function|python-3.8 | 0 | 56 | 1 | 72,961,699 | 72,961,699 | 1 | true | 2022-07-13T06:06:03.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to call nested function independently in Python script<p>In the below Python code, I am trying to call the nested function (at step2) independently but g... |
72,961,486 | Limit traffic without scaling out in Azure?<p>Im looking into to use a Load Balancer in front of our API management, for example if a 1000 requests coming in in 5 second i want the 1001th request to be denied.</p>
<p>Which solution would work in this case?</p> | <p>API Management you can use <a href="https://docs.microsoft.com/en-us/azure/api-management/api-management-access-restriction-policies#LimitCallRateByKey" rel="nofollow noreferrer">Rate Limit policies</a>:</p>
<blockquote>
<p>The rate-limit-by-key policy prevents API usage spikes on a per key basis by limiting the cal... | Limit traffic without scaling out in Azure? | azure|load|load-balancing|azure-traffic-manager | 1 | 56 | 1 | 72,962,321 | 72,962,321 | 1 | true | 2022-07-13T05:49:20.983Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Limit traffic without scaling out in Azure?<p>Im looking into to use a Load Balancer in front of our API management, for example if a 1000 requests coming in... |
72,964,311 | getInitialProps function in document.js run on server or client?<p><code>getInitialProps</code> function run just in servser or client or both ?</p>
<pre><code>
class MyDocument extends Document {
static async getInitialProps(ctx: DocumentContext) {
const initialProps = await Document.getInitialProps(ctx);
c... | <p><a href="https://github.com/vercel/next.js/discussions/11211#discussioncomment-1692" rel="nofollow noreferrer">https://github.com/vercel/next.js/discussions/11211#discussioncomment-1692</a></p>
<blockquote>
<p>If I use getInitialProps will the list of books be outdated to what
was the list at the time I ran npm run ... | getInitialProps function in document.js run on server or client? | reactjs|next.js | 0 | 56 | 1 | 72,964,375 | 72,964,375 | 1 | true | 2022-07-13T09:54:33.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
getInitialProps function in document.js run on server or client?<p><code>getInitialProps</code> function run just in servser or client or both ?</p>
<pre><co... |
72,969,956 | python in Visual Studio Code - how to print funky stuff<p>I have been testing printing colors and characters in VS Code (version 1.69) using python 3.+. To print colored text in VS code you would use:</p>
<pre><code>print("\033[31mThis is red font.\033[0m")
print("\033[32mThis is green font.\033[0m"... | <p>The first example is showing ansi escape sequences, the second example is using a common convention in many languages, including Python, to include non-standard characters in a string by escaping their character value, but in your example, you may not be realising that you're escaping <em>octal</em> values, instead ... | python in Visual Studio Code - how to print funky stuff | python|visual-studio-code | 1 | 56 | 1 | 72,973,559 | 72,973,559 | 1 | true | 2022-07-13T16:55:45.323Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
python in Visual Studio Code - how to print funky stuff<p>I have been testing printing colors and characters in VS Code (version 1.69) using python 3.+. To p... |
72,979,002 | foreach data to array laravel<p>I get the problem when I try looping the data to store in variable for making the pie chart on Laravel</p>
<p><strong>this is my code in controller</strong></p>
<pre><code>// $countUser = DB::select(DB::raw("
// SELECT r.name AS name, count(u.id) AS countUser
// ... | <p>In your example you keep overwriting <code>$data</code>, instead lets use Laravel Collection methods to help you.</p>
<p>Map all your entries to the format <code>[$name, $count]</code>. Then use the Collection method <code>implode()</code>, to join the strings with a comma.</p>
<pre><code>$concatenatedUsers = $count... | foreach data to array laravel | php|mysql|laravel | -2 | 56 | 1 | 72,979,130 | 72,979,130 | 1 | true | 2022-07-14T10:23:57.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
foreach data to array laravel<p>I get the problem when I try looping the data to store in variable for making the pie chart on Laravel</p>
<p><strong>this is... |
72,981,200 | App Bar not filling the top of the page MUI MATERIAL<p>I am using MUI MATERIAL.</p>
<p>I got an
<a href="https://i.stack.imgur.com/oxqkz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oxqkz.png" alt="AppBar" /></a>
It has a padding on the top,right,left of the page.</p>
<p>I want the App Bar to be a... | <p>You can add <a href="https://mui.com/material-ui/react-css-baseline" rel="nofollow noreferrer">CssBaseline</a> at the top level of your app to get rid of the space around the <code>AppBar</code> component. It will apply style rules from <a href="https://github.com/necolas/normalize.css" rel="nofollow noreferrer">no... | App Bar not filling the top of the page MUI MATERIAL | reactjs|material-ui|styles | 0 | 56 | 1 | 72,981,736 | 72,981,736 | 1 | true | 2022-07-14T13:19:19.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
App Bar not filling the top of the page MUI MATERIAL<p>I am using MUI MATERIAL.</p>
<p>I got an
<a href="https://i.stack.imgur.com/oxqkz.png" rel="nofollow n... |
72,981,565 | EF.Functions.Like() for an array of string<p>I want to filter the <code>IQueryable<T></code> with the help of <code>EF.Functions.Like()</code> method, which accepts a string parameter, to make use of array of strings. Also, I want this filter to be applied on an <code>IQueryable</code> and not on a List.</p>
<pre... | <p>Try the following query:</p>
<pre class="lang-cs prettyprint-override"><code>var configurations = _dbContext.Configurations
.Include(x => x.ChildTable)
.Where(x => x.Id == Id);
if (!string.IsNullOrEmpty(request.Filter))
{
configurations = configurations
.Where(x => x.ChildTable.Any(c =&... | EF.Functions.Like() for an array of string | entity-framework-core | 0 | 56 | 1 | 72,981,843 | 72,981,843 | 1 | true | 2022-07-14T13:44:27.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
EF.Functions.Like() for an array of string<p>I want to filter the <code>IQueryable<T></code> with the help of <code>EF.Functions.Like()</code> method, ... |
72,987,894 | How can I solve that type of issue when I compile using `javac`: " error: cannot find symbol [...]"?<p>For starters, I have to say that I am using <strong>IntelliJ IDEA Community Edition 2020.3.1</strong> and running <strong>java 15.0.1 2020-10-20</strong>, also when I run my program after enabling assertions and click... | <p>After reading many answers, I found that the solution was simple.</p>
<p>First compiling TestRunner.java:</p>
<p><code>javac -cp . TestRunner.java</code></p>
<p>Then running TestRunner (containing my <strong>main</strong> function):</p>
<p><code>java -cp . -ea TestRunner</code></p>
<p>It turns out I was missing on t... | How can I solve that type of issue when I compile using `javac`: " error: cannot find symbol [...]"? | java|class|javac | -1 | 56 | 1 | 72,988,743 | 72,988,743 | 1 | true | 2022-07-15T00:26:18.773Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I solve that type of issue when I compile using `javac`: " error: cannot find symbol [...]"?<p>For starters, I have to say that I am using <strong>In... |
72,992,102 | I want to sort only odd numbers in an array in ascending order and leaving even numbers at their orignal place in java<p><a href="https://i.stack.imgur.com/JEPYF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JEPYF.png" alt="enter image description here" /></a></p>
<p>Below is the code in image wher... | <p>The key aspect you need to consider is that to ignore even numbers in array and apply your sorting algorithm at odd numbers only.
Here's the implementing using bubble sort:</p>
<pre><code>public static void main(String[] args) {
int[] a = {5, 8, 6, 3, 4};
int i, j, n=a.length;
for(i=0; i < n; i++... | I want to sort only odd numbers in an array in ascending order and leaving even numbers at their orignal place in java | java|arrays|sorting | -3 | 56 | 1 | 72,992,429 | 72,992,429 | 1 | true | 2022-07-15T09:46:12.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I want to sort only odd numbers in an array in ascending order and leaving even numbers at their orignal place in java<p><a href="https://i.stack.imgur.com/J... |
72,807,280 | Intel HD Graphics violates OpenCL specification regarding SVM?<p>I am trying to allocate several SVM buffers and pass them to an OpenCL kernel using the following method. The kernel is run on Intel HD Graphics 530 and NVIDIA GTX 950M. I get different results on these GPUs, and I am not sure which behavior is correct (m... | <p>Intel works correctly and adheres to the specification. NVIDIA is more fool-proof, however.</p>
<p>To fix the problem in question, one needs to not forget to pass an array of SVM buffers to a kernel:</p>
<pre><code>ret = clSetKernelExecInfo(kernel, CL_KERNEL_EXEC_INFO_SVM_PTRS, sizeof(svm_buffers), svm_buffers);
</c... | Intel HD Graphics violates OpenCL specification regarding SVM? | pointers|opencl|svm|nvidia|intel | 2 | 56 | 1 | 72,996,267 | 72,996,267 | 1 | true | 2022-06-29T20:10:55.257Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Intel HD Graphics violates OpenCL specification regarding SVM?<p>I am trying to allocate several SVM buffers and pass them to an OpenCL kernel using the foll... |
72,995,702 | How to re-use the calling result of a java collection's stream, so we don't do same work twice?<p>I know that once a Collection's stream actions of <code>collect</code>/<code>forEach</code>/<code>min</code>/<code>max</code>, the stream is closed and no longer valid for further function call.</p>
<p>My question is, how ... | <ol>
<li><p>You should distinct() before sorting() to avoid to sort double values which you throw away anyway.</p>
</li>
<li><p>You could save your processed values in a collecten of your choice. I would recommend you a List (keep in mind that this List is unmodifiable) and if you need to work with streams from there, ... | How to re-use the calling result of a java collection's stream, so we don't do same work twice? | java|duplicates|java-stream | 0 | 56 | 2 | 72,997,957 | 72,997,957 | 1 | true | 2022-07-15T14:39:52.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to re-use the calling result of a java collection's stream, so we don't do same work twice?<p>I know that once a Collection's stream actions of <code>col... |
72,997,637 | Trouble opening dataframe with OOP<p>I am new at OOP and I am stuck. I am trying to read in an excel file from the user and output the dataframe. My code does not give any errors but it also doesn't output anything. What am I doing wrong here?</p>
<pre><code>class openSheet():
def openFile(self, filepath):
... | <p>Try this, since you are taking path as input so don't need to pass it while calling. 'data' is the required output, hope this will help</p>
<pre><code>class openSheet:
def openFile(self):
filepath = input("Please enter a valid file path to a xls: ")
while not os.path.isfile(filepath):
... | Trouble opening dataframe with OOP | python|pandas|oop | 0 | 56 | 3 | 72,998,196 | 72,998,196 | 1 | true | 2022-07-15T17:19:43.057Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trouble opening dataframe with OOP<p>I am new at OOP and I am stuck. I am trying to read in an excel file from the user and output the dataframe. My code doe... |
73,000,778 | Get object type without template parameters<p>I need to be able to have any object that takes a single bool as a template parameter, and obtain the type of that object without the bool, so I can then create a similarly typed object but of a different bool.</p>
<p>This is what I came up with, but it does not compile. ... | <p>A little ugly, but this works:</p>
<pre><code>template<bool NewBool, template<bool> typename ClassName, bool TheBool>
ClassName<NewBool> FT(const ClassName<TheBool>&);
template<bool X>
struct T {};
int main() {
T<true> t;
decltype(FT<false>(t)) f;
}
</code></pr... | Get object type without template parameters | c++|templates | 2 | 56 | 2 | 73,000,861 | 73,000,861 | 1 | true | 2022-07-16T00:43:20.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get object type without template parameters<p>I need to be able to have any object that takes a single bool as a template parameter, and obtain the type of t... |
73,006,989 | JS merge Array of the Maps to a single Map<p>I have a structure of</p>
<pre><code>Array(4) [Map(1),Map(1),Map(1),Map(1)]
</code></pre>
<p>All keys are different there.
I am trying find the common way to merge it in one Map.</p>
<p>I know the way for two Maps:</p>
<pre><code>let merged = new Map([...first, ...second])
<... | <p>You are looking for <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap" rel="nofollow noreferrer">flatMap</a>:</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 merge Array of the Maps to a single Map | javascript|node.js|dictionary | 0 | 56 | 3 | 73,007,043 | 73,007,043 | 1 | true | 2022-07-16T19:11:18.487Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JS merge Array of the Maps to a single Map<p>I have a structure of</p>
<pre><code>Array(4) [Map(1),Map(1),Map(1),Map(1)]
</code></pre>
<p>All keys are differ... |
73,004,458 | React Router with dynamic path and dynamic component<p>I'm building the app with hierarchical structure and ability to set any slug url the user wants by the admin panel. For example, if the top page has url <code>news</code> and the page inside has url <code>new_telescope</code>, the whole url would be <code>/news/ne... | <h1>Issue</h1>
<ol>
<li>The <code>getRoute</code> function doesn't return anything. Sure, the Promise chain started from <code>adminRequest</code> returns some JSX, but that resolved value isn't returned by the other function.</li>
<li>React render functions are 100% synchronous functions. You can't call an asynchronou... | React Router with dynamic path and dynamic component | reactjs|react-router-dom | 1 | 56 | 1 | 73,008,214 | 73,008,214 | 1 | true | 2022-07-16T13:04:33.243Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React Router with dynamic path and dynamic component<p>I'm building the app with hierarchical structure and ability to set any slug url the user wants by th... |
73,019,025 | My MySQL Stored Procedure have an error in line: cmd.ExecuteNonQuery()<ol>
<li>I have here my stored procedure "sp_ProductAdjustment"</li>
</ol>
<pre><code>CREATE PROCEDURE sp_ProductAdjustment
(IN `_product_code` varchar(35), IN `_adjusted_qty` int,
IN `_stock_in_out` char(3), IN `_status` varchar(10))
BEG... | <p>i'm just trying anything until i got the correct solution for calling a Stored Procedure.
here's my cents of advice:</p>
<pre><code>cmd.Connection = conn;
cmd.CommandText = "call sp_ProductAdjustment(@product_code, @adjusted_qty, @stock_in_out, @status)";
cmd.CommandType = CommandType.Text;
cmd.Parameters... | My MySQL Stored Procedure have an error in line: cmd.ExecuteNonQuery() | c#|mysql|stored-procedures | 0 | 56 | 1 | 73,019,394 | 73,019,394 | 1 | true | 2022-07-18T07:58:59.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
My MySQL Stored Procedure have an error in line: cmd.ExecuteNonQuery()<ol>
<li>I have here my stored procedure "sp_ProductAdjustment"</li>
</ol>
<p... |
73,029,621 | Add a source directory to a Makefile<p>I have the following makefile:</p>
<pre><code>CPP_COMPILER = g++
CPP_COMPILER_FLAGS = -g -O0 -Wall -Wextra -Wpedantic -Wconversion -std=c++17
EXECUTABLE_NAME = mainDebug
CPP_COMPILER_CALL = $(CPP_COMPILER) $(CPP_COMPILER_FLAGS)
INCLUDE_DIR = include
SOURCE_DIR = src1
BUILD_DIR =... | <p>Look at how you use <code>SOURCE_DIR</code>:</p>
<pre><code>SOURCE_DIR = src1
...
CPP_SOURCES = $(wildcard $(SOURCE_DIR)/*.cpp)
CPP_OBJECTS = $(patsubst $(SOURCE_DIR)/%.cpp, $(BUILD_DIR)/%.o, $(CPP_SOURCES))
...
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cpp
$(CPP_COMPILER_CALL) -I $(INCLUDE_DIR) -c $< -o $@
</code></... | Add a source directory to a Makefile | c++|makefile | 0 | 56 | 1 | 73,029,739 | 73,029,739 | 1 | true | 2022-07-18T23:30:24.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add a source directory to a Makefile<p>I have the following makefile:</p>
<pre><code>CPP_COMPILER = g++
CPP_COMPILER_FLAGS = -g -O0 -Wall -Wextra -Wpedantic ... |
73,030,393 | Update column based on grouped date values<p>Edited/reposted with correct sample output.</p>
<p>I have a dataframe that looks like the following:</p>
<pre><code>
data = {
"ID": [1, 1, 1, 2, 2, 2],
"Year": [2021, 2021, 2023, 2015, 2017, 2018],
"Combined": ['started', 'finished', 'st... | <p>This uses temporary columns, and avoids the apply path which can be generally slow:</p>
<pre class="lang-py prettyprint-override"><code># identify the start rows that have a True value
start_true = df.Combined.eq('started') & df['bool']
# identify rows where Combined is finished
condition = df.Combined.eq('fini... | Update column based on grouped date values | python|pandas|dataframe|numpy | 2 | 56 | 2 | 73,031,321 | 73,031,321 | 1 | true | 2022-07-19T02:12:34.123Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Update column based on grouped date values<p>Edited/reposted with correct sample output.</p>
<p>I have a dataframe that looks like the following:</p>
<pre><c... |
72,299,700 | long-running python program ram usage<p>I am currently working on a project where a python program is supposed to be running for several days, essentially in an endless loop until an user intervenes.
I have observed that the ram usage (as shown in the windows task manager) rises - slowly, but steadily. For example from... | <p>Okay, turns out the answer is: no, this is not proper behaviour, the ram usage can stay absolutely stable. I have tested this for three weeks now and the ram usage never exceeded 80 mb.
The problem was in the usage of the influxdb v2 client.
You need to close both the write_api (implicitly done with the "with..... | long-running python program ram usage | python|memory|tracemalloc | 0 | 56 | 1 | 73,104,684 | 73,104,684 | 1 | true | 2022-05-19T06:35:59.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
long-running python program ram usage<p>I am currently working on a project where a python program is supposed to be running for several days, essentially in... |
73,001,779 | gca is limited to a single scope<p>S/w : Octave v7.1.0</p>
<h3>Background:</h3>
<ul>
<li>I picked the code example given at 15.2.4 <a href="https://docs.octave.org/v7.1.0/Multiple-Plots-on-One-Page.html" rel="nofollow noreferrer">docs.octave/.../Multiple-Plots</a> and modified it to use multiple figures</li>
</ul>
<ul>... | <ol>
<li><p><code>legend</code>, <code>plot</code> and other axis related functions do their function in current axis of current figure unless you tell them otherwise. When you create figure windows before plotting, the last axis in your last figure is your current axis. So if you want to do plotting or show legend in ... | gca is limited to a single scope | scope|octave|legend | 0 | 56 | 1 | 73,115,033 | 73,115,033 | 1 | true | 2022-07-16T05:33:41.437Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
gca is limited to a single scope<p>S/w : Octave v7.1.0</p>
<h3>Background:</h3>
<ul>
<li>I picked the code example given at 15.2.4 <a href="https://docs.octa... |
72,850,921 | go assertion utility functions behave like non-blocking operation<p><a href="https://i.stack.imgur.com/3uWny.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3uWny.png" alt="enter image description here" /></a>
I expected that each assertion is a blocking operation and test would stop at a point as so... | <p>Assuming you're talking about the <code>assert</code> functions in stretchr/testify (<a href="https://pkg.go.dev/github.com/stretchr/testify/assert" rel="nofollow noreferrer">https://pkg.go.dev/github.com/stretchr/testify/assert</a>), note that <code>assert.True</code> simply verifies whether something is true and i... | go assertion utility functions behave like non-blocking operation | go|testing|assert|go-testing | 0 | 56 | 2 | 72,851,035 | 72,851,035 | 1 | true | 2022-07-04T01:13:43.640Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
go assertion utility functions behave like non-blocking operation<p><a href="https://i.stack.imgur.com/3uWny.png" rel="nofollow noreferrer"><img src="https:/... |
72,988,652 | Keras Model Subclassing TypeError: '<' not supported between instances of 'NoneType' and 'int'<p>I'm working on a project using Keras Model Subclassing in order to create a model with 2 inputs and 2 outputs. The training data for this model is essentially a dataset of other image classification datasets, with each imag... | <p>You cannot feed <code>tf.data.Datasets</code> directly to <code>keras</code> layers. Try this:</p>
<pre><code>dataset1 = tf.data.Dataset.from_tensor_slices((tf.random.uniform((5, 100, 224, 224, 1)))).batch(1)
dataset2 = tf.data.Dataset.from_tensor_slices((tf.random.uniform((5, 100, 2, 95)))).batch(1)
structuremodel... | Keras Model Subclassing TypeError: '<' not supported between instances of 'NoneType' and 'int' | python|tensorflow|image-processing|keras|tensor | 1 | 56 | 1 | 72,989,652 | 72,989,652 | 1 | true | 2022-07-15T03:05:57.463Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Keras Model Subclassing TypeError: '<' not supported between instances of 'NoneType' and 'int'<p>I'm working on a project using Keras Model Subclassing in or... |
72,826,538 | binding reference of type const node*& to node*const<p>I am trying to implement a generic tree and in the function <code>getSizeRecursive</code> <code>line 1</code>why cannot i use <code>const node* &root</code>. Similarly, i am getting the same mistake in <code>line 2</code>.The compiler is giving an error which i... | <p>Let's see the reason for getting each of the error on case by case basis. Moreover, i'll try to explain things in steps.</p>
<h3>Case 1</h3>
<p>Here we consider the 1st error due to the statement:</p>
<pre><code>for(const node* &child : root->children)
</code></pre>
<p>Now to understand why we get error due t... | binding reference of type const node*& to node*const | c++|pointers|reference|tree | 1 | 56 | 1 | 72,831,701 | 72,831,701 | 1 | true | 2022-07-01T08:35:22.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
binding reference of type const node*& to node*const<p>I am trying to implement a generic tree and in the function <code>getSizeRecursive</code> <code>line 1... |
72,995,472 | Unity C# How to check IF (statement) is true for n amount of time?<p>I have an <code>If</code> statement that returns true or false, naturally. How do I check the condition for <code>n</code> amount of time (frames, seconds)? I need the bool to return false only if condition is true for half a second.</p> | <p>Put some code in your Update method and use a float member variable and add Time.deltaTime. The update method triggers every frame. Once the variable is over 0.5f do your magic.</p>
<pre><code>public class MyScript : MonoBehaviour
{
float timer:
void Update()
{
// If condition is false, reset ti... | Unity C# How to check IF (statement) is true for n amount of time? | c#|unity3d | -1 | 56 | 1 | 72,995,506 | 72,995,506 | 1 | true | 2022-07-15T14:21:30.097Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unity C# How to check IF (statement) is true for n amount of time?<p>I have an <code>If</code> statement that returns true or false, naturally. How do I chec... |
72,850,483 | Reading two columns in csv and linking by row<p>I have multiple files in a directory with the format gene_primer_otherinfo.fastq.gz.
I have a csv file with the following format which states the gene and primer combinations I wish to keep. It has 64 rows in total.</p>
<pre><code>| Gene | Reverse_primer |
| -------- ... | <p>Pandas is not a good fit for your need: it's meant for manipulating columns ("series" of data), not iterating rows. Python's CSV module is all you need for reading the CSV file.</p>
<p>After that, you need to figure out a good way to read the CSV (hopefully once) and repeatedly check the data for each fil... | Reading two columns in csv and linking by row | python|csv | 1 | 56 | 2 | 72,851,960 | 72,851,960 | 1 | true | 2022-07-03T23:08:03.820Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reading two columns in csv and linking by row<p>I have multiple files in a directory with the format gene_primer_otherinfo.fastq.gz.
I have a csv file with t... |
72,922,898 | Restarting a python tcpserver based on sockerserver library<p>Working with a tcp server - following snippet creates the server</p>
<pre><code>import threading
import socketserver
import time
class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
#def __init__(self, a,b,c):
# super().__init__(req... | <p>When a server is closed, the connection will not come to 'CLOSED' state immediately. instead, it will be in 'TIME_WAIT' state. to allow the client receive 'FIN_ACK' packet and to ttl down all delayed incoming packets.</p>
<p>During this 'TIME_WAIT' duration, we can't create new server in that address.</p>
<p>More de... | Restarting a python tcpserver based on sockerserver library | python|sockets | 0 | 56 | 1 | 72,923,426 | 72,923,426 | 1 | true | 2022-07-09T16:09:01.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Restarting a python tcpserver based on sockerserver library<p>Working with a tcp server - following snippet creates the server</p>
<pre><code>import threadin... |
72,989,034 | Numpy: using np.pad() for an RGB image causing "operands could not be broadcast together with shapes (4,4,3) (4,4,5)" error<p>I have a function <code>color_image_padding</code> that takes an <strong>RGB image</strong> and adds one layer of zeros padding to the borders. The image has dimensions <code>(Width, Height, 3)... | <p>So this reproduces your error - using the three term <code>pad_width</code> on a 2d array:</p>
<p>ok with 3d:</p>
<pre><code>In [194]: x = np.ones((5,5,3),int)
In [196]: amt_padding=1;np.pad(x, pad_width=((amt_padding, amt_padding), (amt_padding, amt_padding), (0, 0))).shape
Out[196]: (7, 7, 3)
</code></pre>
<p>but ... | Numpy: using np.pad() for an RGB image causing "operands could not be broadcast together with shapes (4,4,3) (4,4,5)" error | numpy | 1 | 56 | 1 | 72,999,145 | 72,999,145 | 1 | true | 2022-07-15T04:25:47.790Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Numpy: using np.pad() for an RGB image causing "operands could not be broadcast together with shapes (4,4,3) (4,4,5)" error<p>I have a function <code>color_i... |
73,011,928 | `aligned_alloc` in Linux Kernel Space when using kmalloc<p>I am writing a kernel module, porting some functionality from user space that uses the <code>aligned_alloc</code> function from the <code>#include <stdlib.h></code> library. I did not find a similar function in the function accessible from kernel modules ... | <p>In recent kernels (>= v5.4) <code>kmalloc()</code> is guaranteed to return naturally aligned objects of sizes that are powers of two, meaning that <code>kmalloc(sz)</code> is already aligned to <code>sz</code> IFF <code>sz</code> is a power of two. So if you are targeting modern kernels <code>kmalloc</code> is al... | `aligned_alloc` in Linux Kernel Space when using kmalloc | c|linux|linux-kernel|heap-memory|kmalloc | 1 | 56 | 1 | 73,040,987 | 73,040,987 | 1 | true | 2022-07-17T12:47:28.187Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
`aligned_alloc` in Linux Kernel Space when using kmalloc<p>I am writing a kernel module, porting some functionality from user space that uses the <code>align... |
72,895,845 | String formatting "in-place"<p>I have strings (list of str) containing placeholders <code>{}</code> and want to include variable values into those placeholders. One example of such a string could be <code>'test_variable = {}'</code>.
I need to find the index within the list I want to deal with and replace the <code>{}<... | <p>You could use a combination of str.replace() and your function</p>
<pre><code>def find_occurrence_in_str_list(lines, findstr,value, start_index=0):
for i in range(start_index, len(lines)):
if findstr in lines[i]:
lines[i] = lines[i].replace('{}', str(value))
return lines
# Examples
variable_valu... | String formatting "in-place" | python | -1 | 56 | 1 | 72,896,175 | 72,896,175 | 1 | true | 2022-07-07T09:59:46.503Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
String formatting "in-place"<p>I have strings (list of str) containing placeholders <code>{}</code> and want to include variable values into those placeholde... |
72,882,060 | Find the number of occurrence of a string in a list of list<p>I have a list in the following format.</p>
<pre><code>my_list=[['xyz','abc','Qwerty 1','Qwerty 2'],[],['1','2','Qwerty 1','Qwerty 2',1,4,'Qwerty 3',3],['1','QQQ','Quit','Qual','Qwerty 1']]
</code></pre>
<p>I'm trying to find the number of times the string '... | <pre><code>my_list = [
['xyz', 'abc', 'Qwerty 1', 'Qwerty 2'],
[],
['1', '2', 'Qwerty 1', 'Qwerty 2', 1, 4, 'Qwerty 3', 3],
['1', 'QQQ', 'Quit', 'Qual', 'Qwerty 1']
]
count_list = []
for list in my_list:
q_count = 0
for str_val in list:
if 'Qwerty' in str(str_val):
q_... | Find the number of occurrence of a string in a list of list | python|string|list | 1 | 56 | 3 | 72,882,158 | 72,882,158 | 1 | true | 2022-07-06T10:38:48.650Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find the number of occurrence of a string in a list of list<p>I have a list in the following format.</p>
<pre><code>my_list=[['xyz','abc','Qwerty 1','Qwerty ... |
72,939,524 | panda groupby agg and calculated function together<p>I have below contents in csv file</p>
<pre><code>key1 key2 Key3 key4 key5
Val1 A 51 'True' 25
Val1 A 50 'False' 25
Val1 A 49 'True' 25
Val1 A 48 'True' 25
Val2 A 47 'False' 25
Val2... | <p>An easy way to count the number of <code>True</code>s in any array is to take the sum of that array (since they're typically based on the integer values 0 & 1; True == 1, and False == 0).</p>
<pre class="lang-py prettyprint-override"><code>out = (
json_data.groupby(['key1', 'key2'])
.agg(
maxkey5... | panda groupby agg and calculated function together | python|pandas|dataframe | 2 | 56 | 2 | 72,939,577 | 72,939,577 | 1 | true | 2022-07-11T13:41:01.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
panda groupby agg and calculated function together<p>I have below contents in csv file</p>
<pre><code>key1 key2 Key3 key4 key5
Val1 A ... |
72,870,125 | Tokio subtask within task not executing as expected<p>Although I am new to rust, after having read the rust and tokio books I thought to know how async tasks work. However, obviously I missed something crucial, since I can't seem to be able to resolve the following problem:</p>
<p>I have an async function (asfunc) that... | <p>I fully agree with everything @ChayimFriedman says.</p>
<p>Here is some code to accompany his answer, based on the fact that you say that you <strong>need</strong> to use <code>std::sync::mpsc</code>:</p>
<pre class="lang-rust prettyprint-override"><code>use std::sync::mpsc::Sender;
use std::time;
async fn wrapper(... | Tokio subtask within task not executing as expected | asynchronous|rust|rust-tokio | 1 | 56 | 2 | 72,893,167 | 72,893,167 | 1 | true | 2022-07-05T13:16:53.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Tokio subtask within task not executing as expected<p>Although I am new to rust, after having read the rust and tokio books I thought to know how async tasks... |
72,782,679 | Delete table from list<p>I have list and I need to delete some table from the list. Below you can see my current solution</p>
<pre><code> imported_templates_XM$Export_FRPS5.xlsx$Sheet2<-NULL
imported_templates_XM$Export_RP10.xlsx$Sheet2<-NULL
imported_templates_XM$Export_RP115_AS.xlsx$Sheet2<-NULL
impor... | <p>I guess that what you're looking for is this:</p>
<pre class="lang-r prettyprint-override"><code>library(purrr)
map(imported_templates_XM, assign_in, "Sheet2", NULL)
#> $Export_FRPS5.xlsx
#> $Export_FRPS5.xlsx$Sheet1
#> [1] "Keep this"
#>
#>
#> $Export_RP10.xlsx
#> $Export... | Delete table from list | r|dplyr | -2 | 56 | 1 | 72,784,363 | 72,784,363 | 1 | true | 2022-06-28T07:56:18.490Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Delete table from list<p>I have list and I need to delete some table from the list. Below you can see my current solution</p>
<pre><code> imported_templates... |
73,016,590 | + operator in Kotlin gives "Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:"<p>I am learning Kotlin by doing exercises on exercism.com. I am currently working on <a href="https://exercism.org/tracks/kotlin/exercises/triangle" rel="nofollow noreferrer">triangles</a... | <p>This is because Kotlin does not provide a <code>plus</code> overload for adding two <code>Number</code>s. One way is to convert the <code>Number</code>s to <code>Double</code>s add then perform operations on them. Also, Kotlin provides a handy <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/require.html... | + operator in Kotlin gives "Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:" | kotlin | 0 | 56 | 1 | 73,017,120 | 73,017,120 | 1 | true | 2022-07-18T01:49:04.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
+ operator in Kotlin gives "Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:"<p>I am learning Kotlin b... |
72,951,710 | Update field after changing its value with JavaScript<p>I would like to simulate user input on a website using JavaScript. To do so, I simply do something like this:</p>
<pre><code>a = document.getElementsByClassName('field-name')[0];
a.value = 'new value';
</code></pre>
<p>However, on some websites which require you t... | <p>The <a href="https://developer.mozilla.org/en-US/docs/Web/API/InputEvent/InputEvent" rel="nofollow noreferrer"><code>InputEvent</code></a>'s type should be either <code>beforeinput</code> or <code>input</code> (<code>input</code>, in your case), not <code>change</code>; you might also consider firing a an <code>Even... | Update field after changing its value with JavaScript | javascript|html | 0 | 56 | 1 | 72,951,776 | 72,951,776 | 1 | true | 2022-07-12T11:39:51.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Update field after changing its value with JavaScript<p>I would like to simulate user input on a website using JavaScript. To do so, I simply do something li... |
72,970,350 | How to make sure that several random colors are not repeated<p>I have an ElevatedButton, I give it a random color of 3 properties</p>
<pre><code> backgroundColor: MaterialStateProperty.all(Colors.primaries[Random().nextInt(Colors.primaries.length)],),
overlayColor: MaterialStateProperty.all(Colors.primaries[Rand... | <p>The concept is getting a single random color and <a href="https://github.com/yeasin50/space_craft/blob/master/lib/core/utils/helpers/hue_changer.dart" rel="nofollow noreferrer">change hue</a> to generate others based on this color. For this, we can use HSLColor system</p>
<pre class="lang-dart prettyprint-override"... | How to make sure that several random colors are not repeated | flutter|dart|random|colors | 1 | 56 | 3 | 72,971,540 | 72,971,540 | 1 | true | 2022-07-13T17:28:24.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make sure that several random colors are not repeated<p>I have an ElevatedButton, I give it a random color of 3 properties</p>
<pre><code> backgrou... |
72,928,042 | Convert bytes string literal to integer<p>I receive a 32-bit number over the serial line, using <code>num = ser.read(4)</code>. Checking the value of <code>num</code> in the shell returns something like a very unreadable <code>b'\xcbu,\x0c'</code>.</p>
<p>I can check against the ASCII table to find the values of "... | <p>I found two alternatives to solve this problem.</p>
<ol>
<li>Using the <code>int.from_bytes(bytes, byteorder, *, signed=False)</code> method</li>
<li>Using the <code>struct.unpack(format, buffer)</code> from the builtin <code>struct</code> module</li>
</ol>
<h2>Using int.from_bytes</h2>
<p>Starting from Python 3.2, ... | Convert bytes string literal to integer | python|python-3.x | 0 | 56 | 2 | 72,928,082 | 72,928,082 | 1 | true | 2022-07-10T11:11:01.603Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert bytes string literal to integer<p>I receive a 32-bit number over the serial line, using <code>num = ser.read(4)</code>. Checking the value of <code>n... |
73,025,235 | Kernel keeps dying in Jupyter notebook with pulp solver<p>I've created a LP solver in Jupyter notebooks that is giving me some issues. Specifically, when I run the last line of code in the script below, I get the error message saying <code>The kernel appears to have died. It will restart automatically.</code></p>
<p>Ed... | <p>You had a handful of typos here... Not sure if/how you got this running.</p>
<p>A couple of issues you had:</p>
<ul>
<li>You co-mingled <code>df</code> and <code>data</code> variable names inside your function. So who knows what that was pulling in. (One of the hazards of working in a notebook.)</li>
<li>In sever... | Kernel keeps dying in Jupyter notebook with pulp solver | python|jupyter-notebook|solver|pulp | 0 | 56 | 1 | 73,040,348 | 73,040,348 | 1 | true | 2022-07-18T15:56:16.283Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kernel keeps dying in Jupyter notebook with pulp solver<p>I've created a LP solver in Jupyter notebooks that is giving me some issues. Specifically, when I r... |
72,823,846 | R does not recognize whitespace<p>I'm trying to extract the first word of that name, but I'm not able to because R is not recognizing whitespace.</p>
<pre><code>library(stringr)
name <- x[76,3]
name
[1] "Byrsonima crispa A.Juss."
word(name,1)
[1] "Byrsonima crispa A.Juss."
str_count(name,"... | <p>Try to specify white space as Regex pattern:</p>
<pre><code>str_count("Byrsonima crispa A.Juss.", "\\s")
#[1] 2
word("Byrsonima crispa A.Juss.", 1, sep = "\\s")
#[1] "Byrsonima"
</code></pre>
<hr />
<p><strong>Update:</strong></p>
<p>I am also curious about what's c... | R does not recognize whitespace | r | 1 | 56 | 1 | 72,823,866 | 72,823,866 | 1 | true | 2022-07-01T02:32:48.543Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R does not recognize whitespace<p>I'm trying to extract the first word of that name, but I'm not able to because R is not recognizing whitespace.</p>
<pre><c... |
72,947,037 | How to do a terms query on @Query in SpringBoot Elasticsearch Repository<p>From <a href="https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#elasticsearch.query-methods.at-query" rel="nofollow noreferrer">here</a>, an example of how to query something <code>IN</code> a list, but the example is... | <p>There was a bug in the handling of collection parameters in <code>@Query</code> methods that was fixed 2 weeks ago in the <em>main</em> branch (<a href="https://github.com/spring-projects/spring-data-elasticsearch/pull/2182" rel="nofollow noreferrer">https://github.com/spring-projects/spring-data-elasticsearch/pull/... | How to do a terms query on @Query in SpringBoot Elasticsearch Repository | spring-boot|spring-data-elasticsearch | 0 | 56 | 1 | 72,947,252 | 72,947,252 | 1 | true | 2022-07-12T04:26:18.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do a terms query on @Query in SpringBoot Elasticsearch Repository<p>From <a href="https://docs.spring.io/spring-data/elasticsearch/docs/current/refere... |
72,801,689 | How to print only the specified rows from the grid view<p>Welcome
I have a sales screen with an invoice that is displayed in the grid view with the report of Extra Robert
I just want when I select some rows using the select box only the selected rows are printed on one page I tried this code but it prints each row in a... | <p>I suggest to create the WHERE condition dynamically with the selected records:</p>
<pre class="lang-cs prettyprint-override"><code>string sql = @"SELECT [Order_ID] as 'رقم الفاتورة',talb_ID as 'طلب',[Cust_Name] as 'اسم العميل',Products.Pro_Name as 'المنتج',Products.Group_ID as 'قسم',Products_Group.Group_Name as... | How to print only the specified rows from the grid view | c# | 0 | 56 | 2 | 72,802,317 | 72,802,317 | 1 | true | 2022-06-29T12:47:27.833Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to print only the specified rows from the grid view<p>Welcome
I have a sales screen with an invoice that is displayed in the grid view with the report of... |
72,869,014 | How to assign all values to NA with condition?<pre><code>library(raster)
r1 <- r2 <- r3 <- raster(ncol=10, nrow=10)
r1[] <- runif(ncell(r1))
r2[] <- runif(ncell(r2)) / 2
r3[] <- runif(ncell(r3)) * 1.5
s <- stack(r1, r2, r3)
r11 <- r22 <- r33 <- raster(ncol=10, nrow=10)
r11[] <- runi... | <p>Let's do this with "terra" (the replacement of "raster").</p>
<p>Example data</p>
<pre><code>library(terra)
set.seed(0)
s <- rast(ncol=10, nrow=10, nlyr=3, vals=rep(1:100, 3))
g <- rast(ncol=10, nrow=10, nlyr=3, vals=sample(8, 300, replace=TRUE))
</code></pre>
<p>Set all values in <code>s</... | How to assign all values to NA with condition? | r|raster | 0 | 56 | 1 | 72,871,257 | 72,871,257 | 1 | true | 2022-07-05T11:55:17.273Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to assign all values to NA with condition?<pre><code>library(raster)
r1 <- r2 <- r3 <- raster(ncol=10, nrow=10)
r1[] <- runif(ncell(r1))
r2[]... |
72,923,827 | R shiny shinyjs toggle output on/off<p>In a Shiny app, I would like to be able to use check boxes or radio buttons to toggle on and off the visible output.</p>
<p>Currently, I can achieve this only by creating separate check box ui items and observe conditions for each element I would like to toggle.</p>
<pre><code>lib... | <p><code>toggle</code> expects a <code>boolean</code> but <code>input$select</code> returns a character, which might explain the unexpected behaviour.</p>
<p>With a single <code>checkboxGroupInput</code>, using <code>%in%</code> to get booleans:</p>
<pre><code>library(shiny)
library(shinyjs)
ui <- fluidPage(
useS... | R shiny shinyjs toggle output on/off | r|shiny|shinyjs | 0 | 56 | 1 | 72,924,067 | 72,924,067 | 1 | true | 2022-07-09T18:41:44.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R shiny shinyjs toggle output on/off<p>In a Shiny app, I would like to be able to use check boxes or radio buttons to toggle on and off the visible output.</... |
72,925,330 | How to make parallax effect if not with background-attachment?<p>Found this for parallax effect: <a href="https://www.w3schools.com/howto/howto_css_parallax.asp" rel="nofollow noreferrer">https://www.w3schools.com/howto/howto_css_parallax.asp</a></p>
<p>They use <code>background-attachment: fixed;</code></p>
<p>If you ... | <p>There's multiple ways to do a parallax effect, but it mostly depends on the parallax effect you're looking for.</p>
<p>If you want two divs moving at a different speed, you'll probably need to use Javascript, or a package that will do it for you. Here's a link to a package that will add parallax to a div: <a href="h... | How to make parallax effect if not with background-attachment? | jquery|css|parallax | -1 | 56 | 1 | 72,925,548 | 72,925,548 | 1 | true | 2022-07-09T23:49:23.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make parallax effect if not with background-attachment?<p>Found this for parallax effect: <a href="https://www.w3schools.com/howto/howto_css_parallax.... |
72,928,958 | Split URL that contains more than one comma javascript<p>Basically I try to split a string of URL that contains more than one Comma, but the result turns out to be like this:</p>
<pre><code>{
"photoUrl": [
"https://m.media-amazon.com/images/M/MV5BMTU4MTgxOTQ0Nl5BMl5BanBnXkFtZT... | <p>Since we know the url starts with <code>https://</code> we can check each segment for it and build up url accordingly:</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 ... | Split URL that contains more than one comma javascript | javascript|regex|split | 0 | 56 | 2 | 72,929,222 | 72,929,222 | 1 | true | 2022-07-10T13:46:51.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Split URL that contains more than one comma javascript<p>Basically I try to split a string of URL that contains more than one Comma, but the result turns out... |
73,013,021 | Unicode characters not getting displayed correctly on localhost<p>I want to display this character “‾” (U+203E) but this is what I get on the local host: ‾
Im using python and this is the code im using:</p>
<pre class="lang-py prettyprint-override"><code>from http.server import HTTPServer, BaseHTTPRequestHandler
... | <p>As I know browser doesn't have to use <code>utf-8</code> as default encoding but i.e. <code>iso8859-2</code>.</p>
<p>Browser doesn't know what encoding is inside file and you have to use HTTP header to inform it</p>
<pre><code>self.send_header("Content-Type", "text/plain; charset=utf-8")
</code><... | Unicode characters not getting displayed correctly on localhost | python|unicode|localhost | 1 | 56 | 1 | 73,013,630 | 73,013,630 | 1 | true | 2022-07-17T15:26:14.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unicode characters not getting displayed correctly on localhost<p>I want to display this character “‾” (U+203E) but this is what I get on the local host: ââ... |
72,883,184 | Select and extract different capture groups from string using regex<p>I would like to extract various parts of a string using regex patterns and capturing groups. I am able to filter the string using <code>str_match_all</code>, but I would like to have the possibility to explicitely select one of the capturing groups, ... | <p>You could use the builtin function <code>sub</code> as follows:</p>
<pre><code>dt.test[, Extract.1 := sub(".*delta_(\\d+)_.*", "\\1", file_names)]
file_names Extract.1
1: 20200131_20210228_PROD_TEST_MF_delta_20210228_20210107_20210210.c... | Select and extract different capture groups from string using regex | r|regex|data.table|stringr|stringi | 0 | 56 | 1 | 72,883,603 | 72,883,603 | 1 | true | 2022-07-06T11:57:01.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Select and extract different capture groups from string using regex<p>I would like to extract various parts of a string using regex patterns and capturing gr... |
72,838,717 | Assignment and retrieval along with Post increment in single line in c++<p>This is the code which I ran.</p>
<pre><code>int minimumCardPickup(vector<int>& cards) {
int N = cards.size();
int l = 0, r = 0, res = INT_MAX;
unordered_map<int, int> pos;
while (r < N... | <p>As you correctly identified, the problem is here:</p>
<pre><code>pos[cards[r]] = r++; //Here
</code></pre>
<p>In earlier standards:</p>
<p>If you post-increment or post-decrement a variable, you should not read the value of it again before a sequence point (in this case, <code>;</code>). This is because post-increme... | Assignment and retrieval along with Post increment in single line in c++ | c++|c++11|c++17 | 0 | 56 | 1 | 72,838,751 | 72,838,751 | 1 | true | 2022-07-02T11:33:17.907Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Assignment and retrieval along with Post increment in single line in c++<p>This is the code which I ran.</p>
<pre><code>int minimumCardPickup(vector<int&g... |
72,881,634 | Workaround for spherical polar coordinate Jacobian division<p>I am having data visualization issue.
Short summup, I'm working on a project involving a polar spherical coordinate mesh, and trying to solved coupled system of ODE (chemical reactions) for each cell.
For a specific reason I need my state vector to be of the... | <p>Tweaking the formula slightly seems to work. Also used a lighter color for cmap.</p>
<pre><code>cst2 = np.copy(cst) / (pow(a[0],2)*np.sin(a[1]))
pcm = ax.pcolormesh(b[0]*np.cos(b[1]), \
b[0]*np.sin(b[1]), \
cst2,cmap='coolwarm',edgecolor='black')
</code></pre>
<p><a href="http... | Workaround for spherical polar coordinate Jacobian division | python|matplotlib|data-visualization|numeric|spherical-coordinate | 0 | 56 | 1 | 72,919,927 | 72,919,927 | 1 | true | 2022-07-06T10:09:46.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Workaround for spherical polar coordinate Jacobian division<p>I am having data visualization issue.
Short summup, I'm working on a project involving a polar ... |
72,932,046 | Converting from json to DataFrames?<p>I'm trying to convert JSON to DataFrames.</p>
<p>JSON output from API is like that:</p>
<pre class="lang-json prettyprint-override"><code>{
"code": 0,
"data": {
"list": [
{
"address": "abcdxyz",
"n... | <p>You had to go just one level deeper to access not the overall "data" but the specific "list":</p>
<pre><code>response = requests.get(url)
json_data = json.loads(response.text)
df = pd.DataFrame(json_data['data']['list'])
</code></pre> | Converting from json to DataFrames? | python|json|pandas|list|dataframe | 2 | 56 | 1 | 72,932,106 | 72,932,106 | 1 | true | 2022-07-10T21:30:29.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting from json to DataFrames?<p>I'm trying to convert JSON to DataFrames.</p>
<p>JSON output from API is like that:</p>
<pre class="lang-json prettypri... |
72,870,117 | Script to open multiple Chrome tabs each for a Google search from a list of keywords present in an Excel sheet<p>I have a list of keywords stored in a column in an Excel sheet. I want to do a Google search for each keyword in separate chrome tabs.</p>
<p>Can anyone please help me with Python code to automate it?</p> | <p>Rahil, say your keywords are in the "A" column of <code>rahils_keywords.xlsx</code> file, in the worksheet called <code>keywords</code>. At the shell, install this dependency:</p>
<pre class="lang-bash prettyprint-override"><code>> pip install openpyxl
</code></pre>
<p>Then in your text editor or Python... | Script to open multiple Chrome tabs each for a Google search from a list of keywords present in an Excel sheet | python|excel | 0 | 56 | 1 | 72,870,380 | 72,870,380 | 1 | true | 2022-07-05T13:16:23.287Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Script to open multiple Chrome tabs each for a Google search from a list of keywords present in an Excel sheet<p>I have a list of keywords stored in a column... |
72,900,940 | keyring.get_password() throws NameError when reading credential from Windows Credential Manager<p>I am try to implement keyring on a windows system to manage database passwords for connection strings in pyodbc and sqlalchemy. I have tried to ensure the relevant packages from the NameError(s) thrown are installed.</p>
<... | <p>This was an issue with extra python installations on my device.</p>
<p>I fixed this issue by deleting an extra set of python installations on my computer.</p>
<p><a href="https://stackoverflow.com/questions/72903927/create-venv-without-admin-access-python">Create venv without admin access python</a></p>
<pre><code>i... | keyring.get_password() throws NameError when reading credential from Windows Credential Manager | python|windows|keyring | 1 | 56 | 1 | 72,913,790 | 72,913,790 | 1 | true | 2022-07-07T16:00:02.597Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
keyring.get_password() throws NameError when reading credential from Windows Credential Manager<p>I am try to implement keyring on a windows system to manage... |
72,971,794 | Flattize an array of objects<p>I need some help doing a dataset transformation.</p>
<p>I have this array of objects:</p>
<pre class="lang-js prettyprint-override"><code>const CATEGORY = "category";
const DATE = "date";
const dataset = [
{ date: "2012", category: "pizza", value... | <p>Here is a non lodash solution. What to take from here is I'm creating an <code>initializer</code> which will look like <code>{pizza: 0, fruit: 0,....}</code> depending on the unique categories and then I'm setting a copy of it inside the <code>reduce</code> for every new group by date</p>
<p><div class="snippet" dat... | Flattize an array of objects | javascript | 0 | 56 | 2 | 72,972,284 | 72,972,284 | 1 | true | 2022-07-13T19:43:28.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flattize an array of objects<p>I need some help doing a dataset transformation.</p>
<p>I have this array of objects:</p>
<pre class="lang-js prettyprint-over... |
72,991,797 | In Python/BeautifulSoup, get_text() failed<p>In Python/BeautifulSoup, below code <code>title</code> values is</p>
<pre><code><span class="ux-textspans"><!--F#f_7[0]-->4K Photon MONO<!--F/--></span>
</code></pre>
<p>when use <code>title.get_text()</code> to get text <code>4K Photon MON... | <p>It can also be done using <code>soup.find</code> function.</p>
<pre><code>import requests
from bs4 import BeautifulSoup
url='https://www.ebay.com/itm/284163810059'
req=requests.get(url)
soup=BeautifulSoup(req.text,'lxml')
title=soup.find("span", {"itemprop" : "model"})
title_text= &qu... | In Python/BeautifulSoup, get_text() failed | python|web-scraping|beautifulsoup|css-selectors | 0 | 56 | 3 | 72,991,963 | 72,991,963 | 1 | true | 2022-07-15T09:22:21.103Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In Python/BeautifulSoup, get_text() failed<p>In Python/BeautifulSoup, below code <code>title</code> values is</p>
<pre><code><span class="ux-textspan... |
72,807,871 | how to get number containing rows in snowflake<p>I have tried regexp, regexp_like and like but didn't work</p>
<p><strong>select * from b</strong></p>
<ul>
<li>where regexp_like(col1, '\d')</li>
<li>where regexp_like(col1, '[0-9]')</li>
<li>....etc</li>
</ul>
<p><strong>we have this table</strong></p>
<div class="s-tab... | <p>You can use <code>regexp_instr</code> in the where clause to see if it finds a digit anywhere in the string:</p>
<pre><code>create temp table b(col1 string);
insert into b (col1) values ('avr100000'), ('adfdsgwr'),
('20170910020359.761'),
('Enterprise'),
('adf56ds76gwr'),
('0+093000'),
('080000'),
('adfdsgwr')
;
... | how to get number containing rows in snowflake | snowflake-cloud-data-platform | 0 | 56 | 3 | 72,809,095 | 72,809,095 | 1 | true | 2022-06-29T21:05:58.827Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to get number containing rows in snowflake<p>I have tried regexp, regexp_like and like but didn't work</p>
<p><strong>select * from b</strong></p>
<ul>
<... |
72,776,330 | Apply a Function per Row of Sub Groups of the Data **Above** the Current Row<p>Assume I have data in the form (As a Pandas' Data Frame):</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Index</th>
<th>ID</th>
<th>Value</th>
<th>Div Factor</th>
<th>Weighted Sum</th>
</tr>
</thead>
<tbody>
<tr... | <p>This should do what you're asking:</p>
<pre class="lang-py prettyprint-override"><code>df1 = df[['ID', 'Value']].set_index('ID', append=True).unstack(-1)
df2 = df1.fillna(0).cumsum() / df1.notnull().astype(int).cumsum()
df['Weighted Sum'] = df2.mean(axis=1)
</code></pre>
<p>(Simplification of the last line based on ... | Apply a Function per Row of Sub Groups of the Data **Above** the Current Row | python|pandas|dataframe|performance | 1 | 56 | 1 | 72,776,744 | 72,776,744 | 1 | true | 2022-06-27T17:44:29.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Apply a Function per Row of Sub Groups of the Data **Above** the Current Row<p>Assume I have data in the form (As a Pandas' Data Frame):</p>
<div class="s-ta... |
72,789,073 | Find the first occurrence that matches multiple conditions in a dataframe<p>I have a general Date and Values Dataframe and I'm trying to use it create another more filtered one with certain ranges.</p>
<p>I'm having a hard time trying to find the first time a Value is either equal or greater than the start Value of the... | <p>This should do what you've asked:</p>
<p><strong>Method 1:</strong></p>
<pre class="lang-py prettyprint-override"><code>x = df[(df.index > df2['Start Date'].iloc[0]) & (df.Value > df2['Start Value'].iloc[0])]
df2['First recurrence'] = x.index.min()
</code></pre>
<p>Input:</p>
<pre><code>df:
Val... | Find the first occurrence that matches multiple conditions in a dataframe | python|pandas | 1 | 56 | 1 | 72,789,309 | 72,789,309 | 1 | true | 2022-06-28T15:14:40.423Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find the first occurrence that matches multiple conditions in a dataframe<p>I have a general Date and Values Dataframe and I'm trying to use it create anothe... |
72,935,774 | Scaling Spring Authorization Server on GCP Cloud Run<p>We are experiencing an issue in production which seems identical to when we restart our dev boxes and try to authenticate using the token that was generated with the previous instance of our SSO Spring Boot App and powered by Spring Authorization Server.</p>
<p>The... | <p>Spring Authorization Server is built on Spring Security (see docs <a href="https://docs.spring.io/spring-authorization-server/docs/current/reference/html/overview.html#introducing-spring-authorization-server" rel="nofollow noreferrer">Overview</a>) and does require knowledge of Spring Security (see <a href="https://... | Scaling Spring Authorization Server on GCP Cloud Run | spring|spring-security | 0 | 56 | 2 | 72,954,035 | 72,954,035 | 1 | true | 2022-07-11T08:38:57Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scaling Spring Authorization Server on GCP Cloud Run<p>We are experiencing an issue in production which seems identical to when we restart our dev boxes and ... |
72,785,468 | Subset multiple row values into new table and and count string pattren occurences<p>I have the following table for processing (Table1):</p>
<pre><code>Fuse Ident Grade
A1 BLU123 skyline
A1 RED235 blue
A1 RED345 ortho
B1 RED160 linx
B1 BLU760 milli
B2 BLU222 moli
B2 RED201 straw
C1 RED201 straw
C2 ... | <h5>count the aggregated occurrences</h5>
<pre><code>out = (df
# extract BLU/RED as col (other methods are possible)
.assign(group=df['Ident'].str[:3])
.groupby(['Fuse', 'group'])['Grade'].agg(';'.join) # aggregate multiple occurrences
.unstack().value_counts() # count values
.reset_index(name='count')
)
... | Subset multiple row values into new table and and count string pattren occurences | python|pandas | 1 | 56 | 1 | 72,785,648 | 72,785,648 | 1 | true | 2022-06-28T11:17:26.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Subset multiple row values into new table and and count string pattren occurences<p>I have the following table for processing (Table1):</p>
<pre><code>Fuse ... |
72,885,412 | Chrome browser opens but doesn't want to go to a url<p>This is my code and for some reason when the browser opens it doesn't go to gmail.com. Any idea how to fix this?</p>
<pre><code>from selenium import webdriver
import time
driver = webdriver.Chrome("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&quo... | <p><code>driver.get()</code> requires valid URL that starts with <code>"http"/"https"</code>. However, <code>driver.get("http://www.gmail.com")</code> will navigate to <code>"https://www.gmail.com"</code> but the <code>driver.get(gmail.com)</code> will simply get lost.</p>
<p>For... | Chrome browser opens but doesn't want to go to a url | python | 1 | 56 | 1 | 72,885,637 | 72,885,637 | 1 | true | 2022-07-06T14:33:59.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Chrome browser opens but doesn't want to go to a url<p>This is my code and for some reason when the browser opens it doesn't go to gmail.com. Any idea how to... |
72,903,756 | Rails JSON.parse "unexpected token" error<p>I have a simple controller that is hit by webhooks. I need to store all data sent in a model's <code>metadata</code> which is a <code>text</code> column for later consumption.</p>
<pre><code>class NotificationsController < ApplicationController
def create
notificati... | <blockquote>
<p>When I inspect params.class inside any controller action, I get an ActionController::Parameters object that acts like a hash.</p>
</blockquote>
<p>Yes, this is what <code>params</code> is. It's an object, that acts like a <code>hash</code> in most respects.</p>
<blockquote>
<p>However, when storing para... | Rails JSON.parse "unexpected token" error | json|ruby-on-rails|ruby|model-view-controller | 0 | 56 | 2 | 72,903,901 | 72,903,901 | 1 | true | 2022-07-07T20:18:15.780Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rails JSON.parse "unexpected token" error<p>I have a simple controller that is hit by webhooks. I need to store all data sent in a model's <code>metadata</c... |
72,772,536 | how to change character in phaser js i face issue<p>I set value of character but first time is work fine charter changed but when gameover then if i change the character value will be changed but character still same which i choose first time.</p>
<pre><code> this.player = this.physics.add.sprite(100, -500, this.cha... | <p>You would have to call the function <code>setTexture</code> of the sprite object, to change the texture. <a href="https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.Sprite.html#setTexture__anchor" rel="nofollow noreferrer">here is the link to the documentation</a>, after the reselecting of a new character... | how to change character in phaser js i face issue | javascript|phaser-framework | 0 | 56 | 1 | 72,773,979 | 72,773,979 | 1 | true | 2022-06-27T13:00:46.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to change character in phaser js i face issue<p>I set value of character but first time is work fine charter changed but when gameover then if i change t... |
72,884,419 | AttributeError: 'str' object has no attribute 'xpath' scrapy python<p>I am trying to extract values from a web page but it's getting me an <code>AttributeError</code>. I am not sure why this error is printing. If you look at the code, you will not find something that is causing this error. In fact, the first value <cod... | <p><a href="https://docs.scrapy.org/en/latest/topics/selectors.html" rel="nofollow noreferrer">https://docs.scrapy.org/en/latest/topics/selectors.html</a></p>
<p>The <code>.xpath(...)</code> method returns a <code>Selector</code> that you can call <code>.xpath</code> on again.</p>
<p>But calling <code>.get()</code> on ... | AttributeError: 'str' object has no attribute 'xpath' scrapy python | python|scrapy | 0 | 56 | 2 | 72,884,637 | 72,884,637 | 1 | true | 2022-07-06T13:28:19.150Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AttributeError: 'str' object has no attribute 'xpath' scrapy python<p>I am trying to extract values from a web page but it's getting me an <code>AttributeErr... |
72,392,740 | Django multiple update Task at once<p>I have my Django website where i can have tasks created and subtasks under tasks i have mark complete option which is working fine i need them to be completed in batch like selecting multiple tasks at once and complete them.</p>
<p><strong>serializers.py</strong>:</p>
<pre><code>cl... | <p>I think you can change the path for bulk update.</p>
<p>In urls.py,</p>
<pre><code>path('<str:task_ids>/complete', views.TaskUpdateAPIView.as_view(),
name='task_update'),
</code></pre>
<p>And in views.py, you can customize <code>put</code> method for update request.</p>
<pre><code>class TaskUpdateAPIView(Upda... | Django multiple update Task at once | django|django-models|django-rest-framework|django-views|django-forms | 0 | 56 | 2 | 72,394,232 | 72,394,232 | 1 | true | 2022-05-26T13:37:34.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django multiple update Task at once<p>I have my Django website where i can have tasks created and subtasks under tasks i have mark complete option which is w... |
72,383,262 | How to indicate that a (TypeScript) parameter type must be exactly one of two types (and not the union)?<p>I have a function that takes an argument and a processing function, and always returns a tuple. How can I tell typescript that if I pass one type of argument, the processing function can accept only that type, and... | <p>The TypeScript type checker can't really verify much about the behavior of <a href="https://www.typescriptlang.org/docs/handbook/2/conditional-types.html" rel="nofollow noreferrer">conditional types</a> that depend on <a href="https://www.typescriptlang.org/docs/handbook/2/generics.html" rel="nofollow noreferrer">ge... | How to indicate that a (TypeScript) parameter type must be exactly one of two types (and not the union)? | typescript | 1 | 56 | 2 | 72,396,894 | 72,396,894 | 1 | true | 2022-05-25T19:35:28.553Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to indicate that a (TypeScript) parameter type must be exactly one of two types (and not the union)?<p>I have a function that takes an argument and a pro... |
72,396,765 | How to perform a check for a particular FirebaseFirestore error code?<p>I have the following code:</p>
<pre><code>db.collection("property").document(userUID).update(propertyRoot).addOnSuccessListener(
new OnSuccessListener<Void>(){
@Override
public... | <p>That should be possible if you cast the exception to a <a href="https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/FirebaseFirestoreException" rel="nofollow noreferrer"><code>feedbackFirebaseFirestoreException </code> object</a> and then check its <code>getCode()</code> value against th... | How to perform a check for a particular FirebaseFirestore error code? | java|android|firebase|google-cloud-firestore | 0 | 56 | 1 | 72,397,587 | 72,397,587 | 1 | true | 2022-05-26T19:01:10.570Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to perform a check for a particular FirebaseFirestore error code?<p>I have the following code:</p>
<pre><code>db.collection("property").documen... |
72,397,575 | ERC20 Payment processing<p>What's wrong with my smart contract, because I get "Error: cannot estimate gas; transaction may fail or may require manual gas limit". On frontend I am calling approveTokens() first and acceptPayment() later</p>
<pre><code>pragma solidity ^0.8.11;
import '@openzeppelin/contracts/to... | <p>Users need to call <code>approve()</code> directly on the <code>token</code> address - not through your contract.</p>
<p>Your current implementation approves <code>owner</code> to spend <code>PaymentProcessor</code>'s tokens because <code>PaymentProcessor</code> is the <code>msg.sender</code> in the context of the <... | ERC20 Payment processing | blockchain|solidity | 0 | 56 | 1 | 72,397,683 | 72,397,683 | 1 | true | 2022-05-26T20:15:34.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ERC20 Payment processing<p>What's wrong with my smart contract, because I get "Error: cannot estimate gas; transaction may fail or may require manual ga... |
72,372,306 | How to bing click/mousedown events for HTML Audio element<p>In the below shared stackblitz example, i have bound mousedown and click event for the audio element wrapper which is not triggered. I need to perform my own action, with audio element click being performed.</p>
<p>Couldn't find any solutions for this case, an... | <p>Tried the below way of wrapping inside the <strong>figure</strong> HTML element, which is an alternate solution <strong>instead of wrapping a separate element</strong> above the <strong>audio</strong> element. Those who want to wrap the audio elements within a inline/block nodes.</p>
<pre><code>```css
figure {
d... | How to bing click/mousedown events for HTML Audio element | javascript|html|typescript|html5-video|html5-audio | 2 | 56 | 2 | 72,416,294 | 72,416,294 | 1 | true | 2022-05-25T05:20:33.500Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to bing click/mousedown events for HTML Audio element<p>In the below shared stackblitz example, i have bound mousedown and click event for the audio elem... |
72,394,438 | Can I modify pd.Series.value_counts so that by default `dropna=False`?<p>When using <code>pd.Series.value_counts</code> I almost always add the parameter <code>dropna=False</code>. Is there a simple way to set this as the default value without creating a separate function?</p>
<p>I (<a href="https://github.com/pandas-d... | <p>You can check the parameters of <code>pd.Series.value_counts</code>:</p>
<pre class="lang-py prettyprint-override"><code>print(pd.Series.value_counts.__annotations__)
# Ouput
{'normalize': 'bool', 'sort': 'bool', 'ascending': 'bool', 'dropna': 'bool'}
</code></pre>
<p>And the associated default values:</p>
<pre clas... | Can I modify pd.Series.value_counts so that by default `dropna=False`? | python|pandas | 1 | 56 | 1 | 72,417,788 | 72,417,788 | 1 | true | 2022-05-26T15:39:32.607Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can I modify pd.Series.value_counts so that by default `dropna=False`?<p>When using <code>pd.Series.value_counts</code> I almost always add the parameter <co... |
72,392,012 | Ruby float to date time<p>I've got response from <code>Sidekiq::Worker</code> where <code>created_at</code> is a float</p>
<p>active_workers.map { |w| w.dig('created_at') }.first
=> 1653562493.6044002</p>
<p>How to change that value to date time? I've tried to do simple <code>.to_date</code> but it return me an erro... | <p>Just adding the answer mentioned in the comment by Stefan</p>
<pre><code>Time.at(1653562493.6044002)
</code></pre>
<p>Also, if Timezone is a crucial factor we can use the below code as well</p>
<pre><code>Time.zone.at(1653562493.6044002)
</code></pre> | Ruby float to date time | ruby-on-rails|ruby | 0 | 56 | 1 | 72,432,038 | 72,432,038 | 1 | true | 2022-05-26T12:43:40.380Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ruby float to date time<p>I've got response from <code>Sidekiq::Worker</code> where <code>created_at</code> is a float</p>
<p>active_workers.map { |w| w.dig(... |
72,370,401 | How can I make my tkinter program autoupdate?<p>I'm using python and tkinter to create a little program. I'd like to make the program check if the version the user is using is the most recent version. If not, then I'd like a window pop up to prompt the user to update. Then, I'd like my software to automatically install... | <p>Here is the code I made:
<em>Side Note: I dont know if you would want to download multiple or just one, the example I gave just download one</em></p>
<pre class="lang-py prettyprint-override"><code>from tkinter import *
import requests
import os
import sys
VERSION = 0
def check_updates():
try:
link = &... | How can I make my tkinter program autoupdate? | python|tkinter | 0 | 56 | 1 | 72,476,818 | 72,476,818 | 1 | true | 2022-05-24T23:15:11.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I make my tkinter program autoupdate?<p>I'm using python and tkinter to create a little program. I'd like to make the program check if the version th... |
72,310,931 | InputBox to enter details, if no details loop back on itself<p>I need my InputBox to require a text entry.<br />
If its blank have and error message and return to the InputBox.<br />
If cancelled the new sheet be removed and go back to the beginning.</p>
<p>I used the record Macro function.</p>
<pre class="lang-vb pret... | <p>Edit: <del>I just thought of an edgecase where the user might be stuck in an endless loop if they try to cancel after entering nothing, will update this once I tested it.</del>
After proper testing it turns out this isn't a problem.</p>
<p>By using a variable and if-statements you will be able to check for those cas... | InputBox to enter details, if no details loop back on itself | excel|vba | 0 | 56 | 1 | 72,312,040 | 72,312,040 | 1 | true | 2022-05-19T20:51:23.663Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
InputBox to enter details, if no details loop back on itself<p>I need my InputBox to require a text entry.<br />
If its blank have and error message and retu... |
72,350,127 | Incompatible two void functions declaration<p>I have a problem about declaring two void functions in my template "Wallet" class, which are going to remove and add existing template class "CreditCard" to the vector. Compiler writes that "declaration is incompatible"</p>
<pre><code>#pragma o... | <p>The <strong>problem</strong> is that <code>CreditCard</code> is a class template which is different from a <strong>class-type</strong>. So we have to specify the template argument list to make it a type.</p>
<p>To <strong>solve</strong> this you can specify the template arguments to <code>CreditCard</code> as shown ... | Incompatible two void functions declaration | c++|oop|templates|declaration | 0 | 56 | 1 | 72,350,215 | 72,350,215 | 1 | true | 2022-05-23T14:19:01.240Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Incompatible two void functions declaration<p>I have a problem about declaring two void functions in my template "Wallet" class, which are going to... |
72,298,410 | How to plot logical matrix in python<p>How do I plot a logical array in python, for example, I have this code:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
filename = r"test.jpg"
img = cv2.imread(filename)
cv2.imshow("image", img)
b, g, r = cv2.split(img)
cv2.imshow('Green', g... | <p>You are mostly there, you need to enclose the conditional statement.</p>
<p><strong>Code:</strong></p>
<pre><code>img = cv2.imread('parrot.jpg')
b, g, r = cv2.split(img)
# create 2-channel image of the same shape
# here is where we will display the result
mask = np.zeros((img.shape[0], img.shape[1]), np.uint8)
# C... | How to plot logical matrix in python | python|numpy|opencv | 1 | 56 | 1 | 72,299,773 | 72,299,773 | 1 | true | 2022-05-19T03:49:32.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to plot logical matrix in python<p>How do I plot a logical array in python, for example, I have this code:</p>
<pre><code>import numpy as np
import matpl... |
72,351,694 | Is it possible to use a python list as a choice?<p>All. I am a bit new to Python. I have recently taken a course and followed a few tutorials. I am trying to explore on my own and just make "something". This is for a texted-based RPG. I am trying to read the users input from a pre-existing list I already crea... | <p>Could achieve this in different ways. I assume you want a while loop though.</p>
<p>One way would be using if/elif against a list.</p>
<p>Code:</p>
<pre><code>right_Choices = ["right", "Right", "RIGHT"]
left_Choices = ["left", "Left", "LEFT"]
while True:
... | Is it possible to use a python list as a choice? | python|linux|windows | 1 | 56 | 2 | 72,352,118 | 72,352,118 | 1 | true | 2022-05-23T16:11:30.807Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to use a python list as a choice?<p>All. I am a bit new to Python. I have recently taken a course and followed a few tutorials. I am trying to... |
72,375,134 | How would you display these two div elements?<p>I'm struggling to display two div elements correctly right next to each other and I'm not sure what would be the best way to go about this.
<a href="https://i.stack.imgur.com/veFmB.jpg" rel="nofollow noreferrer">Here you can see what it looks like live</a></p>
<p>And this... | <p>From what I understand, you want to display the albums side by side.
To achieve that you can place both the albums in a parent container (Example: classname = albums) and give it a <code>display:flex</code>.</p>
<p>Also you can use <code>justify-content: space-between;</code> to place it in two ends. <code>float: ri... | How would you display these two div elements? | html|css | 0 | 56 | 3 | 72,375,228 | 72,375,228 | 1 | true | 2022-05-25T09:32:52.720Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How would you display these two div elements?<p>I'm struggling to display two div elements correctly right next to each other and I'm not sure what would be ... |
72,379,021 | Why can I not use getElementById as a callback to Array#map?<p>To map an array of stringified numbers to actual Numbers, I can simply pass the Number function:</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... | <p>You can find an explanation of what is happening <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Called_on_incompatible_type" rel="nofollow noreferrer">here</a>:</p>
<blockquote>
<p>When this error is thrown, a function (on a given object), is called with a <code>this</code> not cor... | Why can I not use getElementById as a callback to Array#map? | javascript|dom|array-map | 0 | 56 | 2 | 72,379,262 | 72,379,262 | 1 | true | 2022-05-25T13:57:56.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can I not use getElementById as a callback to Array#map?<p>To map an array of stringified numbers to actual Numbers, I can simply pass the Number functio... |
72,400,521 | Python True Copy Within a Class<p>For some reason, I have a list that keeps getting modified despite being explicitly a deep copy. It appears to be unmodified as it goes through the loop, but it suddenly is modified once it exists? I must be missing something that pertains to Python's rules and logic, but I can't figur... | <p>Notice, the local variable <code>list_to_copy</code> is the deepcopy, not <code>self.availible_moves</code>. You are saving a deepcopy of <code>self.availible_moves</code> and it is being stored in the <code>list_to_copy</code> variable you defined. <code>list_to_copy</code> never changes as expected from a deepcopy... | Python True Copy Within a Class | python|list|class|deep-copy | 1 | 56 | 1 | 72,402,786 | 72,402,786 | 1 | true | 2022-05-27T04:38:35.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python True Copy Within a Class<p>For some reason, I have a list that keeps getting modified despite being explicitly a deep copy. It appears to be unmodifie... |
72,286,376 | Get data between two tags<p>I need to extract text between two tags <code><mail></code> and <code></mail></code></p>
<p>This is the text</p>
<pre><code><?xml version='1.0' encoding='utf-16'?>
<li xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
... | <p>By default, the <code>.</code> pattern does not match across multiple lines.</p>
<p>Enable <a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-options#single-line-mode" rel="nofollow noreferrer">single-line</a> mode to change its behaviour:</p>
<blockquote>
<p>Changes the meaning ... | Get data between two tags | regex|powershell|powershell-2.0|powershell-3.0|powershell-4.0 | 1 | 56 | 1 | 72,288,669 | 72,288,669 | 1 | true | 2022-05-18T09:17:14.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get data between two tags<p>I need to extract text between two tags <code><mail></code> and <code></mail></code></p>
<p>This is the text</p>
<pre... |
72,289,855 | How to repeatedly execute a stored procedure in a loop?<p>Imagine we have a stored procedure <code>dbo.MyStoredProcedure</code> that takes <code>@Id</code> as parameter and then does some work.</p>
<p>I have a CSV containing over 1000 rows of different Id's. How do I the best and easiest way execute <code>dbo.MyStoredP... | <p>You sould ideally work on sets like @larnu alludes to in comments. However if you can't change the proc you're a bit stuck...</p>
<p>If you can import your CSV into a table you can use a CURSOR. Do note the obligatory warning that looping in SQL Server is <em><strong>nearly always not the best solution</strong></em... | How to repeatedly execute a stored procedure in a loop? | sql|sql-server|loops | -1 | 56 | 1 | 72,290,104 | 72,290,104 | 1 | true | 2022-05-18T13:09:53.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to repeatedly execute a stored procedure in a loop?<p>Imagine we have a stored procedure <code>dbo.MyStoredProcedure</code> that takes <code>@Id</code> a... |
72,348,050 | How to avoid wrapping of elements in a long list with scrollbars in Firefox<p>I have a long flex list which should wrap it's items (Buttons) when they have not enough space (flex-wrap). However, as soon as the list gets a scrollbar, the items will be wrapped in Firefox even if there is enough space.</p>
<p>Chrome displ... | <p>I see the flex container taking the whole available space in the viewport as expected by <code>height: 100vh;</code>. I'm using firefox.</p>
<p>Then your next problem is not about the vertical space but how to correctly display elements inline. You should have your buttons with <code>display: inline-block;</code> to... | How to avoid wrapping of elements in a long list with scrollbars in Firefox | html|css|firefox | 0 | 56 | 1 | 72,348,369 | 72,348,369 | 1 | true | 2022-05-23T11:48:39.167Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to avoid wrapping of elements in a long list with scrollbars in Firefox<p>I have a long flex list which should wrap it's items (Buttons) when they have n... |
72,388,627 | Pytorch matrix multiplication<p>I'm struggling with dimension and matric multiplication in pytorch.
I want to multiply matrix A</p>
<pre><code>tensor([[[104.7500, 111.3750, 138.2500, 144.8750],
[104.2500, 110.8750, 137.7500, 144.3750]],
[[356.8750, 363.5000, 390.3750, 397.0000],
[356.3750, 36... | <p>This example would be helpful:</p>
<pre><code>a = torch.ones((4, 4)).long()
a = a.reshape(2, 2, 4)
b = torch.tensor(list(range(36*6)))
b = b.reshape(2, 3, 4, 9)
t1 = a[0] @ b[0, :]
t2 = a[1] @ b[1, :]
result = t1 + t2
</code></pre>
<hr />
<pre><code>accum = torch.zeros((b.shape[1], a.shape[1], b.shape[3]))
for i in... | Pytorch matrix multiplication | python|pytorch|tensor | 0 | 56 | 2 | 72,389,369 | 72,389,369 | 1 | true | 2022-05-26T08:00:19.833Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pytorch matrix multiplication<p>I'm struggling with dimension and matric multiplication in pytorch.
I want to multiply matrix A</p>
<pre><code>tensor([[[104.... |
72,294,416 | shifting result using <<<p><a href="https://i.stack.imgur.com/MqBeP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MqBeP.png" alt="enter image description here" /></a>I want to calculate the string value that is return from a function, which is a hex value in string type. I used int(,16) to convert ... | <p>Your NEW problem is one of precedence. <code>+</code> has higher precedence than <code><<</code> so your statement is parsed like <code>value = value_high << (18 + value_low)</code>.</p>
<p>To solve this, add parentheses explicitly, like: <code>value = (value_high << 18) + value_low</code>.</p> | shifting result using << | python | 0 | 56 | 2 | 72,294,533 | 72,294,533 | 1 | true | 2022-05-18T18:40:00.543Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
shifting result using <<<p><a href="https://i.stack.imgur.com/MqBeP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MqBeP.png" alt="enter ... |
72,277,683 | Using regular expression to match and replace<p>There is a list of string A which is some how matching with another list of string B. I wanted to replace string A with list of matching string B using regular expression. However I am not getting the correct result.</p>
<p>The solution should be <code>A == ["Yogesh&... | <p>this one works to me:</p>
<pre><code>lst=[]
for a in A:
lst.append([b for b in B if b.lower() in a.lower()][0])
</code></pre>
<p>This returns element from list B if it is found at A list. It's necessary to compare lowercased words. The <code>[0]</code> is added for getting string instead of list from comprehensi... | Using regular expression to match and replace | python|regex|python-re | 0 | 56 | 2 | 72,277,961 | 72,277,961 | 1 | true | 2022-05-17T16:32:28.837Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using regular expression to match and replace<p>There is a list of string A which is some how matching with another list of string B. I wanted to replace str... |
72,341,614 | What are the semantics of fdatasync() when used on a directory descriptor?<p>Specifically, can <code>fdatasync</code> be used in place of <code>fsync</code> if I only care about the directory structure and not timestamps or other directory metadata. If it can, does it have any performance advantages?</p>
<p>Does POSIX ... | <p>Think of it from the point of view of the VFS API, it's generally implemented as: sync content + optionally metadata. In a directory it means: sync some of children metadata + optionally it's own metadata.</p>
<p>However, ultimately, how to handle it, is up to the file system.</p>
<p>If the attributes metadata is pa... | What are the semantics of fdatasync() when used on a directory descriptor? | linux|filesystems|posix|freebsd|fsync | 2 | 56 | 1 | 72,408,893 | 72,408,893 | 1 | true | 2022-05-22T22:09:25.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What are the semantics of fdatasync() when used on a directory descriptor?<p>Specifically, can <code>fdatasync</code> be used in place of <code>fsync</code> ... |
72,311,226 | How to keep an icon in one side of a chart in JFreeChart Java<p>I have the following chart:</p>
<p><a href="https://i.stack.imgur.com/VTxsO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VTxsO.png" alt="enter image description here" /></a></p>
<p>The chart is dynamic and has the capability of make z... | <p>I looks like you want to annotate "one side of the…chart, ignoring the value of the <em>X</em> axis". Ordinarily, such <a href="https://www.jfree.org/jfreechart/javadoc/org/jfree/chart/annotations/package-summary.html" rel="nofollow noreferrer">annotations</a> specify both coordinates in <em>data</em> spac... | How to keep an icon in one side of a chart in JFreeChart Java | java|annotations|icons|jfreechart | 1 | 56 | 1 | 72,370,245 | 72,370,245 | 1 | true | 2022-05-19T21:23:18.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to keep an icon in one side of a chart in JFreeChart Java<p>I have the following chart:</p>
<p><a href="https://i.stack.imgur.com/VTxsO.png" rel="nofollo... |
72,302,914 | Creating list of unique_ptr using initialization list and make_unique fails in GCC 5.4<p>I am using GCC 5.4 for compiling a test program in C++ 14.</p>
<pre><code>#include <type_traits>
#include <list>
#include <iostream>
#include <memory>
int main()
{
int VALUE = 42;
const auto list_ =... | <p>You can use:</p>
<pre><code>const std::initializer_list<std::unique_ptr<int>> list{
std::make_unique< int >( 42 ),
std::make_unique< int >( 0 ),
std::make_unique< int >( 0 )
};
</code></pre>
<p><a href="https://godbolt.org/z/1Wz9jsKj7" rel="nofollow noreferrer">Demo</a> (old... | Creating list of unique_ptr using initialization list and make_unique fails in GCC 5.4 | c++|gcc|c++14|unique-ptr | 0 | 56 | 1 | 72,303,868 | 72,303,868 | 1 | true | 2022-05-19T10:27:25.570Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating list of unique_ptr using initialization list and make_unique fails in GCC 5.4<p>I am using GCC 5.4 for compiling a test program in C++ 14.</p>
<pre>... |
72,263,780 | Custom return MongoDB aggregate<p>I'm trying to do some testing with MongoDB and I have figured some of the simpler MySQL queries MongoDB. Now, I have this slightly more complex query.</p>
<p>I have this query that tells me if there was a message in a certain period from a determined user:</p>
<pre class="lang-sql pret... | <p>You just need one more <code>$addFields</code> stage to apply <code>$cond</code> to your <code>value</code></p>
<pre class="lang-js prettyprint-override"><code>db.collection.aggregate([
{
$match: {
$and: [
{
user_id: "256f5280-fb49-4ad6-b7f5-65c4329d46e0"
},
{
... | Custom return MongoDB aggregate | sql|mongodb|mongodb-query|aggregation-framework | -1 | 56 | 1 | 72,265,543 | 72,265,543 | 1 | true | 2022-05-16T18:13:28.553Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Custom return MongoDB aggregate<p>I'm trying to do some testing with MongoDB and I have figured some of the simpler MySQL queries MongoDB. Now, I have this s... |
72,328,669 | Algorithm to find all combination from an array of objects<p>Recently a friend of mine proposed to solve a simple problem and I'm struggle to find the best algorithm to solve it.</p>
<p>There's a list of <strong>athletes</strong>, every athlete has a name, a weight and can have multiple roles, at least 1 maximum 3 ( <s... | <blockquote>
<p>What is the best algorithm to find <strong>all possible combination</strong> for this problem?</p>
</blockquote>
<p>In the worst case, where you have <code>n >= 6</code> athletes, each weighing so little that the limit doesn't matter, and each able to play all roles, the number of teams grows very, v... | Algorithm to find all combination from an array of objects | algorithm|time-complexity|combinations | 1 | 56 | 1 | 72,342,537 | 72,342,537 | 1 | true | 2022-05-21T10:23:01.693Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Algorithm to find all combination from an array of objects<p>Recently a friend of mine proposed to solve a simple problem and I'm struggle to find the best a... |
72,349,658 | How to debug a legacy Azure function<p>I've been given the task to debug an Azure function on VS 2022 targeting .Net Framework 4.8. While its straight forward to debug it in .Net Core 3.0 or later, I keep getting the error - A project with an Output Type of Class Library cannot be started directly, when I try to run it... | <p>We have tried to create Azure function with <code>.net framework 4.8</code> and successfully tested in our local by using <em>visual studio 2022</em>.</p>
<ul>
<li><p>We have installed <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v4%2Cwindows%2Ccsharp%2Cportal%2Cbash#v2" r... | How to debug a legacy Azure function | azure|azure-functions | 0 | 56 | 1 | 72,353,016 | 72,353,016 | 1 | true | 2022-05-23T13:46:16.427Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to debug a legacy Azure function<p>I've been given the task to debug an Azure function on VS 2022 targeting .Net Framework 4.8. While its straight forwar... |
72,240,873 | Find last available date if date does not exist in other DataFrame<p>Suppose that you have two data frames which can be created using code below:</p>
<pre><code>df1 = pd.DataFrame(data={'start_date': ['2021-07-02', '2021-07-09',
'2021-07-16', '2021-07-23',
... | <p>You can try <a href="https://pandas.pydata.org/docs/reference/api/pandas.merge_asof.html" rel="nofollow noreferrer"><code>pandas.merge_asof</code></a></p>
<pre class="lang-py prettyprint-override"><code>df1[['start_date', 'end_date']] = df1[['start_date', 'end_date']].apply(pd.to_datetime)
price_df['date'] = pd.to_d... | Find last available date if date does not exist in other DataFrame | python|pandas|dataframe|replace|isin | 1 | 56 | 1 | 72,241,247 | 72,241,247 | 1 | true | 2022-05-14T13:53:38.790Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find last available date if date does not exist in other DataFrame<p>Suppose that you have two data frames which can be created using code below:</p>
<pre><c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.