OpenID Connect realms strategy

I’m reaching out to see if I can get a second opinion on something that came up at work. One of the clients of the company that I work at is setting up an OpenID Connect provider to authenticate api’s that they will be exposing to third parties (partners and in the future perhaps other api’s available to the general public). This provider might also be used for internal api’s further down the line.

Since the provider has to be exposed to the internet, do you think it is a reasonable strategy to set up three different realms, each of them for the three scenarios that I described above? (external api’s for partners, external api’s for the general public, and internal api’s). In case it’s relevant, the client is working with RedHat SSO.

To make the administration manageable, as long as each partner has its own client and it is correctly configured per the needs of each integration scenario, I thought that this setup would be correct. On the other hand, publicly available api’s will probably serve different, less sensitive information so I thought it could be acceptable to have a separate realm for those cases.

Thanks in advance!

SQL Server 2017 Backup strategy

RTO is 8 hours

RPO is 24 hours

Retention Period: 5 days

Based on above values I have plan to configure below backup stratgey for Production. Please suggest if there is any changes required in below backup policy.

Full Backup – Daily

Log Backup – every 30 minutes (this is just to prevent log grwoth/low disk problems during index rebuild job)

SQL DB size is approx 500-650 GB.

HA/DR solution for above DB: Configured Distributed Always-ON AG from DC1 to DC2 on top of WSFC (DC1- two DB serevrs and DC2-two DB servers)

Is it a useful strategy for Mobile VR titles to render faster than their simulation loop?

For example – If a title had a very heavy simulation loop (say 20ms), is it desirable to render at a greater rate, say 90hz?

This would always a present head pose correct to the view, without being stalled on simulation.

Or does this result in discomfort for the player, and instead render and sim should stay in lockstep?

In Unity, how can I render borders of provinces from a colored province map in a grand strategy game?

I am kind of a beginner of Unity.

I am trying do work on a grand strategy game. I already have a province map, colored by unique rgba for each province, looks like something below:


I know that the province map is kind of a look up map for province id. But when I obverse the paradox strategy games, I notice that they have render borders differently for the provinces and nations. For example, in the CK3, the Baron collars are separated with dotted lines, and the kingdoms are separated with enhanced yellow lines.

enter image description here

I thought they have some other maps or files containing those information, so I went to read their dev diary, and I find that all province shape information are stored in the province map.

enter image description here

So, my question is:

Is there any way in Unity3D to create those different borders with some shader and some province map such those given above?

The opposite of a Tit-for-Tat strategy

The tit-for-tat strategy is a well-known strategy that can be applied, for example, in the Iterated Prisoner’s Dilemma (IPD). Roughly, the idea is that you always repeat what the opponent did in the previous round.

I was wondering, does there exist a name for the opposite of a tit-for-tat strategy? That is, a strategy in which you always do the exact opposite of what your opponent did in the previous round.

Of course, in the IPD such a strategy wouldn’t make any sense, but there may be other games where it does. Any links to papers that have investigated such strategies are welcome.

Optimal strategy for tossing three dependent coins

Suppose that I have three correlated coins. The marginal probability of Head of coin $ i$ is denoted by $ p_i$ .

The conditional probability of head for coin $ i$ given the outcomes of coin $ j$ and $ k$ is denoted by $ p_i|x_j,x_k$ , where $ x_j,x_k\in\{H,T\}$ . We can similarly construct the conditional probability of $ i$ given $ x_j$ .

Each coin can be tossed at most once and you receive a $ 1 for a head and -$ 1 for a tail. You don’t have to toss all the coins, and your objective is to maximize the total reward.

What would be the optimal sequence of tossing coins in this case?

If the coins are independent of each other, the order wouldn’t matter. The optimal strategy should be “flip coin i if $ p_i>\frac{1}{2}$ “. For the case of two coins, it can be shown that it is always the best to flip the coin with a higher marginal $ p_i$ . However, this doesn’t have to be optimal for three coin cases. I’ve been thinking about this problem for a quite long time but can’t come up with a general solution or an intuition that might help..

What strategy should I use to sovle this interview problem? May I apply DP on this?

The problem description is as below and it feels like a DP problem but I am not sure, thank you for helping!

You have a certain dose of a drug, say, 200 milliliters, and now some patients need this drug. The doses for each patient may vary from person to person, for example, 2.5 milliliters for A, B, C, 5 milliliters for D, E, and 7 milliliters for F, and so on. The question is, in short, how can you allocate the drugs so that you have the least amount of drugs left? Example input: total drug dose 10 (milliliters). A needs 3, B needs 5, C needs 2, D needs 4, E needs 2. Output: A, B, C or A, B, E (perfect allocation with no drugs left). Note: there may be decimals.

You are welcome to give any hints or mature solutions to the question, or you can ask for more details about it.

Proof strategy to show that an algorithm cannot be implemented using just hereditarily terminating procedures

I am taking my question here from there. Consider the following scenario:

You are given a fixed programming language with no nonlocal control flow constructs. In particular, the language does not have

  • Exceptions, first-class continuations, etc.
  • Assertions, in the sense of “runtime tests that crash the program if they fail”.

Remark: An example of such a language could be Standard ML, minus the ability to raise exceptions. Inexhaustive pattern matching implicitly raises the Match exception, so it is also ruled out.

Moreover, you are forced to program using only hereditarily terminating values. Inductively, we define hereditarily terminating values as follows:

  • Data constructors (including numeric and string literals) are hereditarily terminating.
  • Applications of data constructors to hereditarily terminating arguments are hereditarily terminating.
  • A procedure f : foo -> bar is hereditarily terminating if, for every hereditarily terminating x : foo, evaluating the expression f x always terminates and the final result is a hereditarily terminating value of type bar.


  • Hereditarily terminating procedures need not be pure. In particular, they may read from or write to a mutable store.

  • A procedure is more than just the function it computes. In particular, functions do not have an intrinsic asymptotic time or space complexity, but procedures do.

Hereditarily terminating procedures formalize my intuitive idea of “program that is amenable to local reasoning”. Thus, I am interested in what useful programs one can write using only hereditarily terminating procedures. At the most basic level, programs are built out of algorithms, so I want to investigate what algorithms are expressible using only hereditarily terminating procedures.

Unfortunately, I have hit an expressiveness ceiling much earlier than I expected. No matter how hard I tried, I could not implement Tarjan’s algorithm for finding the strongly connected components of a directed graph.

Recall that Tarjan’s algorithm performs a depth-first search of the graph. In addition to the usual depth-first search stack, the algorithm uses an auxiliary stack to store the nodes whose strongly connected components have not been completely explored yet. Eventually, every node in the current strongly connected component will be explored, and we will have to pop them from the auxiliary stack. This is the step I am having trouble with: The loop that pops the nodes from the stack terminates when a given reference node has been found. But, as far as the type checker can tell, the reference node could not be in the stack at all! This results in an extra control flow path in which the stack is empty after popping everything from it and still not finding the reference node. At this point, the only thing the algorithm can do is fail.

This leads to the following…

Conjecture: Tarjan’s algorithm cannot be implemented in Standard ML using only hereditarily terminating procedures.

My questions are:

  1. What kind of proof techniques would be necessary to prove the above conjecture?

  2. What is the bare minimum type system in which Tarjan’s algorithm can be expressed as a hereditarily terminating program? That is, what is the bare minimum type system that can “understand” that the auxiliary stack is guaranteed to contain the reference node, and thus will not add a control flow path in which the auxiliary stack is empty before the reference node has been found?

Final remark: It is possible to rewrite this program inside a partiality monad. Then every procedure would be a Kleisli arrow. Instead of

val tarjan : graph -> scc list 

we would have something like

val tarjan : graph -> scc list option 

But, obviously, this defeats the point of the exercise, which is precisely to take out the procedure out of the implicit partiality monad present in most programming languages. So this does not count as a solution.