I'm wondering how the truncate function works. C++ is just an example i'm using because it's a language I know. I've searched online and I can't seem to find how it works, simply how to use it and what it does. here for example only shows w3schools and geeks4geeks pages on the input and output of the function, remarks, etc.. I'm wondering about what the underlying algorithm/process is.
I am working with two different workbooks. WB1=Destination data, WB2=Source. I am trying to do a lookup and match between the wb, using wb2 to find the match in WB1. Once the match is found, copy the row (not including value in column A, the search term). This is the range of B20:Y20. The search term and matching is in Column A in both wb. Each workbook will have a different date/number with the name. This is what I have so far and can't seem to get it to copy and paste the data correctly. Sub FindAndCopyAdjacent() Dim wbDest As Workbook Dim wbSource As Workbook Dim wb As Workbook ', wb As Wor
When I try to write something like this: dialogSystem.onDialogueStart.AddListener(() =\> { }); If I press arrow keys to the left from the end of the line, it takes 23 arrow clicks to reach the last e from the word AddListener. This is driving me mad, I just want to move inside spaces and type my data, and I am forced to grab my mouse and click inside the area or press 100 times the arrow key for each line. Does anyone know how to disable this indentation check/block of movement?(I use C# not sure if relevant)
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_relocate_at itself? template <class T> T* trivially_relocate_at(T* dst, T* src); Naively, if the library authors can, so should I. Problem: Where is the magic sauce? That function signature does not convey that it effectively destructs an object at src, or the reverse problem, that it effectively constructs an object at dst. I suspect the answer is no: The few examples I have found are avoiding it by doing manual memory management with
I am working on AI behaviour in a beat-em-up game in Unity. I use my own statemachine (with states that don't inherit from monobehaviour) to control my actors' behaviour and use the free version of the A* pathfinding project: using System; using System.Collections.Generic; using AYellowpaper.SerializedCollections; using Lean.Pool; using UnityEngine; using UnityEngine.Rendering; public class EnemyController : MonoBehaviour, IDamagable { public float MovementSpeed => movementSpeed; public float ChaseDistance => chaseDistance; public float StoppingDistance => stoppingDistance; public Transform Pl
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][
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
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
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
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(
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
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
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
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
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
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
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
I'm currently working on a production-ready React application built with React Router v7 and Vite. I need to implement a proper sitemap to improve SEO performance. Tech Stack: React 19 with TypeScript React Router v7 (react-router-dom v7.1.5) Vite as build tool Client-side SPA (Single Page Application) Route Structure: 270+ routes, including static pages (home, about, contact, terms, etc.) Dynamic routes with parameters: /hp/:slug - Provider profiles /service-details/:id/:slug - Service detail pages Protected routes (customer/provider dashboards) Routes defined in a centralized all_routes.tsx
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
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
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?
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?
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.
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
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
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?
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?
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 ?
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; }
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.