How to interpolate position using velocity and position samples
I have a dynamic dataset of length n, which is greater than or equal to one. The dataset contains m-dimensional position and velocity values for discrete time.import numpy as nptimes = np.array([t1,...
View ArticleHow to pass a List of strings as FormData to FastAPI using JavaScript Fetch API?
This is the Next.js frontend:// Create FormData to send files, URLs and username to the APIconst formData = new FormData();if (files && files.length > 0) { files.forEach((file) => {...
View ArticleHttp-only cross-site cookie not being added to browser
I am sending my refresh and access tokens as http-only cookies to the frontend of my Next.js application. When I log the response headers in the console of my frontend, I am able to get the cookies....
View ArticleHow can I reduce the startup time of FastAPI?
I'm building a Retrieval-Augmented Generation (RAG) application using Python + FastAPI. I'm also running a Kafka consumer alongside the FastAPI app to process incoming text and generate embeddings...
View ArticleHow define the winning candidate in instant runoff voting even if he hasn't...
I'm trying to resolve algorithm of Instant Runoff Voting. Count the first place vote for every voter and if an option have a majority elects a winner if no then check a tie for last place; eliminate...
View ArticleUnable to set the STOP-LOSS limit order using Binance Python API
I am attempting to create a LONG TRADE that will contain a BUY ORDER and a STOP-LOSS using Python asyncio, ccxt API (which is calling the Binance API for the Binance Crypto Exchange).First I create the...
View ArticleExtracting lines from two files where there is a match of value in specific...
I have two tab-separated files (with thousand of lines each):File1:anno1.g20653.t1 anno1.g20674.t1 eud1g02416 eud1g02458 27 +anno2.g3796.t1 anno1.g20698.t1 eud1g02520 eud1g02556 28 +File2:scaffold_1...
View ArticleWhat's wrong with my Python Firebase Cloud Function?
When trying to deploy the function below I get the error:Build failed with status: FAILURE. Could not build the function due to a missing permission on the build service account. If you didn't revoke...
View Articleunable to import module named pandas
I have python 2.7 and python 3 installed.I also have pip2.7 and pip3 installed.I use IPython Notebook in the Jupyter console. Using the console I can use every module I want but I'm trying to use the...
View ArticleTried plotting yfinance data by framing into pandas with the help of seaborn...
import yfinance as yfimport matplotlib.pyplot as pltimport seaborn as snsimport pandas as pddf = yf.download('AAPL',start="2021-01-01",end='2025-07-13')print(df.head()) #display the first five rows of...
View ArticleHow to Safely Upgrade a Package in Django (e.g., django-jalali from 1.0.2 to...
I'm currently working on upgrading an older Django project and I have both a specific and a general question about package upgrades.🔍 Specific Question:I’m using django-jalali-date==1.0.2 in one of my...
View ArticleIs it possible to access the history of calls done by LangChain LLM object to...
When we create an Agent in LangChain we provide a Large Language Model object (LLM), so that the Agent can make calls to an API provided by OpenAI or any other provider. For example:llm =...
View ArticleFluentD continues reading and advancing .pos file even when buffer is full...
I'm using FluentD with the in_tail plugin and the elasticsearch_data_stream output. My setup writes logs from many pods to a central NFS. FluentD tails the log files from that shared NFS and forwards...
View ArticleWindows getting freeze while running python script
I have made a project using fastapi. I have tested it few days ago and it was working fine. But since yesterday when I try to run the code using python main.py the windows get freeze I tried running it...
View ArticleVSCode devcontainer and UV
I'm developing using VSCode's devcontainer, and I used pip with a requirements.txt file for a few years with no problems. Works like charm.I'd like to upgrade to using uv, but I'm encountering a...
View ArticleHow to do discord OAuth2 in a request session?
(From the user side not the bot) I don't know how to go about this and I would like some help.I tried it myself but got this error[01:19:41] Rover login failed: 400 | {"errorCode":...
View ArticleMoviepy - Output video not playable
I'm using the library moviepy on Linux Mint 18.1.Specifically, it's moviepy 0.2.3.2 on python 3.5.2Since I'm getting started, I tried this simple script, which should concatenate two videos one after...
View ArticleERROR: Failed building installable wheels for nlbayes
I'm trying to install a github repo through pip and it kept throwing the following:ERROR: Failed to build installable wheels for some pyproject.toml based projects (nlbayes)I tried updating setuptools...
View ArticleStreamlit App Always Predicts the Same Result [closed]
I’ve built a machine learning project to predict student employability:Trained and evaluated multiple ML models (SVM, Decision Tree, Logistic Regression, KNN) using Python.Choose the best-performing...
View ArticleHow to set a maximum range on a variable in Python
I'm very new to coding and trying to write a simple program to roll dice for the TTRPG game Daggerheart (I play solo on paper, so something to help track both Fear and Hope seemed useful). In the game...
View ArticleCalculate Exponential decay rate constant from graph
I would like to calculate the lifetime of the particles from the extrapolated curve below, I know that lifetime is 1/decay constant but I get values for the decay constant that dont make sense.import...
View ArticleHow to verifying whether a file has valid signature in python?
I want to verify signature code in python with the only input is path/to/fileAll other sources I've consulted need individual signature files but I only want to take as input a single file (can be .exe...
View ArticleHow to get peaks consistent with seaborn kdeplot() in one-dimensional data...
Example data:a = [68, 63, 20, 55, 1, 21, 55, 58, 14, 4, 40, 54, 33, 71, 36, 38, 9, 51, 89, 40, 13, 98, 46, 12, 21, 26, 40, 59, 17, 0, 5, 25, 19, 49, 91, 55, 39, 82, 57, 28, 54, 58, 65, 2, 39, 42, 65,...
View ArticleError #15: Initializing libiomp5.dylib, but found libiomp5.dylib already...
Getting the error message when using matplotlib:Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized OMP: Hint: This means that multiple copies of the OpenMP runtime...
View ArticleHow to receive return value using page.on("response")
I'm trying to catch contents of response using Playwright Python, but I'm not sure how to achieve this. Here's my sample code.from playwright.sync_api import Playwright, sync_playwrightdef...
View ArticleHow to uv add git repo with subpackages
I want to use uv to install packages and add dependencies, equivalent to the following pip workflow:git clone https://github.com/<username>/<repository>.git cd <repository>pip install...
View Articlepybind11: Python callback executed in C++ with parameter modification
I'm working on Python bindings of my C++ library (a mathematical optimization solver) and I'm stuck at a point where I create a Python callback evaluate_constraints() that takes two arguments, pass it...
View ArticleHow to deploy zip files (or other binaries) through cgi in Python?
I'm coding a small website with Python and CGI where users can upload zip files and download files uploaded by other users. Currently I'm able to upload correctly the zip's, but I'm having some trouble...
View ArticleMatrix Multiply with Vector and Tensor in Python
I have a Vector, M, with size N and a Tensor, d, with size NxNxD.My aim is to perform the matrix multication M*d[i,:,:] for each i to get a new matrix with size nxD.Now I could just do it like this:a =...
View ArticleHow to parametrize all async tests?
I have many test functions, sync and async.I'm using pytest-asyncio in the "auto" mode, so it detects all async tests and I don't have to mark them as such.My problem is that I want to parametrize all...
View Article