on-internet

How to get bounding boxes (BBox) for chunks in a RAG Pipeline to highlight top 5 retrieved chunks in a PDF document?

I'm working on a RAG (retrieval-augmented generation) pipeline, where I first preprocess a PDF document and split it into chunks. When running the RAG process, I retrieve the top 5 chunks and generate an answer. To provide context, I want to highlight these 5 chunks in the original PDF document. I'm using the pdf.js library on the frontend, which can technically highlight text, but I'm facing two issues: How do I connect the bounding boxes to the chunks after splitting the PDF? How do I handle situations where bounding boxes overlap across pages? For context, I am using Haystack AI and Python

Join the discussion →

How to sum cells/structs in MATLAB

I am trying to add vertically the lists of a database like DB (see below) contained in a cell. DB={ {[11 12]} {[13 14]} {[15 16]} {[17 18]} {[19 20]}; {[21 22]} {[23 24]} {[25 26]} {[27 28]} {[29 30]}; {[31 32]} {[33 34]} {[35 36]} {[37 38]} {[39 40]}} I would like to get: [33 36] [69 72] [75 78] [81 44] [ 87 90 ] I tried with a for loop (see below), but it takes too much time. sum=[ ] for j=1:5 sumi=0 for i=1:3 sumi=sumi+ c2{i,j}{1} end sum=[sum sumi] end How could I do this with a minimum of for loops or, even better, without any loop?

Join the discussion →

doxygen documentation deployed successfully to GitHub Pages but getting 404 page not found error

I am trying to build the Doxygen documentation and publish it to GitHub Pages. Generally, I build the static HTML and CSS files, generate them, and push them with the repository. Then, I use a custom static action to publish the files to GitHub Pages. I want to automate the build and publishing process without needing to push the static web pages along with the code. So, I modified my old GitHub Action script as follows name: build-docs on: push: branches: ["main"] permissions: contents: write pages: write id-token: write jobs: deploy: environment: name: github-pages url: ${{ steps.deployment.

Join the discussion →

How can I get the absolute path for a directory created with pyinfra?

I created a new directory with pyinfra using the relative path new_dir from pyinfra.operations import files, server files.directory("new_dir") Now I would like to get the absolute path of the new directory. I tried result = server.shell("pwd", _chdir="new_dir") print(result.stdout) But that only raises an exception: RuntimeError: Cannot evaluate operation result before execution How can I get the absolute path of the directory pyinfra created for me?

Join the discussion →

Redis Backup Cron Job in EKS is Causing High NAT Gateway Costs in AWS

I’ve noticed unexpectedly high costs in our AWS bill, specifically from NAT Gateway data transfer charges. After investigating, it seems the Redis backup Cron Jobs are the primary cause. Here’s the setup: Redis: in a node in private subnet in AZ A. Backup Process: Regular backups to S3. generated by hourly Cron Jobs in the same private subnet in AZ A. Redis architecture Issue: Every time a Redis backup is triggered, the data transfer through the NAT Gateway significantly increases, resulting in high charges. This is especially problematic because our database size is growing, and so are the ba

Join the discussion →

Why does Rcpp + RcppParallel with Rcpp::List throw me a fatal error?

I run R + Rcpp + RcppParallel from RStudio. I run a parallel loop that works if I do not use a Rcpp::List in the worker, but throws an abort if I use the Rcpp::List in the worker (even in a trivial way). Am I not allowed to use a List in a worker? Minimal example: The R file sourceCpp('minimal_example.cpp') nn = 1e2 ## the following works nicely my_test = list_paral_flawed(nn, 2) ## the following throws a fatal error my_test = list_paral_flawed(nn, 1) The corresponding file minimal_example.cpp (note the minimal change between struct_A1 and struct_A2) // [[Rcpp::depends(RcppArmadillo)]] #includ

Join the discussion →

Kafka connector restarts every 6 minutes in MSK Connect 3.7.x

I'm trying to upgrade Kafka connectors in MSK Connect (AWS) from 2.7.1 to 3.7.x. Functionally they seem to work fine after the upgrade. But after observing logs in CloudWatch for these connectors I found that workers keep receiving shutdown signal every 6 minutes, as if it's happening on some schedule. This never happened in MSK Connect 2.7.1 and looks concerning. What's more, there are no errors or any obvious indications in logs on why this happens, it just happens for all connectors with predictable intervals. One of these connectors is Debezium source connector for PostgreSQL. This is how

Join the discussion →

How to extract text from scanned PDF files, which could work in both web workers and NodeJS too

I want to extract text from PDF files particularly only those that are made up of scanned images, I tried to use PDF.js methods with Tesseract.js OCR, but it won't work in web workers, although this is quite expected because document or any DOM elements are not available in web workers. The single most important reason I can't do this on the main thread or in the main script modules, is because of performance, as the browser can freeze or even crash while extracting large PDFs or containing many pages. This is the code I have currently: import * as pdfjsLib from 'pdfjs-dist'; import Tesseract

Join the discussion →

how to create a new vite react project without boilerplate code?

When creating a new React-Typescript project with: npm create vite@latest I get a new project with a lot of boilerplate code, like CSS, components and images that I have to remove in order to start coding. This is getting annoying every time I have to create a project. I explore all the options available in the menu, but I couldn't find any.

Join the discussion →

Need clarification on how to capture by reference in C++ recursive lambda

While writing a library that will be shared between programs compiled under GCC 14.2.0 for X86 and ARM 6.22 for Cortex-M, I came upon a discrepancy between how the two compilers handle the recursive lambda capture when using the new 'this auto &&' deduced 'this' feature. Here is the code: /* Compiled with --std=c++23 option */ struct Foo { int s = 1 ; void zook (void) { auto f_ok = [ & s = s ] (this auto && f , int x) -> void // ok { if (x < 10) f (x + s) ; } ; auto f_bad = [ & ] (this auto && f , int x) -> void // error: invalid use of non-static data member 'Foo::s' { if (x < 10) f (x + s) ;

Join the discussion →

Tabula GUI and Tabula-py give a different outcome

I'm trying to extract some data from a pdf table, I used the Tabula.exe app at the beginning and after selecting the wanted area the resulting csv is how I want it. I exported the template and I tried the same thing with Tabula-py using "read_pdf_with_template", but the result gives some NaN values. Sarting PDF: pdf portion Template: template [{"page":3,"extraction_method":"guess","x1":56.99806280517571,"x2":537.6866864624022,"y1":239.22816177368162,"y2":737.7751863098144,"width":480.6886236572265,"height":498.54702453613277}] Tabula GUI result: gui result Python code: df_list = tabula.read_pd

Join the discussion →

How to resolve NET MAUI workload version mismatch?

I am new to .NET and I have been receiving this error: "The current .NET MAUI package version '9.0.21' requires the .NET MAUI workload version to be at least '9.0.0'. The current .NET MAUI workload version is '8.0.83'." I tried the things ChatGPT told me, I have also checked the dotnet version and it is "9.0.101". But the issue still persists and the app won't deploy. Here's what I have tried: "1. Update the .NET MAUI Workload Run the following commands in your terminal or Developer Command Prompt for Visual Studio: dotnet workload update Check Your .NET SDK Version Ensure you are using a comp

Join the discussion →

Error in Exporting Database in phpmyadmin

Error: TypeError: PhpMyAdmin\Export::getFilenameAndMimetype(): Argument #5 ($filenameTemplate) must be of type string, null given, called in C:\xampp\phpMyAdmin\libraries\classes\Controllers\Export\ExportController.php on line 397 Error Occurs When: in 'Export' -> 'Export method:' select 'Quick - display only the minimal options' in 'Export' -> 'Export method:' select 'Custom - display all possible options' with 'data' selected gives error Fixes Tried: changed the 'max_input_vars' in php.ini values to (2000, 10000, 100000) default value was 1000. removed all data in table. tried exporting usin

Join the discussion →

vscode how to disable .ssh exposure into devcontainer?

By default vscode "Dev Containers" extension seems to expose the contents of ~/.ssh/known_hosts and all my ssh keys ssh-add -l (all private keys not added to ssh-agent) of my local machine to the dev container that is being created. This seems to be a feature established sometime in 2019. However there is no trace of documentation how this can be disabled. The GitHub issue referenced above does refer to remote extensions however the remote-ssh isn't installed on my vscode profile. The vscode v1.41 release notes state: Forwarding SSH agent The local SSH agent is now forwarded into the container

Join the discussion →

Scratch implementation of ridge regression

I am trying to implement Ridge regression but I feel like I am missing something with the Python operators. Here is my code: import numpy as np x = np.random.rand(10, 2) y = np.random.rand(10, 1) lambda_reg = 0.1 alpha = 0.1 num_iterations = 100000 X_train = np.hstack((np.ones((x.shape[0], 1)), x)) def ridge_regression_gradient_descent(X, y, lambda_reg, alpha, num_iterations): n, p = X.shape B = np.zeros(p) # Gradient descent loop for _ in range(num_iterations): y_pred = X.dot(B).reshape(-1, 1) gradient_B0 = - (1/n) * np.sum(y - y_pred) gradient_B = - (1/n) * (X[:, 1:].T @ (y - y_pred)) + lamb

Join the discussion →

Data API Builder with Azure Static Web Apps

Trying to understand Data API Builder (DAB) and if its right for my use case. Based off a simple address book example, there is a table "Addresses" that would have columns: User (the user of the address book, likely an ID linked from a User table) Name Email Address In a standard web application (front end + back end) to get a list off all addresses belong to the app User, a back end function would take a User ID (de-crypted from the User authentication) and return all address linked to the User. In the DAB example, the front end will be filtering/querying the address table based on the User I

Join the discussion →

In Django REST Framework, why does raising serializers.ValidationError return errors in different format in validate() and create() methods?

I am working on a DRF project and have a serializer like: class SomeSerializer(serializers.Serializer): number_field = serializers.IntegerField(required=False, min_value=25, max_value=100) In my settings.py, I have REST_FRAMEWORK = { other settings.... 'EXCEPTION_HANDLER': 'apps.utils.exceptions.custom_exception_handler', } In the custom exception handler, I handle ValidationError as follows: def custom_exception_handler(exc, context): # Call REST framework's default exception handler first response = exception_handler(exc, context) messages = None code = None detail = None if response is not

Join the discussion →

Using a constructor as parameter to Array.map

I need to map an array of objects to an array of other objects. Here is an example: class A {} class B { constructor(a: A) { // ...do something } } let a_arr: A[] = []; // now I want to create a B[] from the A[] If I use an anonymous function, it compiles without error: let b_arr: B[] = a_arr.map((item) => new B(item)); But that anonymous function seems useless—I suppose we can directly use the constructor: let b_arr: B[] = a_arr.map(B.constructor); Unfortunately, the above line didn't pass compilation: sh$ tsc t.ts t.ts:11:28 - error TS2345: Argument of type 'Function' is not assignable to pa

Join the discussion →

Setting of MainPage equivalent after deprecation

I have a Xamarin Forms app that I am updating to use Maui 9. In my app, there are a couple of places where I need to change the top-level page. I was able to do this by setting the MainPage property of the app. The release notes for Maui 9 say to override CreateWindow to set MainPage at the start of the app, and use Application.Current.Windows[0].Page to get the page, but I can see no other way of setting MainPage... can anyone suggest how I can achieve the equivalent of setting MainPage (other than overriding CreateWindow)?

Join the discussion →

How do I know whether I need to clear security during an international transfer?

On some international-to-international connections, you need to clear security on others you do not. Examples: coming from the US you go through security in London Heathrow, Paris CDG or Doha but not in Frankfurt, Zurich or Tokyo. The basic rule here is: "You need to clear transfer security unless the airport has a waiver for your departure country". But so far I have found no reliable information on what waivers are in place at which airport. Which brings me to my question How do I find out whether I need to pass through transfer security for a specific route or not? Transfer security is a ma

Join the discussion →

finding option id of single select field in github projects by using `gh` cli

I want to update a single select field by using gh command. However, the problem is to find single-select-option-id gh project item-edit --id $id \ --single-select-option-id <option-id> \ --field-id $field_id \ --project-id $project_id variable source result $id gh project item-list ✔️ $field_id gh project field-list ✔️ <option-id> ❓ ✖️ I couldn't manage to fetch the id of this single select field. Is there a solution for this?

Join the discussion →

How to pass the "xsl:initial-template" in Altova XMLSpy 2024

I want to process JSON by XSLT 3.0. I am using Altova XMLSpy 2024. I can't seem to find how to initiate the processing without at least one dummy XML file and a <xsl:template match="/">. Where do I pass the name of my initial template in XMLSpy? And how can I make a <xsl:template name="xsl:initial-template"> picked up by the processor inside XMLSpy without requiring a dummy XML input file? @MartinHonnen was so kind as to provide an answer to an earlier question of mine which included a template <xsl:template match="/" name="xsl:initial-template"> but I could not get it to work in XMLSpy withou

Join the discussion →

VSCode under Windows keeps popping up a terminal window asking to update WSL even though I uninstalled the WSL extension

I'm using Windows 11 24H2. I installed VSCode on it before I upgraded from Win 10. The VSCode version is 1.93.1. I used to have the WSL extension in VSCode, but I uninstalled it. Still, every time I start VSCode, it keeps popping up a terminal window asking me to "update" WSL. Even though, WSL itself is also no longer installed on my PC (anymore). This is what I see in the pop-up: Windows Subsystem for Linux must be updated to the latest version to proceed. You can update by running 'wsl.exe --update'. For more information please visit https://aka.ms/wslinstall Press any key to install Windows

Join the discussion →

apollo-client-maven-plugin: How to flatten fragments in generated models

I'm using the apollo-client-maven-plugin version 7.1.0, and I'm trying to flatten fragments in my response models, but I'm encountering an issue where the fragments are wrapped in a nested object. Here’s the GraphQL query I’m using: fragment AuthenticationFragment on SessionInfo { role sessionGUID token } mutation loginAsGuest { login( lang: { key: "FRA" } ) { ...AuthenticationFragment } } The expected response (from a GraphQL client like Postman) is: { "data": { "login": { "role": "XXX", "sessionGUID": "XXX", "token": "XXXX" } } } However, when using the Apollo Java Client, the response looks

Join the discussion →

Specifying $and logic in a CASL rule

I understand from the CASL docs that logic operators like $and, $or etc. have not been implemented in CASL for mongoose $or can easily be specified by separate can rules with the same action and subject But I don't understand quite how to implement $and. The docs only mention that combination of cannot rules allows to mimic $not and $and operators. Moreover as we discussed in this guide, all properties inside conditions object are checked by AND logic, this is another way to mimic $and operator What exactly does that mean? I have actually no idea how to implement a rule like this correctly: ca

Join the discussion →

Tbb based row sum of an armadillo matrix

Following the tbb example for parallel_reduce here with a basic datatypes, I wanted to try and implement a tbb version of a row sum of an Armadillo matrix. (I realize the use of arma::sum for this purpose, but this was an attempt at getting to know tbb, Armadillo and how they work together a bit better. ) The following code was aimed to loop over columns of a matrix X, and add the column values to a running total vector. It compiles fine but crashes at run time. I am wondering where I am going wrong. Is the X.col(j) use is incorrect? Thank you! arma::vec parallelRowsumTBB_withArma(arma::mat X)

Join the discussion →

What kind of visa is necessary for transiting Turkey by land?

Turkey offers a transit e-visa, which is easy to obtain, but only allows the person to stay within the airport. What kind of visa is neccessary for someone, who wants to fly to Istanbul and take a bus to another country (transit by land)? Source: https://turkey-e-visas.com/news/turkey-transit-visa-for-nepalese-citizens/ Passport: Nepal, Residency: Dubai

Join the discussion →

"Open in terminal" hangs in Visual Studio 2022

I'm using latest version of Visual Studio 2022 and when I right click on a solution and click "Open in Terminal" the terminal panel opens but nothing happens, it just stays blank with a blinking cursor but never reaches the command prompt, like this: Any idea about how I can diagnose or fix this?

Join the discussion →

Understanding error messages in Rcpp code with structures and functions

I'm getting a couple of error messages when I run the following code that I do not understand - expected initializer before 'add_f' no matching function for call to 'try_grid::try_grid(Rcpp::NumericMatrix&, Rcpp:: NumericMatrix&, int&) Can someone explain what I am doing incorrectly? cpp file: #include <Rcpp.h> using namespace Rcpp; //Declaring a structure struct try_grid { NumericMatrix x; NumericMatrix y; int size; } // Declaring function Void add_f(const try_grid&); // [[Rcpp::export]] NumericMatrix plussomething(NumericMatrix samp, NumericMatrix tramp, int size) { // Declaring and defining

Join the discussion →

How to Restrict PowerShell SDK to Limit Script Access to Specific Callback Methods in a C# Application?

In my C# application I want to use the PowerShell SDK to allow user-provided PS scripts to interact with limited parts of the application through callbacks. I want to restrict what these scripts can do, ideally allowing only specific methods to be called on a provided callback interface, without giving full access to system resources or sensitive .NET types. Here’s a simplified code example: var iss = InitialSessionState.CreateRestricted(SessionCapabilities.Language); iss.LanguageMode = PSLanguageMode.FullLanguage; // ConstrainedLanguage would inhibit the callbacks // Add specific cmdlets, for

Join the discussion →
Older stories