## architecture – How to generate frontend URLs in a “12 factor app” service?

I’m working on a system with a user-facing frontend and with 1-n backend services which I’m trying to design according to the principles of the Twelve-Factor App.

I’m now facing the task of sending emails to the user that contain a link to the frontend. The question is, how do I generate the URLs, or more specifically where do I take the URL domain/host from?

I’m seeing the following approaches:

## 1. Put the domain in the configuration

I’m putting the domain in an environment variable and expose it to the service using the framework’s configuration API.

Here, I see a potential problem if in the future the application needs to be available from multiple domains (e.g. one domain per country or multi tenancy). Currently, this is not the case, but who knows what new requirements might come.

## 2. Extract the host from the request

When the the user enables email notifications, I extract the domain from the request headers. As the email(s) will be sent at a later time, I’ll need to persist the domain in the database where the rest of the per-user settings live.

This will work in a scenario where the application has more than one domain but until this is the case, putting the same value (`domain = "https://my-domain.com"`) in every database entry feels redundant.

## 3. Have the frontend generate the whole URL

Currently, the system only serves one domain but it already supports localization using subpaths (think `/{language}/login`). To generate the correct URL for each user, I need to persist the locale that will be part of the URL in the DB anyway.

This begs the question, why not have the frontend generate the complete URL including domain, language and path and store it in the database? This would kill two birds with one stone since now the backend doesn’t need to know the URL structure of the frontend. However this would potentially open up a possibility for a malicious client to mess with the generated URLs. The redundancy argument from 2. also applies.

Are there any more arguments for/against the given approaches or even alternative approaches or does it come down to taste?

## nt.number theory – Automorphy factor and the determinant of the Jacobian matrix

There are two cocycles defining the automorphy factors.

Let $$D$$ be the bounded symmetric domain (due to Harish-Chandra). Then there is a canonical automorphy factor $$J:Gtimes Dto K_{mathbb{C}}$$ where $$G$$ is a real Lie group with a maximal compact subgroup $$K$$, $$D=G/K$$ and $$K_{mathbb{C}}$$ is the complexification of $$K$$.

Meanwhile, due to Baily and Borel, there is also an automorphy factor $$J_0:Gtimes Dto mathbb{C}^{*}$$ coming from the determinant of the Jacobian matrix, i.e. the Jacobian of the action of $$g$$ at $$zin D$$.(Baily, Walter L., and Armand Borel. “Compactification of arithmetic quotients of bounded symmetric domains.” Annals of mathematics (1966): 442-528.)

Is there any relation between these two? The first one seems more general to me since we can add the representation of $$K_{mathbb{C}}$$ while the second one is always a nonzero complex number. And with the first one, we can transfer the automorphic forms (vector-valued) on Lie groups to the ones defined on the domain.

## Which factor of authentication is an X.509 certificate

Given 3 factors of authentication:

• Type 1: something you know
• Type 2: something you have
• Type 3: something you are

Which factor of authentication would be an X.509 certificate, assuming this certificate is stored in the filesystem of the device I use? For example, let’s place it in the context of TLS mutual authentication, where the aforementioned certificate is the client certificate. Please note this is not a question about a digital certificate stored on a separate hardware token or similar.

My understanding is that this is still a type 1, not type 2, because it does not relate to the physical posession of device other than the one client is using anyway. Is my understanding correct?

## project management – How to improve the “truck factor” in my development team?

but some tasks such as refactoring have been added to sprint as a courtesy, not as providing customer value.

If refactoring improves the product, it is always a customer value as the customer gets a better product for the same amount of money, even if they cannot actually see that. And even if refactoring just improves the code, it actually does improve the product as with better code, there will be less bugs in the future, features will be easier to implement (or can be implemented at all), and implementing new features or fixing existing bugs will require less time (customers get both of them faster and have to pay less to get them).

So refactoring always has a value for customers, unless it doesn’t improve anything at all, like you swap some code for other code but the new code is in no way better than the old code used to be. However, if that was the case, why are you refactoring to begin with? Usually one refactors code to achieve a goal and whatever that goal is, this is already the customer value.

We’re currently in a state of things where 50% the tickets we have they can’t handle without taking a massive delay or risking regressions or both.

And this sentence tells me where the problem is: You are asking how you can teach people swimming without forcing them into the water. You suggest to give them theoretical swim instruction books, make them watch how you swim, or make tests about swimming theory but you cannot learn swimming without trying to actually swim.

I faced the same problem multiple times in the past and the solution that always worked was: Let them handle any ticket that comes along.

They don’t know how to do it? Doesn’t matter. They should try it anyway. Maybe they find out on their own.

They don’t? Then they shall come along and ask you for help. But don’t fix it for them, tell them how you would have fixed it and let them do it for you. Maybe they will succeed.

If not, you will have to clean up their mess afterwards but then do it together with them so they see what they did wrong and how you would have done it better.

The first couple of weeks your team performance will be horrible (prepare the management for it) but it will improve every week and there will be more and more tickets they can handle on their own. And the more tickets they handle without your help, the more you can concentrate on other tasks and the better the overall team performance will soon get.

## linux – Yubikey as 2nd Factor to open luks-encrypted disk on OpenSuse

How do I set up a Yubikey as a 2nd factor, in addition to my password, to open my LUKS-encrypted disk on Opensuse? All the information I’ve found so far seem to be geared at Arch Linux and Debian and they require Yubikey-luks, which is not available for Opensuse as far as I know. I found a Fedora implementation. However, I wasn’t able to find all the packages and libraries needed in the repositories. If I use Fedora rpms and libraries, it may not work and I could be locked out of my computer. Can someone please provide a specific guide for Opensuse?

## complex – How to factor a polynomial expression with variable coefficients (and imaginary values)

How can I factor terms with variable coefficients?

For example for the expression: $$x^2 + a$$

I know that I can factor this to: $$(x+isqrt{a})(x -isqrt{a})$$

How do I do this in mathematica?

I would’ve expected something like Factor(x^2 + a, x) but I don’t see anything like this so far.

## matrix – ReplaceAll doesn’t replace all, factor out constants first

I have this matrix:$$left( begin{array}{ccccc} {{0},{0,0,0}} & {{1},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} \ {{-1},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} \ {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,z,-y}} & {{0},{-z,0,x}} \ {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,-z,y}} & {{0},{0,0,0}} & {{0},{y,-x,0}} \ {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{2z,0,-2x}} & {{0},{-y,x,0}} & {{0},{0,0,0}} \ end{array} right)$$

When I run `ReplaceAll` (/.) on it using this$$left{{{1},{0,0,0}}to X_1,left{{t},left{frac{2 x}{3},frac{2 y}{3},frac{2 z}{3}right}right}to X_2,{{0},{y,-x,0}}to X_3,{{0},{z,0,-x}}to X_4,{{0},{0,z,-y}}to X_5,{{0},{0,0,0}}to 0right}$$

it doesn’t replace everything:

$$left( begin{array}{ccccc} 0 & X_1 & 0 & 0 & 0 \ {{-1},{0,0,0}} & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & X_5 & {{0},{-z,0,x}} \ 0 & 0 & {{0},{0,-z,y}} & 0 & X_3 \ 0 & 0 & {{0},{2z,0,-2x}} & {{0},{-y,x,0}} & 0 \ end{array} right)$$

I expect:$$left( begin{array}{ccccc} 0 & X_1 & 0 & 0 & 0 \ -X_1 & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & X_5 & -X_4 \ 0 & 0 & -X_5 & 0 & X_3 \ 0 & 0 & 2X_4 & -X_3 & 0 \ end{array} right)$$

Is there an automated way of doing these replacements?

## matrix – ReplaceAll doesn’t replace all, factor out negative sign first

I have this matrix:$$left( begin{array}{ccccc} {{0},{0,0,0}} & {{1},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} \ {{-1},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} \ {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,z,-y}} & {{0},{-z,0,x}} \ {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{0,-z,y}} & {{0},{0,0,0}} & {{0},{y,-x,0}} \ {{0},{0,0,0}} & {{0},{0,0,0}} & {{0},{z,0,-x}} & {{0},{-y,x,0}} & {{0},{0,0,0}} \ end{array} right)$$

When I run `ReplaceAll` (/.) on it using this$$left{{{1},{0,0,0}}to X_1,left{{t},left{frac{2 x}{3},frac{2 y}{3},frac{2 z}{3}right}right}to X_2,{{0},{y,-x,0}}to X_3,{{0},{z,0,-x}}to X_4,{{0},{0,z,-y}}to X_5,{{0},{0,0,0}}to 0right}$$

it doesn’t replace everything:

$$left( begin{array}{ccccc} 0 & X_1 & 0 & 0 & 0 \ {{-1},{0,0,0}} & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & X_5 & {{0},{-z,0,x}} \ 0 & 0 & {{0},{0,-z,y}} & 0 & X_3 \ 0 & 0 & X_4 & {{0},{-y,x,0}} & 0 \ end{array} right)$$

I expect:$$left( begin{array}{ccccc} 0 & X_1 & 0 & 0 & 0 \ -X_1 & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & X_5 & -X_4 \ 0 & 0 & -X_5 & 0 & X_3 \ 0 & 0 & X_4 & -X_3 & 0 \ end{array} right)$$

Is there an automated way of doing these replacements?

## javascript – Is this an efficient/correct way to get largest Prime factor?

Is this an efficient way to get the largest prime factor of a given number? Other solutions I found involved nested algorithms.

``````function largestPrimeFactor(number) {
const factors = ()
for(let i = 2; i <= number; i++){
if(number % i === 0){
factors.push(i);
number = number / i;
i = 1;
}
}
return factors.pop()
}
``````