General Q&A about programming, scripting, software design & architecture, process, tools, testing, and more.
Filters (None)
Let's say we have an object, we store it in a union (into some other narrower type, but with memcpy(3), so it's allowed --I guess--), and then read it from the union via it's original type (so no a...
Is it worth using the Java Platform Module System introduced in Java 9 to structure application code? Given that the Java Platform Module System introduced in Java 9 doesn't manage dependency versi...
A friend is involved in rewriting a distributed software application and while discussing the architecture, we noticed that in many cases the messages had duplication between headers and payload. ...
The proposed library would sit alongside cross-platform libraries in Xamarin apps for iOS and Android. However, it would include files with names like MyLibraryFile.android.cs MyLibraryFile.ios...
Hi, I'm trying to use the JSON Generator to create data with nested repeating values. I want to create 100 objects with an ID, Name, and Code. The Id is incremented from 0 to 99, but the Code (pr...
Suppose we have N points on XY plane, ie. (x, y) and x, y are integers and multiple queries where each query is of the form y = mx + c and m, c are integers. Is it possible to count number of poin...
I am creating a button that once clicked will change from off to on with react and i am also creating a responsive clock through useEffect. Yet the code still return that useEffect is undefined th...
What exactly does the static keyword do in C? I have seen it used in several diverse contexts: 1) As a variable outside a function: #include <stdio.h> static int x = 5; int main (void) ...
I have a query summarizing some transaction data that I'd like to summarize by day of week. For my use case, I need to return weekdays formatted according to ISO 8601, so Monday must be the first d...
I'm trying to subclass pdb to have a debugger that, in case of a call to a decorated function, can "step in" the decorated function directly and skip the decorator content altogether. A well-behave...
I'd like to write a TCP client in Rust that can receive the entire message sent by a server, but I have no information about the length of a message. I'm aware that TCP doesn't preserve message bo...
I'd like to organize my Matlab packages into folders. However, if I try to lay out my code like this +MyPackage |---foo.m |---SubDir |---bar.m then I'm unable to reach bar. F...
The Code using Microsoft.EntityFrameworkCore; public class BloggingContext : DbContext { public DbSet<Blog> Blogs { get; set; } public DbSet<Post> Posts { get; set; } ...
Can someone explain why this PHP code is not excluding the watched videos? The email_id parameter is used to specify the location of the watched videos array. The code should remove the watched_vi...
MWE import random import pandas as pd from itertools import product random.seed(12345) dies = [1, 2] cells = list(range(10)) currents = [100, 200, 300] dcc = list(product(dies, ce...
Using parentheses in Javascript is always needed when you want to create functions, if/else statements and for/while loops. But in Python it has a function that is called tuples. When using an if s...
There may be a better way to manage website's with JavaScript deployments. I added jest to my repo simply to execute tests when I make PRs as part of a GitHub action. This requires a package-lock.j...
char *p, *q; p = malloc(1); free(p); q = p; // lvalue conversion Is the last lvalue conversion (= p;) Undefined Behavior or not? We didn't take the address of the local p. C11::6.3.2.1...
I have seen this construct quite a lot: int *p = (int*) malloc(n * sizeof(int)); Is this how it should be? What is the proper way to use malloc? I have also seen this: int *p = malloc(n * size...
The dictionary methods .keys(), .values(), and .items() all return view objects. Said objects reflect any changes to the underlying dictionary. This is often useful. Is there a way to get such a v...
I am developing a web app that is tied to a database. My codebase is stored on a private GitLab instance. I would like to set up a workflow that would look something like this: I have a developm...
I'm trying to do some DOM manipulation in jQuery, but am having issues with creating wrapper elements. For some reason, prepending to the wrapper doesn't work after I call wrap. Code <html>...
We have done a reverse proxy to forward blog.example.com to example.com/blog. As I think it gives great help in getting the “link juice” to the root domain. However, I am concerned about any possi...
I'm still a novice in Python. But have come across a question about format specifiers. For example, if I have two variables that are called animal and age. And print a string in the console using f...
I am working on a React Native app using Realm, Atlas Flexible Sync, and MongoDB, and I'm super confused about how subscriptions work. I'm coming from a .NET SQL background, so I'm completely new t...
What does it mean that we can use memcmp(3) on invalid values? ISO C allows comparing an invalid value through memcmp(3), because it doesn't read the value, but rather its representation, and "rea...
How to verify if a year is leap? Given a numeric value (such as 2023) or some object that represents a date (such as Date, Calendar, LocalDate, etc), how can I do it?
Problem How can I compress each column of a dataframe to the output of a function (i.e., mean), preserving columns? MWE import pandas as pd data = {"A": [1, 2, 3, 4], "B": [5, 6, 7, 8]} ...
For example: I have noticed that this does not work for any vocabulary's tests. What is the alternate way to USE: these test vocabularies? EDIT: The test word appears to run all tests alongside...
Note: I asked this question on TopAnswers a couple weeks ago, but didn't get any response, so I figured I'd ask it here. I am currently learning C++. I have a parent class (Vehicle) and two subc...
I want to pass a variable to TeamCity (on prem) to choose between deployment environments (there are 14 of 'em - don't ask) when running a TC deployment configuration build which uses a PowerShell ...
Hello everyone, I am seeking help with understanding why multithreading does not work correctly in this example: import time import matplotlib.pyplot as plt import concurrent.futures voltage...
What factors should be considered when choosing web security measures for a site?
I have written a screensaver program that, in part, uses the current wallpaper for some visual effects. However, finding the current wallpaper in different operating systems and environments is les...
Salut, quelle solution de paiement e-commerce avec 0% de commission me proposerez vous ?
I am currently using this code to display a GUI counter: USING: accessors arrays fonts kernel math math.parser ui ui.gadgets ui.gadgets.buttons ui.gadgets.editors ui.gadgets.labels ui.gadgets.pa...
For a UI gadget like a $link in Factor, a click automatically opens the page that it points to. I want to know where this default behaviour is defined. In the factor documentation, there are many ...
I've my go app the is running a web API and working smoothly at my laptop. I read this and completed the IIS setup using a config file: <configuration> <system.webServer> ...
Is it valid to partly allocate an object, as long as you only use the allocated part of it? #include <stdio.h> #include <stdlib.h> struct s { int i[100]; }; int main(void) {...
Let's analyze this code, assuming an architecture where the alignment of int64_t is the same as that of double: void bar(double *f, int64_t *j) { *(int64_t *)f = *j; } void foo(void) ...
I have to implement a JSON based REST web service for querying literature. Ordinary users should be able to query data and process it in their clients. The "main user" can adapt database entries vi...
I tried using query selector but it does not work heres my HTML code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>JS + CSS Clock<...
Consider the following method as an example: List<int> Foo() { // ... } Are there any disadvantages of returning an interface instead of a concrete implementation in C#? IList<i...
(Full code available for cloning here) I've run into some odd behavior of EF-core's Find method. It seems like the returned entity doesn't include the rest of the data. MWE Models using Micro...
I started adding types to my (working) solution to Exercism's "Kindergarten Garden" exercise, to learn how typing with python and Mypy (strict) works. While doing so, I ran into a Mypy error that I...
Context I am currently migrating a Web application from on-prem infrastructure to K8s. The legacy infrastructure relies on defining some tokens in the configuration files and these are replaced d...
Context I am currently working on migrating a legacy application to an ASP.NET Core + Angular application. The Web API's main project is based on Jason Taylor's template (clean architecture) and a...
I've turned the tables movies and scenes into media and now I don't know what to do with the movies_scenes relation. CREATE TABLE IF NOT EXISTS "movies_scenes" ( `movie_id` integer, `sce...
Title says it all. I found "Step into external code" but not sure if it's the same feature.
I have float noise values, between -1 and 1, for every x,y coordinate in a 2D area and I am trying to convert that to a whole number between 0 and 319 which represents a vertical z coordinate to re...