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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
73,016,993 | Replace value in an array of struct c#<p>I have the following public struct in C#:</p>
<pre><code>public struct Route
{
public float Start;
public float End;
public float Range;
public bool InConstruction;
};
</code></pre>
<p>I want to replace every property Range of Route used as an array of struct... | <p>If you can't change the struct, then no, you've done the most optimal thing. Even if you do find some solution with Linq, it's eventually just going to boil down to a loop like you have.</p>
<p>If you're dead set on using Linq, you'd need to do something like this:</p>
<pre><code>desc.Route = desc.Route.Select(d =&g... | Replace value in an array of struct c# | c#|arrays | 0 | 54 | 1 | 73,017,044 | 73,017,044 | 1 | true | 2022-07-18T03:22:05.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace value in an array of struct c#<p>I have the following public struct in C#:</p>
<pre><code>public struct Route
{
public float Start;
public f... |
72,895,011 | Phaser 3 extract key out from texture<p><a href="https://i.stack.imgur.com/Qpdso.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qpdso.png" alt="Inspect Element Console" /></a></p>
<pre><code>const CButton = this.add.image(0, 0, 'C').setInteractive()
const OButton = this.add.image(0, 0, 'O').setInter... | <p>If you want to get the <strong>key</strong> of an <strong>image</strong>, in an event-handler for example, you can pass the specific <strong><em>button/image</em></strong> as the scope of the event function <em>(link to <a href="https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.GameObject.html#on__anchor... | Phaser 3 extract key out from texture | javascript|key|phaser-framework | 1 | 54 | 2 | 72,897,534 | 72,897,534 | 1 | true | 2022-07-07T09:00:00Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Phaser 3 extract key out from texture<p><a href="https://i.stack.imgur.com/Qpdso.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qpdso.png... |
72,925,749 | Add a animated sprite to phaser objects<p>I have the following code in phaser, and I want to use a sprite animation instead of a static image, how can I pull that off? Using group to create new bullets.
I am creating a new object and with that creating new bullets to get fired by the player. And I want the bullet to ro... | <p>First you could extend from <code>Phaser.GameObjects.Sprite</code> rather than from <code>Phaser.GameObjects.Image</code>. Then create an animation, with <code>this.anims.create</code> (<a href="https://photonstorm.github.io/phaser3-docs/Phaser.Animations.AnimationManager.html#create__anchor" rel="nofollow noreferre... | Add a animated sprite to phaser objects | javascript|object|phaser-framework|group | 1 | 54 | 2 | 72,927,603 | 72,927,603 | 1 | true | 2022-07-10T02:14:27.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add a animated sprite to phaser objects<p>I have the following code in phaser, and I want to use a sprite animation instead of a static image, how can I pull... |
72,942,048 | Regex Expression to match X or more characters until first forward slash<p>Trying to check a string like this:</p>
<pre><code>Product Title Here / Something / Something else
</code></pre>
<p>I want to isolate the first string before the first <code>/</code> and then see how long it is and only match if it is longer tha... | <p>Use this:</p>
<pre><code>^[^/]{10,}
</code></pre>
<p><code>[^/]</code> matches anything except <code>/</code>, and <code>{10,}</code> requires it to be at least 10 characters long.</p>
<p><a href="https://regex101.com/r/OYahmr/1" rel="nofollow noreferrer">DEMO</a></p> | Regex Expression to match X or more characters until first forward slash | regex|string|string-length | 0 | 54 | 1 | 72,942,120 | 72,942,120 | 1 | true | 2022-07-11T16:54:54.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex Expression to match X or more characters until first forward slash<p>Trying to check a string like this:</p>
<pre><code>Product Title Here / Something ... |
72,897,697 | Typescript error coming after using the spread operator on a state value<p>I don't know if the interface syntax is wrong code editor is happy though</p>
<pre><code>interface innerQuiz1 {
question: string;
sectionId: number;
attachmentId: number;
options: string[];
answers: string[];
}
interface innerQuiz {
... | <p>You're trying to spread the variable courseQuiz of interface CourseQuiz which looks like this :</p>
<pre><code>interface courseQuiz {
quiz: innerQuiz[];
passing: number;
attempts: number;
quizTitle: string;
}
</code></pre>
<p><strong>You cannot spread objects inside the console log function, only arrays.</st... | Typescript error coming after using the spread operator on a state value | javascript|reactjs|typescript | 0 | 54 | 1 | 72,897,808 | 72,897,808 | 1 | true | 2022-07-07T12:19:02.723Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typescript error coming after using the spread operator on a state value<p>I don't know if the interface syntax is wrong code editor is happy though</p>
<pre... |
72,393,725 | Would there be a shorter version of this part of code in JS / CSS / HTML programming?<p>A question in JS / CSS / HTML programming!</p>
<p>Again, I'm not good at asking the question pinpoint, and sorry for all the confusion. I shall talk about my real intention for this part of code, and see what solutions can be made.<... | <p>Why not check for a range of keys:</p>
<pre><code>document.addEventListener('keydown', function(event) {
if (event.key >= 'a' && event.key <= 'z'){
console.log(event.key);
}
</code></pre> | Would there be a shorter version of this part of code in JS / CSS / HTML programming? | javascript|html|css | -2 | 54 | 3 | 72,393,773 | 72,393,773 | 1 | true | 2022-05-26T14:47:32.690Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Would there be a shorter version of this part of code in JS / CSS / HTML programming?<p>A question in JS / CSS / HTML programming!</p>
<p>Again, I'm not good... |
72,383,503 | Output Bash pipes to Python-compatible format<p>I'm working on text tokenization and lemmatization using UDPipe models. I can complete the task itself by using <code>!echo</code> commands or printing into a file, but I would like to generate a Python data structure to further process the output.</p>
<h1>What works</h1>... | <p>You've done some research and found <code>subprocess</code> module, which is the most common way to call processes from Python. If you want to use functionality of shell <em>(such as pipe)</em> you need to pass argument <code>shell=True</code> to any function which actually call process, e.g. <a href="https://docs.p... | Output Bash pipes to Python-compatible format | python|bash|nlp|pipe|udpipe | 0 | 54 | 1 | 72,394,781 | 72,394,781 | 1 | true | 2022-05-25T19:57:59.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Output Bash pipes to Python-compatible format<p>I'm working on text tokenization and lemmatization using UDPipe models. I can complete the task itself by usi... |
72,399,568 | Fullcalendar Function Not In Scope<p>I am trying to interact with Fullcalendar from outside of scope. For example below, I am trying to change the colour of an event. Another example would be to simply display an alert with the current view.</p>
<p>The catch is, that I am using a tool called FileMaker which has the abi... | <p>Try moving your changeColour function inside the DOMContentLoaded function and attaching it to the window explicitly</p>
<pre><code>document.addEventListener('DOMContentLoaded', function(){
var calendar = new FullCalendar....
....
window.changeColour = function(id){
var event = calendar.getEventB... | Fullcalendar Function Not In Scope | javascript|scope|fullcalendar|filemaker|fullcalendar-4 | 1 | 54 | 1 | 72,399,797 | 72,399,797 | 1 | true | 2022-05-27T01:28:19.117Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fullcalendar Function Not In Scope<p>I am trying to interact with Fullcalendar from outside of scope. For example below, I am trying to change the colour of ... |
72,378,515 | Serializing circe.Json in Flink<p><strong>Scala Flink</strong> has problems serializing json in <strong>circe.Json</strong> format.</p>
<p>I am using lib <a href="https://github.com/findify/flink-adt" rel="nofollow noreferrer">flink-adt</a> to derive <strong>TypeInformation</strong> that contains the serializer.</p>
<p... | <p>I got the serializer to work by adding <code>new ExecutionConfig()</code></p>
<p>This code worked:</p>
<pre class="lang-scala prettyprint-override"><code>import io.circe._
import io.circe.syntax._
import org.apache.flink.api.common.typeinfo.TypeInformation
import org.apache.flink.api.common.ExecutionConfig
impl... | Serializing circe.Json in Flink | scala|apache-flink|circe | 0 | 54 | 1 | 72,472,292 | 72,472,292 | 1 | true | 2022-05-25T13:26:03.370Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Serializing circe.Json in Flink<p><strong>Scala Flink</strong> has problems serializing json in <strong>circe.Json</strong> format.</p>
<p>I am using lib <a ... |
72,267,984 | why does pync .notify for mac not work? (python)<p>I'm trying to do notifications in python on mac. I have installed pync, and used the following code:</p>
<pre class="lang-py prettyprint-override"><code>from plyer import notification
import pync, time
while True:
pync.notify("lets do something random!")... | <p>Yes, it works for me on MacOS 12.3.1</p>
<p>Make sure you have notification from <strong>terminal-notifier</strong> allowed:</p>
<p>System Preferences -> Notifications & Focus -> terminal-notifier
and allow the notifications</p>
<p>Also, it might be the case that you have notifications disabled on your mac... | why does pync .notify for mac not work? (python) | python|macos|notifications | 0 | 54 | 1 | 72,268,072 | 72,268,072 | 1 | true | 2022-05-17T03:46:45.837Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why does pync .notify for mac not work? (python)<p>I'm trying to do notifications in python on mac. I have installed pync, and used the following code:</p>
<... |
72,390,562 | Range of unicode as array of vector<p>I'm trying to get the unicodes from <code>\u0300</code> to <code>\u036f</code> as an array or a vector in Rust.</p>
<p>I tried several things but those haven't worked yet.</p> | <p>You can create a range of <code>char</code>s, and collect them into a <code>Vec</code>:</p>
<pre class="lang-rust prettyprint-override"><code>Vec::from_iter('\u{0300}'..='\u{036f}')
</code></pre>
<p><a href="https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=467c504c965c0f64acf3a28ec... | Range of unicode as array of vector | arrays|vector|rust|unicode | 0 | 54 | 1 | 72,390,612 | 72,390,612 | 1 | true | 2022-05-26T10:45:38.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Range of unicode as array of vector<p>I'm trying to get the unicodes from <code>\u0300</code> to <code>\u036f</code> as an array or a vector in Rust.</p>
<p>... |
72,297,513 | TypeError: Room.findOne is not a function<p>I just start learning how to build a database by using
Im trying to add data to mongoDB and using the <strong>.findOne function</strong>, but I'm getting this error. is findOne a function in MongoDB?</p>
<p>My Goal is to try to build a full stack mobile application and using ... | <p>Your error is located here:</p>
<pre><code>io.on('connection', (socket) => {
console.log('connected!');
socket.on('create-game', async({nickname, name, numRounds, occupancy}) => {
try {
//error is here
const existingRoom = await Room.findOne({name});
if(exist... | TypeError: Room.findOne is not a function | javascript|node.js|database|mongodb|mongoose | 1 | 54 | 1 | 72,297,702 | 72,297,702 | 1 | true | 2022-05-19T00:57:37.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TypeError: Room.findOne is not a function<p>I just start learning how to build a database by using
Im trying to add data to mongoDB and using the <strong>.fi... |
72,364,676 | C# Selenium navigate to Statistics on specifig Page<p>I am working with C# and Selenium.</p>
<p>On this Page i want to click on "Statistics":
<a href="https://eatradingacademy.com/software/forex-historical-data/" rel="nofollow noreferrer">https://eatradingacademy.com/software/forex-historical-data/</a></p>
<p... | <p>This is a special case because the element you want to click is located in an iFrame.<br />
To locate such element, you'll first have to switch the focus to the iFrame.<br />
You can do this like this:</p>
<pre><code>webdriver.SwitchTo().Frame(webdriver.findElement(By.id("data-app-frame"));
</code></pre>
<... | C# Selenium navigate to Statistics on specifig Page | c#|selenium|xpath|hyperlink|navigateurl | 0 | 54 | 2 | 72,366,572 | 72,366,572 | 1 | true | 2022-05-24T14:27:19.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# Selenium navigate to Statistics on specifig Page<p>I am working with C# and Selenium.</p>
<p>On this Page i want to click on "Statistics":
<a hr... |
72,256,686 | How do I sort a list of dictionaries this way?<p>Suppose You have a list of dictionaries like the below.</p>
<pre><code>data = [
{
'id':1,
'name':'ABC corporation',
'state': 'WA'
},
{
'id':2,
'name':'ABC corporation',
'state': 'QLD'
},
{
'... | <p>Try this, it returns <code>""</code> on <code>"QLD"</code>, which should always be the "first" string when sorting:</p>
<pre><code>def my_sort(x):
if x["state"] == "QLD":
return ""
else:
return x["state"]
sorted_data = lis... | How do I sort a list of dictionaries this way? | python|python-3.x | -1 | 54 | 1 | 72,256,807 | 72,256,807 | 1 | true | 2022-05-16T09:07:23.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I sort a list of dictionaries this way?<p>Suppose You have a list of dictionaries like the below.</p>
<pre><code>data = [
{
'id':1,
... |
72,381,920 | Create % comparison value between two visuals<p>I am trying to create a new dynamic comparison metric between two table visuals with identical metrics and custom date slicers that create a period A/B view.</p>
<p>Both tables and date slicers reference the same dataset (tableA). I want to create a measure that can calcu... | <p>Instead of duplicating the fact table I would duplicate the Date table, having DateA, and DateB, both with relationship to fact table date.</p>
<p>Then use each Date table for each period A and B. and adjust interactions to <strong>disable filtering</strong> period A visuals with Date B slicer and period B visuals w... | Create % comparison value between two visuals | powerbi|dax|relationship|measure|powerbi-custom-visuals | 0 | 54 | 1 | 72,384,196 | 72,384,196 | 1 | true | 2022-05-25T17:24:50.493Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create % comparison value between two visuals<p>I am trying to create a new dynamic comparison metric between two table visuals with identical metrics and cu... |
72,317,180 | how to render an SVG from a server and still have the option to interpolate JSX into it?<p><strong>My goal is to fetch from my own server an SVG and to interpolate the <code>children</code> attribute after the <code><polygon></polygon></code> tag.</strong></p>
<p>I am doing this is to add an interactive lay... | <p>You should consider using <code>rehype-react</code> - <a href="https://github.com/rehypejs/rehype-react" rel="nofollow noreferrer">https://github.com/rehypejs/rehype-react</a>.</p>
<p>If you store your SVG as an XML in a database for example, then retrieving it as a string in the client-side, this package allows you... | how to render an SVG from a server and still have the option to interpolate JSX into it? | javascript|reactjs|svg | 1 | 54 | 1 | 72,404,520 | 72,404,520 | 1 | true | 2022-05-20T10:12:59.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to render an SVG from a server and still have the option to interpolate JSX into it?<p><strong>My goal is to fetch from my own server an SVG and to inter... |
72,351,107 | unexpected Logout approximately in 30-60 seconds after login<p>I wrote a site using .netCore and locally everything works perfect. But on server I can't stay logged in for a long time. It takes 30-60 sec to kick me out to login page and I need to log in again.</p>
<p>My hosting allows me to use up to 1 gb memory for a ... | <p>I don't know if this is best practice, but I was able to resolve the problem by changing "System.GC.Server" to "false" in <code>[appName].runtimeconfig.json</code>.</p> | unexpected Logout approximately in 30-60 seconds after login | .net|asp.net-mvc|iis | 1 | 54 | 2 | 72,361,895 | 72,361,895 | 1 | true | 2022-05-23T15:27:35.097Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
unexpected Logout approximately in 30-60 seconds after login<p>I wrote a site using .netCore and locally everything works perfect. But on server I can't stay... |
72,311,194 | How is it possible to access property without "->" in c?<p>I've been learning c for a while, and let's say I thought I had a good understanding of pointers though this example is bugging me.</p>
<p>Let's say we have an array in which each element points to a structure. If we allocate space for two elements like in the ... | <p>It seems you mean the following</p>
<pre><code>(*p[1] ).t = (char*)malloc(10*sizeof(char));
strcpy( ( *p[1] ).t, "test");
( *p[1] ).p = 10;
</code></pre>
<p>That is <code>p[1]</code> is a pointer. So you can write for example either <code>p[1]->t</code> or dereferencing the pointer and getting the point... | How is it possible to access property without "->" in c? | c|pointers|struct|dereference | 2 | 54 | 1 | 72,311,271 | 72,311,271 | 1 | true | 2022-05-19T21:19:17.433Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How is it possible to access property without "->" in c?<p>I've been learning c for a while, and let's say I thought I had a good understanding of pointers t... |
72,370,867 | Route won't render component in React<p>I am trying to make a simple navigation bar using React that will navigate through pages.</p>
<p>I am using Router, and you can see that the links change the page, but without rendering the component.
I used this import :</p>
<pre><code>import { BrowserRouter as Router, Routes, R... | <p>Try to add a property <code>exact</code> to the routes components, like:</p>
<pre><code><Route path="/" exact element={<Home />} />
<Route path="/profile" element={<Profile />} />
<Route path="/classes" element={<Classes />} />
</code></pre>
<p>This h... | Route won't render component in React | reactjs | 0 | 54 | 1 | 72,370,915 | 72,370,915 | 1 | true | 2022-05-25T00:41:30.403Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Route won't render component in React<p>I am trying to make a simple navigation bar using React that will navigate through pages.</p>
<p>I am using Router, a... |
72,325,350 | How do I access triple nested values in JSON using Java?<p>I am trying to access the "text" values in the below JSON and create an ArrayList with those values. How would I approach that? I am trying to use com.fasterxml.jackson.</p>
<pre><code>{
"searchApiFormatVersion": "1.0",
&... | <p>I know you tagged this question as a Jackson question, but I think JSONPath may be a good fit here.</p>
<p>The JSONPath library is available as a Maven dependency:</p>
<pre class="lang-xml prettyprint-override"><code><dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json... | How do I access triple nested values in JSON using Java? | java|json|jackson | 0 | 54 | 1 | 72,325,994 | 72,325,994 | 1 | true | 2022-05-20T22:37:05.637Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I access triple nested values in JSON using Java?<p>I am trying to access the "text" values in the below JSON and create an ArrayList with t... |
72,289,010 | Thread in DLL hangs on Synchronize() until thread is terminated<p>I wrote a DLL in C++Builder XE6 that uses a thread to do some background task.</p>
<p>Here's the (simplified) code in the DLL:</p>
<pre><code>typedef void (__stdcall* ERRORCALLBACK)();
class TMyThread : public TThread
{
typedef TThread inherited;
... | <p>You are correct that the reason <code>TThread::Synchronize()</code> hangs is because its request is not being processed. The reason why the request gets processed when the thread is terminated is because <code>TThread::WaitFor()</code> processes <code>TThread::Synchronize()</code> requests while waiting for the thr... | Thread in DLL hangs on Synchronize() until thread is terminated | multithreading|dll|c++builder | 1 | 54 | 1 | 72,294,835 | 72,294,835 | 1 | true | 2022-05-18T12:16:13.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Thread in DLL hangs on Synchronize() until thread is terminated<p>I wrote a DLL in C++Builder XE6 that uses a thread to do some background task.</p>
<p>Here'... |
72,299,515 | Filling up values of a dict, which in itself is in a list<p>I have a problem. I have a <code>list</code> and this in turn contains <code>dicts</code>. The problem is that the <code>dicts</code> can have different sizes. That some elements are missing in some <code>dicts</code>. Is there an option to fill the <code>dict... | <p>If I understand the problem correctly, it seems that you need to construct a superset of all possible keys. Once you have that you can iterate over the list and set default values in each dictionary. Now that the "top level" dictionaries have been adjusted you need to step down a level and do the same thin... | Filling up values of a dict, which in itself is in a list | python|pandas|list|dictionary | 1 | 54 | 2 | 72,300,287 | 72,300,287 | 1 | true | 2022-05-19T06:20:47.217Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filling up values of a dict, which in itself is in a list<p>I have a problem. I have a <code>list</code> and this in turn contains <code>dicts</code>. The pr... |
72,320,707 | Is there a way to upload/download a file from/to Dropbox while keeping the modification date of the file?<p>I'm trying to build a sync system for my writing application, so that I can synchronize my text files with a Dropbox folder and edit them from my computer.</p>
<p>Thing is, when a file is uploaded, its modificati... | <p>You can set the <code>clientModified</code> date using <a href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v5.2.0/com/dropbox/core/v2/files/UploadBuilder.html#withClientModified(java.util.Date)" rel="nofollow noreferrer"><code>UploadBuilder.withClientModified</code></a>. It's not possible to override the <c... | Is there a way to upload/download a file from/to Dropbox while keeping the modification date of the file? | java|android|dropbox-api|dropbox-sdk | 0 | 54 | 1 | 72,320,930 | 72,320,930 | 1 | true | 2022-05-20T14:35:51.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to upload/download a file from/to Dropbox while keeping the modification date of the file?<p>I'm trying to build a sync system for my writing ... |
72,281,479 | How to write a function to return user input and calculate<p>I am new to python and I would like to learn how to create a function to ask the user what action they want to take and return the action the user selects. I would also want to use a for loop to ask the user for the input 3 times. Thank you in advance.</p> | <p>You can do it like the following, I added comments to explain what each line does.</p>
<pre><code>def func(): # Function decleration
action = input("Enter action") # Get action from user
return action # Print action back to user
for i in range(3): # Loop for 3 times
action_returned = func() ##... | How to write a function to return user input and calculate | python | -2 | 54 | 1 | 72,281,541 | 72,281,541 | 1 | true | 2022-05-17T22:49:55.010Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to write a function to return user input and calculate<p>I am new to python and I would like to learn how to create a function to ask the user what actio... |
72,239,789 | Split work between writing output from .exe and reading the output<p>I have a simple .exe downloaded from the apple app store. It gives real-time updates on crypto prices and their percentage change. I am extracting percentage changes of bitcoin.</p>
<p>I am using a subprocess to extract the output. I am storing the ou... | <p>I don't know if this answer resolve all your problems because you have few mistakes in program - when you repair one mistake then it still doesn't work because there are other mistakes.</p>
<hr />
<p>First:</p>
<p><code>target</code> in <code>Thread</code> and <code>Process</code> needs function's name without <code... | Split work between writing output from .exe and reading the output | python|multithreading|multiprocessing | 0 | 54 | 1 | 72,247,706 | 72,247,706 | 1 | true | 2022-05-14T11:32:06.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Split work between writing output from .exe and reading the output<p>I have a simple .exe downloaded from the apple app store. It gives real-time updates on ... |
72,294,894 | How to "undo" a commit as a new commit?<p>I've searched to find many answers relating to my question but they don't do exactly what I want, and I'm not sure how else to describe it.</p>
<p>Lets say I make a commit called <code>remove tracking</code> and I remove 10 lines of code.</p>
<p>I want to essentially "undo... | <p>Like "I want to get this file back to how it was on HEAD~"?</p>
<pre><code>git checkout HEAD~ -- the-file
git reset the-file # so that it is out of the index
</code></pre>
<p>This is the new approach, if I recall correctly:</p>
<pre><code>git restore --worktree HEAD~ -- the-file
</code></pre>
<p>If you nee... | How to "undo" a commit as a new commit? | git | 0 | 54 | 2 | 72,295,006 | 72,295,006 | 1 | true | 2022-05-18T19:24:21.337Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to "undo" a commit as a new commit?<p>I've searched to find many answers relating to my question but they don't do exactly what I want, and I'm not sure ... |
72,345,285 | How to use polymorphism in anemic domain model design?<p>Now i am working on a mmorpg server,Let's talk one scene that player drop something from inventory to world</p>
<p>If I design the Drop with rich domain model,i will create code like this</p>
<pre><code>class Player {
void Drop(IDropable dropable,vector3 pos)... | <p>One way to get rid of those if/else chains: double dispatch</p>
<p>Example:</p>
<pre><code>class DropService:IDropService {
void RemoveFromPlayerInventory(Player player){
//.....
}
void Drop(Player player, IDropable dropable,vector3 pos){
RemoveFromPlayerInventory(player);
dropabl... | How to use polymorphism in anemic domain model design? | c#|domain-driven-design|object-oriented-analysis | 0 | 54 | 2 | 72,345,571 | 72,345,571 | 1 | true | 2022-05-23T08:16:20.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use polymorphism in anemic domain model design?<p>Now i am working on a mmorpg server,Let's talk one scene that player drop something from inventory t... |
72,250,364 | Java Scanner.readLine consumes new line character, but when using println doesn't consume new line character<h1>Code</h1>
<pre class="lang-java prettyprint-override"><code>import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class MainT {
public static void main(String[] args) {
... | <p>As the documentation of the <code>nextLine()</code> method states</p>
<blockquote>
<p>Advances this scanner past the current line and returns the input that was skipped. <b>This method returns the rest of the current line, excluding any line separator at the end</b>. [...]</p>
</blockquote>
<p><a href="https://docs.... | Java Scanner.readLine consumes new line character, but when using println doesn't consume new line character | java | 0 | 54 | 1 | 72,250,930 | 72,250,930 | 1 | true | 2022-05-15T16:56:48.423Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java Scanner.readLine consumes new line character, but when using println doesn't consume new line character<h1>Code</h1>
<pre class="lang-java prettyprint-o... |
72,359,778 | delete data only between may 6 and may 18, 2022<p>I have a table with <code>CLIENT_CONTACT</code> data, where there is call data from 2020 to today.</p>
<p>How can I delete data only between May 6 and May 18, 2022, did I write correctly?</p>
<pre><code>DELETE FROM CLIENT_CONTACT
WHERE rep_date >= TO_DATE('06.05.2022... | <blockquote>
<p>did I write correctly?</p>
</blockquote>
<p>Maybe.... in Oracle, a <code>DATE</code> is a binary data type consisting of 7 bytes representing century, year-of-century, month, day, hour, minute and second and it <strong>ALWAYS</strong> has those components; however, many client applications used to acces... | delete data only between may 6 and may 18, 2022 | sql|oracle | 0 | 54 | 1 | 72,359,995 | 72,359,995 | 1 | true | 2022-05-24T08:41:43.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
delete data only between may 6 and may 18, 2022<p>I have a table with <code>CLIENT_CONTACT</code> data, where there is call data from 2020 to today.</p>
<p>H... |
72,391,700 | Want to include just the chosen ones in the invoice<p>In my system for pistol competition we have an invoice system. The problem is that one can choose one or more signups but not all for creating invoices but all signups are created. For example we have two signups, John Doe and Mary Doe and I choose only John Doe for... | <p>I got the solution. This is the adjusted code part:</p>
<pre><code> /**
* Instanciate $invoices as new collection.
*/
$invoices = new \Illuminate\Database\Eloquent\Collection;
$query = Competition::where(function($query) use ($club, $signupIds, $teamIds){
$query->w... | Want to include just the chosen ones in the invoice | php|laravel-9|php-8.1 | 1 | 54 | 1 | 72,453,875 | 72,453,875 | 1 | true | 2022-05-26T12:18:09.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Want to include just the chosen ones in the invoice<p>In my system for pistol competition we have an invoice system. The problem is that one can choose one o... |
72,260,932 | Split column after first two characters<p>I want to split a column into two columns while the one column would keep the first two characters within the origin column and the new column would contain all other characters.</p>
<p>Something similar is also fine, as long as I can split the cell content into two columns aft... | <pre><code># sample data
d = data.frame(x = c("a", "ab", "abc", "abcd"))
tidyr::separate(d, x, into = c("x1", "x2"), sep = 2)
# x1 x2
# 1 a
# 2 ab
# 3 ab c
# 4 ab cd
</code></pre>
<p>You could also use <code>substring</code>:</p>
<pre><code>library(... | Split column after first two characters | r | 0 | 54 | 2 | 72,260,989 | 72,260,989 | 1 | true | 2022-05-16T14:34:46.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Split column after first two characters<p>I want to split a column into two columns while the one column would keep the first two characters within the origi... |
72,322,181 | Can itterows restart at each new index group?<p>I have an inventory model where I have inputs increasing the inventory and outputs decreasing the inventory every day. The inventory cannot go below zero.</p>
<pre><code>import numpy as np
import pandas as pd
day = [1, 2, 3, 4, 5, 6, 1, 2, 3, 1, 2]
item_id = [1, 1, 1, 1, ... | <p><s>You can first calculate a net change and use <code>group_by</code> and <code>cumsum</code> to calculate the result. </s></p>
<p>Edit: <code>cumsum</code> doesn't seem capable to solve the problem. Here is a functional way using numpy to solve it.</p>
<pre class="lang-py prettyprint-override"><code>my_df["net... | Can itterows restart at each new index group? | python|pandas | 0 | 54 | 2 | 72,322,559 | 72,322,559 | 1 | true | 2022-05-20T16:39:09.183Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can itterows restart at each new index group?<p>I have an inventory model where I have inputs increasing the inventory and outputs decreasing the inventory e... |
72,374,526 | Add custom schedule to AWS ec2 lifecycle manager<p>How can I use cron expression to schedule quarterly backup? Like Backup at 12:00AM on every 1st January, 1st April, 1st July and 1st October.</p>
<p><a href="https://i.stack.imgur.com/ZU9Wt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZU9Wt.png" a... | <p>Try setting up the event with this:</p>
<pre><code>cron(0 12 1 1/3 ? *)
</code></pre>
<p>This translates to:</p>
<p><code>1/3</code> -> every third month</p>
<p><code>1</code> -> on the first day of the month</p>
<p><code>0 12</code> at 12 PM</p>
<p>One of the day-of-month or day-of-week values must be a quest... | Add custom schedule to AWS ec2 lifecycle manager | amazon-web-services|amazon-ec2|cron | 1 | 54 | 1 | 72,374,804 | 72,374,804 | 1 | true | 2022-05-25T08:47:42.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add custom schedule to AWS ec2 lifecycle manager<p>How can I use cron expression to schedule quarterly backup? Like Backup at 12:00AM on every 1st January, 1... |
72,276,659 | Run a function when deep property is set<p>I have an object like</p>
<pre><code>const obj = { field1: obj1, field2: obj2 }
</code></pre>
<p>and now I'd like to run a function when anything in <code>obj</code> was changed:</p>
<pre><code>function objChanged() { ... }
// decorate obj somehow ...
obj.field3 = data; // o... | <p>Orgil's answer works only with a single property that needs to be known and encoded. I wanted a solution which works for all properties, including later added. Inspired by his idea to create an observing object, I created a dynamic Proxy that adds another Proxies when needed.</p>
<p>In the following code <code>dog1<... | Run a function when deep property is set | javascript|object | 0 | 54 | 2 | 72,280,731 | 72,280,731 | 1 | true | 2022-05-17T15:20:58.423Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Run a function when deep property is set<p>I have an object like</p>
<pre><code>const obj = { field1: obj1, field2: obj2 }
</code></pre>
<p>and now I'd like ... |
72,376,919 | How to store profile views inside the JSON? MySQL<p>Every user has a column and it will show how many people viewed his profile.</p>
<p>I don't need to show how many people viewed the profile only, I also want to sort views according to time.</p>
<p>I did it like this but if I reach 50 million and above, I'll suffer fr... | <p>(You have been chastised in the Comments for the JSON approach; I won't repeat.) "50M rows" may not be an issue.</p>
<pre><code>-- If you need to keep the exact time of every view, have this:
CREATE TABLE view_details (
user_id MEDIUMINT UNSIGNED ..., -- pick suitable INT size
view_date DATETIME ... | How to store profile views inside the JSON? MySQL | mysql|sql|database | 0 | 54 | 1 | 72,394,975 | 72,394,975 | 1 | true | 2022-05-25T11:37:29.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to store profile views inside the JSON? MySQL<p>Every user has a column and it will show how many people viewed his profile.</p>
<p>I don't need to show ... |
72,351,359 | Dynamically and Accurately Replace HTML span with SVG text with correct positioning<p>I would like to replace a regular HTML span with the same text but in SVG format.</p>
<p>I have seen examples of this, but it seems like the positioning is just manually entered in the examples, i.e. x=10 and y=10, but I am not sure w... | <p>Something like this? It's in the centre of the box.</p>
<p>I've replaced the jQuery assignment with innerHTML as jQuery and SVG don't really work together.</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-... | Dynamically and Accurately Replace HTML span with SVG text with correct positioning | jquery|svg | 0 | 54 | 1 | 72,352,380 | 72,352,380 | 1 | true | 2022-05-23T15:44:44.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dynamically and Accurately Replace HTML span with SVG text with correct positioning<p>I would like to replace a regular HTML span with the same text but in S... |
72,317,836 | Calculate the string length of only characters (not symbols) in the string using Javascript<p>I am trying to select words being passed through an IF statement based on only their character length, ignoring symbols.</p>
<p>For example If I have the word "hello!" I want the if statement to recognise it as a len... | <p>You can use regex like so:</p>
<pre class="lang-js prettyprint-override"><code>text = "hello!"
text.match(/[a-z]/g).join("") // join to return a string without any symbols
</code></pre>
<p>If you need to match more characters just update the pattern.</p>
<p>In your particular case it would look s... | Calculate the string length of only characters (not symbols) in the string using Javascript | javascript|arrays|string|for-loop|if-statement | 0 | 54 | 1 | 72,317,893 | 72,317,893 | 1 | true | 2022-05-20T11:00:29.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculate the string length of only characters (not symbols) in the string using Javascript<p>I am trying to select words being passed through an IF statemen... |
72,338,722 | data table: for each row generate random values from other table<p>I would like to simulate flight numbers by generating flight numbers from a simulation table (table_simul), by taking an observation table as a basis.</p>
<pre><code>table_simul <- data.table(
date_f = c("2020-01-01","2020-01-02"... | <p>Maybe use a helper function to sample from <code>table_obs</code> and then join with <code>table_simul</code></p>
<pre><code>f <- function(i, ...) {
if(length(i) == 1) i else sample(i, size = 1, ...)
}
set.seed(42)
tmp <- table_obs[, .(flight = f(flight, prob = weight)), by = city]
table_simul[, flight := t... | data table: for each row generate random values from other table | r|data.table | 2 | 54 | 2 | 72,339,800 | 72,339,800 | 1 | true | 2022-05-22T15:01:09.370Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
data table: for each row generate random values from other table<p>I would like to simulate flight numbers by generating flight numbers from a simulation tab... |
72,288,194 | Faster text search in Python with complex if statement<p>I have a large set of <strong>long</strong> text documents with punctuation. Three short examples are provided here:</p>
<pre><code>doc = ["My house, the most beautiful!, is NEAR the #seaside. I really love holidays, do you?", "My house, the most b... | <p>You can build regexps for the word bags you have, and use them:</p>
<pre><code>def make_re(word_set):
return re.compile(
r'\b(?:{})\b'.format('|'.join(re.escape(word) for word in word_set)),
flags=re.I,
)
wAND_re = make_re(wAND)
wOR_re = make_re(wOR)
wNOT_re = make_re(wNOT)
def re_match(do... | Faster text search in Python with complex if statement | python|string|list | 0 | 54 | 2 | 72,288,714 | 72,288,714 | 1 | true | 2022-05-18T11:17:44.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Faster text search in Python with complex if statement<p>I have a large set of <strong>long</strong> text documents with punctuation. Three short examples ar... |
72,300,135 | An Inbuilt function to find Difference Between Two Images for Android (Kotlin Preferred)<p>In my app, I want to find the difference between two Images, almost similar but with a slight difference. The function should extract the difference and should give out an image that contains the difference it extracted. Input sh... | <p>This worked for me, but its not pefect... I'm still trying to improve this or trying to find other solutions.</p>
<pre><code> import org.opencv.android.BaseLoaderCallback
import org.opencv.android.LoaderCallbackInterface
import org.opencv.android.OpenCVLoader
import org.opencv.android.Utils
import org.opencv.cor... | An Inbuilt function to find Difference Between Two Images for Android (Kotlin Preferred) | android|kotlin | 0 | 54 | 1 | 72,456,440 | 72,456,440 | 1 | true | 2022-05-19T07:12:21.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
An Inbuilt function to find Difference Between Two Images for Android (Kotlin Preferred)<p>In my app, I want to find the difference between two Images, almos... |
72,291,087 | DataFrame group and shift to get previous column values<p>I have a DF like so:</p>
<pre><code>
asset_id source_id open_px close_px start_bin end_bin
0 1 a None 10 2022-01-01 09:30:00 2022-01-01 10:00:00
1 1 a None 10 2022-01-01 10... | <pre><code>df.sort_values(['asset_id','start_bin'], inplace=True)
df['open_px'] = df['close_px'].shift()
df.loc[~df['asset_id'].duplicated(),'open_px'] = None
print(df)
asset_id source_id open_px close_px start_bin end_bin
0 1 a NaN 10 2022-01-01 09:30:00 2022-01-... | DataFrame group and shift to get previous column values | python|pandas|dataframe | 0 | 54 | 1 | 72,291,817 | 72,291,817 | 1 | true | 2022-05-18T14:29:10.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
DataFrame group and shift to get previous column values<p>I have a DF like so:</p>
<pre><code>
asset_id source_id open_px close_px start_bin ... |
72,275,871 | Group the contents of a Map of LocalDates into a Map of Ranges of dates<p>I have a map of working shifts indexed by day <code>Map<LocalDate, Collection<Shift>> shiftsAllDays</code>
such as:</p>
<pre><code>"2020-03-26": [
{
"id": 4,
"startTime": "21:00:00&qu... | <h3>Solution with custom Range class</h3>
<p>To begin with, you need to define a class <code>Range</code> with two fields (<em>start date</em> and <em>end date</em>), and create a list of ranges. Since only three instance are required, it makes sense to declare this list as a <code>public static final</code> field with... | Group the contents of a Map of LocalDates into a Map of Ranges of dates | java|hashmap|java-stream|collectors|localdate | 1 | 54 | 1 | 72,277,003 | 72,277,003 | 1 | true | 2022-05-17T14:30:50.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Group the contents of a Map of LocalDates into a Map of Ranges of dates<p>I have a map of working shifts indexed by day <code>Map<LocalDate, Collection<... |
72,238,384 | how to plot pairs in different subplots with difference on the side<p>I want to make a plot in seaborn but I am having some difficulties. The data has 2 variable: time (2 levels) and state (2 levels). I want to plot time on the x axis and state as different subplots, showing individual data lines. Finally, to the right... | <p>The problem is that <code>sns.relplot</code> operates at a figure level. This means it creates its own figure object and we cannot control the axes it uses. If you want to leverage seaborn for the creation of the lines without using "pure" matplotlib, you can copy the lines on matplotlib axes:</p>
<pre><co... | how to plot pairs in different subplots with difference on the side | python|matplotlib|seaborn | 6 | 54 | 1 | 72,238,756 | 72,238,756 | 2 | true | 2022-05-14T08:04:50.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to plot pairs in different subplots with difference on the side<p>I want to make a plot in seaborn but I am having some difficulties. The data has 2 vari... |
72,241,359 | Form input checkbox and file type isn't functioning<p>I'm trying to make a form for adding a blog page.</p>
<p>I have title form, date form, content form, checkbox for blog category form and image form for the topic image.</p>
<p>When I try to fill the form, only the 3 of the 4 checkbox forms that worked and when I cli... | <p>The very first mistake is you have added different <code>id</code> than <code>for</code></p>
<pre><code><label for="reactJs" class="check-label">React Js
<input type="checkbox" id="checkReact" name="checkReact">
<span class="checkmark"... | Form input checkbox and file type isn't functioning | javascript|html|css | 1 | 54 | 2 | 72,241,462 | 72,241,462 | 2 | true | 2022-05-14T14:54:57.010Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Form input checkbox and file type isn't functioning<p>I'm trying to make a form for adding a blog page.</p>
<p>I have title form, date form, content form, ch... |
72,245,262 | Copy Data from Multiple Excel files to Mastefile<p>I am currently novice when it comes to VBA and I have this problem that requires an expert in this field. So I have a Masterfile Named Archive with Extract button and I have multiple excel workbook (20+) in a folder. I wanted to copy a specific information from those w... | <h2>Copy a Row Range From Several Workbooks</h2>
<pre><code>Sub CopyRows()
' Source
Const sFolderPath As String = "C:\Users\ChrisLacs\Desktop\My Files\"
Const sFilePattern As String = "*.xls*"
Const sName As String = "Sheet1"
Const sAddress As String = "B9:N9&... | Copy Data from Multiple Excel files to Mastefile | excel|vba | 2 | 54 | 1 | 72,245,502 | 72,245,502 | 2 | true | 2022-05-15T03:02:02.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Copy Data from Multiple Excel files to Mastefile<p>I am currently novice when it comes to VBA and I have this problem that requires an expert in this field. ... |
72,258,130 | How to create a column of lists from a column in pyspark<p>I have the following pyspark dataframe:</p>
<pre><code>import pandas as pd
foo = pd.DataFrame({'id': ['a','a','a','a', 'b','b','b','b'],
'time': [1,2,3,4,1,2,3,5],
'col': ['1','2','1','2','3','2','3','2']})
foo_df = spar... | <p>You can do that with a <code>goupBy</code> on the column <code>id</code> followed by a <code>collect_list</code> on the column <code>col</code>:</p>
<pre><code>import pyspark.sql.functions as F
list_df = foo_df.groupBy(F.col("id")).agg(F.collect_list(F.col("col")).alias("col"))
list_df.... | How to create a column of lists from a column in pyspark | pyspark | 0 | 54 | 1 | 72,258,835 | 72,258,835 | 2 | true | 2022-05-16T10:58:04.563Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a column of lists from a column in pyspark<p>I have the following pyspark dataframe:</p>
<pre><code>import pandas as pd
foo = pd.DataFrame({'id... |
72,263,244 | How to get access to "mesh renderer" of a different object using raycast?<p>For example, a camera that generates Raycast and if it hits it destorys an object.</p>
<pre><code>public class RaycastScript : MonoBehaviour
{
void CheckForRaycastHit()
{
RaycastHit hit;
//if raycast hit
if(Phy... | <p>Get Mesh Renderer like bellow:</p>
<pre class="lang-cs prettyprint-override"><code>var meshRenderer = hit.collider.GetComponent<MeshRenderer>();
if (meshRenderer) meshRenderer.enabled = false;
</code></pre> | How to get access to "mesh renderer" of a different object using raycast? | c#|unity3d | 3 | 54 | 1 | 72,263,364 | 72,263,364 | 2 | true | 2022-05-16T17:25:05.650Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get access to "mesh renderer" of a different object using raycast?<p>For example, a camera that generates Raycast and if it hits it destorys an object... |
72,265,493 | How to create a type for reverse recursive reduce function?<p>First, sorry, it was really hard to define my question.</p>
<p>I have as string like this: <code>"first.second.third"</code> and some <code>value</code> (it can be object, boolean or string). I wrote <code>reduce</code> function which converts thos... | <p>So we need to come with a description of what <code>processNestedFilter(columnField, value)</code> produces at the type level. Let's call the type <code>ProcessNestedFilter<K, V></code> and make it the return type of the function:</p>
<pre><code>declare const processNestedFilter: <K extends string, V>(
... | How to create a type for reverse recursive reduce function? | typescript | 1 | 54 | 1 | 72,267,130 | 72,267,130 | 2 | true | 2022-05-16T20:51:38.717Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a type for reverse recursive reduce function?<p>First, sorry, it was really hard to define my question.</p>
<p>I have as string like this: <cod... |
72,284,221 | Merge two lists, replacing elements with same index in Python<p>I would like to replace elements in one list with elements in another, but only as far as the second list goes.</p>
<p>For example:</p>
<pre class="lang-py prettyprint-override"><code>defaults = ['apple','banana','cherry','date']
data = ['accordion','banjo... | <p>You want:</p>
<pre><code>result = data + defaults[len(data):]
</code></pre>
<p>If <code>data</code> can be longer than <code>defaults</code> and you want the length of <code>defaults</code> to be the maximum length:</p>
<pre><code>result = data[:len(defaults)] + defaults[len(data):]
</code></pre>
<p>This use of <cod... | Merge two lists, replacing elements with same index in Python | python-3.x|list | 0 | 54 | 1 | 72,284,244 | 72,284,244 | 2 | true | 2022-05-18T06:35:40.777Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Merge two lists, replacing elements with same index in Python<p>I would like to replace elements in one list with elements in another, but only as far as the... |
72,284,907 | Compare Student ID in multiple row and get the desired output<p>I have a dataframe like this</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: center;">Student ID</th>
<th style="text-align: center;">Subject</th>
<th style="text-align: center;">Current class</th>
<th style=... | <p>First step would be to group all cls in a single column (not sure if more than one cls column can be different than <code>--</code> but this would be handled here) and group by <code>Student ID</code> and <code>Subject</code>:</p>
<pre><code>df['cls'] = df[['prev cls', 'current cls', 'next cls']].agg(lambda x: [i fo... | Compare Student ID in multiple row and get the desired output | python|pandas|jupyter-notebook | 1 | 54 | 1 | 72,286,669 | 72,286,669 | 2 | true | 2022-05-18T07:32:57.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Compare Student ID in multiple row and get the desired output<p>I have a dataframe like this</p>
<div class="s-table-container">
<table class="s-table">
<the... |
72,318,931 | Valgrind message: Conditional jump or move depends on uninitialised value(s) unresolved<p>I'm trying a new assignment I've got: I need to copy the Environment variables from the shell into an array, then lowercase them and print them back. (I'm using Ubuntu 20.04.4 LTS, gcc for compiling, and writing my code in C langu... | <p>In <code>PrintString</code> you're not using the right loop control:</p>
<pre><code>for(int j = 0; strings[j] != NULL; j++)
</code></pre>
<p>You pass int <code>counter</code> which tells you how many entries you have, but you don't use it. You instead look for a <code>NULL</code> entry, but you never set a <code>NU... | Valgrind message: Conditional jump or move depends on uninitialised value(s) unresolved | c|linux|valgrind | 1 | 54 | 1 | 72,319,016 | 72,319,016 | 2 | true | 2022-05-20T12:26:45.250Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Valgrind message: Conditional jump or move depends on uninitialised value(s) unresolved<p>I'm trying a new assignment I've got: I need to copy the Environmen... |
72,320,462 | react router not unmounting previous content when route is changed<p>I'm trying to build a react app which fetches news from the news api and displays it based on the category. It uses Infinite scrolling and displays 6 news items at a time.</p>
<pre><code>export default class App extends Component {
render() {
re... | <p>This is an optimization when 2 or more routes render the same routed component. In this case, the <code>News</code> component. The <code>News</code> component will remain mounted and only the <code>category</code> prop is changing, so the <code>News</code> component can respond to <em>that</em> change. You have a co... | react router not unmounting previous content when route is changed | reactjs|react-router | 2 | 54 | 1 | 72,322,073 | 72,322,073 | 2 | true | 2022-05-20T14:18:13.053Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
react router not unmounting previous content when route is changed<p>I'm trying to build a react app which fetches news from the news api and displays it bas... |
72,323,457 | Weakly captured self won't let the view model deallocate until the Task finishes<p>I am trying to learn ARC and I'm having a hard time with a weakly captured self. My project is using MVVM with SwiftUI. I'm presenting a sheet (AuthenticationLoginView) that has a <code>@StateObject var viewModel = AuthenticationLoginVie... | <p>At the time you call <code>onLogin</code> the reference to <code>self</code> is valid and so the Task commences.</p>
<p>After that, the reference to <code>self</code> in <code>login</code> keeps <code>self</code> alive. The Task has a life of its own, and you did not cancel it.</p>
<p>Moreover the use of <code>sleep... | Weakly captured self won't let the view model deallocate until the Task finishes | swift|memory|automatic-ref-counting|self | 0 | 54 | 1 | 72,323,510 | 72,323,510 | 2 | true | 2022-05-20T18:35:03.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Weakly captured self won't let the view model deallocate until the Task finishes<p>I am trying to learn ARC and I'm having a hard time with a weakly captured... |
72,323,822 | Drop first nan rows in multiple columns<p>I have the below <code>df</code>:</p>
<pre><code> ID Number Number 2 Number 3
1 10001 NaN NaN 5
2 10001 25 NaN 12
3 10001 78 4 NaN
4 10002 3 NaN NaN
5 10002 234 201 NaN
6 10002 NaN 510... | <pre><code>df1 = df.melt('ID').dropna()
df1['var1'] = df1.groupby(['variable', 'ID']).cumcount()
df1.pivot(['ID', 'var1'], 'variable', 'value').reset_index(0)
</code></pre>
<hr />
<pre><code>variable ID Number Number 2 Number 3
var1
0 10001 25.0 4.0 5... | Drop first nan rows in multiple columns | python|pandas | 1 | 54 | 4 | 72,324,046 | 72,324,046 | 2 | true | 2022-05-20T19:12:12.110Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Drop first nan rows in multiple columns<p>I have the below <code>df</code>:</p>
<pre><code> ID Number Number 2 Number 3
1 10001 NaN NaN ... |
72,331,451 | Is there a way to convert a NoneType into a String?<p>Is there a way to convert a NoneType that the user inputs into a string, in python?
This is my code:</p>
<pre><code>topping = print(input("What topping would you like on your pizza?"))
requested_toppings = []
requested_toppings.append(topping)
print("... | <p>It is possible to "convert" <code>None</code> to <code>str</code> -> <code>str(None)</code> which will result a string <code>'None'</code>. This is not what you want here.</p>
<p>You have a problem in your code - <code>input</code> returns a string, but you print it. <code>print</code> doesn't return a ... | Is there a way to convert a NoneType into a String? | python | -3 | 54 | 2 | 72,331,491 | 72,331,491 | 2 | true | 2022-05-21T16:37:34.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to convert a NoneType into a String?<p>Is there a way to convert a NoneType that the user inputs into a string, in python?
This is my code:</p... |
72,335,005 | Django exposes raw html on a rendered website<p>I am learning Django with the documentation tutorial:</p>
<p><a href="https://docs.djangoproject.com/en/4.0/intro/tutorial03/" rel="nofollow noreferrer">https://docs.djangoproject.com/en/4.0/intro/tutorial03/</a></p>
<p>I have just completed the "Write views that act... | <p>Try to update your view to make it more simple:</p>
<pre><code>def index(request):
latest_question_list = Question.objects.all()
context = {
'latest_question_list': latest_question_list,
}
return render(request, 'polls/index.html', context)
</code></pre> | Django exposes raw html on a rendered website | python|html|django | 2 | 54 | 1 | 72,335,312 | 72,335,312 | 2 | true | 2022-05-22T05:26:44.663Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django exposes raw html on a rendered website<p>I am learning Django with the documentation tutorial:</p>
<p><a href="https://docs.djangoproject.com/en/4.0/i... |
72,341,108 | Python: Comparing two strings that are not exact match<p>I would like to compare two strings in Python, where:</p>
<pre><code>string1 = 'yymm_employeenumber_Employee Name'
# Example: 2203_1145_John Doe
string2 = 'employeenumber_Employee Name'
# Example: 1145_John Doe
</code></pre>
<p>How can I ignore the the <strong>... | <p>With cases like these, it's usually best to define a custom class that can handle comparisons, i.e. something like this:</p>
<pre><code>class Employee:
def __init__(self, yymm, employee_number, employee_name):
self.yymm = yymm
self.employee_number = employee_number
self.employee_name = em... | Python: Comparing two strings that are not exact match | python | 1 | 54 | 1 | 72,341,330 | 72,341,330 | 2 | true | 2022-05-22T20:33:20.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Comparing two strings that are not exact match<p>I would like to compare two strings in Python, where:</p>
<pre><code>string1 = 'yymm_employeenumber_... |
72,347,449 | Periodic background sync: multiple registrations with different tags<p>I've been using PBS for a while, with a single tag, and it works as expected. My main source of information is <a href="https://web.dev/periodic-background-sync/#registering-a-periodic-sync" rel="nofollow noreferrer">this article</a>.
However, I may... | <p>Some of those behaviors are not covered explicitly by the specification, so in practice, different browsers that support Periodic Background Sync might implement them differently, and the same browser might vary in implementation across different operating systems.</p>
<p>Generally speaking, my experience with Chrom... | Periodic background sync: multiple registrations with different tags | javascript|progressive-web-apps | 0 | 54 | 1 | 72,351,914 | 72,351,914 | 2 | true | 2022-05-23T11:00:53.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Periodic background sync: multiple registrations with different tags<p>I've been using PBS for a while, with a single tag, and it works as expected. My main ... |
72,354,763 | I am trying to load a texture onto a Sphere in Nuxt using Three<p>I am trying to add a texture to a sphere, specifically by mapping an image to it using TextureLoader.</p>
<p>However, I can add the material perfectly fine, without the image that is. For example, if I removed the line "map: TextureLoader().load(ear... | <p>When creating a TextureLoader, you have to use the <code>new</code> keyword. You can use that single TextureLoader multiple times to load as many textures as you need.</p>
<pre class="lang-js prettyprint-override"><code>const texLoader = new TextureLoader();
const sphere = new Mesh(
new SphereGeometry(5, 50, 50),... | I am trying to load a texture onto a Sphere in Nuxt using Three | vue.js|three.js|nuxt.js | 1 | 54 | 1 | 72,355,833 | 72,355,833 | 2 | true | 2022-05-23T21:00:15.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I am trying to load a texture onto a Sphere in Nuxt using Three<p>I am trying to add a texture to a sphere, specifically by mapping an image to it using Text... |
72,355,478 | Global Constants in .h included in multiple c++ project<p>I want to run a small simulation in c++.<br />
To keep everything nice and readable I seperate each thing (like all the sdl stuff, all the main sim stuff, ...) into it's own .h file.<br />
I have some variables that I want all files to know, but when I #include ... | <p>You can put the declarations for all the globals in a header and then define them in a source file and then you will be able to use those global variables in any other source file by just including the header as shown below:</p>
<p><strong>header.h</strong></p>
<pre><code>#ifndef MYHEADER_H
#define MYHEADER_H
//de... | Global Constants in .h included in multiple c++ project | c++ | 0 | 54 | 2 | 72,357,013 | 72,357,013 | 2 | true | 2022-05-23T22:38:45.067Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Global Constants in .h included in multiple c++ project<p>I want to run a small simulation in c++.<br />
To keep everything nice and readable I seperate each... |
72,360,760 | OptaPlanner solution using two entity classes with queued variables(list variables). Error "there are multiple in the entityClassSet"<p>I use the OptaPlanner 8.19.0. The problem has two entityClass.</p>
<p>But it comes out the following exception:</p>
<blockquote>
<p>Failed to instantiate [org.optaplanner.core.api.sol... | <p>Cases with multiple entity classes (that each have at least one genuine (=non-shadow) planning variable) are difficult and rare.</p>
<p><code>@PlanningListVariable</code> is not yet compatible with multiple entity classes.</p> | OptaPlanner solution using two entity classes with queued variables(list variables). Error "there are multiple in the entityClassSet" | optaplanner | 0 | 54 | 1 | 72,365,106 | 72,365,106 | 2 | true | 2022-05-24T09:48:57.127Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
OptaPlanner solution using two entity classes with queued variables(list variables). Error "there are multiple in the entityClassSet"<p>I use the OptaPlanner... |
72,375,513 | In Oracle database, does SYS.COL_USAGE$ ever get reset?<p>Is there a way to reset the table SYS.COL_USAGE$? Does the number keep going up for ever?</p>
<p>Of course, I can truncate the table or do DML operations but this is a SYSTEM table and I prefer not to do that.</p>
<p>Background: We have an unusual data warehouse... | <p>DBMS_STATS.RESET_COL_USAGE is your friend here.</p>
<p><a href="https://docs.oracle.com/en/database/oracle/oracle-database/19/arpls/DBMS_STATS.html#GUID-0ED25A41-8642-46E4-AB5C-AAC08E622A8F" rel="nofollow noreferrer">https://docs.oracle.com/en/database/oracle/oracle-database/19/arpls/DBMS_STATS.html#GUID-0ED25A41-86... | In Oracle database, does SYS.COL_USAGE$ ever get reset? | database|oracle|performance|usage-statistics | 1 | 54 | 1 | 72,377,116 | 72,377,116 | 2 | true | 2022-05-25T09:57:38.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In Oracle database, does SYS.COL_USAGE$ ever get reset?<p>Is there a way to reset the table SYS.COL_USAGE$? Does the number keep going up for ever?</p>
<p>Of... |
72,375,945 | How to store exact decimal value in Rails database?<p>I am trying to store <code>145.19064169678300</code> decimal value in database but when I look into database the last 3 digits are different and stored value is <code>145.19064169678299</code>. My migration file looks like this</p>
<pre><code> t.decimal :latitude, ... | <p>Are you viewing the csv file in Excel?</p>
<p>Are you sure Excel isn't rounding the display?</p>
<p>Excel, in its attempts to be "helpful" can distort the display of data, and change the underlying data if you edit the file. It drops leading 0s, rounds numbers or converts them to scientific notation. Best... | How to store exact decimal value in Rails database? | ruby-on-rails|postgresql | 0 | 54 | 1 | 72,377,376 | 72,377,376 | 2 | true | 2022-05-25T10:28:14.830Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to store exact decimal value in Rails database?<p>I am trying to store <code>145.19064169678300</code> decimal value in database but when I look into dat... |
72,395,614 | Regex to not match more than one trailing slash in string<p>Looking for a regex to not match more than 1 occurrence of a trailing slash</p>
<pre><code>api/v1
/api/v1
/api/2v1/21/
/api/blah/v1/
/api/ether/v1//
/api/23v1///
</code></pre>
<p>Expected match</p>
<pre><code>/api/v1
/api/2v1/21/
/api/blah/v1/
</code></pre>
<p... | <p>In the pattern that you tried, the second part of the pattern can not match, it asserts the start of the string <code>^</code> and then matches a <em>single</em> character in the character class <code>(^[\/{2,}\s])$</code> directly followed by asserting the end of the string.</p>
<pre><code>^\/([^?&#\s]*)(^[\/{2... | Regex to not match more than one trailing slash in string | regex|regex-lookarounds|regex-group|regex-negation | 2 | 54 | 3 | 72,395,859 | 72,395,859 | 2 | true | 2022-05-26T17:11:15.797Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex to not match more than one trailing slash in string<p>Looking for a regex to not match more than 1 occurrence of a trailing slash</p>
<pre><code>api/v1... |
72,330,683 | Write data in file using python<p>I'm working on a python project and I want to write some data in a file text.txt but I have this error : <code>UnboundLocalError: local variable 'data' referenced before assignment</code>
This is my code :</p>
<pre><code>from flask import Flask, request, jsonify
app = Flask(__name__)
... | <p>Set <code>data</code> to empty string before the condition. Otherwise it's undefined if the condition is false</p>
<pre><code>data=''
if request.method == 'POST':
data = request.json
print(data)
with open('text.txt', 'a') as file:
file.write(data)
</code></pre> | Write data in file using python | python | 0 | 54 | 2 | 72,330,715 | 72,330,715 | 2 | true | 2022-05-21T14:58:46.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Write data in file using python<p>I'm working on a python project and I want to write some data in a file text.txt but I have this error : <code>UnboundLocal... |
72,356,992 | Use multiple sampler2D over one input texture in OpenGL<p>Now I have a noise texture generated by this website: <a href="https://aeroson.github.io/rgba-noise-image-generator/" rel="nofollow noreferrer">https://aeroson.github.io/rgba-noise-image-generator/</a>. I want to use 4 uniform samplers in my computing shader to ... | <p>The type of the uniform is <code>ìmage2D</code>, not <code>sampler2D</code>. To load and store an image, you must bind the texture to an image unit using <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBindImageTexture.xhtml" rel="nofollow noreferrer"><code>glBindImageTexture</code></a>. See <a ... | Use multiple sampler2D over one input texture in OpenGL | c++|opengl | 2 | 54 | 1 | 72,357,450 | 72,357,450 | 2 | true | 2022-05-24T03:45:20.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use multiple sampler2D over one input texture in OpenGL<p>Now I have a noise texture generated by this website: <a href="https://aeroson.github.io/rgba-noise... |
72,238,305 | nested forEach not working with append HTML<p>Nested forEach() not working with append HTML.</p>
<p>Data is coming properly fine in <code>console</code> but not properly displaying with append HTML.</p>
<p>My Code:-</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<di... | <p>You just need one <code>.forEach()</code> interpolate the following into the string in the <code>.service-wrapper-body</code>:</p>
<pre><code>`${val.services[0].discounted_price}`
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">... | nested forEach not working with append HTML | javascript|jquery | 1 | 54 | 2 | 72,238,378 | 72,238,378 | 2 | true | 2022-05-14T07:50:44.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
nested forEach not working with append HTML<p>Nested forEach() not working with append HTML.</p>
<p>Data is coming properly fine in <code>console</code> but ... |
72,244,827 | Vagrant machine wont run SED correctly - How to escape backslashes in Vagrant shell scripts<p>I have a problem I can't get around with vagrant provisioning. I have a file that has backslashes in it that I need to remove but Vagrant (Ruby?) just won't do it and I have tried for 2 days now.</p>
<pre><code>Vagrant.configu... | <p>The issue turns out to be more complex than you would think. The problem is that you have three stages of string interpolation going on here. Each stage needs strings and backslashes escaped properly in order for the final <code>sed</code> command to be correct:</p>
<ol>
<li><strong>Ruby</strong> does string interpo... | Vagrant machine wont run SED correctly - How to escape backslashes in Vagrant shell scripts | ruby|sed|vagrant | 0 | 54 | 1 | 72,248,160 | 72,248,160 | 2 | true | 2022-05-15T00:53:26.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vagrant machine wont run SED correctly - How to escape backslashes in Vagrant shell scripts<p>I have a problem I can't get around with vagrant provisioning. ... |
72,249,280 | Issue with unique_ptr<p>Can anyone tell me what the issue is with this code? It throws an error:</p>
<blockquote>
<p>cannot convert argument 1 from '_Ty' to 'const day18::BaseInstruction &'</p>
</blockquote>
<pre><code> enum Command { snd, set, add, mul, mod, rcv, jgz };
struct BaseInstruction {
Comm... | <p><code>std::make_unique()</code> is the smart-pointer equivalent of <code>new</code>, which means it calls the constructor of the specified type, passing the input parameters to that constructor, and returns a <code>std::unique_ptr</code> that points to the new object.</p>
<p>The statement:</p>
<pre><code>std::make_u... | Issue with unique_ptr | c++ | -4 | 54 | 1 | 72,249,349 | 72,249,349 | 2 | true | 2022-05-15T14:41:00.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Issue with unique_ptr<p>Can anyone tell me what the issue is with this code? It throws an error:</p>
<blockquote>
<p>cannot convert argument 1 from '_Ty' to ... |
72,384,904 | Browser Alert for Right-Click on Image<p>Does anyone know of a window alert script (browser message) that would make an alert appear when a user right-clicks on an image? The idea is to warn someone that the image is copyrighted, or that they need to cite the source if they want to use it, etc. If such a script exists... | <p>On a basic level:</p>
<pre><code><img onclick="window.alert('All copyrights reserved');"
oncontextmenu="window.alert('Image context menu is disabled');return false;"
src="some.jpg"
/>
</code></pre>
<p>Generally windows alerts are bad for usability. I suggest you look at ano... | Browser Alert for Right-Click on Image | javascript | -1 | 54 | 1 | 72,384,987 | 72,384,987 | 2 | true | 2022-05-25T22:50:23.577Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Browser Alert for Right-Click on Image<p>Does anyone know of a window alert script (browser message) that would make an alert appear when a user right-clicks... |
72,242,285 | Why the result of Exists function use == and != is not opposite?<pre><code>string input = "1234";
string[] array = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
bool in_N1 = Array.Exists(array, x =>... | <p>Let's do a high-level English version of what you're asking C# to evaluate..</p>
<blockquote>
<p>a) Dear C#, here are some numbers: 1,2,3,4. Does there exist any number in that set that is EQUAL to 1?</p>
</blockquote>
<p>Yes</p>
<blockquote>
<p>b) Dear C#, here are some numbers: 1,2,3,4. Does there exist any number... | Why the result of Exists function use == and != is not opposite? | c#|arrays|string|exists | 0 | 54 | 1 | 72,242,313 | 72,242,313 | 2 | true | 2022-05-14T16:51:40.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why the result of Exists function use == and != is not opposite?<pre><code>string input = "1234";
string[] array = { "0", "1", ... |
72,255,794 | Math with different width variables and casting<p>Consider the following code snippet:</p>
<pre><code>// The assigned numbers are random and not relevant
uint16_t val = 2;
uint32_t sum = 4;
sum += val; // point 1
sum /= val; // point 2
</code></pre>
<ol>
<li>In this operation, is the val automatically cast to <code>u... | <p>In both cases, the value of <code>val</code> is automatically converted to the larger type <code>uint32_t</code>. The precise behavior depends on the actual size of <code>int</code>.</p>
<ul>
<li><p>If type <code>int</code> has 15 value bits, the <code>val</code> is converted to <code>uint32_t</code>, preserving the... | Math with different width variables and casting | c | 1 | 54 | 1 | 72,255,974 | 72,255,974 | 2 | true | 2022-05-16T07:52:10.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Math with different width variables and casting<p>Consider the following code snippet:</p>
<pre><code>// The assigned numbers are random and not relevant
uin... |
72,388,957 | Run maven plugin on all modules in parallel without dependency order<p>I am looking for a way to run a maven plugin, like <a href="https://code.revelc.net/formatter-maven-plugin/format-mojo.html" rel="nofollow noreferrer">the formatter plugin</a> or <a href="https://maven.apache.org/plugins/maven-checkstyle-plugin/chec... | <p>Yes you are right about the assumption to speed up things via <code>-T1C</code> if the plugin it does it correctly. As you can see that the <code>formatter-maven-plugin</code> does it correctly. As you can see the results which shows it improves the speed.</p>
<pre><code>$ hyperfine -L threads 2,4,6,8,1C -p 'git co ... | Run maven plugin on all modules in parallel without dependency order | java|maven | 2 | 54 | 1 | 72,397,963 | 72,397,963 | 2 | true | 2022-05-26T08:32:09.337Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Run maven plugin on all modules in parallel without dependency order<p>I am looking for a way to run a maven plugin, like <a href="https://code.revelc.net/fo... |
72,240,273 | How to create multiple CLI options identified my package name in a python?<p>I want to build a cli interface for my application which has nested functionality. Example:</p>
<pre><code>├── ...
├── setup.py
└── package-name
├──__init__.py
├──command1.py
└──command2.py
</code></pre>
<pre><code>package-name co... | <p>If you want access multiple sub-cli's in one entry command, you can implement a sub-command manager at <code>__main__.py</code>, which can parse sub-command from sys.argv and then dispatch to target module.</p>
<p>1️⃣First, i recommend the <a href="https://github.com/google/python-fire/blob/master/docs/guide.md" rel... | How to create multiple CLI options identified my package name in a python? | python|python-3.x | 1 | 54 | 1 | 72,241,015 | 72,241,015 | 2 | true | 2022-05-14T12:37:53.767Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create multiple CLI options identified my package name in a python?<p>I want to build a cli interface for my application which has nested functionalit... |
72,310,142 | How to import a given csv located inside one of the files that are themselves inside a zip?<p>Let's imagine a zip "a0" that contains 3 files "a01", "a02" and "a03".
Using R, how to import a given csv (e.g. "ax.csv") that we don't know in which file is it?</p>
<p>NB : it... | <p>Use <code>unzip</code>. The first line gets the names of the files in the zip file. We then grep out the file we want. Change the pattern to whatever you are looking for. Finally the second unzip call extracts the csv file and we read it in. No packages are used.</p>
<pre><code>nms <- unzip("test.zip"... | How to import a given csv located inside one of the files that are themselves inside a zip? | r|csv|zip | 1 | 54 | 2 | 72,310,264 | 72,310,264 | 2 | true | 2022-05-19T19:29:52.370Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to import a given csv located inside one of the files that are themselves inside a zip?<p>Let's imagine a zip "a0" that contains 3 files "... |
72,290,012 | Avoid evaluating input properties on Angular directives after init<p>I have a very simple Angular attribute directive that looks something like this:</p>
<pre class="lang-js prettyprint-override"><code>import { Directive, Input, OnInit } from "@angular/core";
@Directive({
selector: "[foo]",
})
ex... | <p>I guess this is not a problem to solve on the directive definition side. Every time that change detection runs on the component that host that div the expensive calculation on the string getter takes place.
So I would not use that expensive string getter in the template, instead I would work around to assign that re... | Avoid evaluating input properties on Angular directives after init | angular|angular-directive|angular2-changedetection | 1 | 54 | 1 | 72,290,309 | 72,290,309 | 2 | true | 2022-05-18T13:22:02.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Avoid evaluating input properties on Angular directives after init<p>I have a very simple Angular attribute directive that looks something like this:</p>
<pr... |
72,292,196 | Is there a way to set the precedence of capturing groups<p>I want 3 capturing groups (pre/mid/post) that share some characters. All three can match 0 or 1 time, something like this:</p>
<pre><code>^(?<pre>[T])?(?<mid>[T][A-Z])?(?<post>[T])?$
</code></pre>
<p>I am looking for them to match in order: <c... | <p>I don't think you need any lazy operators - just explicitly group <code>pre</code> together with <code>mid</code>, so that if <code>pre</code> matches then <code>mid</code> is required:</p>
<pre><code>^(?:(?<pre>T)?(?<mid>T[A-Z]))?(?<post>T)?$
</code></pre>
<p><sup>(<a href="https://regex101.com/r/... | Is there a way to set the precedence of capturing groups | regex|regex-group | 4 | 54 | 1 | 72,296,580 | 72,296,580 | 2 | true | 2022-05-18T15:41:47.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to set the precedence of capturing groups<p>I want 3 capturing groups (pre/mid/post) that share some characters. All three can match 0 or 1 ti... |
72,246,028 | Pandas - Specify Slice + Additional Column Label in loc()<p>When using loc, it seems I can <em>either</em> specify a list with separate column labels <em>or</em> a slice.</p>
<p>However, can I combine a slice with an additional column label and -if so- how?</p>
<p>I tried</p>
<pre><code>games.loc[games.Platform.isin(['... | <h2>Solution with <code>loc</code></h2>
<pre><code>df.loc[:, ['D', *df.loc[:, 'A':'C'].columns]]
</code></pre>
<hr />
<pre><code> D A B C
0 1 1 a a
1 2 1 a a
2 3 1 a a
3 1 2 a a
4 -1 2 a a
5 -1 3 a a
6 -2 3 a a
7 -3 3 a a
</code></pre> | Pandas - Specify Slice + Additional Column Label in loc() | python|pandas|slice | 0 | 54 | 4 | 72,247,171 | 72,247,171 | 3 | true | 2022-05-15T06:33:00.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas - Specify Slice + Additional Column Label in loc()<p>When using loc, it seems I can <em>either</em> specify a list with separate column labels <em>or<... |
72,295,952 | Problem accessing hash imported from CSV in Perl<p>I am working with the <a href="https://metacpan.org/pod/Text::CSV#SYNOPSIS" rel="nofollow noreferrer">Text::CSV</a> library of Perl to import data from a CSV file, using the functional interface. The data is stored in an array of hashes, and the problem is that when th... | <p>$mem is a reference to a hash, but you keep trying to use it directly as a hash. Change your code to:</p>
<pre><code>foreach (keys %$mem) {
print $mem->{$_};
}
</code></pre>
<p>There is a slight complication in that in some versions of perl, 'keys $mem' was allowed directly as an experimental feature, which l... | Problem accessing hash imported from CSV in Perl | csv|perl | 2 | 54 | 2 | 72,296,112 | 72,296,112 | 3 | true | 2022-05-18T21:02:39.323Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Problem accessing hash imported from CSV in Perl<p>I am working with the <a href="https://metacpan.org/pod/Text::CSV#SYNOPSIS" rel="nofollow noreferrer">Text... |
72,344,698 | A compilation error occurs when using clang in a Windows environment<p>I compliation the code with Vscode.
The <code>clang -v</code>:</p>
<pre><code>clang version 14.0.3
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/mingw64/bin
</code></pre>
<p>You can see I get clang form msys.</p>
<p>The ... | <p><code>clang-cpp</code> is the Clang <em>preprocessor</em>, not the C++ compiler. You should use <code>clang++</code> for the C++ compiler front-end program.</p> | A compilation error occurs when using clang in a Windows environment | c++|windows|visual-studio-code|clang|clang++ | 0 | 54 | 1 | 72,344,817 | 72,344,817 | 3 | true | 2022-05-23T07:25:54.077Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
A compilation error occurs when using clang in a Windows environment<p>I compliation the code with Vscode.
The <code>clang -v</code>:</p>
<pre><code>clang ve... |
72,360,948 | RxJS Subscription and code execution in it<p>In many projects, I see this kind of subscription code:</p>
<pre><code>isLoading: boolean; // the variable initializes, for instance, the display of the loader
</code></pre>
<p>The next step is to load the content of the page:</p>
<pre><code>this.loadSomething(): void {
th... | <p>You can use <code>finalize</code> operator to handle loading disablement, it'll run after upon <code>complete</code> or <code>error</code></p>
<pre><code>this.someService.getMethod(data).
pipe(finalize(()=>this.loading=false))
.subscribe()
</code></pre> | RxJS Subscription and code execution in it | angular|rxjs|subscribe | 0 | 54 | 2 | 72,361,212 | 72,361,212 | 3 | true | 2022-05-24T10:03:08.973Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
RxJS Subscription and code execution in it<p>In many projects, I see this kind of subscription code:</p>
<pre><code>isLoading: boolean; // the variable initi... |
72,381,863 | Image is corrupted after PIL's tobytes() method<p>I want to upload an image to a Google Bucket, however I want to reduce the size of the image before uploading. When I don't call the self._resize_image method the image gets successfully uploaded without any problems. However, when I call the resize method it works unti... | <p>From <a href="https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.tobytes" rel="nofollow noreferrer">Pillow's documentation on <code>tobytes</code></a>:</p>
<blockquote>
<p>This method returns the raw image data from the internal storage. For compressed image data (e.g. PNG, JPEG) use save()... | Image is corrupted after PIL's tobytes() method | python|image|cloud|python-imaging-library | 1 | 54 | 3 | 72,381,941 | 72,381,941 | 3 | true | 2022-05-25T17:19:57.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Image is corrupted after PIL's tobytes() method<p>I want to upload an image to a Google Bucket, however I want to reduce the size of the image before uploadi... |
72,239,200 | How can I change a value in a set method depending on a boolean's answer in Java?<p>I'm trying to change the VAT rate of an item depending if it's a luxury item or not.</p>
<p>I've tried using an if inside of my set method but it only uses the pre-set value that I gave it.</p>
<pre><code>private double vat = 0.08;
</co... | <p>You nede to call <code>setVat</code> in the constructor to apply the logic</p>
<pre><code>public ProductTest(String pname, double price, boolean lux) {
this.pname = pname;
this.price = Math.max(0, price);
this.lux = lux;
setVat(vat);
}
public void setVat(double vat) {
if (lux) {
this.vat... | How can I change a value in a set method depending on a boolean's answer in Java? | java|boolean | 0 | 54 | 2 | 72,239,321 | 72,239,321 | 3 | true | 2022-05-14T10:08:57.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I change a value in a set method depending on a boolean's answer in Java?<p>I'm trying to change the VAT rate of an item depending if it's a luxury i... |
72,390,969 | Material UI browser compatibility<p>I have a reactjs application that is using v3.9.0 of material Ui , i want to know which version of different browser it supports.
I searched for it a lot on internet but didn't find any resources for it,
I want to know is there a way by which i can get versions of browser that suppor... | <p>Information about the material ui browser compatibility can be found here.</p>
<p>For Version 5:</p>
<ul>
<li><a href="https://mui.com/material-ui/getting-started/supported-platforms/" rel="nofollow noreferrer">https://mui.com/material-ui/getting-started/supported-platforms/</a></li>
</ul>
<p>For Version 4:</p>
<ul>... | Material UI browser compatibility | reactjs|material-ui|frontend | 2 | 54 | 1 | 72,391,028 | 72,391,028 | 3 | true | 2022-05-26T11:18:10.020Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Material UI browser compatibility<p>I have a reactjs application that is using v3.9.0 of material Ui , i want to know which version of different browser it s... |
72,325,451 | Python 3 - How do I use a loop to create multiple classes at once?<p>I'm trying to make a D&D character creator, although I need to make an individual instance of a class for every single 'class' and 'race' in this.</p>
<p>I've made it so that every instance is created on a seperate line, one after another (so it's... | <p>I'd suggest collecting your classes in a dictionary keyed on the class name, rather than having named variables for each:</p>
<pre><code>dnd_classes = {
class_name: DnD_Class(class_name)
for class_name in (
"Barbarian",
"Bard",
"Cleric",
"Dru... | Python 3 - How do I use a loop to create multiple classes at once? | python|python-3.x|class | 0 | 54 | 1 | 72,325,474 | 72,325,474 | 3 | true | 2022-05-20T23:00:00.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python 3 - How do I use a loop to create multiple classes at once?<p>I'm trying to make a D&D character creator, although I need to make an individual in... |
72,398,384 | How can I update these rows that match a condition in another column of my data frame?<p>I'm trying to update Sam's role in the tibble below from PM to TC. For some reason, I have no idea how to get this to work, even though it seems simple. Here is my data frame.</p>
<pre><code>df <- tibble(
Name = c(&quo... | <p>You could also use <code>mutate</code> function and refer to column names without dollar sign and data frame name as if they are like any objects in R:</p>
<pre><code>library(dplyr)
df %>%
mutate(Role = if_else(Name == 'Sam', 'TC', Role))
# A tibble: 7 × 3
Name Role Number
<chr> <chr> <i... | How can I update these rows that match a condition in another column of my data frame? | r|dplyr | 2 | 54 | 1 | 72,398,412 | 72,398,412 | 4 | true | 2022-05-26T21:49:33.310Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I update these rows that match a condition in another column of my data frame?<p>I'm trying to update Sam's role in the tibble below from PM to TC. F... |
72,281,263 | Unable to scale Redis cluster to more than 90 nodes<p>I am using AWS Elasticache with 30 shards and 3 replicas each in EU Frankfurt region. I have a total of 90 nodes in the cluster. While trying to scale beyond this cluster configuration, I am constantly getting the following error</p>
<pre><code>Number of nodes in a ... | <p>AWS Elasticache now supports 500 Nodes Per Cluster. So, your cluster can easily scale to more than 90 nodes. However, for increasing the cluster size to more than 90 nodes, you would need to raise request for a service limit increase for <strong>“nodes per cluster per instance type”</strong> using the <strong>AWS Su... | Unable to scale Redis cluster to more than 90 nodes | amazon-web-services|redis|amazon-elasticache | 2 | 54 | 2 | 72,281,293 | 72,281,293 | 4 | true | 2022-05-17T22:18:54.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to scale Redis cluster to more than 90 nodes<p>I am using AWS Elasticache with 30 shards and 3 replicas each in EU Frankfurt region. I have a total of... |
72,291,560 | How to parse a string to case which doesn't match the type in 3rd party crate?<p>So this is some code from a 3rd party library:</p>
<pre><code>#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Copy, Ord, PartialOrd)]
pub enum ViewingMetric {
RatingPercentage,
Rating
}
</code></pre>
<p>and what... | <p>There is a guide on <a href="https://serde.rs/remote-derive.html" rel="nofollow noreferrer">how to derive Serde for remote creates</a>, in where you can customize whatever you need:</p>
<p>Would be something like:</p>
<pre class="lang-rust prettyprint-override"><code>#[derive(Serialize, Deserialize)]
#[serde(remote ... | How to parse a string to case which doesn't match the type in 3rd party crate? | rust|serde | 1 | 54 | 1 | 72,291,851 | 72,291,851 | 4 | true | 2022-05-18T15:00:22.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to parse a string to case which doesn't match the type in 3rd party crate?<p>So this is some code from a 3rd party library:</p>
<pre><code>#[derive(Debug... |
72,349,705 | How to use pivot_longer() in R to separate columns into multiple rows by category?<p>Here is some fictional data:</p>
<pre class="lang-r prettyprint-override"><code>tibble(fruit = rep(c("apple", "pear", "orange"), each = 3),
size = rep(c("big", "medium", "sm... | <p>Using the <code>names_pattern</code> argument, we can do:</p>
<pre class="lang-r prettyprint-override"><code>pivot_longer(df, c(-fruit, -size), names_pattern = '(^.*)_wk(.*$)',
names_to = c('Shop_season', 'week'))
#> # A tibble: 135 x 5
#> fruit size Shop_season week value
#> <chr&... | How to use pivot_longer() in R to separate columns into multiple rows by category? | r|dataframe|pivot|tidyr|reshape | 2 | 54 | 2 | 72,349,848 | 72,349,848 | 5 | true | 2022-05-23T13:49:46.033Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use pivot_longer() in R to separate columns into multiple rows by category?<p>Here is some fictional data:</p>
<pre class="lang-r prettyprint-override... |
72,267,259 | How to control C# string interpolation formatting for classes<p>This works:</p>
<pre class="lang-cs prettyprint-override"><code>class Item
{
public decimal Number { get; set; }
public override string ToString() => Number.ToString();
}
</code></pre>
<p>then later:</p>
<pre class="lang-cs prettyprint-override"... | <p><code>$"{item:C2}"</code> effectively calls <code>item.ToString("C2", CultureInfo.CurrentCulture);</code>, so you can implement <code>IFormattable</code> (<a href="https://docs.microsoft.com/en-us/dotnet/api/system.iformattable?view=net-6.0" rel="nofollow noreferrer">docs</a>):</p>
<pre class="la... | How to control C# string interpolation formatting for classes | c# | 0 | 54 | 1 | 72,267,323 | 72,267,323 | 5 | true | 2022-05-17T01:33:59.400Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to control C# string interpolation formatting for classes<p>This works:</p>
<pre class="lang-cs prettyprint-override"><code>class Item
{
public decim... |
72,361,930 | why are elements of unordered_set not unique for custom equal_to<p>I am trying to understand unordered_set better. Mainly, to my understanding elements in an unordered_set should be unique up to equal_to operator.
Therefore, I decided to test that by a small piece of code</p>
<pre><code>#include <iostream>
#inclu... | <p>Unordered containers <a href="https://en.cppreference.com/w/cpp/named_req/UnorderedAssociativeContainer" rel="noreferrer">have the following requirements for their hash and key equality functions</a>:</p>
<blockquote>
<p>If two Keys are equal according to Pred, Hash must return the same
value for both keys.</p>
</bl... | why are elements of unordered_set not unique for custom equal_to | c++|stl|unordered-set | 2 | 54 | 1 | 72,362,064 | 72,362,064 | 6 | true | 2022-05-24T11:17:32.777Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why are elements of unordered_set not unique for custom equal_to<p>I am trying to understand unordered_set better. Mainly, to my understanding elements in an... |
72,920,571 | UseEffect and useState problem with filter (posisible render loop)<p>I'm making a small code and my code was working before. I'm trying to separate my functions from my views, but when I do it, there's something that escapes me and I can't find the solution.</p>
<p>This is my old code:</p>
<p>views/letter.js:</p>
<pre>... | <p>The problem is pretty obvious:</p>
<pre><code>const [products, setProducts] = useState([]);
useEffect(() => {
setProducts(getProducts()); // <- new state is undefined
getSections();
}, []);
const getProducts = async () => { // <- it doesn't return anything
const response = await axios.get('http:/... | UseEffect and useState problem with filter (posisible render loop) | reactjs|use-effect | 0 | 54 | 2 | 72,920,670 | 72,920,670 | 1 | true | 2022-07-09T10:18:24.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
UseEffect and useState problem with filter (posisible render loop)<p>I'm making a small code and my code was working before. I'm trying to separate my functi... |
72,768,825 | How to get the support_ values from RFE pipeline?<p>I created a Pipeline with <code>RFE</code> and <code>RandomForestClassifer</code> in it and then applied <code>RandomizedSearchCV</code> to find the best hyperparameter values for both. This is what my code looks like -</p>
<pre><code>from sklearn.esemble_learning imp... | <p>You can access the retained features of the <em>best estimator</em> as follows:</p>
<pre><code>rs.best_estimator_.named_steps['rfe'].support_
</code></pre>
<p>Namely, you should access the <code>best_estimator_</code> attribute of the <code>RandomizedSearchCV</code> fitted instance (i.e. the pipeline re-fitted with ... | How to get the support_ values from RFE pipeline? | python|scikit-learn|pipeline|rfe | 2 | 54 | 1 | 72,772,021 | 72,772,021 | 1 | true | 2022-06-27T08:05:49.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get the support_ values from RFE pipeline?<p>I created a Pipeline with <code>RFE</code> and <code>RandomForestClassifer</code> in it and then applied ... |
72,809,513 | How do I know what is the size limit for constructing a Set in JavaScript?<p>I am making a tool for deleting geometry from a model in browser.</p>
<p>At some step of the deletion process, I take an array full of indexes and create a Set from it to get the array of unrepeated indexes.</p>
<pre><code>function GetSetFromA... | <p>The collection containing the items in a Set is called a "List" in the specification, and a limit on the size of a List is <a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type" rel="nofollow noreferrer">not specified</a>.</p>
<blockquote>
<p>These sequences may be of any length</p>
</bl... | How do I know what is the size limit for constructing a Set in JavaScript? | javascript|three.js | 2 | 54 | 1 | 72,809,580 | 72,809,580 | 1 | true | 2022-06-30T01:51:15.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I know what is the size limit for constructing a Set in JavaScript?<p>I am making a tool for deleting geometry from a model in browser.</p>
<p>At some... |
72,856,766 | Firestore Index Rules format JSON<p>I'm relatively new to Firebase and Firestore, I have created 2 Index in the firestore web app and seems like I also have to update the firestore.indexes.json on my IDE.</p>
<p><a href="https://i.stack.imgur.com/80yM7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/... | <p>The index definition is almost there, but it will only create one index, across all four of those fields (one of which, uid, will be duplicated).</p>
<p>To create 2 indexes, you can put 2 entries in the <code>indexes</code> array rather than putting all 4 fields into a single index entry:</p>
<pre><code>{
"in... | Firestore Index Rules format JSON | json|firebase|visual-studio-code|google-cloud-firestore | 0 | 54 | 1 | 72,858,956 | 72,858,956 | 1 | true | 2022-07-04T12:27:37.240Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firestore Index Rules format JSON<p>I'm relatively new to Firebase and Firestore, I have created 2 Index in the firestore web app and seems like I also have ... |
72,948,450 | How to get file count and names in directory on bash<p>I want to get the file count & file names & folder names in directory:</p>
<pre><code>mkdir -p /tmp/test/folder1
mkdir -p /tmp/test/folder2
touch /tmp/test/file1
touch /tmp/test/file2
file_names=$(find "/tmp/test" -mindepth 1 -maxdepth 1 -type f ... | <p>The answer to the second question is really the answer to the first, too.</p>
<pre><code>mapfile -d '' files < <( find /tmp/test -type f \
-mindepth 1 -maxdepth 1 \
-printf '%f\0')
echo "${#files} files"
printf '%s\n' "${files[@]}"
</code></pre>
<p>The use of double quotes and <code... | How to get file count and names in directory on bash | bash|shell | 0 | 54 | 1 | 72,948,557 | 72,948,557 | 1 | true | 2022-07-12T07:21:12.500Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get file count and names in directory on bash<p>I want to get the file count & file names & folder names in directory:</p>
<pre><code>mkdir -p... |
73,018,315 | Bash diference between quotes with/without space<p>I was trying to check if an array contained a value and I found <a href="https://stackoverflow.com/questions/3685970/check-if-a-bash-array-contains-a-value">Check if a Bash array contains a value</a></p>
<p>It did not work for me, and it was because I decided to remove... | <p><code>[[ string =~ regex ]]</code> checks if <code>regex</code> matches any substring of <code>string</code>. That operator does <strong>not</strong> iterate over your array entries as <code>for entry in "${words[@]}"</code> would do. It cannot even handle arrays.</p>
<p><code>[[ " ${words[@]} " ... | Bash diference between quotes with/without space | linux|bash|shell|posix|contains | 0 | 54 | 1 | 73,019,233 | 73,019,233 | 1 | true | 2022-07-18T06:54:44.077Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bash diference between quotes with/without space<p>I was trying to check if an array contained a value and I found <a href="https://stackoverflow.com/questio... |
72,969,673 | Why doesn't the spread operator add properties to my array?<p>I'm working with a React useState variable. I have an array of objects that has 18 objects at this top level. I'm trying to update the object at the 14th index and then return the remaining objects after it. At first I was directly mutating the state by push... | <p>bcz <code>splice</code> changes in actual array you need to use <code>slice</code></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 arr = [1, 2, 3, 4]
arr.splice(0,2)
c... | Why doesn't the spread operator add properties to my array? | javascript|reactjs|typescript|object | -1 | 54 | 2 | 72,969,729 | 72,969,729 | 1 | true | 2022-07-13T16:30:57.523Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why doesn't the spread operator add properties to my array?<p>I'm working with a React useState variable. I have an array of objects that has 18 objects at t... |
72,992,035 | How to remove and append child with WebDriverIO?<p>I want to remove and later append a child to a parent element using browser.execute in WebDriverIO, but I keep getting the error <strong>stale element reference: stale element not found</strong>, however, keeping the reference to the removed child shouldn't cause this.... | <p>This worked for me on a demo website. You could alter it a bit to make it work for you.</p>
<pre class="lang-js prettyprint-override"><code> it('stack', async () => {
await browser.url('https://www.saucedemo.com/');
const parent = await $('.login_credentials_wrap-inner');
const child = await $('.logi... | How to remove and append child with WebDriverIO? | typescript|webdriver-io | 0 | 54 | 1 | 72,992,353 | 72,992,353 | 1 | true | 2022-07-15T09:41:20.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove and append child with WebDriverIO?<p>I want to remove and later append a child to a parent element using browser.execute in WebDriverIO, but I ... |
72,986,938 | Can't Debugg using VS Code because it doesnt Find a local file<p>Currently when I debbuging moves to <em>my_proyect</em> and run</p>
<pre><code>/home/my_user/my_company/my_proyect/my_folder/my_code.py
</code></pre>
<p>However, I getting the following error:</p>
<pre><code>FileNotFoundError: [Errno 2] No such file or di... | <p>VS Code takes the <strong>open folder</strong> as the workspace. I have tested according to your directory structure, and there is no problem.</p>
<p><a href="https://i.stack.imgur.com/eskXP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eskXP.png" alt="enter image description here" /></a></p>
<p... | Can't Debugg using VS Code because it doesnt Find a local file | python|debugging|visual-studio-code | 0 | 54 | 1 | 72,988,357 | 72,988,357 | 1 | true | 2022-07-14T21:41:24.090Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't Debugg using VS Code because it doesnt Find a local file<p>Currently when I debbuging moves to <em>my_proyect</em> and run</p>
<pre><code>/home/my_user... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.