on-internet

Moving from C, how can I implement a doubly linked list in C++ using C++ features?

I'm moving from C to C++ and I'm trying to avoid using C practices in C++. It is said that raw pointers are a C feature, and that in C++ I should use smart pointers instead, yet every example I have seen online for implementing a doubly-linked list starts something like this: class DoublyLinkedList { struct Node { int data; Node* prev; Node* next; }; Node* head; Node* tail; ... }; I struggle to find an elegant way to implement this with smart pointers. I could implement it using shared pointers, but I heard that these should be seldom used and that I should attempt implementing using unique_pt

Join the discussion →

Can the Mac file-picker filter by the whole file name? [duplicate]

I know you can set the Info.plist to match files by extension, MIME type, or UTI. Is there a way to add custom matching, like adding a filter function that looks at the entire name? Edit: This query was flagged as a duplicate. I can't reword the question because these queries aren't the same at all. The other query is about how to select a folder/directory; this one is about filtering by criteria not already given by Apple. For me, the criterion is exact filename, which applies to both regular files and directories. (As examples: "maildir" for a directory, and "mbox" for a regular file.)

Join the discussion →

Adding multiple function plots to a single figure with subplots in MATLAB

I've been trying to run a function three times that plots 2 subplots (6 plots total) onto one single figure. So I've got a function that reads in a dataset and a manipulator, then manipulates it in 2 different ways, then plots in 2 subplots - the function works as it should, I just can't seem to merge the plots when I'm running it in a separate script. Simplified function below: function function_plot(dataset,manipulator) %Manipulates Data figure; subplot(1,2,2); imagesc(data_manipulated1); subplot(1,2,1); imagesc(data_manipulated2); end Simplified script below: function_plot('data.mat',manipu

Join the discussion →

How to work with discriminatedUnion and zodEffects effectively?

I have this zod schema with a discriminatedUnion: const mySchema = baseTypeSchema.extend({ id: z.string(), name: z.string(), specificData: z.discriminatedUnion("type", [specificDataA, specificDataB] as const) }); In addition, I have specific zodObject, such as the one below: const specificDataA = z.object({ type: z.literal("typeA"), isSomeDataRequired: z.boolean(), someData: z.string().optional() }); The issue is that I want to refine specificDataA, like this: const specificDataA = z .object({ type: z.literal("typeA"), isSomeDataRequired: z.boolean(), someData: z.string().optional() }) .refine

Join the discussion →

Distance Providers for VRP with Timefold/Optaplanner

In any VRP solution that involves actual driving distances, we need to use a service to get the distance between any two points, be it Google maps or Nominatim etc. What is the best practice for calculating these distances ahead of time. Should we use a multi-threaded app to get a full distance matrix between all points before we ask the Solver to work on the problem. In all the examples, the HaversineDistanceCalculator is used which is an approximation and is calculated during constraint validation , and because it doenst need to call an API, itd be fast etc, but if we were to use a service,

Join the discussion →

Power Automate / Copilot Studio: Retrieving last email thread by To or CC

I’m building a flow in Power Automate / Copilot Studio that works as follows: The flow gets an email address input from the user. It retrieves the last email thread involving that address. It passes the email thread to AI to generate a reply. The challenge I’m facing is retrieving emails reliably from Outlook Inbox when filtering by To or CC. What I’ve tried 1. Microsoft Graph API I attempted to retrieve emails using an HTTP request in Power Automate: Input (HTTP action): { "host": { "connectionReferenceName": "shared_office365-3", "operationId": "HttpRequest" }, "parameters": { "Uri": "https:

Join the discussion →

Laravel Vue Inertia delete confirm returning modal with "1" value

I am having trouble with the delete function for my table items. It keeps returning a modal with a value of 1. I have tried many possible solutions found online, but the issue persists. Controller: public function destroy($id) { $articleCategories = ArticleCategory::findOrFail($id); $articleCategories->delete(); return redirect()->route('article_categories')->with('message', 'Article category deleted successfully.'); } Vue: <script> import Title from "../Layouts/Components/Title.vue"; import PaginationLinks from "../../components/PaginationLinks.vue"; import TableEditButton from "../../compone

Join the discussion →

Multiple criteria formula to include horizontal and vertical lookup

I am trying to write a formula that has multiple conditions looking up both horizontally and vertically. In the Excel table below, col's A to G are the data. Col's I to L needs to be the combined lookup data that looks to Col's A to G to return the outcome into col. L - please see attachment for the table. I have tried several permutations using Index/Match and XLookup but to no avail, eg: =INDEX(D3:G7,MATCH(1,(D2:G2=J2)\*(C3:C7=K2)\*(A3:A7=I2)\*(B3:B7=I2),0)) =XLOOKUP(1,(D2:G2=J2)\*(C3:C7=K2)\*(A3:A7=I2)\*(B3:B7=I2),D3:G7)

Join the discussion →

How to implement email verification using Express JS with React native expo?

I am planning to build a project using an Express JS REST API with React native. I am wondering how email verification is usually handled with this kind of stack. A flow is: User registers with credentials Create a user in the database with an active field set to false The user is sent an email to verify their account (Maybe a code to enter in the app?) If verified set active field to true I am wondering if they are any external libraries to use or whether to create a custom email server to send these emails.

Join the discussion →

How can I standardize Amazon Bedrock model invocation parameters when each provider and model uses different request schemas?

I’m building an internal LLM testing platform where users can select any Amazon Bedrock model and dynamically adjust its input parameters (e.g., max_tokens, temperature, top_p, embedding options, etc.) through a UI. My goals: 1. Test all Bedrock models, including: • Text-generation models • Embedding models • Rerank models • Multimodal / video models (e.g., TwelveLabs) 2. Allow users to modify each model’s parameters before calling the model. 3. Send the correct request payload depending on the selected model. However, I ran into a problem: Problem Amazon Bedrock does not provide an API that r

Join the discussion →

Is there a char* type in the LLVM C++ API

I want to make a function starting with a function prototype as usual in the LLVM C++ API and I want one of the accepted arguments of the function to be a char*. Can someone guide me on how I can do that? Thanks! Note: I just want to know if there is a Type::char* or something like that but if not, whats the equivalent.

Join the discussion →

Frappe ERPNext: Custom grand total in Sales Invoice not decreasing on child table row deletions

I'm customizing a Sales Invoice in Frappe/ERPNext to calculate a discounted grand total (15% off qty * rate per item). The total updates correctly on add/edit but doesn't decrease when deleting rows from the 'items' child table. What I've tried: Client-side JS: Triggers on qty, rate, items_add, items_remove, refresh, onload, after_save. Recalculates and refreshes fields. Added a custom "Recalculate & Save" button. Server-side Python: Hook on before_save/before_submit to recalc and persist via frappe.db.set_value. Added debug frappe.msgprint. Custom fields: custom_g_total (Currency, in Sales In

Join the discussion →

Parse Issue (Xcode): Module 'mobile_scanner' not found

I am using the mobile_scanner package in my Flutter project for barcode/QR code scanning. Here is how and where I use it in the code: 1. pubspec.yaml dependencies: flutter: sdk: flutter mobile_scanner: ^3.5.1 # (example version) 2. Usage in my Dart code I import the package normally: import 'package:mobile_scanner/mobile_scanner.dart'; I use it inside a widget, for example: class ScanPage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: MobileScanner( onDetect: (capture) { final List<Barcode> barcodes = capture.barcodes; for (final barcode in barc

Join the discussion →

Spectral method ODE solver is stable in MATLAB but blows up in R

I am using a spectral method to solve an ordinary differential equation. The following R code and MATLAB code are completely equivalent, but the R code blows up (the values of u that it computes become very large), while the MATLAB code solves for u stably. I suspect this is because numerical computation in R is less stable than in MATLAB. I would appreciate it if someone could analyze the situation in more detail. # R (The result would explode) library(pracma) f<- function(x){ return(exp(x)*(x^2+ 4*x+1)+ exp(5*x)*(x^2-1)^5) } Cheb<- function(N){ #D_cheb of size N+1, corresponding to N sub-int

Join the discussion →

How to set the Elevenlabs webhook type programmatically?

I am using ElevenLabs for transcribing audio (speech to text), and want to create a webhook which will be triggered once audio transcription is complete. I found that you must specify the webhook type into Edit Endpoint into the dashboard in order to make it work. Webhooks My question is that I couldn't do it using the JavaScript SDK and I didn't find the option on the API reference. import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"; const { webhookId, webhookSecret } = await elevenlabs.webhooks.create({ settings: { authType: "hmac", name: "test-webhook", webhookUrl: "https://www.ex

Join the discussion →

WooCommerce How to Display Stripe Based on PostCode

In WordPress 6.9 version and WooCommerce version 10.3.6, I want to display the Stripe based on the shipping zone. Shipping zone 1 consists of Post code 3000 Shipping zone 2 consists of Post code 4000. ex: Post Code 3000 should display Stripe. Post Code 4000 or any other postcodes should hide Stripe. Currently, I am using woocommerce_available_payment_gateways webhook to display. add_filter('woocommerce_available_payment_gateways', 'payment_gateways_based_on_chosen_shipping_method'); function payment_gateways_based_on_chosen_shipping_method($available_gateways) { $shouldReturnAll = true; if( is

Join the discussion →

Rule exceptions for specific libraries

I am applying Pyright to my project. I want to fix issues however, on specific imports I want to ignore some rules. File or line level rule exceptions are problematic for me. Line level: from mockito import ANY, mock, unstub, when ... when(bob).get_fruit("Apple").thenReturn("Apple") # pyright: ignore[reportUnknownMemberType] I can keep the rule exception on specific situations but I need to repeat that for each line. File level: # pyright: reportUnknownMemberType=false from mockito import ANY, mock, unstub, when ... when(bob).get_fruit("Apple").thenReturn("Apple") Now I don't need to repeat bu

Join the discussion →

Pyright - rules exceptions for specific libraries?

I am currently doing some efforts on applying Pyright throughout my project. Most of the time I want to fix the issues instead of ignoring them, however, in some situations (mainly on specific imports) I always want to ignore some rules. I know that you can have file level or line level rules exceptions but both are problematic for me. For line level, like: from mockito import ANY, mock, unstub, when ... when(bob).get_fruit("Apple").thenReturn("Apple") # pyright: ignore[reportUnknownMemberType] I like that since I can keep the rule exception on specific situations but the issue is that I will

Join the discussion →

How to connect to MCP server (Transport type: Streamable HTTP) in MCP Inspector (v0.17.2)

I have this local MCP-server and I want to test with this MCP Inspector, I followed this tutorial but it does not work. Got this following error. My MCP-server written in java (Spring boot) using: <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-starter-mcp-server-webflux</artifactId> </dependency> McpApplication.java @SpringBootApplication public class McpApplication { public static void main(String args) { SpringApplication.run(McpApplication.class, args); } @Bean public ToolCallbackProvider employeeTools(EmployeeService employeeService) { return MethodToolCallbac

Join the discussion →

Keras: only display NN-architecture without model memory allocation

My goal is to use Keras to visualise the architecture of the model. No training, no inference. For example if I just want to visualise the graph of the network of the classic VGG16-model with model = create_vgg_like_model() then Keras starts to pre-allocate the memory needed and the program crash (see image). PC specs: CPU with 4 cores, 8GB RAM. Due to the "huge" amount of parameters of the model it uses even the swap partition. I tried to play around with cpu_devices = tf.config.list_physical_devices('CPU') if cpu_devices: try: # avoid allocating all memory on the device tf.config.set_visible

Join the discussion →

How to localise the text of a type="submit" button without changing the value it sends to the server?

I am building a multi-lingual website and want to localise the captions shown on buttons in a form. document.querySelector('form').addEventListener('submit', ev => { ev.preventDefault(); console.log('submitted: %o', Object.fromEntries(new FormData(ev.target, ev.submitter).entries())); }); <form action="check.php" method="post"> <input type="submit" name="action" value="Enter"/> <input type="submit" name="action" value="Cancel"/> </form> When I change the @value, that value is also received on the server. I would like to keep processing of the form simpler by handling only the default language

Join the discussion →

How can an ARM Cortex M0+ processor wake up to resume execution?

I have an Arduino KR WiFi 1010, which has an ARM Cortex-M0+ processor, and I try to implement sleep correctly. An interrupt is registered, and __WFI (wait for interrupt) is called. This does correctly wake up the board from sleep, but after the interrupt handler returns, the board goes to sleep again, instead of resuming execution. The documentation from ARM on that topic is rather sparse. The relevant paragraph is this: Exiting STANDBY mode: Any peripheral able to generate an asynchronous interrupt can wake up the system. For example, a module running on a Generic clock can trigger an interru

Join the discussion →

How can the microcontroller wake up to resume execution on an ARM Cortex M0+ processor?

I have an Arduino MKR Wifi 1010, which has an ARM Cortex M0+ processor, and try to implement sleep correctly. What happens is that an interrupt is registered, and then __WFI (Wait for interrupt) is called. This does correctly wake up the board from sleep, but after the interrupt handler returns, the board goes to sleep again, instead of resuming execution. The documentation from ARM on that topic is rather sparse. The relevant paragraph is this: Exiting STANDBY mode: Any peripheral able to generate an asynchronous interrupt can wake up the system. For example, a module running on a Generic clo

Join the discussion →

How to connect WhatsApp node and webhook URL (error callback URL not validated)

So this thing has been breaking my head for almost a day. How do I connect my n8n WhatsApp on message trigger node to the Meta developer panel? Because when I copy the webhook URL and paste it in meta, it says call back URL error when setting a random verify token: Meta dev panel error image How do I make this connection work? I asked ChatGPT, and it never helped. I would appreciate if someone can throw light in this situation. I would be extremely grateful as I have to submit the project by this week. Here are my WhatsApp node settings: WhatsApp node image

Join the discussion →

Making a case for a defensive infantry wedge formation

Disclaimer: So i'm writing a parody setting of DnD/ASOIF/LOTR so just accept that things might be a bit farcical Background: we have a formation of heavily armoured dismounted knights with cleaver falchions holding a position in a very narrow mountain pass. This pass is maybe 20 metres wide at most. Their opponents are the stereotypical rawhide axe-wielding barbarians. The barbarians are charging down the pass and face first into the knights. No outflanking is possible. For the purposes of this story, i want the knights to be in a quasi-wedge formation ie, formation leader up front, and then b

Join the discussion →

How to generate a simple ARIMA process with statsmodels

I am trying to generate an ARIMA process with statsmodels. I tried already different combinations but nothing works. There is also nothing in the documentation that could solve my problem. The parameters of the ARIMA model should be AR coefficient [0.4], MA coefficient [-0.2] and no differencing. So, the order must be (1, 0, 1). Here is the code from my latest trial: ar_params = np.r_[0.4] ma_params = np.r_[-0.2] order = (len(ar_params), 0, len(ma_params)) model = ARIMA([0], order=order) simdata = model.simulate(nsimulations=2000, params=np.r_[ar_params, ma_params]) I couldn find anything even

Join the discussion →

Understanding Dataset Controls in Delphi While Using SQLite

My Delphi application uses SQLite for its database. My understanding is that the database connection control TFDConnection has a default row count of 50 records. If true, there should only be 50 records displayed in the TDBGrid control on screen at any one time. The next set of 50 (or less) would be shown once you pass the 50th record in the dataset by proceeding to the next or last record. The problem is my application is apparently loading all the database records (currently 148) at one time which exceeds the default record count using select * from tablename. I have tried to setup a "paging

Join the discussion →
Older stories