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,336,212 | Adding items from list to the dictionaries in another list<p>I'm trying to add items from list to the dictionaries in another list.</p>
<pre><code>info = [{'id' : 1, 'tag' : 'Football'}, {'id' : 2, 'tag' : 'MMA'}]
dates = ['May 1st', 'April 23rd']
for item in dates:
for dic in info:
dic['date'] = item
</code>... | <p>If you nest the for cycles then only the last iteration of the first for matters.</p>
<p>The correct way to do it is cycling in parallel over the two list, using the function <code>zip</code>.</p>
<pre><code>info = [{'id' : 1, 'tag' : 'Football'}, {'id' : 2, 'tag' : 'MMA'}]
dates = ['May 1st', 'April 23rd']
for item... | Adding items from list to the dictionaries in another list | python|python-3.x | 2 | 52 | 2 | 72,336,255 | 72,336,255 | 4 | true | 2022-05-22T09:15:33.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding items from list to the dictionaries in another list<p>I'm trying to add items from list to the dictionaries in another list.</p>
<pre><code>info = [{'... |
72,325,131 | How do I convert a string with a first name and last name to an object w/ properties of {firstName: "string first name", lastName: "string last name}?<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 prettyprin... | <p>Just split on the space character.</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>function convertNameToObject(string) {
const [firstName, lastName] = string.split(" ")... | How do I convert a string with a first name and last name to an object w/ properties of {firstName: "string first name", lastName: "string last name}? | javascript|string | 0 | 52 | 2 | 72,325,148 | 72,325,148 | 4 | true | 2022-05-20T21:57:14.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I convert a string with a first name and last name to an object w/ properties of {firstName: "string first name", lastName: "string last name}?<p><div... |
72,313,425 | Is the ManuallyDrop ABI guaranteed to be repr(transparent)?<p>The <a href="https://doc.rust-lang.org/nomicon/other-reprs.html" rel="nofollow noreferrer">nomicon</a> says:</p>
<blockquote>
<h3>repr(transparent)</h3>
<p>[...]
This repr is only considered part of the public ABI of a type if either the single field is pub,... | <p>This was actually <a href="https://github.com/rust-lang/rust/pull/88375/files" rel="noreferrer">just clarified</a> with today's release of <a href="https://github.com/rust-lang/rust/blob/stable/RELEASES.md#version-1610-2022-05-19" rel="noreferrer">Rust 1.61.0</a>. The documentation of <code>ManuallyDrop</code> now s... | Is the ManuallyDrop ABI guaranteed to be repr(transparent)? | rust | 4 | 52 | 1 | 72,313,657 | 72,313,657 | 7 | true | 2022-05-20T03:56:06.020Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is the ManuallyDrop ABI guaranteed to be repr(transparent)?<p>The <a href="https://doc.rust-lang.org/nomicon/other-reprs.html" rel="nofollow noreferrer">nomi... |
72,329,739 | Assigning std::minmax result to new variables<p><code>auto [x, y] = std::minmax(a, b)</code> defines <code>x</code> and <code>y</code> as references to <code>a</code> and <code>b</code> (or <code>b</code> and <code>a</code>).</p>
<p>How do I make <code>x</code> and <code>y</code> new variables initialized with min and ... | <p>You can use the overload of the <code>std::initializer_list</code> version, which returns <code>pair<T, T></code>.</p>
<pre><code>auto [x, y] = std::minmax({a, b});
</code></pre> | Assigning std::minmax result to new variables | c++ | 5 | 52 | 1 | 72,329,812 | 72,329,812 | 7 | true | 2022-05-21T12:53:11.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Assigning std::minmax result to new variables<p><code>auto [x, y] = std::minmax(a, b)</code> defines <code>x</code> and <code>y</code> as references to <code... |
72,327,344 | How to check that they belong to the same class in c++ test Visual Studio?<p>I want to check if the constructor is initialized correctly, but I don't know which assert method to use</p>
<pre><code>TEST_METHOD(testInitNavigator)
{
Room room;
INavigator navigator(room);
Assert:... | <p>I think it is correct so</p>
<pre><code> TEST_METHOD(testInitNavigator)
{
Room room;
INavigator navigator(room);
Assert::IsTrue(typeid(room).name() == typeid(navigator.getLocalRoom()).name());
}
</code></pre> | How to check that they belong to the same class in c++ test Visual Studio? | c++|visual-studio|unit-testing | -2 | 52 | 1 | 72,327,376 | 72,327,376 | -1 | true | 2022-05-21T06:55:12.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check that they belong to the same class in c++ test Visual Studio?<p>I want to check if the constructor is initialized correctly, but I don't know wh... |
72,837,827 | How can I make it display what I need after the condition is met<p>Here is my code:</p>
<pre><code>start_bot=input("Enter '/start' to start the bot: ")
while start_bot!=("/start"):
print (input("Enter start!"))
if start_bot==("/start"):
print("Welcome!")
</... | <p>I guess you need to set the last conditional statement out of the loop, and reassign the <code>start_bot</code> variable inside it:</p>
<pre><code>start_bot=input("Enter '/start' to start the bot: ")
while start_bot!=("/start"):
start_bot=input("Enter start!")
print("Welcome!&q... | How can I make it display what I need after the condition is met | python|while-loop | 0 | 52 | 1 | 72,837,861 | 72,837,861 | 1 | true | 2022-07-02T09:04:52.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I make it display what I need after the condition is met<p>Here is my code:</p>
<pre><code>start_bot=input("Enter '/start' to start the bot: &qu... |
73,016,012 | DataFrame idxmin returning weird values<p>I have a dataframe. I use</p>
<pre><code>df[:10].idxmin()
</code></pre>
<p>Since I only want to take the index of the min value in the first 10 rows. But it gives me values for the 58th row and so on. What is wrong and what am I missing?</p> | <p>Parameters for idxmin :
axis : 0 or ‘index’ for row-wise, 1 or ‘columns’ for column-wise
skipna : Exclude NA/null values. If an entire row/column is NA, the result will be NA.</p>
<p>Use <code>df.idxmin(axis = 0)</code> for rows or <code>df.idxmin(axis = 1)</code> for column.</p>
<p>Example:</p>
<pre><code>df
A ... | DataFrame idxmin returning weird values | python|pandas | -1 | 52 | 2 | 73,016,042 | 73,016,042 | 1 | true | 2022-07-17T23:20:14.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
DataFrame idxmin returning weird values<p>I have a dataframe. I use</p>
<pre><code>df[:10].idxmin()
</code></pre>
<p>Since I only want to take the index of t... |
72,986,734 | Rails 6 Gradient will not take up the whole page no matter WHAT I do<p>I am having an extremly frustrating problem with Rails. If I use a regular HTML page with no rails the gradient works properly. If I put it into my Rails app it will NOT work right no matter what I do. It will either take up only the center of the... | <p>Ok I finally figured this out. I added the additional -ms- and -o- prefixes and that did NOTHING at all. I left them in anyway since that post that @Sagmar recommended it.</p>
<p>So in the end this was my CSS code:</p>
<pre><code>.login-bg {
background: rgb(236,240,241);
background: -moz-linear-gradient(1... | Rails 6 Gradient will not take up the whole page no matter WHAT I do | html|css|ruby-on-rails|sass|background | -1 | 52 | 1 | 73,199,056 | 73,199,056 | 1 | true | 2022-07-14T21:14:35.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rails 6 Gradient will not take up the whole page no matter WHAT I do<p>I am having an extremly frustrating problem with Rails. If I use a regular HTML page ... |
73,007,363 | TYPO3 11.4 DBAL compatibility<p>In this changelog: <a href="https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.4/Important-94697-QuoteDatabaseIdentifiersWhenUsedInsteadOfGloballyUpfront.html?highlight=dbal" rel="nofollow noreferrer">https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.4/Importan... | <p>TypoScript is not related to this change.<br />
TypoScript options are described <a href="https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/" rel="nofollow noreferrer">here</a> and if there will be a change it will be <a href="https://docs.typo3.org/c/typo3/cms-core/main/en-us/Index.html" rel="nofollow ... | TYPO3 11.4 DBAL compatibility | typo3|typo3-11.x | 0 | 52 | 1 | 73,009,393 | 73,009,393 | 1 | true | 2022-07-16T20:13:29.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TYPO3 11.4 DBAL compatibility<p>In this changelog: <a href="https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.4/Important-94697-QuoteDatabaseId... |
72,869,990 | ASP.NET Core asp-fallback tag helper with pseudo selectors (and bootstrap-icons)<p>I'm using ASP.NET Core 6, with the <code>asp-fallback</code> feature of the <code><link></code> tag helper (I <a href="https://stackoverflow.com/q/51363291/9971404">know</a> how to use it, and it works well for me).</p>
<p>I'm also... | <p>The <code>LinkTagHelper</code> fallback mechanism does not support pseudo selectors. There is a tracking issue on <a href="https://github.com/dotnet/aspnetcore/issues/38146" rel="nofollow noreferrer">the repo</a>, so maybe it'll be fixed in v7.</p>
<p>Until then I'm using a <strong>WORKAROUND</strong>. I extended th... | ASP.NET Core asp-fallback tag helper with pseudo selectors (and bootstrap-icons) | c#|asp.net-core|razor|asp.net-core-6.0|asp.net-core-tag-helpers | 1 | 52 | 1 | 72,869,991 | 72,869,991 | 1 | true | 2022-07-05T13:07:22.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ASP.NET Core asp-fallback tag helper with pseudo selectors (and bootstrap-icons)<p>I'm using ASP.NET Core 6, with the <code>asp-fallback</code> feature of th... |
73,011,443 | Jsp can't get session attribute value<p>I wrote a servlet.</p>
<pre><code>request.setAttribute("itemCount", 1000);
request.getRequestDispatcher("test.jsp").forward(request, response);
</code></pre>
<p>And in test.jsp I wrote:</p>
<pre><code><%@ page language="java" contentType="tex... | <p>In your servlet, you can try using:</p>
<pre><code>request.getSession().setAttribute("itemCount", 1000);
</code></pre>
<p>& then in your jsp, you can access <code>itemCount</code> the way you are accessing.</p>
<p>Or alternatively,</p>
<p>use</p>
<pre><code><%
String name=(String)request.getAttribu... | Jsp can't get session attribute value | java|jsp|session|servlets | -1 | 52 | 1 | 73,011,488 | 73,011,488 | 1 | true | 2022-07-17T11:39:20.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Jsp can't get session attribute value<p>I wrote a servlet.</p>
<pre><code>request.setAttribute("itemCount", 1000);
request.getRequestDispatcher(&qu... |
73,018,576 | simple method to print star pyramid with minimal code in dart?<p>What is the simplest method to print star pyramid with minimal code?
It shouldn't use more than one looping statement.
I've produced pyramids with nested loop but I need more leaner code.</p> | <pre><code> const int row = 5;
for(int i = 0;i<row;i++){
stdout.writeln(" "*(row-i)+"* "*i);
}
</code></pre> | simple method to print star pyramid with minimal code in dart? | dart | 0 | 52 | 1 | 73,018,646 | 73,018,646 | 1 | true | 2022-07-18T07:21:40.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
simple method to print star pyramid with minimal code in dart?<p>What is the simplest method to print star pyramid with minimal code?
It shouldn't use more t... |
72,970,384 | Is there any way to get reference to object that called a method in java?<p>I need some way to get an instance of a class that called some method. For example, in this program, I want to get the instance of <code>Person</code> (named Jack here) that called method <code>Main.call()</code>.</p>
<pre class="lang-java pret... | <p>There isn't a way to do it that can't be subverted with relative ease. Which renders this kind of pointless as a security mechanism.</p>
<p>Note that it might be (have been!) possible to do something using <code>SecurityManager</code>, but that assumes that your code is only called from code that is in a "san... | Is there any way to get reference to object that called a method in java? | java|methods|call|stack-trace | -2 | 52 | 1 | 73,001,556 | 73,001,556 | 1 | true | 2022-07-13T17:31:00.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there any way to get reference to object that called a method in java?<p>I need some way to get an instance of a class that called some method. For exampl... |
73,028,930 | How fix a problem when I change the expression of `x_new` inside the following function `phix`?<p>I try to change the expression of <code>x_new</code> inside the following function <code>phix</code> defined as follows.</p>
<p>[![enter image description here][1]][1]</p>
<p>The code for this function is as follows.</p>
<... | <p>Even though, you could just use <code>np.vectorize</code>, you may better step back and re-think what actually happens when working with numpy arrays. This will help you to write more efficient/faster code, so you do not start blaming python for being slow :-).</p>
<p>In the original function, you want to replace th... | How fix a problem when I change the expression of `x_new` inside the following function `phix`? | python|numpy | 0 | 52 | 2 | 73,034,183 | 73,034,183 | 1 | true | 2022-07-18T21:42:04.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How fix a problem when I change the expression of `x_new` inside the following function `phix`?<p>I try to change the expression of <code>x_new</code> inside... |
72,900,343 | how to apply if condition based on date format in pandas<p>in a folder I have multiple csv files. Few files have date format in 2022-01-01 format and few in 01/01/2022. I have set date as index in all files. Now I need to parse the dates. I am using below method:</p>
<pre><code>if df.index.format() == "%Y-%m-%d&qu... | <p>I can suggest you using <strong>convtools</strong> library as a helper here (<a href="https://github.com/westandskif/convtools" rel="nofollow noreferrer">github</a> | <a href="https://convtools.readthedocs.io/en/latest/tables.html" rel="nofollow noreferrer">Table docs</a>).</p>
<p>The code below assumes there's a fi... | how to apply if condition based on date format in pandas | python|pandas | 0 | 52 | 2 | 72,900,713 | 72,900,713 | 1 | true | 2022-07-07T15:15:16.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to apply if condition based on date format in pandas<p>in a folder I have multiple csv files. Few files have date format in 2022-01-01 format and few in ... |
72,774,228 | Faster code to find the colored cells (Interior) ,OR speed up `For each` Loop<p>I am using below code to select the <strong>colored cells</strong> (interior) on UsedRange exclude First Row.<br>
It works ,but it is slow with huge ranges e.g 20k. <br>
Is there a faster method or speed up <code>For each</code> Loop. <br>
... | <blockquote>
<p>yes you can consider the colored cell have only one color yellow</p>
</blockquote>
<p>Maybe this kind of code is faster ?</p>
<pre><code>Sub test()
Set crg = ws.UsedRange
Set crg = crg.Offset(1, 0).Resize(crg.Rows.Count - 1, crg.Columns.Count)
With Application.FindFormat
.Clear
.Interior.Color ... | Faster code to find the colored cells (Interior) ,OR speed up `For each` Loop | excel|vba|for-loop|optimization | 1 | 52 | 1 | 72,777,227 | 72,777,227 | 1 | true | 2022-06-27T14:58:22.007Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Faster code to find the colored cells (Interior) ,OR speed up `For each` Loop<p>I am using below code to select the <strong>colored cells</strong> (interior)... |
72,912,081 | Python: Parsing data containing both types of quotation as well as special characters<p>Hi All I am working on a project where I need to parse some data containing both " and ' quotation marks as well as special characters. While the data is confidential and therefore cannot be posted on here the text below replic... | <p>I think the problem lies in the <code>shlex</code> module, stripping the quotation marks. But there is an easy solution with the extra argument <code>posix=False</code>. With this argument, the quotation marks are kept intact, see e.g. here:</p>
<pre class="lang-py prettyprint-override"><code>import io
import shlex
... | Python: Parsing data containing both types of quotation as well as special characters | python|parsing|shlex | 1 | 52 | 1 | 72,912,295 | 72,912,295 | 1 | true | 2022-07-08T13:23:25.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Parsing data containing both types of quotation as well as special characters<p>Hi All I am working on a project where I need to parse some data cont... |
72,817,594 | How to get parameter value from link in flutter?<p>I am using <code>Firebase dynamic links</code> and I save it to a <code>deepLink</code> variable and pass it to the next page. Tell me, how can I get the <code>code</code> and <code>pageName</code> parameters from the link so that I can use them in the future?</p>
<p><... | <p>You can access the data through the queryParameter property. It also should be a good idea to check beforehand if the key is given in the Map</p>
<pre><code>if(deepLink.queryParameters.containsKey('code')){
final code = deepLink.queryParameters['code'];
}
</code></pre> | How to get parameter value from link in flutter? | flutter|dart | 0 | 52 | 1 | 72,817,882 | 72,817,882 | 1 | true | 2022-06-30T14:30:05.577Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get parameter value from link in flutter?<p>I am using <code>Firebase dynamic links</code> and I save it to a <code>deepLink</code> variable and pass ... |
72,960,987 | Python: Zipping the subfolders including inside the data<p>I am trying to make the script for zipping the subfolders including inside files, and sub subfolders as well as it's own in python.
below program is by entering the folder name but still, it won't work.
Please, somebody, help with the script.
Thank you so much ... | <p>To create a zip archive you can use the ZipFile class from the zipfile module.</p>
<pre><code>import os
from zipfile import ZipFile, ZIP_DEFLATED
def zipfolders(*args):
"""
Creates identically named zip archives of folders provided.
example: zipfolders(path1, path2, path3)
output ->... | Python: Zipping the subfolders including inside the data | python|zip|python-zipfile | 1 | 52 | 1 | 72,972,905 | 72,972,905 | 1 | true | 2022-07-13T04:33:40.877Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Zipping the subfolders including inside the data<p>I am trying to make the script for zipping the subfolders including inside files, and sub subfolde... |
72,845,089 | How can I prevent amending a commit when in the middle of a merge conflict?<p>My workflow usually involves uploading commits for review e.g. commit chain <code>A(HEAD) -> B -> C</code> - and if I get a review on commit <code>B</code> - I run <code>git rebase -i</code>, select <code>B</code> for editing, and then ... | <p>During rebase, there is a <code>.git/rebase-merge</code> directory. <code>--amend</code> can be captured in the hook <a href="https://git-scm.com/docs/githooks#_prepare_commit_msg" rel="nofollow noreferrer">prepare-commit-msg</a>.</p>
<blockquote>
<p>or commit, followed by a commit object name (if a -c, -C or --amen... | How can I prevent amending a commit when in the middle of a merge conflict? | git | 0 | 52 | 1 | 72,846,987 | 72,846,987 | 1 | true | 2022-07-03T08:45:18.003Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I prevent amending a commit when in the middle of a merge conflict?<p>My workflow usually involves uploading commits for review e.g. commit chain <co... |
72,772,352 | extract date from string that contains time as well in C#<p>I get an string from one of DTO i.e. "2020-05-17T00:00:00" and this is automapped to one of view model. Actually i only need date part i.e. 2020-05-17 and not time part from it.</p>
<p>Within automapper i tried directly formatting string in followin... | <p>Try to get a DateTime instead of string then use the method</p>
<pre class="lang-cs prettyprint-override"><code>.ToShortDateString()
</code></pre>
<p>If you can't get a DateTime, convert the string to DateTime with</p>
<pre class="lang-cs prettyprint-override"><code>DateTime oDate = DateTime.Parse(iDate);
</code></p... | extract date from string that contains time as well in C# | c#|.net|automapper | 1 | 52 | 1 | 72,772,455 | 72,772,455 | 2 | true | 2022-06-27T12:46:42.380Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
extract date from string that contains time as well in C#<p>I get an string from one of DTO i.e. "2020-05-17T00:00:00" and this is automapped to o... |
72,780,556 | How to print one element in a list at a time and not carry forward the previous one?<p><a href="https://i.stack.imgur.com/o5gZR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o5gZR.png" alt="enter image description here" /></a></p>
<p>As you can see in the image, I'm trying to achieve the expected b... | <p>Create a new <code>blank_mask</code> each time through the loop, rather than drawing on the same mask as the previous iteration.</p>
<pre><code> for i in range(len(cnt)):
blank_mask = np.zeros((thresh.shape[0], thresh.shape[2], 3), np.uint8)
cv2.drawContours(blank_mask, cnt[i], -1, (0, 255, 0), 1)... | How to print one element in a list at a time and not carry forward the previous one? | python|arrays|list|opencv | 0 | 52 | 1 | 72,780,928 | 72,780,928 | 2 | true | 2022-06-28T03:51:46.267Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to print one element in a list at a time and not carry forward the previous one?<p><a href="https://i.stack.imgur.com/o5gZR.png" rel="nofollow noreferrer... |
72,777,856 | Efficiently use Dense layers in parallel<p>I need to implement a layer in Tensorflow for a dataset of size N where each sample has a set of M independent features (each feature is represented by a tensor of dimension L). I want to train M dense layers in parallel, then concatenate the outputted tensors.</p>
<p>I could ... | <p>This should be doable using <code>einsum</code>. Expand this layer to your liking with activation functions and whatnot.</p>
<pre><code>class ParallelDense(tf.keras.layers.Layer):
def __init__(self, units, **kwargs):
super().__init__(**kwargs)
self.units = units
def build(self, input_shape):... | Efficiently use Dense layers in parallel | python|tensorflow|keras|neural-network|tensorflow2.0 | 1 | 52 | 1 | 72,781,571 | 72,781,571 | 2 | true | 2022-06-27T20:17:24.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Efficiently use Dense layers in parallel<p>I need to implement a layer in Tensorflow for a dataset of size N where each sample has a set of M independent fea... |
72,784,961 | Kotlin set lazy field through Java reflection<p>I'm trying to play around with Java reflection in Kotlin, and I have the following field in my Kotlin class:</p>
<pre><code>val tree: Tree by lazy {
getTree(hashGroup, service)
}
</code></pre>
<p>I'd like to set this field through Java reflection, and so far I got t... | <p>Just create a <code>Lazy<T></code> instance like you normally would!</p>
<p>If you want to set it to the constant value <code>newTree</code>:</p>
<pre><code>tField.set(transaction, lazyOf(newTree))
</code></pre>
<p>You can also set a new block of code for it to be evaluated lazily:</p>
<pre><code>tField.set(tr... | Kotlin set lazy field through Java reflection | java|kotlin|reflection | 1 | 52 | 1 | 72,785,351 | 72,785,351 | 2 | true | 2022-06-28T10:38:56.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kotlin set lazy field through Java reflection<p>I'm trying to play around with Java reflection in Kotlin, and I have the following field in my Kotlin class:<... |
72,793,703 | Why is my Python nested while loop not working?<p>I'm learning Python and have a hard time understanding what's wrong with my logic in this nested loop.</p>
<pre><code>numbers = [4, 3, 1, 3, 5]
sum = 0
while sum < 10:
for n in numbers:
sum += n
print(sum)
</code></pre>
<p>While sum is less than 10, ite... | <p>It's because the outer <code>while</code> loop cannot test the <code>sum</code> value until the inner loop has totally completed. You would need something like this:</p>
<pre><code>for n in numbers:
sum += n
if sum >= 10:
break
</code></pre>
<p>As for your second sample, trace through it:</p>
<pre><c... | Why is my Python nested while loop not working? | python|loops|while-loop|nested-loops | 0 | 52 | 1 | 72,793,743 | 72,793,743 | 2 | true | 2022-06-28T22:15:19.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is my Python nested while loop not working?<p>I'm learning Python and have a hard time understanding what's wrong with my logic in this nested loop.</p>
... |
72,796,141 | How to loop though list properly?<p>Here is a simple list I am trying to loop but it throws error <strong>AttributeError: 'Response' object has no attribute 'i'</strong> whats wrong here kindly suggest</p>
<pre><code>response = requests.get(url)
m1 = ['ok', 'raise_for_status', 'raw', 'reason',
'request', 'status_... | <p>The way to loop through those attributes is the following.</p>
<h1>Code</h1>
<pre class="lang-py prettyprint-override"><code>import requests
response = requests.get('http://example.com')
m1 = ['ok', 'raise_for_status', 'raw', 'reason', 'request', 'status_code', 'text', 'url']
for i in m1:
print(i)
print(ge... | How to loop though list properly? | python|python-3.x|list | 0 | 52 | 1 | 72,796,178 | 72,796,178 | 2 | true | 2022-06-29T05:22:22.697Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to loop though list properly?<p>Here is a simple list I am trying to loop but it throws error <strong>AttributeError: 'Response' object has no attribute ... |
72,800,459 | Create parameterized summaries of a column<p>I have a tibble and I want create several summaries of the same column, specifically the first, second and third quartiles.</p>
<p>To do it, I create a named list of functions and that works fine.</p>
<pre class="lang-r prettyprint-override"><code>library("tidyverse&quo... | <p>you're almost here</p>
<pre><code>df <- tibble(x = rnorm(100))
df %>%
summarise(
across(x,
map(1:3, ~partial(quantile, probs=./4)),
.names = "Q{.fn}"
)
)
# A tibble: 1 x 3
Q1 Q2 Q3
<dbl> <dbl> <dbl>
1 -0.579 0.0... | Create parameterized summaries of a column | r|dplyr | 2 | 52 | 2 | 72,801,449 | 72,801,449 | 2 | true | 2022-06-29T11:15:06.550Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create parameterized summaries of a column<p>I have a tibble and I want create several summaries of the same column, specifically the first, second and third... |
72,810,114 | How to make a for loop break on counter in Django Templates?<p>How can I make the <code>for product in products</code> loop break after the if condition is fulfilled 3 times. I have been trying to set up a counter but that isn't working... because <code>set</code> is not accepted inside of for loops. Though testing it ... | <p>You can't (by design).Django is opinionated by design, and the template language is intended for display and not for logic.</p>
<p>You can use Jinja instead.</p>
<p>Or, you can do the complicated stuff in Python and feed the results to the template language through the context. Bear in mind that appending arbitrary ... | How to make a for loop break on counter in Django Templates? | django|django-templates | 2 | 52 | 2 | 72,814,071 | 72,814,071 | 2 | true | 2022-06-30T03:48:19.427Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make a for loop break on counter in Django Templates?<p>How can I make the <code>for product in products</code> loop break after the if condition is f... |
72,815,208 | Simplifying flags when filtering models<p>I have a user model that has a set of notifications:</p>
<pre><code>class User(AbstractUser):
# Notification flags
send_to_all = models.BooleanField(default=True)
send_to_me = models.BooleanField(default=True)
send_to_friends = models.BooleanField(default=True)... | <p>You can wrap <code>User.objects.filter()</code> with <strong>eval</strong> like that:</p>
<pre><code>users_to_send = eval(f"User.objects.filter({flag}=True)")
</code></pre> | Simplifying flags when filtering models | python|django|django-models|django-rest-framework | 1 | 52 | 1 | 72,815,304 | 72,815,304 | 2 | true | 2022-06-30T11:45:02.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Simplifying flags when filtering models<p>I have a user model that has a set of notifications:</p>
<pre><code>class User(AbstractUser):
# Notification f... |
72,822,781 | Alternative to `do.call(rbind.data.frame)` for combining a list of data frames?<p>I have this loop in <strong>R</strong> that generates 100 random numbers - I know that this can obviously be done without a loop, but for argument sake, I generated 100 random numbers with a loop:</p>
<pre><code>final_results <- list()... | <p>We can also use</p>
<pre><code>data.table::rbindlist(final_results)
</code></pre>
<p>If you work with "data.table" more often than "data.frame", this is a good choice.</p>
<p><a href="https://i.stack.imgur.com/cIVsO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cIVsO.png" alt... | Alternative to `do.call(rbind.data.frame)` for combining a list of data frames? | r|list|dataframe|loops | 0 | 52 | 2 | 72,822,954 | 72,822,954 | 2 | true | 2022-06-30T22:51:37.813Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Alternative to `do.call(rbind.data.frame)` for combining a list of data frames?<p>I have this loop in <strong>R</strong> that generates 100 random numbers - ... |
72,840,205 | UploadPartCopy Amazon S3 API<p>As per the Amazon documentation there is a API called <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html" rel="nofollow noreferrer">UploadPartCopy</a> which copies an object from source bucket into a part of a destination object. But I cant find this API in <... | <p>The API that calls into the REST API UploadPartCopy is <a href="https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/S3/MS3CopyPartAsyncStringStringStringStringStringCancellationToken.html" rel="nofollow noreferrer">CopyPart</a> and <a href="https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/S3/TCopyPartReques... | UploadPartCopy Amazon S3 API | .net|amazon-web-services|amazon-s3|.net-core | 1 | 52 | 1 | 72,840,417 | 72,840,417 | 2 | true | 2022-07-02T15:19:58.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
UploadPartCopy Amazon S3 API<p>As per the Amazon documentation there is a API called <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartC... |
72,859,301 | CMake with multiple sub projects building into one directory<p>I'm not very familiar with CMake and still find it quite confusing. I have a project that has a server and client that I want to be able to run independent of each other but that builds together into the same directory (specifically the top level project bu... | <p>You cannot have multiple subdirectories use the same build directory, but that doesn't seem what you're trying to achieve.</p>
<p>Assuming you don't set the <a href="https://CMAKE_RUNTIME_OUTPUT_DIRECTORY" rel="nofollow noreferrer">variable <code>CMAKE_RUNTIME_OUTPUT_DIRECTORY</code></a> anywhere in your project, an... | CMake with multiple sub projects building into one directory | c++|cmake | 2 | 52 | 1 | 72,860,463 | 72,860,463 | 2 | true | 2022-07-04T15:49:29.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CMake with multiple sub projects building into one directory<p>I'm not very familiar with CMake and still find it quite confusing. I have a project that has ... |
72,860,426 | Exporting object keys individually<p>I want to mock <code>fs</code> in vitest using <a href="https://github.com/streamich/memfs" rel="nofollow noreferrer">memfs</a>. And for that I created a mock file <code>./__mocks__/fs.ts</code> and set up the mocked volume and fs.</p>
<p>However, I cannot get the mocked export to ... | <p>You've run into the problem of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#import_an_entire_modules_contents" rel="nofollow noreferrer">importing an entire module's contents under a namespace</a> and the requirement to explicitly define each export by name. Using ES m... | Exporting object keys individually | javascript|typescript|vitest | 1 | 52 | 2 | 72,861,216 | 72,861,216 | 2 | true | 2022-07-04T17:50:41.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Exporting object keys individually<p>I want to mock <code>fs</code> in vitest using <a href="https://github.com/streamich/memfs" rel="nofollow noreferrer">me... |
72,867,110 | Why we need to repeat trait bounds that were specified in trait definitions?<p>I have a function like this:</p>
<pre class="lang-rust prettyprint-override"><code>pub fn foo<T: FromStr<Err = impl Display>>() -> T {
T::from_str("123").map_err(|e| println!("{e}")).unwrap()
}
</code><... | <p>This is a (very old) rustc bug: <a href="https://github.com/rust-lang/rust/issues/20671" rel="nofollow noreferrer">#20671</a>.</p> | Why we need to repeat trait bounds that were specified in trait definitions? | rust | 2 | 52 | 1 | 72,867,262 | 72,867,262 | 2 | true | 2022-07-05T09:33:04.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why we need to repeat trait bounds that were specified in trait definitions?<p>I have a function like this:</p>
<pre class="lang-rust prettyprint-override"><... |
72,873,450 | Create new dataframe column with values based existing column AND on dictionary?<p>I have a dictionary</p>
<pre><code>smsgateway = {'AT&T':'@txt.att.net', 'Boost Mobile':'@sms.myboostmobile.com', 'Cricket':'@sms.cricketwireless.net', 'Google Fi':'@msg.fi.google.com', 'Metro PCS':'@mymetropcs.com', 'Republic Wireles... | <p>You can replace the <code>cell_provider</code> values with the addresses from the dictionary using <code>.replace</code> and then add the resulting series to the cell number after casting to string like this:</p>
<pre><code>df = df.assign(cell_num_provider=df.cell_number.astype(str) + df.cell_provider.replace(smsgat... | Create new dataframe column with values based existing column AND on dictionary? | python|pandas|dataframe|dictionary | 0 | 52 | 3 | 72,873,500 | 72,873,500 | 2 | true | 2022-07-05T17:32:54.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create new dataframe column with values based existing column AND on dictionary?<p>I have a dictionary</p>
<pre><code>smsgateway = {'AT&T':'@txt.att.net'... |
72,876,350 | Why does closure cause memory leak in JavaScript in this case?<p>I have this following code snippet:</p>
<pre class="lang-js prettyprint-override"><code>
function outer() {
let a
return function inner() {
a = new Uint8Array(100000)
const b = new Uint16Array(100000)
};
};
const fn = outer();
fn()
... | <p>@ITgoldman's explanation is right: <code>a</code> is retained because <code>inner</code> uses it, and <code>fn === inner</code>, and <code>fn</code> is still reachable. This is not a leak.</p>
<p><code>a</code> can be reached again after <code>fn()</code> finishes simply by calling <code>fn()</code> again. <code>b</... | Why does closure cause memory leak in JavaScript in this case? | javascript|memory-leaks | 1 | 52 | 2 | 72,876,903 | 72,876,903 | 2 | true | 2022-07-05T23:00:42.047Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does closure cause memory leak in JavaScript in this case?<p>I have this following code snippet:</p>
<pre class="lang-js prettyprint-override"><code>
fun... |
72,876,972 | How to repeat textures from a texture atlas<p>I'm making a game engine in WebGL. I would like to support many textures and multiple texture sizes. I would also like to support repeating textures multiple times across a single primitive.</p>
<p>This is trivial if I simply bind to a new texture every time I draw somethin... | <blockquote>
<p>So, given a texture atlas, how do I do my own repeating?</p>
</blockquote>
<p>As you probably know, repeating using UV coordinates only works by wrapping around the 0..1 range, so it obviously doesn't work for atlas textures.</p>
<p>One solution would be to throw more geometry at the problem, essentiall... | How to repeat textures from a texture atlas | webgl | 1 | 52 | 1 | 72,877,002 | 72,877,002 | 2 | true | 2022-07-06T01:07:30.253Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to repeat textures from a texture atlas<p>I'm making a game engine in WebGL. I would like to support many textures and multiple texture sizes. I would al... |
72,878,745 | dataframe groupby aggregation count function with condition for binning purpose<p>So I have a dataframe like this</p>
<pre><code>df = pd.DataFrame({
'A': [1,1,2,2,3,3,3],
'B': [1,3,1,3,1,2,1],
'C': [1,3,5,3,7,7,1]})
A B C
0 1 1 1
1 1 3 3
2 2 1 5
3 2 3 3
4 3 1 7
5 3 2 7
6 3... | <p>Because you need processing each bin separately instead <code>groupby+size+unstack</code> is used <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.crosstab.html" rel="nofollow noreferrer"><code>crosstab</code></a> with join DataFrames by <a href="http://pandas.pydata.org/pandas-docs/stable/r... | dataframe groupby aggregation count function with condition for binning purpose | python|pandas|dataframe|pandas-groupby | 3 | 52 | 2 | 72,878,792 | 72,878,792 | 2 | true | 2022-07-06T06:22:09.867Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
dataframe groupby aggregation count function with condition for binning purpose<p>So I have a dataframe like this</p>
<pre><code>df = pd.DataFrame({
'A': [1,... |
72,882,651 | Mysql return result even id is wrong<p>I am facing an issue when adding a random string after the id value still query return result.</p>
<p>Ideally, it should return an empty result.</p>
<pre><code>mysql> select * from pricelists where id = '1abcd';
+----+---------+--------+--------------+--------------+-----------... | <blockquote>
<p>when adding a random string after the id value still query return result. Ideally, it should return an empty result.</p>
</blockquote>
<p>This means that <code>id</code> column is numeric one, and the comparing have numeric context. The string literal is converted to the numeric value implicitly, and <c... | Mysql return result even id is wrong | mysql | -1 | 52 | 2 | 72,882,789 | 72,882,789 | 2 | true | 2022-07-06T11:16:21.853Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mysql return result even id is wrong<p>I am facing an issue when adding a random string after the id value still query return result.</p>
<p>Ideally, it shou... |
72,886,568 | SQL - only increment ROW_NUMBER() on specific values<p>I have the below table and am trying to add a column using row number (partitioning by the product and ordering by the contract start date) which will only increment when the contract_status_id is not 4. If the contract_status_id is 4, it should show as -1</p>
<p>S... | <p>There are a few ways you could do this. You could use <code>ROW_NUMBER</code> to start with, but you'd need to partition on the contract status with an <code>IIF</code>:</p>
<pre class="lang-sql prettyprint-override"><code>CASE Contract_Status_ID WHEN 4 THEN -1
ELSE ROW_NUMBER() OVER (PARTITION BY Product, IIF(... | SQL - only increment ROW_NUMBER() on specific values | sql|sql-server|tsql|sql-server-2016 | 0 | 52 | 3 | 72,886,668 | 72,886,668 | 2 | true | 2022-07-06T15:52:06.887Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL - only increment ROW_NUMBER() on specific values<p>I have the below table and am trying to add a column using row number (partitioning by the product and... |
72,890,869 | Get a part of a string that comes before .mp3 but is not always the same link<p>I want to get only the ID that comes before the .mp3 but after several attempts I can't do it, the link is not always the same length</p>
<p>String examples:</p>
<pre><code>"https://urlexample.com/EXAMPLE_STRING/media/example/audio/202... | <p>Create a URL with your string then get the id</p>
<h2>Code :</h2>
<pre><code>let string = "https://urlexample.com/EXAMPLE_STRING/media/example/audio/20227/07/1657142074431_15789.mp3"
guard let url = URL(string: string) else {
// not a url string
return
}
// file name with extension
let fileNa... | Get a part of a string that comes before .mp3 but is not always the same link | swift | -1 | 52 | 1 | 72,892,326 | 72,892,326 | 2 | true | 2022-07-06T23:35:51.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get a part of a string that comes before .mp3 but is not always the same link<p>I want to get only the ID that comes before the .mp3 but after several attemp... |
72,912,380 | Negative big.Int turns positive after using Int64() conversion due integer overflow<p>I have a simple if statement which compares two numbers. I couldn't use <code>big.Int</code> to compare with zero due to compile error, therefore I tried to convert to an int64 and to a float32. The problem is that after calling <code... | <p>Use <a href="https://pkg.go.dev/math/big#Int.Cmp" rel="nofollow noreferrer"><code>Int.Cmp()</code></a> to compare it to another <a href="https://pkg.go.dev/math/big#Int" rel="nofollow noreferrer"><code>big.Int</code></a> value, one representing <code>0</code>.</p>
<p>For example:</p>
<pre><code>zero := new(big.Int)
... | Negative big.Int turns positive after using Int64() conversion due integer overflow | go|math|comparison|bigint | 1 | 52 | 1 | 72,912,482 | 72,912,482 | 2 | true | 2022-07-08T13:46:02.550Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Negative big.Int turns positive after using Int64() conversion due integer overflow<p>I have a simple if statement which compares two numbers. I couldn't use... |
72,909,329 | VB6 Alternate 7 images every calendar week continuously<p>I am (still) programming in VB6, but I think this problem is not program language related.</p>
<p>I need to show one Picture out of 7 Pictures (named 1.jpg to 7.jpg) every calendar week, beginning with Calendar week 3, which shows picture nr.1</p>
<p>Example:
(y... | <p>Here is some code that gives the results you desire. It should be fairly self-explanatory:</p>
<pre><code>Option Explicit
Private Sub Test()
Dim dt As Date
Dim i As Integer
dt = DateSerial(2022, 1, 17) 'start at 3rd calendar week
For i = 1 To 100
Debug.Print Format(dt, "mm/dd/yyyy&q... | VB6 Alternate 7 images every calendar week continuously | date|calendar|vb6 | 1 | 52 | 1 | 72,913,715 | 72,913,715 | 2 | true | 2022-07-08T09:24:41.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
VB6 Alternate 7 images every calendar week continuously<p>I am (still) programming in VB6, but I think this problem is not program language related.</p>
<p>I... |
72,917,306 | bash command to get current time in given time zone accounting for daylight savings<p>Is there a bash command that will tell me the current time in a given time zone while accounting for daylight savings? For example, I'm thinking of something like this:</p>
<pre><code>$ getDateTime --region Seattle
2021-01-01-13-30-00... | <p>Building on Barmar's answer, here's a bash function you can use:</p>
<pre><code>getDateTime() {
TZ="$1" date '+%Y-%m-%d-%H-%M-%S %Z %z'
}
</code></pre>
<p>Sample usage:</p>
<pre><code>getDateTime America/Los_Angeles
getDateTime America/New_York
getDateTime Pacific/Honolulu
getDateTime Asia/Hong_Kong
2... | bash command to get current time in given time zone accounting for daylight savings | bash|timezone | 0 | 52 | 4 | 72,918,271 | 72,918,271 | 2 | true | 2022-07-08T21:48:15.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
bash command to get current time in given time zone accounting for daylight savings<p>Is there a bash command that will tell me the current time in a given t... |
72,923,476 | Angular observable and service<p><strong>post-create.component.ts</strong></p>
<pre><code>import { Component, EventEmitter, Output} from "@angular/core";
import { NgForm } from "@angular/forms";
import { Post } from '../post.model';
import { PostsService } from "../posts.service";
@Comp... | <blockquote>
<p>How was it working without observable?</p>
</blockquote>
<p>In your ngOnInit, you're assigning <code>this.posts = this.postsService.getPosts();</code> (which amounts to <code>this.posts = this.postsService.posts</code>. Since <code>posts</code> is an object, this assignment creates not a copy, but simpl... | Angular observable and service | angular|typescript | 0 | 52 | 1 | 72,923,610 | 72,923,610 | 2 | true | 2022-07-09T17:39:16.357Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular observable and service<p><strong>post-create.component.ts</strong></p>
<pre><code>import { Component, EventEmitter, Output} from "@angular/core&... |
72,931,145 | How to apply PolynomialFeatures only to certain (not all) independent variables<p>I am very new to scikit-learn <code>PolynomialFeatures</code> and struggling with the following use case: I have <code>x1</code> and <code>x2</code> as both independent variables as well as a <code>color</code> variable which would need t... | <p>You can use scikit-learn <a href="https://scikit-learn.org/stable/modules/generated/sklearn.compose.ColumnTransformer.html" rel="nofollow noreferrer"><code>ColumnTransformer</code></a> to apply the <code>PolynomialFeatures</code> transformer and the <code>OneHotEncoder</code> only to specific columns. Note that if y... | How to apply PolynomialFeatures only to certain (not all) independent variables | python|machine-learning|scikit-learn | 1 | 52 | 1 | 72,934,193 | 72,934,193 | 2 | true | 2022-07-10T19:03:53.907Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to apply PolynomialFeatures only to certain (not all) independent variables<p>I am very new to scikit-learn <code>PolynomialFeatures</code> and strugglin... |
72,935,545 | How to convert pandas DataFrame column names into one column<p>For example, I have follow pandas DataFrame:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(data=[[1, 2, 3], [4, 5, 6]], columns=['a', 'b', 'c'])
print(df)
a b c
0 1 2 3
1 4 5 6
</code></pre>
<p>I want to convert it into below format:</p>... | <p>You can <code>stack</code> the datframe, then perform some index drop/reset, and column renames:</p>
<pre class="lang-py prettyprint-override"><code>df.stack().droplevel(0).reset_index().rename(columns={'index': 'field', 0:'data'})
</code></pre>
<p><strong>OUTPUT</strong></p>
<pre class="lang-py prettyprint-override... | How to convert pandas DataFrame column names into one column | python|pandas | 0 | 52 | 1 | 72,935,603 | 72,935,603 | 2 | true | 2022-07-11T08:15:37.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert pandas DataFrame column names into one column<p>For example, I have follow pandas DataFrame:</p>
<pre><code>import pandas as pd
df = pd.DataF... |
72,952,951 | find the first cell in range where cumulative sum >= 0<p>I have an excel file like this:
<a href="https://i.stack.imgur.com/sGuSO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sGuSO.png" alt="enter image description here" /></a></p>
<p>could anyone help me to find the first cell (from left to right... | <p>With ms365 try:</p>
<p><a href="https://i.stack.imgur.com/AVG06.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AVG06.png" alt="enter image description here" /></a></p>
<p>Formula in <code>C6</code>:</p>
<pre><code>=XLOOKUP(TRUE,SCAN(0,C2:J2,LAMBDA(a,b,a+b))>=0,C2:J2,"No value >= 0"... | find the first cell in range where cumulative sum >= 0 | excel|excel-formula|sum | 0 | 52 | 2 | 72,953,176 | 72,953,176 | 2 | true | 2022-07-12T13:16:57.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
find the first cell in range where cumulative sum >= 0<p>I have an excel file like this:
<a href="https://i.stack.imgur.com/sGuSO.png" rel="nofollow noreferr... |
72,953,852 | Add Docker label if variable is true in an Ansible playbook<p>I'm trying to set up an ansible entry where a docker label is added to a container only if a variable is true, and skip it if false.</p>
<p>An example, if <code>use_my_label_1: true</code></p>
<pre class="lang-yaml prettyprint-override"><code>- docker_contai... | <p>One option would be to use the <a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#making-variables-optional" rel="nofollow noreferrer"><code>omit</code></a> special value along with the <a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#defining-differe... | Add Docker label if variable is true in an Ansible playbook | docker|ansible | 0 | 52 | 1 | 72,953,970 | 72,953,970 | 2 | true | 2022-07-12T14:18:57.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add Docker label if variable is true in an Ansible playbook<p>I'm trying to set up an ansible entry where a docker label is added to a container only if a va... |
72,954,689 | Groupby two columns and create a new column based on a conditional subtraction in python<p>I'm trying to create a new column based on a conditional subtraction in python. I want to first group the dataframe by column A and D, then take the row value of C where B equals 2, and subtract that value from all values in colu... | <p>IIUC, you can use a mask before using <code>groupby.transform('first')</code>:</p>
<pre><code>df['e'] = df['c'] - (df['c'].where(df['b'].eq(2))
.groupby([df['a'], df['d']])
.transform('first')
.convert_dtypes()
)
... | Groupby two columns and create a new column based on a conditional subtraction in python | python|pandas|lambda|apply|subtraction | 1 | 52 | 1 | 72,954,761 | 72,954,761 | 2 | true | 2022-07-12T15:19:49.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Groupby two columns and create a new column based on a conditional subtraction in python<p>I'm trying to create a new column based on a conditional subtracti... |
72,960,972 | Combine column values into a list of unique values without nan in a new column<p>I want to combine multiple columns of a Pandas <code>DataFrame</code> into a single column of lists, such that each list does not contain duplicate values and does not contain null values.</p>
<p>So, for example, in the data frame below, c... | <p>You could use <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.dropna.html" rel="nofollow noreferrer"><code>pd.dropna</code></a> before using <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.unique.html#pandas.Series.unique" rel="nofollow noreferrer"><code>pd.Series.unique</c... | Combine column values into a list of unique values without nan in a new column | python|pandas|dataframe | 0 | 52 | 3 | 72,961,127 | 72,961,127 | 2 | true | 2022-07-13T04:30:47.730Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combine column values into a list of unique values without nan in a new column<p>I want to combine multiple columns of a Pandas <code>DataFrame</code> into a... |
72,959,057 | Constructing a function that declares some other function inside it's body?<p>Sometimes I need to use a declaration of a function inside another function. For example, I made the following in Mathematica:</p>
<blockquote>
<p><a href="https://i.stack.imgur.com/A6nIC.png" rel="nofollow noreferrer"><img src="https://i.sta... | <p><code>:=</code> always defines a global function, even if it's within another function or block. As it stands, when you call <code>f</code> twice, the second definition of <code>g</code> clobbers the first one -- you can't have two different <code>g</code> functions.</p>
<p>I think what you want is an unnamed functi... | Constructing a function that declares some other function inside it's body? | maxima | 2 | 52 | 1 | 72,970,548 | 72,970,548 | 2 | true | 2022-07-12T22:34:10.717Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Constructing a function that declares some other function inside it's body?<p>Sometimes I need to use a declaration of a function inside another function. Fo... |
72,971,439 | Problem with exercise with Xquery on Basex<p>I really need your help with a query in BaseX.
The problem is that I really do not understand the logic behind this language which is Xquery.
So I have this first exercise and it is asking me:</p>
<p>"Find the first symptom(s) appearing after June 5, 2012. Report the re... | <p>Learning any language from online resources alone can be very tough. There's so much information, but it is typically of very mixed quality, and most of it's written in an hour or two with very little design or review. Get yourself a good old-fashioned book, like Priscilla Walmsley's - you know that's written by an ... | Problem with exercise with Xquery on Basex | html|xquery|basex | 0 | 52 | 1 | 72,973,627 | 72,973,627 | 2 | true | 2022-07-13T19:08:36.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Problem with exercise with Xquery on Basex<p>I really need your help with a query in BaseX.
The problem is that I really do not understand the logic behind t... |
72,985,330 | Vanilla JS: Add Class When A Different Class Is Under An Element<p>What I'm looking to do is add a class to a specific element with a specific class when an element with a different or no class is below it.</p>
<p>For instance, let's use this code as an example.</p>
<pre><code>< p class="my-paragraph">T... | <p>You can try this.</p>
<pre><code>const children = [...document.getElementsByClassName("my-paragraph")];
children.forEach((child) => {
if (!child.nextElementSibling.classList.contains("my-paragraph")) {
child.classList.add('nomargin')
}
});
</code></pre> | Vanilla JS: Add Class When A Different Class Is Under An Element | javascript|html|css | 0 | 52 | 3 | 72,985,550 | 72,985,550 | 2 | true | 2022-07-14T18:46:25.047Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vanilla JS: Add Class When A Different Class Is Under An Element<p>What I'm looking to do is add a class to a specific element with a specific class when an ... |
73,003,800 | How does the trait upcast coercion workaround work (trait method for getting an instance of the supertrait)?<p>It looks like Rust does not allow using a reference to an instance of a trait to be used where a reference to an instance of the supertrait was expected:</p>
<pre class="lang-rs prettyprint-override"><code>tra... | <p><code>&self</code> in <code>upcast()</code> is not <code>&dyn Dog</code>, it is the concrete <code>&Foo</code>. This is usual call to a method of a <code>dyn Trait</code>.</p> | How does the trait upcast coercion workaround work (trait method for getting an instance of the supertrait)? | rust|traits | 1 | 52 | 1 | 73,008,987 | 73,008,987 | 2 | true | 2022-07-16T11:26:37.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does the trait upcast coercion workaround work (trait method for getting an instance of the supertrait)?<p>It looks like Rust does not allow using a refe... |
72,895,360 | How to create a nested directories structure via Ansible<p>Finally, I found a solution on how to create nested directory structure which is an equivalent of the Bash command</p>
<pre class="lang-bash prettyprint-override"><code>mkdir -p jenkins/cache/{war,tmp,workspace}
</code></pre>
<p>My playbook</p>
<pre class="lang... | <p>You can definitely use a <code>with_nested</code> and <code>join</code> the second level list with a <code>/</code>.</p>
<p>So, a task like this would do:</p>
<pre class="lang-yaml prettyprint-override"><code>- debug:
msg: >-
{{ base_directory }}/
{{- item | join('/') }}
with_nested: "{{ di... | How to create a nested directories structure via Ansible | ansible | 3 | 52 | 2 | 72,895,946 | 72,895,946 | 2 | true | 2022-07-07T09:25:00.117Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a nested directories structure via Ansible<p>Finally, I found a solution on how to create nested directory structure which is an equivalent of ... |
72,926,842 | Type mismatch when using subclasses<p>The following code gives me a type mismatch error under strict typeschecking in Python.</p>
<pre><code>class DataClass1(ABC):
@abstractmethod
def to_int(self) -> int:
return 1
class DataClass2(DataClass1):
def __init__(self, value: int):
self.value =... | <p>A subclass is not the parent class. Therefore declaring WidgetClassImp needing a Dataclass2 changes the funcion signature to its parent therefore typemismatch. You need to also declare Dataclass1 as Parameter and inside the logic either cast to Dataclass2 or only use dataclass1 members.</p> | Type mismatch when using subclasses | python|python-typing|pyright | 3 | 52 | 2 | 72,926,888 | 72,926,888 | 2 | true | 2022-07-10T07:30:51.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Type mismatch when using subclasses<p>The following code gives me a type mismatch error under strict typeschecking in Python.</p>
<pre><code>class DataClass1... |
73,017,261 | How to sort the data from the array in the order as they appear for the exact match?<p>I need to filter the data based on first matching character or string of that word and print the result as below.</p>
<ol>
<li><p>Input: 'T' or 'Th' or 'The'
Output: ['The Shawshank Redemption', 'The Godfather', 'The Godfather: Part ... | <p>Here's one approach. While sorting we check if both the movies to sort are starting with the character and store them in <code>isGoodMatchA</code> and <code>isGoodMatchB</code>, if one of them is false and the other true, then we give priority to the true one. Else if both of them are true or if both of them are fal... | How to sort the data from the array in the order as they appear for the exact match? | javascript|arrays|filter | 2 | 52 | 1 | 73,017,349 | 73,017,349 | 2 | true | 2022-07-18T04:14:29.533Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to sort the data from the array in the order as they appear for the exact match?<p>I need to filter the data based on first matching character or string ... |
72,852,217 | What is the proper way doing *ngfor?<p>Hi Could someone tell me how to do *<strong>ngFor</strong> properly?</p>
<p><strong>Error:</strong></p>
<blockquote>
<p>Type '{ colorways: { thumbnail: string[]; thumbnailWithAvatar:
string[]; patternLayoutThumbnailWithFabricMark: string; name: string;
thumbnailWithFabricMark: str... | <p>I think that you've put the wrong variable here, your 'item' array is empty but you're trying to iterate on it. If you switch with 'data' constant which has your data, it works fine :</p>
<pre><code><div class="item-list" * ngFor="let item of data.colorways">
{{ item.thumbnail[0] }}
</... | What is the proper way doing *ngfor? | angular|ngfor | 0 | 52 | 2 | 72,852,304 | 72,852,304 | 2 | true | 2022-07-04T05:45:22.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the proper way doing *ngfor?<p>Hi Could someone tell me how to do *<strong>ngFor</strong> properly?</p>
<p><strong>Error:</strong></p>
<blockquote>
<... |
72,889,820 | Python: AttributeError: Response.read and .text not working<p>Here is my code:</p>
<pre><code>import requests
feeds = []
for i in range(2002, 2023):
feeds.append(str(i))
for feed in feeds:
link = f"https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-{feed}.json.zip"
response = requests.get(link)... | <p>You are getting two errors with different causes.</p>
<p>The first occurs because the type <code>requests.models.Response</code> that <code>requests.get</code> returns does not have a function <code>read</code>.</p>
<p>The second occurs because you can't write a <code>str</code> type to a file when you open it with ... | Python: AttributeError: Response.read and .text not working | python|python-requests|attributeerror | 2 | 52 | 1 | 72,889,968 | 72,889,968 | 2 | true | 2022-07-06T21:02:50.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: AttributeError: Response.read and .text not working<p>Here is my code:</p>
<pre><code>import requests
feeds = []
for i in range(2002, 2023):
fe... |
72,964,268 | Best way to render multiple dynamic components in a list<p>I want to render components in a list, but I cannot do this statically. Based on user import I can determine which components I have to show. The problem also is that depending on input inside those components the list can change too</p>
<p>Right now I have eve... | <p>I've been testing what I mentioned in the comments. This solution is probably what you were looking for. Also I've been playing with it and I've implemented a couple things like event emitting between rendered components, input data to the rendered components and more.</p>
<p>Basically you have a module called Compo... | Best way to render multiple dynamic components in a list | angular | 1 | 52 | 1 | 72,964,864 | 72,964,864 | 2 | true | 2022-07-13T09:51:47.343Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Best way to render multiple dynamic components in a list<p>I want to render components in a list, but I cannot do this statically. Based on user import I can... |
72,978,828 | Styling a marker in LightningChart JS<p>I am adding a list of markers to my chart based of certain conditions, these conditions are varying and therefore I will need to have markers that look different:
(using the setGridStrokeXStyle function doesn't seem to have an effect. What is the correct way to accomplish this?)<... | <p>The reason why in your code snippet the <code>setGridStrokeXStyle</code> is seemingly not having an effect is because the X grid stroke is not visible.</p>
<p>I have highlighted which element the "X grid stroke" is in the below picture with <strong>red</strong> to make sure:</p>
<p><a href="https://i.stack... | Styling a marker in LightningChart JS | lightningchart | 0 | 52 | 1 | 73,017,538 | 73,017,538 | 2 | true | 2022-07-14T10:11:34.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Styling a marker in LightningChart JS<p>I am adding a list of markers to my chart based of certain conditions, these conditions are varying and therefore I w... |
72,885,061 | How to perform conditional arithmetic operations in MongoDB<p>I've following schema</p>
<pre><code>{
"_id" : ObjectId("xxxxx"),
"updatedAt" : ISODate("2022-06-29T13:10:36.659+0000"),
"createdAt" : ISODate("2022-06-29T08:06:51.264+0000"),
&q... | <p>You can use <code>$reduce</code> for it:</p>
<pre><code>db.collection.aggregate([
{
$match: {
createdAt: {
$gte: ISODate("2022-06-28T00:00:00.000Z"),
$lte: ISODate("2022-06-30T00:00:00.000Z")
}
}
},
{
$project: {
grandTotal: {
$reduce: {... | How to perform conditional arithmetic operations in MongoDB | mongodb|aggregation-framework | 0 | 52 | 2 | 72,889,069 | 72,889,069 | 2 | true | 2022-07-06T14:10:48.803Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to perform conditional arithmetic operations in MongoDB<p>I've following schema</p>
<pre><code>{
"_id" : ObjectId("xxxxx"),
... |
72,811,660 | How to return an object from the query of a table based on a object<p>I have a table a based on the object a_obj:</p>
<pre><code>CREATE TYPE a_obj IS OBJECT (
a1 INTEGER,
a2 integer
);
CREATE TABLE a OF a_obj (
CONSTRAINT a__a1__pk PRIMARY KEY (a1)
);
</code></pre>
<p>Sometime i want to select the column of a:</... | <p>Use the <a href="https://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#LNPLS752" rel="nofollow noreferrer"><code>OBJECT_VALUE</code> pseudo-column</a>:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT OBJECT_VALUE FROM a;
</code></pre>
<p>Or, as <a href="/questions/72811660/how-to-return-an-... | How to return an object from the query of a table based on a object | sql|oracle | 2 | 52 | 1 | 72,812,271 | 72,812,271 | 2 | true | 2022-06-30T07:12:42.267Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to return an object from the query of a table based on a object<p>I have a table a based on the object a_obj:</p>
<pre><code>CREATE TYPE a_obj IS OBJECT ... |
72,892,179 | How to write a test case for product sum question<p>I am trying to write a test case in my main function for the following code that is used to find the product and sum of a nested array:</p>
<pre><code>package main
import "fmt"
type SpecialArray []interface{}
func ProductSum(array SpecialArray) int {
... | <p>You are very close but did not quite get the array literal syntax right:</p>
<pre><code>func main() {
special := SpecialArray{1, SpecialArray{2, 3}, 2}
result := ProductSum(special)
fmt.Println(result)
}
</code></pre>
<p>Also your <code>helper</code> function is fine as is but you might consider using a ... | How to write a test case for product sum question | arrays|go|interface | -1 | 52 | 1 | 72,892,784 | 72,892,784 | 2 | true | 2022-07-07T04:08:26.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to write a test case for product sum question<p>I am trying to write a test case in my main function for the following code that is used to find the prod... |
72,975,717 | frozen data class with non trivial constructor<ul>
<li>I'm trying to define a <em>frozen data class</em> with a <em>non-trivial</em> constructor</li>
<li>That is, the constructor needs to "tweak" the input before it initializes the corresponding data member:</li>
</ul>
<pre><code>from attrs import frozen
@fr... | <p>Replace</p>
<pre><code>self.name = raw_name[raw_name.find(":") + 1:]
</code></pre>
<p>with</p>
<pre><code>object.__setattr__(self, "name", raw_name[raw_name.find(":") + 1:])
</code></pre>
<p>This works on my end.</p> | frozen data class with non trivial constructor | python|constructor|immutability|python-attrs | 0 | 52 | 1 | 72,976,872 | 72,976,872 | 2 | true | 2022-07-14T05:42:08.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
frozen data class with non trivial constructor<ul>
<li>I'm trying to define a <em>frozen data class</em> with a <em>non-trivial</em> constructor</li>
<li>Tha... |
72,981,652 | MDI Child `MenuStrip` hidden on Non-Maximized and not visible anywhere<p>I have two WinForms. A <code>frmMainMenu</code> and a <code>frmIndividual</code> with <code>frmIndividual</code> a child of <code>frmMainMenu</code>. Each window has its own <code>MenuStrip</code> in the designer. However at runtime, the child men... | <p>This is the default behavior, the tool strip manager gets what you set to the merge-related properties in the MDI parent and child forms and strips then acts accordingly. The window state is not a <em>merge</em> factor. The <a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.form.mainmenustrip?... | MDI Child `MenuStrip` hidden on Non-Maximized and not visible anywhere | vb.net|winforms|menu|mdi | 1 | 52 | 1 | 72,985,992 | 72,985,992 | 2 | true | 2022-07-14T13:51:58.250Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MDI Child `MenuStrip` hidden on Non-Maximized and not visible anywhere<p>I have two WinForms. A <code>frmMainMenu</code> and a <code>frmIndividual</code> wit... |
72,926,182 | Drop duplicate if one duplicate cell contains one value, and the other duplicate contains another<p>So I have this type of dataset while working in python with pandas:</p>
<pre><code> id pos result
0 1 1 AB
1 1 1 --
2 1 1 BC
3 1 1 AB
4 1 2 CA
5 2 ... | <p>You can use masks and boolean indexing:</p>
<pre><code># is the result not a "--"?
m = df['result'].ne('--')
# is there at least a non "--" in the group?
m2 = (m
.groupby([df['id'], df['pos']])
.transform('max')
)
# keep if both conditions are equal
out = df[m==m2]
</code></pre>
<p>Alterna... | Drop duplicate if one duplicate cell contains one value, and the other duplicate contains another | python|pandas|dataframe | 1 | 52 | 1 | 72,926,247 | 72,926,247 | 2 | true | 2022-07-10T04:41:01.323Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Drop duplicate if one duplicate cell contains one value, and the other duplicate contains another<p>So I have this type of dataset while working in python wi... |
72,938,703 | sending local wifi ssid and password to esp32 from android without configuration<p>I have an <strong>esp32</strong> which is going to read data from dht11 and since it might be in different local networks , I initially want to find esp32 (connect to it) by android phone and pass the ssid and password of local network... | <p>I found the answer : use smartConfig example with esp32 and use ESPTOUCH for android phone.
PS: although there are some other provisioning ways like : blfi and AP mode</p> | sending local wifi ssid and password to esp32 from android without configuration | java|android|esp32 | 1 | 52 | 1 | 73,024,376 | 73,024,376 | 2 | true | 2022-07-11T12:35:41.517Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
sending local wifi ssid and password to esp32 from android without configuration<p>I have an <strong>esp32</strong> which is going to read data from dht11 an... |
72,799,770 | Published object not being updated<p>I'm building a WatchOS companion app. In a View there's a Slider that reads and writes value. This value is being communicated between iOS and WatchOS app.</p>
<pre><code>struct ReadingView: View {
@EnvironmentObject var watcher: ViewModelWatch
var body: some View {
... | <p>Add <code>private</code> to this line</p>
<pre><code>private init(session: WCSession = .default){
</code></pre>
<p>It will expose if there is an area in your code where you are not using the same instance.</p>
<p>You should only be using <code>ViewModelWatch.shared</code> so they can share information.</p>
<p>Anothe... | Published object not being updated | ios|swift|swiftui|apple-watch|watchos | 1 | 52 | 2 | 72,802,279 | 72,802,279 | 2 | true | 2022-06-29T10:23:09.177Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Published object not being updated<p>I'm building a WatchOS companion app. In a View there's a Slider that reads and writes value. This value is being commun... |
72,839,603 | Avoid repeating code for archiving files in a directory terraform<p>I lambda functions defined in the files below:</p>
<pre><code>../lambda_functions
├── index_to_s3.py
├── from_s3.py
├── to_s3.py
├── to_fetch.py
├── sql_fetch.py
└── sql_def.py
</code></pre>
<p>I want to archive each one of these functions into their o... | <p>You can combine <a href="https://www.terraform.io/language/meta-arguments/for_each" rel="nofollow noreferrer">for_each</a> and <a href="https://www.terraform.io/language/functions/fileset" rel="nofollow noreferrer">fileset</a> for this:</p>
<pre><code>data "archive_file" "from_s3" {
for_each =... | Avoid repeating code for archiving files in a directory terraform | terraform|terraform-provider-aws | 1 | 52 | 1 | 72,839,859 | 72,839,859 | 2 | true | 2022-07-02T14:00:17.007Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Avoid repeating code for archiving files in a directory terraform<p>I lambda functions defined in the files below:</p>
<pre><code>../lambda_functions
├── ind... |
72,942,564 | How to plot a scatter FacetGrid from a dataframe with multi-level columns<pre><code>data = {('Weight', 'Additive', 'Water'): {0: 3, 1: 3, 2: 3, 3: 3, 4: 3},
('Weight', 'Additive', 'Grass'): {0: 6.0, 1: 7.0, 2: 6.0, 3: 0, 4: 0},
('Weight', 'Filler', 'Flowers'): {0: 1, 1: 2, 2: 3, 3: 4, 4: 5},
('C... | <ul>
<li><strong>Tested in <code>python 3.10</code>, <code>pandas 1.4.2</code>, <code>matplotlib 3.5.1</code>, <code>seaborn 0.11.2</code></strong></li>
<li>It is not recommended to directly use <a href="https://seaborn.pydata.org/generated/seaborn.FacetGrid.html" rel="nofollow noreferrer"><code>sns.FacetGrid</code></a... | How to plot a scatter FacetGrid from a dataframe with multi-level columns | python|pandas|dataframe|seaborn|multi-index | 1 | 52 | 1 | 72,943,592 | 72,943,592 | 2 | true | 2022-07-11T17:37:19.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to plot a scatter FacetGrid from a dataframe with multi-level columns<pre><code>data = {('Weight', 'Additive', 'Water'): {0: 3, 1: 3, 2: 3, 3: 3, 4: 3},
... |
72,793,681 | Subsetting elements in a list and placing them in a data frame<p>I have a list ("listanswer") that looks something like this:</p>
<pre><code>> str(listanswer)
List of 100
$ : chr [1:3] "" "" "\t\t"
$ : chr [1:5] "" "Dr. Smith" "123 Fake Street" ... | <p>If it works, it's the correct way, although there might be a more efficient or more readable way to do the same thing.</p>
<p>Another way to do this is to create a data frame with your columns, and add rows to it. i. e.</p>
<pre><code>#create an empty data frame
df <- data.frame(matrix(ncol = 4, nrow = 0))
colnam... | Subsetting elements in a list and placing them in a data frame | r|list | 1 | 52 | 2 | 72,793,825 | 72,793,825 | 2 | true | 2022-06-28T22:12:47.127Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Subsetting elements in a list and placing them in a data frame<p>I have a list ("listanswer") that looks something like this:</p>
<pre><code>> s... |
73,016,015 | Filter nested array in object based on specific values of another array<p>I have an array of Objects, and every object has an array of strings (tags), I need to filter the array of objects based on another array.</p>
<pre><code>data: [
{
"id":"Nerium",
"tags":[&q... | <p>This should work</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const data = [
{
id: "Nerium",
tags: ["CMS Selection", "Experience Design", "Development", "UX"],
... | Filter nested array in object based on specific values of another array | javascript|arrays|object|ecmascript-6 | 1 | 52 | 2 | 73,016,076 | 73,016,076 | 2 | true | 2022-07-17T23:21:07.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filter nested array in object based on specific values of another array<p>I have an array of Objects, and every object has an array of strings (tags), I need... |
72,782,856 | Kubernetes pod fail/restart simulation<p>We have a data visualization server hosted in Kubernetes pods. The dashboards in that data viz are displayed in the browser of different monitors/terminals for near-real time operational reporting. Sometimes the pods fail, and when they come alive again, the browser redirects to... | <p>If I understand the use case correctly, you might want to use <code>kubectl scale</code> command. This will give you the flexibility to make the replica count to zero to N by running a simple <code>kubectl scale</code> command. See examples. Also, if you are using deployment, you can just do the <code>kubectl dele... | Kubernetes pod fail/restart simulation | kubernetes | 1 | 52 | 1 | 72,789,813 | 72,789,813 | 2 | true | 2022-06-28T08:09:05.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kubernetes pod fail/restart simulation<p>We have a data visualization server hosted in Kubernetes pods. The dashboards in that data viz are displayed in the ... |
72,872,357 | guice : No implementation for interface was bound<p>Is it ok to bind in interface with guice?
the error is <strong>No implementation for com.tobris.apps.base.service.user.UserService was bound.</strong></p>
<p>UserService is an interface.</p>
<pre><code>
@Inject
public SyncContactService(
PartnerRepository pa... | <h1>Guice works with explicit bindings, not implicit ones.</h1>
<p>When you <code>bind()</code> a type, you actually bind that type and not any of its interfaces or superclasses. That means that for a class such as <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ArrayList.html" rel="nofo... | guice : No implementation for interface was bound | java|guice | 1 | 52 | 2 | 72,874,107 | 72,874,107 | 2 | true | 2022-07-05T15:55:51.327Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
guice : No implementation for interface was bound<p>Is it ok to bind in interface with guice?
the error is <strong>No implementation for com.tobris.apps.base... |
72,771,793 | Convert multiple data within a row into a column<p>I have a dict that looks as follows:</p>
<pre><code>print([time])
</code></pre>
<p>output</p>
<pre><code>[{(0, 0): 0.0, (0, 1): 88.6, (0, 2): 60.4, (0, 3): 43.9, (0, 4): 40.5, (1, 0): 89.0, (1, 1): 0.0, (1, 2): 120.1, (1, 3): 59.2, (1, 4): 75.9, (2, 0): 84.9, (2, 1): 1... | <p>You can try <code>unstack</code></p>
<pre class="lang-py prettyprint-override"><code>out = df.unstack(level=1)
</code></pre>
<pre><code>print(out)
0 1 2 3 4
0 0.0 88.6 60.4 43.9 40.5
1 89.0 0.0 120.1 59.2 75.9
2 84.9 137.9 0.0 109.1 97.4
3 36.1 48.7 67.2 0.0 ... | Convert multiple data within a row into a column | python|pandas|dataframe | -1 | 52 | 1 | 72,772,952 | 72,772,952 | 3 | true | 2022-06-27T12:04:33.803Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert multiple data within a row into a column<p>I have a dict that looks as follows:</p>
<pre><code>print([time])
</code></pre>
<p>output</p>
<pre><code>[... |
72,784,788 | How does `write` mode on a `RwLock` work if it isn't mutable?<p>So, I was writing some code and apparently R.A. didn't warn me about some erroneous stuff I had written in regards to how ownership works with lambdas.<br />
So, a friend helped me rewrite some of my code, and this is just a play example, but their new cod... | <blockquote>
<p>From my prior knowledge, mutable in Rust cascades; in other words, if the "master-containing" object is immutable the rest will have to be too.</p>
</blockquote>
<p>This is almost always true... Until we consider <a href="https://doc.rust-lang.org/book/ch15-05-interior-mutability.html" rel="no... | How does `write` mode on a `RwLock` work if it isn't mutable? | rust|rwlock | 3 | 52 | 1 | 72,785,099 | 72,785,099 | 3 | true | 2022-06-28T10:27:33.433Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does `write` mode on a `RwLock` work if it isn't mutable?<p>So, I was writing some code and apparently R.A. didn't warn me about some erroneous stuff I h... |
72,824,773 | Pass a tuple of integers to range() function<p>I'm trying to check if a number is in an interval of numbers using</p>
<pre class="lang-py prettyprint-override"><code>if number in range(2010, 2020)
</code></pre>
<p>However I would like to store <code>(2010, 2020)</code> in a tuple with meaningful variable name:</p>
<pre... | <p>You're looking for the unpacking operator:</p>
<pre><code>VALID_YEARS = (2010, 2020)
number = 2015
if number in range(*VALID_YEARS):
print('yep')
</code></pre>
<p>Similarly, you can also unpack dictionaries to serve as parameters to a function (for example), but you need the double star:</p>
<pre><code>d = {'a':... | Pass a tuple of integers to range() function | python | 1 | 52 | 1 | 72,824,840 | 72,824,840 | 3 | true | 2022-07-01T05:32:52.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pass a tuple of integers to range() function<p>I'm trying to check if a number is in an interval of numbers using</p>
<pre class="lang-py prettyprint-overrid... |
72,825,728 | What does the variable array name at the end of the structure's definition means?<p>I've already read <a href="https://stackoverflow.com/questions/252780/why-should-we-typedef-a-struct-so-often-in-c">this</a>, <a href="https://stackoverflow.com/questions/54137927/what-does-the-variable-name-at-the-end-of-the-structures... | <p>It is a declaration of an array with 16 elements of the type <code>struct ppl_weight</code>. You could split this declaration</p>
<pre><code>struct ppl_weight {
uint16_t weight;
uint8_t weightHour;
} ppl_weightList[16];
</code></pre>
<p>the following way</p>
<pre><code>struct ppl_weight {
uint16_t weigh... | What does the variable array name at the end of the structure's definition means? | arrays|c|struct|declaration | 1 | 52 | 2 | 72,825,885 | 72,825,885 | 3 | true | 2022-07-01T07:26:05.960Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What does the variable array name at the end of the structure's definition means?<p>I've already read <a href="https://stackoverflow.com/questions/252780/why... |
72,826,005 | Transforming rows into columns and columns into rows to perform calculations in BigQuery<p>so i have this table in google-bigquery as shown below</p>
<p>initial table</p>
<pre><code>month | gender | sales | quantity |
Jan-2022 | male. | 2000. | 50. |
Jan-2022 | female. ... | <p>You basically want to transform columns into rows <em>and</em> transform rows into columns. For that, you can use the <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#unpivot_operator" rel="nofollow noreferrer"><code>UNPIVOT</code></a> and <a href="https://cloud.google.com/bigquery... | Transforming rows into columns and columns into rows to perform calculations in BigQuery | sql|google-bigquery | 0 | 52 | 2 | 72,826,836 | 72,826,836 | 3 | true | 2022-07-01T07:48:09.833Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Transforming rows into columns and columns into rows to perform calculations in BigQuery<p>so i have this table in google-bigquery as shown below</p>
<p>init... |
72,844,709 | Mutable data section?<p>I'm developing a virtual CPU for fun and I am currently working on the assembly part.</p>
<p>Now I wonder if values in the <code>.data</code> section should be mutable or not.</p>
<pre><code>section .data
MyGlobalVar dw 10h
</code></pre>
<p>In the places where I reference <em>MyGlobalVar</em>,... | <p>If you implicitly dereferenced at assemble time to produce an immediate constant, you'd always get the value from the source code. That's what <code>equ</code> is for; programmers can use that if that's what they want instead of a load from <code>.rodata</code>. (In that case, the bytes in that section would only ... | Mutable data section? | assembly|mutable|instruction-set | 1 | 52 | 1 | 72,844,737 | 72,844,737 | 3 | true | 2022-07-03T07:38:44.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mutable data section?<p>I'm developing a virtual CPU for fun and I am currently working on the assembly part.</p>
<p>Now I wonder if values in the <code>.dat... |
72,872,853 | How do i assign key / value pairs of an array of strings<pre><code>let arr = ['drink', 'soda', 'name', 'john', 'someKey', 'someValue']
</code></pre>
<p>I'd like to assign key value pairs of the strings i have in the array above</p>
<p>for example:</p>
<pre><code>[{drink: 'soda'},
{name: 'john'},
{someKey:'someValue'}... | <p>You can do it with a simple for loop:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>let arr = ['drink', 'soda', 'name', 'john', 'someKey', 'someValue'];
let result = [];
... | How do i assign key / value pairs of an array of strings | javascript|arrays|object|key-value | -1 | 52 | 3 | 72,872,963 | 72,872,963 | 3 | true | 2022-07-05T16:38:05.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do i assign key / value pairs of an array of strings<pre><code>let arr = ['drink', 'soda', 'name', 'john', 'someKey', 'someValue']
</code></pre>
<p>I'd l... |
72,898,232 | How to break operation of if else in vb6<p>Hello i have this code in vb6 and i want the code to break operation if i click the cancel button but i cant seem to do it i searched online and found nothing, is it possible to do it? This is the code below:</p>
<pre><code>if value <= temp then
if (msgbox("Select ... | <pre class="lang-vb prettyprint-override"><code>if value <= temp then
if msgbox("Select an option", vbOkCancel Or vbExclamation, MSG_TITLE) = vbCancel Then
' Do nothing
else
' extra code
end if
end if
</code></pre>
<pre class="lang-vb prettyprint-override"><code>if value <= t... | How to break operation of if else in vb6 | vb6 | 2 | 52 | 1 | 72,898,782 | 72,898,782 | 3 | true | 2022-07-07T12:57:18.517Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to break operation of if else in vb6<p>Hello i have this code in vb6 and i want the code to break operation if i click the cancel button but i cant seem ... |
72,902,090 | Python 3.8 Raise matrix to power of -1 results in inf<p>I have a simple matrix in Python:</p>
<pre><code>[[1134.01 0. ]
[ 0. 1134.01]]
</code></pre>
<p>And I need to raise it to the power of -1. I have tried</p>
<pre><code>mat**-1 and mat = pow(mat, -1)
</code></pre>
<p>Both methods give me an infinity in the... | <p>You can use <code>numpy.linalg.inv</code> instead.</p>
<pre><code>>>> np.linalg.inv(np.array([[1134.01, 0], [0, 1134.01]]))
array([[0.00088183, 0. ],
[0. , 0.00088183]])
</code></pre> | Python 3.8 Raise matrix to power of -1 results in inf | python|numpy | -1 | 52 | 2 | 72,902,138 | 72,902,138 | 3 | true | 2022-07-07T17:33:08.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python 3.8 Raise matrix to power of -1 results in inf<p>I have a simple matrix in Python:</p>
<pre><code>[[1134.01 0. ]
[ 0. 1134.01]]
</code></pre>... |
72,936,071 | sRGBEncoding in not working in THREE.EffectComposer<p>I'm trying to do post processing in threejs scene
here I'm using EffectComposer for doing it
but im not able to enble sRGBEncoding in renderTarget.</p>
<pre><code>const renderTarget = new THREE.WebGLRenderTarget(
sizes.width,
sizes.height,
{
minF... | <p>When using post processing, use a gamma correction pass at the end of your pass chain. This will ensure a sRGB encoded output:</p>
<pre><code>composer.addPass( new ShaderPass( GammaCorrectionShader ) );
</code></pre>
<p>Full example: <a href="https://threejs.org/examples/webgl_postprocessing_3dlut" rel="nofollow nor... | sRGBEncoding in not working in THREE.EffectComposer | three.js | 2 | 52 | 1 | 72,936,899 | 72,936,899 | 3 | true | 2022-07-11T09:06:13.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
sRGBEncoding in not working in THREE.EffectComposer<p>I'm trying to do post processing in threejs scene
here I'm using EffectComposer for doing it
but im not... |
72,949,147 | C++ possible to call function with same name in different class with single pointer?<p>Is it possible to call run() with p without concerning different class they are(for example class cast on a void*) and different implementation of run() in each class?</p>
<pre><code>class A
{
void func()
{
//new B
... | <p>This works:</p>
<pre><code>#include <iostream>
class B
{
public:
virtual int run(int i);
};
class A
{
public:
int func(B* obj, int i)
{
return obj->run(i);
}
};
class C: public B
{
public:
virtual int run(int i){ return 2*i;}
};
class D: public B
{
public:
... | C++ possible to call function with same name in different class with single pointer? | c++ | 1 | 52 | 1 | 72,949,529 | 72,949,529 | 3 | true | 2022-07-12T08:21:40.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ possible to call function with same name in different class with single pointer?<p>Is it possible to call run() with p without concerning different class... |
72,953,913 | split strings by pattern without deleting pattern strings<p>For a pattern that starts with "pr" following with multiple "r", e.g., <code>pr, prr, pr...r.</code> I would like to split the non-pattern string and ALL pattern strings, without deleting the pattern. <code>strsplit()</code> does the job bu... | <p>This is a bit hacky but you can do one replacement to separate out the values you want with some separator character and then split on that separator character. For example</p>
<pre><code>unlist(strsplit(gsub("(pr+)","~\\1~", x), "~"))
# [1] "z" "pr" "z... | split strings by pattern without deleting pattern strings | r|string | 4 | 52 | 2 | 72,954,016 | 72,954,016 | 3 | true | 2022-07-12T14:23:12.397Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
split strings by pattern without deleting pattern strings<p>For a pattern that starts with "pr" following with multiple "r", e.g., <code>... |
72,973,266 | Split array into groups of three instead of groups of two<p>Currently I have this backup script working just fine in Unraid.
I can add as many backup jobs to the array below as I like and the script will loop through these one after the other until all are done.</p>
<pre><code>#!/bin/bash
# backup source to destinatio... | <p>Use <code>i % 3</code> instead of <code>i % 2</code>. This will be <code>0</code> for the source path, <code>1</code> for the destination path, and <code>2</code> for the job name.</p>
<pre><code>for i in "${!backup_jobs[@]}"; do
case $(($i % 3)) in
0) src_path="${backup_jobs[i]}"; co... | Split array into groups of three instead of groups of two | arrays|bash | 0 | 52 | 3 | 72,973,334 | 72,973,334 | 3 | true | 2022-07-13T22:23:38.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Split array into groups of three instead of groups of two<p>Currently I have this backup script working just fine in Unraid.
I can add as many backup jobs to... |
72,984,560 | How to dim the background when a confirm() is shown and turn dim off when user answers yes or no?<p>I found the similar question about using alert() but changing that to confirm() doesn't work. Need to return the response. This results in the "Not confirmed" alert being displayed first. What do I need to d... | <p><code>setTimeout</code> runs the callback asynchronously, that means the return value inside the callback is not actually used, and the <code>confirm</code> function will return before the timeout callback is called. You'd need to use another callback as argument to confirm in order to get the response, but that wou... | How to dim the background when a confirm() is shown and turn dim off when user answers yes or no? | javascript | 0 | 52 | 1 | 72,984,664 | 72,984,664 | 3 | true | 2022-07-14T17:36:06.030Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to dim the background when a confirm() is shown and turn dim off when user answers yes or no?<p>I found the similar question about using alert() but chan... |
73,007,657 | Go internal and pkg packages sharing same name<p>I'm a go newbie and I've been struggling to understand the best practices when it comes to file structure and packages.</p>
<p>From what I've read, the <code>internal</code> folder contains code that can't be consumed by clients and the <code>pkg</code> folder contains ... | <p>Internal packages are described in <a href="https://pkg.go.dev/cmd/go#hdr-Internal_Directories" rel="nofollow noreferrer">the Go command documentation</a> and <a href="https://docs.google.com/document/d/1e8kOo3r51b2BWtTs_1uADIA5djfXhPT36s6eHVRIvaU/edit" rel="nofollow noreferrer">this design document</a>.</p>
<p>Exte... | Go internal and pkg packages sharing same name | go|package | 0 | 52 | 1 | 73,007,718 | 73,007,718 | 3 | true | 2022-07-16T21:06:51.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Go internal and pkg packages sharing same name<p>I'm a go newbie and I've been struggling to understand the best practices when it comes to file structure an... |
73,015,307 | How to count pairs of cells in alternate rows<p>I am preparing a weekly time-table for my school which looks like the following</p>
<p><a href="https://i.stack.imgur.com/QhMil.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QhMil.png" alt="enter image description here" /></a></p>
<p>The even rows con... | <p>You where pretty close in your attempt. You could use the following in <code>B70</code> and fill down and to the right:
<code>=COUNTIFS($C$10:$P$67,$A70,$C$11:$P$68,B$69)</code></p> | How to count pairs of cells in alternate rows | excel|excel-formula | 2 | 52 | 1 | 73,017,543 | 73,017,543 | 3 | true | 2022-07-17T20:57:50.173Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to count pairs of cells in alternate rows<p>I am preparing a weekly time-table for my school which looks like the following</p>
<p><a href="https://i.sta... |
73,026,805 | Dynamically accessing globals through string interpolation<p>You can call variables through a loop in Python like this:</p>
<pre class="lang-py prettyprint-override"><code>var1 = 1
var2 = 2
var3 = 3
for i in range(1,4):
print(globals()[f"var{i}"])
</code></pre>
<p>This results in:</p>
<pre class="lang-py... | <p>PS: this is dangerous.<br />
Code:</p>
<pre><code>var1 = 1
var2 = 2
var3 = 3
for i in 1:3
varname = Symbol("var$i")
println(getfield(Main, varname))
end
</code></pre> | Dynamically accessing globals through string interpolation | julia | 1 | 52 | 3 | 73,027,161 | 73,027,161 | 3 | true | 2022-07-18T18:12:55.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dynamically accessing globals through string interpolation<p>You can call variables through a loop in Python like this:</p>
<pre class="lang-py prettyprint-o... |
73,031,163 | Python Regex: multiple regrex causing problem<p>A basic version of this problem is using an regex to translate something like <code>abc like '%FFddsdE%'</code> into <code>LOWER(abc) like '%ffddsde%'</code><br />
and the following code works well</p>
<pre><code>import re
text = "abc like '%FFddsdE%'"
print(&qu... | <p>You could use another group to match <code>like</code> and <code>not like</code> at the same time.</p>
<pre class="lang-py prettyprint-override"><code>import re
text = "abc not like '%FFddsdE%' and bcd like '%XyZ%'"
print("before: " + text)
text = re.sub('([^ ^\n]+?) ?(like|not like) ?\'([^ ]+)\'... | Python Regex: multiple regrex causing problem | python|regex | 0 | 52 | 1 | 73,031,283 | 73,031,283 | 3 | true | 2022-07-19T04:34:57.240Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Regex: multiple regrex causing problem<p>A basic version of this problem is using an regex to translate something like <code>abc like '%FFddsdE%'</cod... |
72,923,321 | Generic longer function for types implementing len() function in Rust<p>What I'm attempting to do is creating generic function that compares two instances of something that has length.</p>
<p>My code:</p>
<pre><code>fn main() {
let vec1 = vec!(1, 2, 3);
let vec2 = vec!(1, 2, 3, 4);
println!("Longest ve... | <blockquote>
<p>but right now I'm forced to use <code>.iter()</code> on parameters while calling this function which I would love to avoid</p>
</blockquote>
<p>You can solve that particular issue by bounding on <code>IntoIterator</code>. This is a bit tricky since you want to return a reference that was passed in to t... | Generic longer function for types implementing len() function in Rust | generics|rust|borrow-checker | 2 | 52 | 1 | 72,923,430 | 72,923,430 | 3 | true | 2022-07-09T17:13:05.237Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Generic longer function for types implementing len() function in Rust<p>What I'm attempting to do is creating generic function that compares two instances of... |
72,774,605 | Rust: Strange state-based rounding behaviour on f32<p>When computing the dot-product of two <code>nalgebra::Vector3</code> structs using specific values, I get the following behaviour (<a href="https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0697d3a858808aef736a198e581aeebf" rel="nof... | <p>As @aedm has mentioned in the comment, your <code>dot()</code> function is the cause for this behavior. As a beginner rustacean it wasn't quite obvious to me how it is exactly a cause, so I put an explanation here.</p>
<p>When you define variables for the first time,</p>
<pre><code> 9| println!("Run 1:");
... | Rust: Strange state-based rounding behaviour on f32 | rust|rounding-error | 3 | 52 | 1 | 72,777,668 | 72,777,668 | 3 | true | 2022-06-27T15:24:00.297Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rust: Strange state-based rounding behaviour on f32<p>When computing the dot-product of two <code>nalgebra::Vector3</code> structs using specific values, I g... |
72,909,664 | When you create a new class based on QObject, why does the wizard mark your constructor explicit?<p>I have never really paid attention to <code>explicit</code>, and I am not terribly sure what to infer from it when I find it in a class header. Looking through my code, I noticed that in QtCreator, when you create a new ... | <p>It is used for single parameter constructors as that is when it makes sense.</p>
<p>This way, you disable implicit conversion from a type to a different so that the compiler will generate an error for you.</p>
<p>This makes sense in certain cases when you want to make your API user think and make the conversion expl... | When you create a new class based on QObject, why does the wizard mark your constructor explicit? | c++|qt|constructor|qobject|explicit | 1 | 52 | 1 | 72,920,136 | 72,920,136 | 3 | true | 2022-07-08T09:54:01.613Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When you create a new class based on QObject, why does the wizard mark your constructor explicit?<p>I have never really paid attention to <code>explicit</cod... |
73,028,411 | Get previous workday (weekday) from today with Powershell<p>Every day I run script which downloads couple of files by ftp to lets say <strong>C:\files\ directory</strong> with names like:</p>
<blockquote>
<pre><code>sampl_position_20220714
sampl_position_20220715
sample1_newposition_20220715
</code></pre>
<p>etc.</p>
... | <pre><code># Get the most recent weekday preceding today's date
# (Mon-Fri, not holiday-aware)
$mostRecentWeekDay =
($dt = Get-Date).AddDays(
$(switch ($dt.DayOfWeek) { 'Monday' { -3 } 'Sunday' { -2 } default { -1 } })
)
# Synthesize the file name
'sampl_position_{0:yyyyMMdd}' -f $mostRecentWeekday
</code></p... | Get previous workday (weekday) from today with Powershell | powershell|scripting | 1 | 52 | 2 | 73,028,569 | 73,028,569 | 3 | true | 2022-07-18T20:43:22.140Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get previous workday (weekday) from today with Powershell<p>Every day I run script which downloads couple of files by ftp to lets say <strong>C:\files\ direc... |
73,018,924 | Error: operand type mismatch for `add' immediate value GNU Assembler intel syntax<p>I tried this simple assembly:</p>
<pre><code>add r9, 0x4014000000000000
</code></pre>
<p>It gave me error:</p>
<pre><code>Error: operand type mismatch for `add'
</code></pre>
<p>I also try:</p>
<pre><code>addq r9, 0x4014000000000000 #(s... | <p>There is no encoding that supports a 64-bit immediate on the <code>add</code> instruction, just like it is the case for the majority of instructions.</p>
<p>To <code>add r9, 0x4014000000000000</code>, move the immediate to a scratch register and add that to R9.</p>
<pre><code>mov rax, 0x4014000000000000
add r9, rax
... | Error: operand type mismatch for `add' immediate value GNU Assembler intel syntax | assembly|x86-64|gnu-assembler|instruction-set | 0 | 52 | 1 | 73,021,814 | 73,021,814 | 3 | true | 2022-07-18T07:51:30.860Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error: operand type mismatch for `add' immediate value GNU Assembler intel syntax<p>I tried this simple assembly:</p>
<pre><code>add r9, 0x4014000000000000
<... |
72,971,696 | iterating through an array to transfer its elements to a vector with certain conditions (c++)<p>I am a Grade 10 student taking a Computer Science course over the summer and I am having trouble with my homework question.</p>
<p>The question asks to write code that will allow a user to enter 6 grades and sort the grades ... | <p>The vectors <code>passingGrades</code> and <code>failingGrades</code> have no elements, so any access to their "elements" are invalid.</p>
<p>You can use <a href="https://en.cppreference.com/w/cpp/container/vector/push_back" rel="nofollow noreferrer"><code>std::vector::push_back()</code></a> to add element... | iterating through an array to transfer its elements to a vector with certain conditions (c++) | c++|arrays|algorithm|partitioning|stdvector | -2 | 52 | 3 | 72,971,740 | 72,971,740 | 3 | true | 2022-07-13T19:34:44.113Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
iterating through an array to transfer its elements to a vector with certain conditions (c++)<p>I am a Grade 10 student taking a Computer Science course over... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.