Random snippets of all sorts of code, mixed with a selection of help and advice.
Amplify Flutter + Cognito Identity Pool works via AWS CLI but fails in app (“No identity pool registered for this account”)
16 November 2025 @ 1:44 am
I’m integrating AWS IoT Core with a Flutter app that already uses Amplify Auth (Cognito User Pool).
To allow IoT connections, I added a Cognito Identity Pool section to my amplifyconfiguration.dart (staging environment):
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "us-east-1:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Region": "us-east-1"
}
}
}
In the app, I call:
await Amplify.Auth.fetchAuthSession(forceRefresh: true);
before connecting to IoT.
However, it always throws this exception:
AwsIotMqttException(
Unable to fetch identityId from Cognito session:
No identity pool registered for this account
)
What I’ve Verified
The same user’s ID token works perfectly from the AWS CLI:
aws cognito-identity get-id \
--identity-pool-id us-east-1:xxxxxxx
Missing DATABASE_URL environment variable for Prisma in Turborepo when deploying
16 November 2025 @ 1:21 am
I am trying to deploy a Next.js frontend from my Turborepo monorepo to Vercel. The deployment fails during the build step when it tries to run prisma generate.
The error log clearly shows that the DATABASE_URL environment variable is missing, even though I have it defined in my local .env files and have also added the variable to my Vercel project settings.
The Error Log from Vercel
@repo/db:build:
@repo/db:build: > @repo/db@ build /vercel/path0/packages/db
@repo/db:build: > prisma generate && tsc
@repo/db:build:
@repo/db:db:generate: [[email protected]] injecting env (0) from .env.example -- tip: ⚙️ override existing env vars with { override: true }
@repo/db:db:generate: Failed to load config file "/vercel/path0/packages/db" as a TypeScript/JavaScript module. Error: PrismaConfigEnvError: Missing required environment variable: DATABASE_URL
@repo/db:db:generate: ELIFECYCLE
Calculating the percent of time spent in a country
16 November 2025 @ 1:20 am
Reposted from here as per the recommendations in the comments, please delete if necessary: R: Percent of time spent in a country
I am working with the R programming language.
I have this dataset:
myt = structure(list(name = c("Alice", "Bob", "Bob", "Charlie", "Diana",
"Diana", "Eve", "Eve", "Frank", "Frank", "Frank", "Grace", "Grace",
"Henry", "Henry", "Henry"), country = c("USA", "Canada", "Mexico",
"UK", "France", "Germany", "USA", "Canada", "Mexico", "USA",
"UK", "France", "Germany", "USA", "Canada", "Mexico"), date_arrived = structure(c(1
Blazor onClick not working when switching to .Net 10
16 November 2025 @ 12:50 am
Has anyone else experienced this issue and if so, what was your resolution?
I have a project that was working prior to the switch from 9.0 to 10.0.
The child controls no longer trigger the onclick event which is supposed to bubble up and get handled.
When tested, the @onclick event isn't even fired. I'm guessing there is some item that was updated by MS before release but I'm very unsure where to look at this point.
For now I'll have to move back to .net 9.0 which is kind of sad unless I can find a work around.
How to get pull requests that were never merged on the original project into forked project on Github
16 November 2025 @ 12:50 am
On Github there is a promising repository that hasn't been maintained for years. So there are pull requests from other users that have been ignored.
I have forked the repo. Is there a way to get the unmerged PR commits into my forked repo without just copy-paste editing?
Python function not accepting state variables
16 November 2025 @ 12:42 am
import Vector
class Ball:
radius: float
color: str
position: Vector.Vector
velocity: Vector.Vector
acceleration: Vector.Vector
def __init__(self, radius, color,position, velocity, acceleration):
self.radius = radius
self.color = color
self.position = position
self.velocity = velocity
self.acceleration = acceleration
def update():
velocity = velocity.add(acceleration)
position = position.add(velocity)
The problem I'm having is that the acceleration in the update function is registering that acceleration is a state variable, and it is saying it is not defined
R: Percent of time spent in a country
15 November 2025 @ 11:48 pm
I am working with the R programming language.
I have this dataset:
myt = structure(list(name = c("Alice", "Bob", "Bob", "Charlie", "Diana",
"Diana", "Eve", "Eve", "Frank", "Frank", "Frank", "Grace", "Grace",
"Henry", "Henry", "Henry"), country = c("USA", "Canada", "Mexico",
"UK", "France", "Germany", "USA", "Canada", "Mexico", "USA",
"UK", "France", "Germany", "USA", "Canada", "Mexico"), date_arrived = structure(c(17897,
18414, 18536, 18779, 18231, 18475, 18597, 18687, 18048, 18322,
18567, 17897, 18762, 18383, 18489, 18597), class = "Date"), date_left = structure(c(18322,
18506, 18659, 18840, 18444, 18567, 18659, 2932896, 18231, 1
Scipy Hessian with Numpy cross product
15 November 2025 @ 11:09 pm
I need to compute the Hessian of a function involving cross products in Python. As an experiment, I consider the simple function
def func(x):
return np.sum(np.cross(x[0:3], x[3:6]))
and compute the Hessian with
x0 = np.array([1,2,3,4,5,6])
H = scipy.differentiate.hessian(func, x0)
However, this fails with the error
ValueError: incompatible dimensions for cross product
(dimension must be 2 or 3)
I'm guessing the problem lies with this line from the scipy.differentiate.hessian documentation:
argument f must be vectorized to accept an array of shape (m, ...). The first axis represents the m inputs of f; the remaining axes indicated by ellipses are for evaluating the function at several abscissae in a single call.
but I don't have the Python know-how to fix this. C
How to make it so a parent NEEDS its children to exist in MySQL?
14 November 2025 @ 11:42 pm
I am designing a DB where basically parent can't exist without two children. E.g: Entity set Marriage, CAN'T exist without entity set Man and entity set Woman, but neither Man or Woman need Marriage Entity set to exist. (Lets imagine only Man and Woman marriages so its less complex). Also, lets imagine Marriage can have many men or many women, but men and women can only have ONE marriage. I need help on the query, how do I enforce this?
CREATE TABLE Marriage(
marriageId INT
)
CREATE TABLE Man(
manId INT,
marriageId INT,
FOREIGN KEY (marriageId) REFERENCES Marriage(marriageId)
ON DELETE SET NULL
)
CREATE TABLE Woman(
womanId INT,
marriageId INT,
FOREIGN KEY (marriageId) REFERENCES Marriage(marriageId)
ON DELETE SET NULL
)
This is basically what I have now. (other attributes don't matter right now).
In summary my question is, how can I enforce the TOTAL participation in both ends from marriage?
Grouping rows of contract relationships
13 November 2025 @ 3:34 pm
I have a table of relationships between contracts with two variables: ID1 (refinanced contract) and ID2 (refinancing contract). I want to create a variable that groups all rows of N to M refinancings. For example, if we have:
ID1 ID2
A Z
A Y
A X
B Z
B Y
C W
D W
E V
E U
F T
I want to create a variable such that:
ID1 ID2 Group
A Z 1
A Y 1
A X 1
B Z 1
B Y 1
C W 2
D W 2
E V 3
E U 3
F T 4
The logic is the following:
All rows with the same ID1 should have the same value of Group.
All rows with the same ID2 should have the same value of Group.
The two above conditions have to be combined. In the example, since A->Z and also B->Z, then all rows with ID1 = A or ID1 = B should have