on-internet

Restrict keyword and pointers to pointers

I'm in C and I have an int ** (2 dimensional array, it's basically a matrix, it's actually set up a little bit complicated but there's no internal aliasing, so it's not relevant). is this int** restrict or int * restrict * restrict my instinct is the former since restrict only really applies to variables but the compiler is merrily happy to accept both (although free gets upset at discarding the restrict). For reference the only way the code access i[4][5] is by using i[4][5] . I.e. there are NO other variables such that say j=&(i[4][5]) and the internal array is structured such that say i[a][

Join the discussion →

How to replace a COM Interop with the ComWrapper Source Generator?

I am currently using a COM Interop DLL, generated with tlbimp, to access a proprietary COM library from C# (net8), so no source code available (TLB embedded in DLL). It works, but stops me from using Trimming and AoT. Now, I stumbled over the new ComWrapper API and its Source Generator, but can't find any resources explaining how to switch from the built-in COM Interop mechanism to the ComWrapper Source Generator with only a TLB/Interop Assembly available. From my understanding, it should be somehow possible to generate C# classes from a COM library that make use of the new ComWrapper API and

Join the discussion →

Using slivers to position nested widget always on top of parent

This is a follow-up question to: Position subwidget always on top of VISIBLE part of parent and its awesome answer https://stackoverflow.com/a/79389226/3984221 The mentioned answer gave the hint for using the CustomScrollView and slivers to put some sidebar widgets always on top of the view of their parents as long as they are at least partly visible. This works if it is possible to explicitly name the widget parts. However, in my specific case this is not easily achievable, because my OutputWidgets could be deeply nested. In fact, currently I am using a SingleChildScrollView which can embed w

Join the discussion →

How to assign unique elements to different indices?

I've been working on a program that prints out each word, their number of occurrence's and percentage of the number occurrences over total length of the sentence. As you can imagine I had to create a frequency table for each occurrence of each word so I tried many ways to correctly count the occurrences like using rand() to assign each word to a random index but it failed because the function I created to return the random index was inside a for loop so it called itself over and over so when encountered the same word it assinged it to different index and incremented that index instead. When th

Join the discussion →

Two "Singletons" of the same class

Hypothetically is it possible to have CDI inject exactly 2 different instances of the same class throughout my code? Two singletons of one class so to speak? And if yes, what would the annotations look like? Producing two different @Named instances with @Produces methods? Here is what I came up with: @Singleton public final class StartupBean { @Inject StartupBean(SomeManager someManager) { // nothing happening here } @Produces @Named("fooObject") public MyImplementation produceFooObject() { return new MyImplementation(); } @Produces @Named("barObject") public MyImplementation produceBarObject(

Join the discussion →

Jakarta CDI - Two "Singletons" of the same class

I'm new to injection frameworks. And my question is a contradiction in itself, but - hypothetically - is it possible to have CDI inject exactly 2 different instances of the same class throughout my code? Two singletons of one class so to speak? And if yes, what would the annotations look like? Producing two different @Named instances with @Produces methods? ---- edit ---- Here is what I came up with: @Singleton public final class StartupBean { @Inject StartupBean(SomeManager someManager) { // nothing happening here } @Produces @Named("fooObject") public MyImplementation produceFooObject() { re

Join the discussion →

Definition of the DEFINE instruction used in the source for Microsoft BASIC

Does anyone know where I can find the definition of the DEFINE keyword/instruction used in the source code of the Microsoft BASIC interpreter released to the public by Microsoft here: https://github.com/microsoft/BASIC-M6502/blob/main/m6502.asm As an example the source code contains: DEFINE LDXY (WD),< LDX WD LDY <WD>+1> This might mean the defined symbol LDXY with the parameter (WD) is replaced by the right hand side after the comma. The right hand side is enclosed in arrow-shaped bracket. But I cannot find documentation on the DEFINE assembler instruction anywhere! Thanks

Join the discussion →

Vim 9.1 and Python virtual environments

My Vim scripts use Vim's embedded Python environment. One of these requires the Python environment to use a virtual environment. Ideally Vim would inherit the virtual environment settings from the shell that launched it. Vim uses its own embedded Python interpreter. Some of the environment variables from the parent process, for example VIRTUAL_ENV, are set correctly. But Python's sys.path isn't honoring the virtual environment settings. How do Vim's pythonthreedll and pythonthreehome options affect this behavior? From Vim's help: 'pythonthreedll' Specifies the name of the Python 3 shared libra

Join the discussion →

Local groups and members using Powershell (Get-WMIobject)

I am trying to replicate a combination of WMI and ADSI, to use just WMI. This is a quick fix whilst we put a case forward for winRM as a replacement. This is something that is new to me, so please excuse my ignorance on this. I am trying to get the local groups and group members, i have used the following to get what i need. Get-WmiObject -ClassName Win32_Group –ComputerName $computername Get-WmiObject -ClassName win32_groupuser –ComputerName $computername This gives me what i need, however i can't get the SID from a service which is running. I have a document which was done before me, which s

Join the discussion →

How do I test Blazor Server from Playwright?

I have the following code to start up a kestrel server on a random port. using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting.Server; using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace Abc; public sealed class KestrelWebAppFactory : WebApplicationFactory<Program> { protected override IHost CreateHost(IHostBuilder builder) { // Build the TestServer host first (required by WebApplicationFactory) var testHost = builder.Build(); // Reconfigure the

Join the discussion →

Does CLDR specify language-specific versions of "Label: Text"?

In German and English, we use a colon followed by a space to separate a term from its explanation, or a label from the text that follows. But other languages do it differently. Rather than have a "colon followed by a space" translated from German to French, say, I wonder whether the language-specific variants could be derived from the Unicode CLDR standard. Is this possible? For example, the //ldml/localDisplayNames/localeDisplayPattern/localeKeyTypePattern already contains what is needed: Label: Text - German - colon followed by a space Label : Text - French - colon preceded by a U+202F: NARR

Join the discussion →

multiple arguments in getitem

class A: def __getitem__(self, *args): print(args.__class__, args) class B: def __getitem__(self, args): print(args.__class__, args) def f(*args): print(args.__class__, args) def g(args): print(args.__class__, args) For functions (f or g), we can identify f(1) = f(*(1,)) = f(1,) , but with slicing there is a difference: A()[x] receives raw indexer object x (key or slice), while A()[x,y] receives a tuple (x,y) B()[x] receives (x,), while B()[x,]receives ((x,)) why doesn't python enforce the same identification as for functions? How should I write a generic getitem, where I want to know the numb

Join the discussion →

Why doesn't my AI generated GeoJSON to SVG conversion code work as a Stack Snippet? [closed]

My code converts GeoJSON to SVG and should run on this page. It's generated using OpenAI's ChatGPT (version Mar 14, 2023) to let the user click a button to download the SVG code but it does not work here, why? /* Steps: 1. parse GeoJSON 2. convert lon/lat -> Web Mercator (x, y) in meters 3. compute bbox of projected coords 4. compute uniform scale and translate to fit viewport with padding 5. build SVG path string and insert into container */ function lonLatToWebMercator(lon, lat) { // returns {x, y} in meters (EPSG:3857) const R = 6378137; const x = R * lon * Math.PI / 180; const latRad = lat

Join the discussion →

COUNTIFS - Excel Date Matching

Simply, I have two values to lookup 1st is a name as "A" 1st is a date that I should look for its month given as "9/1/2025" Apparently, I used these values as conditions in a COUNTIFS function for counting the relevant data in a table that includes a number of names and a number of dates I tried using =COUNTIFS(range_of_Names,"A",MONTH(range_of_dates),month(Date_Cell)) the result is an error message

Join the discussion →

How does the computer handle interrupts, and how are they different from context-switches?

What is the difference between an interrupt and a context switch? I understand the concept of an interrupt and how it occurs. Using MIPS as a reference model I was under the impression that when an interrupt occurs, the machine performs a context switch (saving all registers) onto the stack. Is this always the case? I read today that a full context switch doesn't always happen. Can someone explain this?

Join the discussion →

How does the computer handle interrupts?

What is the difference between an interrupt and a context switch? I understand the concept of an interrupt and how it occurs. Using MIPS as a reference model I was under the impression that when an interrupt occurs, the machine performs a context switch (saving all registers) onto the stack. Is this always the case? I read today that a full context switch doesn't always happen. Can someone explain this?

Join the discussion →

MySQL dump from Ionos server not compatible with dockered MySQL db [closed]

I am trying to set up a development and testing environment for the software of my new employer. The data is quite complex and due to some shortcuts/bad architecture decisions of the company that built the software, fake data won't do. So our plan is to download an SQL dump of the production db, anonymize some sensitive information with a faker script and then load it into a locally running docker container. But when I try that, I get different errors such as: 'You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near.

Join the discussion →

Using GSL for Intel C++ on Windows without lib flags, pragma, or CMake

Using vcpkg on Windows 11, I installed GSL (GNU Scientific Library) with vcpkg install gsl. Then I did: set INCLUDE=E:\<mypath>\vcpkg\installed\x64-windows\include;%INCLUDE% set LIB=E:\<mypath>\vcpkg\installed\x64-windows\lib;%LIB% set PATH=E:\<mypath>\vcpkg\installed\x64-windows\bin;%PATH% I run the commands on CMD. I have but do not like Visual Studio. Putting *.lib files in the code using pragma is not ideal as seen below: #include <iostream> #include "gsl/gsl_integration.h" #pragma comment(lib, "gsl.lib") #pragma comment(lib, "gslcblas.lib") int main() { size_t n = 5; gsl_integration_glfix

Join the discussion →

Utilizing GSL for Intel C++ on Windows without implementing lib flags or pragma or CMake

Using vcpkg on Windows 11, I installed GSL (GNU Scientific Library) with vcpkg install gsl. Then I did set INCLUDE=E:\<mypath>\vcpkg\installed\x64-windows\include;%INCLUDE% set LIB=E:\<mypath>\vcpkg\installed\x64-windows\lib;%LIB% set PATH=E:\<mypath>\vcpkg\installed\x64-windows\bin;%PATH% I type and run the commands on CMD. I have but I do not like using Visual Studio. Putting *.lib files in the code using pragma is not ideal for me, as seen in the sample code below: #include <iostream> #include "gsl/gsl_integration.h" #pragma comment(lib, "gsl.lib") #pragma comment(lib, "gslcblas.lib") int m

Join the discussion →

How can I use dynamic parameter counts within a function call?

I am writing a function that calls another function, and in the called function the idea is that the number of parameters are dynamic. The function being called is capable of taking an arbitrary number of parameters For example: void functionCall(parameterlist) { otherFunction(parameter, parameter, parameterList[0], parameterList[1]); } How can this be accomplished?

Join the discussion →

A combobox as new property for a usercontrol to show in the designer crashes Visual Studio

In the user control's class I placed this: [Description("Determines whether the toggle switch's text is hidden or not"), Category("Appearance"), DefaultValue("No"), Browsable(true)] public ComboBox EnableText { set => EnableText.Items.AddRange(new object[] {"Yes","No"}); get => (ComboBox)EnableText.SelectedItem; } When building the project with the user control there is no error. However, the designer, when loading the user controls into the toolbox, hangs and then crashes Visual Studio. What is missing?

Join the discussion →

Sum of a binary tree

I have a binary tree which leafs have a size of 1, and the parent double in size at each level. I project those nodes on a linear axe (memory space). I need to get the equation that gives the adress of the node with the id of the node. Here is the tree : 7 <- size=8 3 11 <- size=4 1 5 9 13 <- size=2 0 2 4 6 8 10 12 14 <- size=1 The address space with the sizes of the nodes : 1 2 1 4 1 2 1 8 1 2 1 4 1 2 1 So the first results are : f(0) = 0 f(1) = 1 f(2) = 3 f(3) = 4 f(4) = 8 f(5) = 9 f(6) = 11 f(7) = 12 f(8) = 20 What is the formula of this layout ?

Join the discussion →

How do I read a specific text file format in C?

How do I read to a specific file format? I want to read from a file that has a format of "info.uc" or "main.uc", how do I do that in C? How do I read from a specific text file format here: #include "include/load_uc_file.h" bool find_file_format() { FILE* fileptr; fileptr = fopen("", "r"); if (fileptr == NULL) { printf("The file was not found"); } return false; }

Join the discussion →

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 about doing that in C? This is a little something I am making and I want to know how to read from a specific text file format: #include "include/load_uc_file.h" bool find_file_format() { FILE* fileptr; fileptr = fopen("", "r"); if (fileptr == NULL) { printf("The file was not found"); } return false; } If anyone has an answer to this, that would be great.

Join the discussion →

Is there any working difference when setFocus() method for agenda group is defined in the java code or in then field(RHS section) of the DRL rule file

I have my DRL rule file which contains more than one agenda group and they needs to be executed in certain order. Will their be any difference if the setFocus() is called upon those agenda group in the java code or in the DRL file. Drools version: 10.x Agenda group set via java code Agenda agenda = ksession.getAgenda(); agenda.getAgendaGroup( "risk" ).setFocus(); agenda.getAgendaGroup( "high" ).setFocus(); agenda.getAgendaGroup( "pre" ).setFocus(); agenda.getAgendaGroup( "automated" ).setFocus(); ksession.fireAllRules(); DRL file rule "enable" when penabled : Boolean(this == true) then kcontex

Join the discussion →

Xcode 26 Shortcut keys for the Coding Assistant message box

Using Xcode 26 and macOS 26, I have the coding assistant open, and when I type questions, it frequently gives me completion suggestions. The issue is I can't figure out how to accept the next suggested word or the entire sentence. I do have a GitHub Copilot personal subscription that looks like it might want to help but isn't any help in the Coding Assistant tab. Maybe that is the interference. I have tried all the AI search suggestions, many of which are not up-to-date for Xcode 26. Tab alone and with CMD, CTRL, OPT, CMD + CTRL, and various combinations I can think of Space alone and with CMD

Join the discussion →

ASP.NET Core embedded Blazor

Preamble In our current setup, I am developing a class library that acts as a plugin to our platform. This "works" because the executable scans its own directory and automatically loads every assembly that follows the naming pattern plugin_<assembly_name>.dll. When such an assembly is loaded, the executable looks for any class implementing a specific interface and calls the StartService() method on it. What am I trying to do? One of our requirements is to have a form of configuration for the end-user. We want to achieve this by having the internal Service start a Kestrel thread and serve a bas

Join the discussion →

Why does Laravel 12 load routes in the bootstrap file instead of RouteServiceProvider

In Laravel 10, we had a RouteServiceProvider class that handled loading up all your different routes. This is a snippet from that file in an older project I worked on using Laravel 10: RouteServiceProvider.php /** * Define your route model bindings, pattern filters, and other route configuration. */ public function boot(): void { $this->configureRateLimiting(); $this->routes(function () { $this->registerCentralDomainRoutes(); config('app.env') == 'local' && Route::middleware('web')->group(base_path('routes/test.php')); }); } You had access to almost all of the tools and features of the Laravel

Join the discussion →

Create array type containing values of all object properties

How do I create a type that must contain all object property values based on object definition? Having an object type defintion like this: type ExampleObject = { property1: "abc", property2: "xyz", property3: "123" } How do I define type that is satisifed only by these values (with items in any order): const exeampleArray = ["abc", "xyz", "123"] const exeampleArray2 = ["xyz", "abc", "123"] ... etc My exact scenario is a little more complicated but it might be useful to know: This is a definition of one TableColumn export type TableColumn< RowEntity extends object, ColumnKey extends string, Val

Join the discussion →

Typescript: Create array type containing values of all object properties

How do I create a type that must contain all object property values based on object definition? Having an object type defintion like this: type ExampleObject = { property1: "abc", property2: "xyz", property3: "123" } How do I define type that is satisifed only by these values (with items in any order): const exeampleArray = ["abc", "xyz", "123"] const exeampleArray2 = ["xyz", "abc", "123"] ... etc My exact scenario is a little more complicated but it might be useful to know: This is a definition of one TableColumn export type TableColumn< RowEntity extends object, ColumnKey extends string, Val

Join the discussion →
Older stories