StackOverflow.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (13 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

How do I troubleshoot the error: "__env__.fill is not a function" in ProcessingJS

1 January 2026 @ 1:04 am

I am stuck on this error when making a platformer 2 player: __env__.fill is not a function I simply added 1 after each instance of the word player. I was going to then duplicate them and add 2 at the end instead of 1. Then I was going to change player 2's color to red. Next, I was going to change the player 2 controls from πŸ‘†πŸΏπŸ‘ˆπŸΏπŸ‘‡πŸΏπŸ‘‰πŸΏ to wasd Then I was going to test it out. The following is the code: frameRate(34); var keys = {}; var rectRect = function(x1,y1,w1,h1,x2,y2,w2,h2){ return(x1 + w1 > x2 && y1 + h1 > y2 && x1 < x2 + w2 && y1 < y2 + h2); }; var Player = function(x,y){ this.x = x; this.y = y; this.w = 20; this.h = 20; this.xv = 35; this.yv = 0; this.grav = 0.6; this.canJump

PHP Variable Naming

1 January 2026 @ 12:32 am

If I have several variables that are only differentiated by a numerical value within the variable name, is there a way to make the numerical value a variable itself and then pass that value to another variable? Not the best explanation, so let me try with an example: <?php $_tbl = 2; $tbl_Fld_type = $tbl{$_tbl}Fld_type; // to make the updated variable $tbl2Fld_type $tbl_FormTypes = $tbl{$_tbl}FormTypes; // to make the updated variable $tbl2FormTypes If there is a way to do it, I can't think of it. I'm also not sure it can even be done. Something along the lines of a variable variable; at least that's my basis for wondering if it was possible.

C++ std::span overload resolution

31 December 2025 @ 11:10 pm

I want to pass a C-style array to a function taking a std::span, but overload resolution chooses to convert the array to bool instead. Is this behavior required by the standard, or is it a compiler issue? (I tried several compilers, and they all do the same thing. https://godbolt.org/z/8rxTWPd3K) When TEST is defined as 0, so the second overload is not defined, the array is converted to std::span as I expected, so clearly that is a good match. If the conversion to std::span isn't better than the conversion to bool, I would have expected it to be ambiguous, rather than choosing the wrong one. It is easy to change the call to workaround the problem, but since there is no warning, it isn't obvious to the person writing the call what the problem is, or how to fix it. Is there a way to change the function definition, or

Do compatible types have the same representation?

31 December 2025 @ 9:56 pm

Furthermore, is the sizeof guaranteed to be the same on compatible types? I expect the answer to both of these questions is likely "yes" in practice, but I don't see anything in the standard (in particular, the C17 standard) that definitively establishes this. The following snippets from the C17 standard seems to support this interpretation, but not definitively: 6.2.7/2: All declarations that refer to the same object or function shall have compatible type [...] 6.5.3.4/2: The sizeof operator yields the size (in bytes) of its operand [...] The size is determined from the type of the operand. It is not clear to me however that two declarations of the same object couldn't have two different (but compatible) types and therefore different sizes. Edit: To be clear, I'm talking about complete types. For incomplete types, I don't believe it is se

How to do a http request for user details everytime the userID signal value changes?

31 December 2025 @ 9:00 pm

I'm just getting used to performing http requests with signals in Angular 20. I'd like a http get request to be executed everytime the profileUserID signal value (which I have defined in a user service) is changed. I've started by converting the observable returned from the http request to a signal with toSignal as follows: userByID = toSignal(this.http.get<User>(`myapi/user/${this.profileUserID()`}), { initialValue: {} }); This does successfully do the http request with the initial value for the profileUserID signal (which is 1) however I would like it to execute the API call with the new profileUserID when its value changes. Note: The profileUserID signal value is set in the profile component every time there is a change in the userID parameter within the route. user service import { Injectable, inject

R Code to recognize speaker turns in verbatim records with inconsistent formatting

31 December 2025 @ 6:36 pm

I am trying to perform text analysis on large character strings that include multiple different speakers. I need to create a dataframe of 2 columns, speaker and turn, which have the person speaking and the text spoken. I have very long character strings like the below. I chopped up a longer string down by around 50,000 characters, but tried to preserve the diversity of the text: wha_1949_long <- "VERBATIM RECORDS OF THE PLENARY MEETINGS FIRST PLENARY MEETING Monday, 13 June 1949, at 11 a.m. Acting President: Dr. Andrija STAMPAR (Yugoslavia) 1. Opening of Session by the President of the First World Health Assembly The ACTING PRESIDENT : It iS my privilege, as President of the first session of the World Health Assembly, to open its second session. My first thoughts are of gratitude to the Italian Government for having offered to our Assembly the hospitality of this ancient city, which has been not only of great importance in the history

How to avoid implicit conversion in C++ concepts?

31 December 2025 @ 5:05 pm

Is there a way to prevent implicit conversions happening in concepts? For example, this example compiles with GCC and clang when I actually want it to give an error that the char constructor is missing: template<typename T> concept specific_constructors = requires { T(int{}, char{}); T(int{}); T(char{}); }; struct test { test(int a_, char b_): a{a_}, b{b_} {} explicit test(int a_): a{a_}, b{} {} //explicit test(char b_): a{}, b{b_} {} private: int a; char b; }; auto main() -> int { specific_constructors auto const v1 {test{1,'a'}}; } Currently, the things that I've thought of are just wrapping the char in a struct, or using a strong type, but I am looking for any other options available. EDIT: Just for some clarity, the question is how do I write the concept specific_constructors

How to identify correct Spring Cloud Gateway dependencies for a Spring Boot MVC project?

31 December 2025 @ 3:50 pm

I have a Spring Boot MVC project, where I now wish to proxy another webapp running on the same server. I'm fronting with Spring for security and URL consistency reasons. Existing pom.xml was configured with <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.4.2</version> </parent> Config I've added is: <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway-mvc</artifactId> </dependency> With AI suggesting I add this to dependencyManagement <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId>

Python packages installation - pandas & nympy

30 December 2025 @ 9:09 pm

I have read close to all posts about this topic now but I can get it working, so sorry if you find this similar to other questions, but I can't just solve it based on existing posts. I find it very hard to install Python with its packages, and remember struggling on my PC a couple of years ago also. I have a macbook. I have installed python. Using PyCharm. I have tried to install a couple of packages, not sure they got installed in the right or wrong folder. So far I have tried (and in some cases been successful) installing requests, torch, wheel, pandas, numpy. All by using pip. I have tried uninstall and install again. Also tried upgrading. Line 8 in the response below is "import pandas as pd" The code in PyCharm gives the following response during execution: File "/Users/name/PycharmProjects/ABCProject/file.py", line 8, in import pandas as pd File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/site-packages/pandas

BeautifulSoup - Extracting content blocks after specific subheadings within a larger section, ignoring document introduction

29 November 2025 @ 2:53 pm

I am scraping the Dead by Daylight Fandom wiki (specifically TOME pages, e.g., https://deadbydaylight.fandom.com/wiki/Tome_1_-_Awakening) to extract memory logs. The goal is to extract the Memory Title (mw-headline <span>) and its corresponding Memory Body (text contained in subsequent elements like <td>, <p>, etc.) as separate records, while strictly ignoring the main TOME introductory text at the top of the page. The Problem My current script successfully identifies all memory titles, but the function designed to extract the body content often incorrectly includes the general TOME introductory text (the large overview paragraph at the very top of the article) into the body of the first memory log extracted. This results in duplicate, incorrect body text for many subsequent memory records. The core issue is scoping the content extraction cor