Most active questions
6,989 questions from the last 30 days
21
votes
21
answers
25k
views
YouTube Error 153: Video Player Configuration Error when embedding YouTube videos
When embedding YouTube videos using the IFrame API or direct embed URLs, the player occasionally displays the message “Error 153: Video Player Configuration Error” instead of loading the video. This ...
34
votes
5
answers
14k
views
Sudden Docker error about "client API version"
I've been successfully using TestContainers with Docker for quite a while now. All of a sudden today, I started getting this error:
UnixSocketClientProviderStrategy: failed with exception ...
25
votes
6
answers
20k
views
Google Antigravity (Gemini 3 Agentic IDE) Stuck in "Setting up your account" Infinite Load [closed]
I'm trying to get started with the Google Antigravity platform (the new Gemini 3 agentic IDE), and I'm hitting a wall right at the very beginning—the account setup phase.
The Issue I'm Seeing:
I ...
24
votes
2
answers
2k
views
Why do JavaScript Websocket objects not get destroyed when they go out of scope?
In JavaScript, when you do something like this,
function connect() {
var ws = new WebSocket(url);
ws.onmessage = function(e) {
window.alert(e.data);
};
}
it will work. But why ...
6
votes
4
answers
5k
views
Error: "PrismaConfigEnvError: Missing required environment variable: DATABASE_URL"
I’m working on a Next.js + TypeScript project with a MySQL database using Prisma.
I set up my configuration in prisma.config.ts like this:
import { defineConfig, env } from "prisma/config";
...
12
votes
4
answers
3k
views
installing dotnet-ef dotnet tool throws error
I’m trying to install the Entity Framework Core CLI tools globally using the .NET CLI command:
dotnet tool install --global dotnet-ef
However, the installation fails with the following error message:
...
23
votes
1
answer
3k
views
How does the compiler interpret '____'?
I have found a piece of code that defines register access permissions for a chip. Using arm-none-eabi-gcc it compiles correctly.
Here is the code:
static const uint8_t defaultRegisterAccess[...
20
votes
4
answers
2k
views
Why doesn't printing a Unicode character with wprintf work?
I made a small C program that should print an emoji:
#include <stdio.h>
#include <windows.h>
int main(void) {
SetConsoleOutputCP(CP_UTF8);
printf("\U0001F625\n"); // 😥
...
17
votes
3
answers
874
views
Necessity of `typename` for naming of local nested classes in function templates
I have a function template f, defining in its body a local class A with another nested class B. Both classes are not templates. Must I name the inner class as typename A::B or shorter variant A::B is ...
Advice
1
vote
21
replies
261
views
How to read a specific text file format in C
I just wanted to ask if it's possible to read to a specific file format, say if I wanted to read from a file that has a format of something "info.uc" or "main.uc", how would I go ...
Best practices
4
votes
14
replies
266
views
#ifdef equivalent for constexpr variables?
I'm looking for some advice.
System: Ubuntu 20.04, g++ 9.4.0 (c++17)
Traditionally in C, we'd use #define along with #ifdef, for example:
#define FOO true
#ifdef FOO
//Do something
#else
//Do ...
10
votes
4
answers
1k
views
C++ template dispatching not calling the correct function
The program test tag dispatching pattern, where the function process_data(tag, a, b) can accept 2 tags int_tag, float_tag. There are 3 case:
int_tag and a, b are int -> print a + b
float_tag and a,...
8
votes
6
answers
852
views
Template for function with N inputs
If it's possible, I would like to define a macro that would take number of arguments in function template ARGS_COUNT and make a template with all argument types being enumerated and output being ...
3
votes
5
answers
627
views
What is special about a ternary statement instead of a if-else statement in terms of optimization?
I'm talking from a language point of view in C or C++, where the compiler sees:
return condition ? a : b;
vs:
if (condition)
return a;
else
return b;
I've tried in my code, and both of them ...
Advice
4
votes
14
replies
237
views
Is there any way to make this more neat?
I currently have a block of code looking like this:
if (StateA)
{
DoSomething();
}
else if (StateB)
{
DoSomething();
DoSomethingElse();
}
I was thinking there must be an elegant way ...
16
votes
2
answers
701
views
Parsing of small floats with std::istream
I have a program that reads the coordinates of some points from a text file using std::istringstream, and then it verifies the correctness of parsing by calling stream's operator bool().
In general it ...
Advice
1
vote
22
replies
304
views
Is there a reason why signed integer is used for the ssize_t?
From the man pages, I found that size_t has the range of 0 to SIZE_MAX, and ssize_t has the range of -1 to SSIZE_MAX. So, after printing those values on a 64bit system, I have the following results:
...
Advice
2
votes
4
replies
246
views
Can function-local class be defined in the global scope?
Any C++ class can be first forward declared, and defined only later in the program. Are function-local classes an exception from this rule?
Please consider a simplified program:
auto f() {
struct ...
Best practices
3
votes
7
replies
275
views
Is it a good practice to import libraries inside function bodies?
In Python, it is common to import all libraries required by a certain file, in the beginning of the file. But this has a disadvantage: if my file contains several different functions, and only one of ...
7
votes
5
answers
835
views
Updating object properties with array elements
I have an object with nested properties. I want to update those nested properties by using an array of elements that reflect the nested sequence of the object. Also if a property does not exist, then ...
14
votes
4
answers
991
views
Is there an `alignof` implementation portable to standard C89 and C99?
C89 and C99 do not provide an alignof macro as part of the standard library (nor an alignof keyword as part of the language as done by C23).
C programmers found out they can define their own version ...
11
votes
7
answers
1k
views
Is it possible to expose C++ template struct (fully specialized) to C?
I want to use circular queue with different types and lengths in a project which mainly consists of C code. I'm thinking about implementing the circular queue as a C++ template struct. How to expose ...
Advice
1
vote
9
replies
200
views
Is this array subscripting behavior really undefined in C?
unsigned int n = 1;
char* s = "X" + 1;
s[-n];
Is that third statement undefined in C23? It seems it is, as by the standard in 6.5.2.1.2:
... The definition of the subscript operator [] is ...
9
votes
2
answers
680
views
Using Chrono, how can I get millisecond precision?
C++, using <chrono>, I would like to get a value formatted as <seconds>.<milliseconds>. I am using system_clock and get the current seconds as:
auto secs = duration_cast<seconds&...
5
votes
6
answers
233
views
How to ensure order of template parameter pack with static_assert?
Let's say I have the following code:
#include <array>
#include <string>
#include <variant>
using namespace std::literals;
using known_types_t = std::variant<int, double, char>...
Advice
0
votes
13
replies
163
views
How to replace Joda dateTime and interval with Java.time
I am trying to replace Joda datetime and interval methods with Java.time and also trying to specify explicitly timezone as Duser.timezone=America/Chicago.
This my code fragment
public void ...
13
votes
1
answer
2k
views
Trying to solve a pip-compile stack trace error
When I run pip-compile I get an error telling me that
AttributeError: 'InstallRequirement' object has no attribute 'use_pep517'
I am using
Python 3.11.6
pip v25.3
pip-compile v7.5.1
From other ...
3
votes
7
answers
214
views
How to extract a given number of ordered rows from a given number of randomly selected samples?
Starting with the example dat0 below, let's say I want to randomly extract 3 pairs of ìd`s.
Initial data (5 id pairs)
dat0 <-
structure(list(id = c("A", "A", "B", &...
2
votes
3
answers
313
views
How can I make two functions with different arguments share a function body?
I need to make a linked list implementation without using STL. push_front function has two overloads: one with const T&, the other with T&&, but the implementation is the same.
The only ...
Advice
0
votes
11
replies
196
views
Casting functions with pointer arguments to function pointers with void* argument
The following code is accepted by GCC and the resulting binary prints the expected results. But is it standard conform and would always work on different systems using different compilers?
Minimal ...
12
votes
2
answers
615
views
How can I create a 'listogram' in ggplot?
I am trying to recreate this graph I saw in this book, but instead make it as a histogram.
This is my code so far, but it is not looking as good:
set.seed(123)
library(dplyr)
library(ggplot2)
# ...
Advice
1
vote
11
replies
221
views
Identifying an event from a big Python list efficiently
I have a big Python list containing integers.
Below is the definition of my event.
Look at each element of the list and check if that element is greater than a specified number, say S. If before that ...
Advice
1
vote
14
replies
239
views
Ordered array vs. hash map in c++ (100 elements)
I need help regarding a code I want to write in c++.
I want to develop a program that receives and visualizes CAN messages on a GUI. The messages in question are about 100 distinct ID's, so we're not ...
10
votes
2
answers
6k
views
Message "Look for and connect to any device on your local network" prevents tests from running automatically
After the last Chrome update message "Look for and connect to any device on your local network" prevents me from running testcafe tests in Chrome.
The browser setting that affects this is ...
5
votes
4
answers
302
views
How to implement perfect forwarding for a container?
Consider the code fragment below:
using List=std::vector<Data>;
List generate();
List a = generate();
List b = generate();
a += generate(); // append generate() output to a
a += b; //...
Advice
0
votes
9
replies
199
views
Why isn't there a returnif keyword or something in c#?
I'm writing an Api in ASP.NET. There is a lot of boilerplate when doing validation checks. If there was a returnif (condition) <return value>. Then Api code could look way cleaner. Instead of ...
Advice
4
votes
2
replies
4k
views
Is C++26 getting destructive move semantics?
Can I express a function that consumes an object? Meaning that its destructor is not run on the moved-from object?
Like the proposed library function trivially_locate_at itself?
template <class T&...
2
votes
6
answers
332
views
Slow bash script using shuf. Alternative to shuf for better performance or poorly written script?
My goal is to get a certain number of values between 1 and 50, a certain amount of times. It has to be randomly selected in [1-50] interval. I wrote this script but it runs awefully slow. I removed a ...
12
votes
1
answer
704
views
How can I set up Thread-Local Storage (TLS) callbacks on Windows without CRT?
I'm trying to register a Thread-Local Storage (TLS) callback in a Windows application without using the C runtime (CRT).
Compiler: MSVC 14.44.35207 (Visual Studio 2022)
Target: x64
OS: Windows 11
I ...
6
votes
3
answers
384
views
Find any single 2D point within radius, but fast
I've got a list P of 2-dimensional points, 100 ≤ |P| ≤ 100000, and a list C of circle centers, 100 ≤ |C| ≤ 100000.
All coordinates (x,y) ∈ P or (x,y) ∈ C are integral, 0 ≤ x,y ≤ 4095.
P and C may ...
3
votes
2
answers
150
views
Different output while using std::cout and std::println
In the below code I'm trying to print an unsigned char variable using std::cout and std::println. Using std::cout prints the character while std::println prints the ascii value.
Can somebody explain ...
3
votes
6
answers
174
views
bash script use function call in string substitution
in a bash script I call an external script that gives me the status of a program, like
~/bin/status
which returns something like
program is running
or
program is halted
Now I want to use only the ...
Advice
6
votes
7
replies
347
views
What are the kinds of practical difficulties you've run into when implementing Microfrontends?
Our current codebase exists as a monolithic .NET application. The many years of legacy has made it difficult for our engineers to make changes and we're looking to Strangler Fig our way out of a Big ...
14
votes
1
answer
858
views
Are out-of-bounds usize slice indexes guaranteed to panic?
Rust programs typically panic when you index into a slice with an out-of-bounds usize index.
Is that panic actually guaranteed to happen? Can I rely on the panic when reasoning about the soundness of (...
7
votes
2
answers
705
views
Infer argument type of an overloaded function
Assuming two overloads:
void X::f(int, float);
void X::f(long, double);
is it possible, in C++17 or higher, to infer int/long (or whatever it is) from float/double for the second argument?
To be used ...
Advice
2
votes
10
replies
380
views
Visual studio vs gcc
I'm a small-scale C programmer at the moment, and I'm bugged by the question: is Visual Studio worth the annoyance that it is?
I've been programming in C and C++ in Visual Studio Code for a while, and ...
7
votes
2
answers
366
views
Error “type containing an unknown-size array is not allowed” using official SDK header
I’m using an official SDK that provides an api.h header file. When I try to compile, I get the following error, with wriggles on cmd:
type containing an unknown-size array is not allowed
Here are the ...
8
votes
1
answer
848
views
Is there any way to iterate data members with STL algorithms using the C++26 reflection?
With C++26 reflection, we can simply iterate all data members of an object:
#include <iostream>
#include <meta>
struct Foo {
int x;
int y;
};
void PrintFoo(const Foo& foo) {
...
10
votes
1
answer
496
views
Why does std::thread::Scope::spawn need the bound `T: 'scope`?
The signature of std::thread::Scope::spawn looks like this:
pub fn spawn<F, T>(&'scope self, f: F) -> ScopedJoinHandle<'scope, T>
where
F: FnOnce() -> T + Send + 'scope,
...
1
vote
6
answers
223
views
Why do we need abstract methods in Enums
I've been studying Java for some time now to better understand what goes on inside some of the code parts.
While studying Enum, which I am used to using exclusively for listing various fixed values (...