Find children whose parents are in the same room

I have two tables ROOMS and CONTACTS. I then have two types of contacts related to each other. Investigator(parent) and Tech(child) . First we assign a Tech to an Investigator. Then assign Investigators to ROOMS. Now we must assign Techs to the room. However I only want the user to see the tech as option IF they are a tech of an Investigator assigned to the room.

Here is what the structure looks likeenter image description here

join_on_tech and join_on_investigator are table occurrences of the same join table.

room_join_contacts is a separate join table than the other join for parent/child

Currently I have a portal set up and and the user is presented with a list of techs via perform find script command. only it shows all techs rather than techs where investigator is in room

how would I go about filtering out techs that do not have an investigator(parent) in the room

Solving a system of differential equations whose one of the coefficients is imported data

Suppose we have a coupled system of differential equations: \begin{equation} \frac{db}{dt}=(- \gamma_b -i\omega_b)b-i\frac{g}{2}p;\quad \frac{dp}{dt}=i\frac{g}{2}\Delta N(t) b-(\gamma_a+\gamma_b+2iJ)p. \end{equation} If $ \Delta N$ was fixed, the solution of the system would be like \begin{equation} \begin{pmatrix} b(t)\ p(t) \end{pmatrix}=\begin{pmatrix} a_{11}&a_{12}\ a_{21}&a_{22} \end{pmatrix}\begin{pmatrix} b(0)\ p(0) \end{pmatrix} \end{equation} Using the following code, I have found a $ 2\times 2$ matrix (called sol) whose entries are $ a_{ij}$ in the above equation:

rb=630;wb=75*10^6;g=0.63;ra=2.6*10^6;rm=3.6*10^6;J=6.3*10^7;DeltaN=0.164*10^5; m ={{-rb-I wb,-I g/2},{I g DeltaN/2,-(ra+rm+2 I J)}}; eigvec = Eigenvectors[m] // Transpose // Simplify; eigval = Eigenvalues[m] // Simplify; inv = Inverse[eigvec] // Simplify; v1 = eigval[[1]]; v2 = eigval[[2]]; sol = eigvec.{{E^(v1 t), 0}, {0, E^(v2 t) }}.inv; 

If we suppose that $ p(0)=0$ , then one can easily plot $ |b(t)/b(0)|^2$ : simply plot $ a_{11}(t)$ . But the problem is that $ \Delta N$ is not fixed. It is a $ N\times 1$ matrix which I have obtained from another code written with Fortran and its type is data.txt. The elements of this file are calculated by assuming the time interval between each one is $ 0.001$ . That is, for $ t=0.001$ we have $ \Delta N_1$ , for $ t=0.002$ we have $ \Delta N_2$ , etc. But the time intervals are not included in the txt file.

One way that comes to my mind is this: Assuming we know the analytical form of solfor a fixed $ \Delta N$ , we set time, i.g., equal to $ 0.001$ and then substitute the first row of the txt file (I call it $ \Delta N_1$ ) into sol and find $ a_{11}$ . Then we raise time to $ 0.002$ , substitute $ \Delta N_1$ into sol, find $ a_{11}$ , and repeat the procedure to the last row of the txt file.

Now the question is this: how can I import the txt file to the code and do the procedure that I explained above to get some data like $ \{\{0.001,a11(0.001)\},\{0.002,a11(0.002)\},….\}$ where the first elements are time intervals and the second ones are $ a_{ij}$ corresponding to that particular time?

I had asked a similar question here enter link description here, but in that problem I did not have an external file with txt format.

I could not upload my txt file, so I write the first 10 elements if necessary:











How to remove sublists whose difference of two elements is either 1 or 11?

I want to create a list of 3-element subsets of $ \{1,2,\cdots,12\}$ where no two elements in each subset can have difference of 1 or 11.

The following attempt fails because it returns just a list of all subsets without restriction.

Select[Subsets[Range[12], {3}]  , (Abs[#[[1]] - #[[2]]] != 1 || Abs[#[[1]] - #[[2]]] != 11) &&    (Abs[#[[1]] - #[[3]]] != 1 || Abs[#[[1]] - #[[3]]] != 11) &&    (Abs[#[[3]] - #[[2]]] != 1 || Abs[#[[3]] - #[[2]]] != 11) &] 


I just got the solution as follows, but can it be simplified?

Select[Subsets[Range[12], {3}]   , ! MemberQ[{1, 11}, Abs[#[[1]] - #[[2]]]] &&     ! MemberQ[{1, 11}, Abs[#[[1]] - #[[3]]]] &&     ! MemberQ[{1, 11}, Abs[#[[3]] - #[[2]]]] &] // Length 

How to express a type that represents an associative array whose keys determine the type of the value?

I’m fairly new to type systems and theory, so I would appreciate some guidance in a problem that sparked my interest.

I would like to understand what type system features are required so a compiler can enforce that a given key will return a value of the same type as the one the key was associated with in the first place.

A practical version of my problem is to declare a Map in TypeScript that allows a developer experience like in the pseudocode below:

const cache =  new  Map<K,  V>()  cache.set('Foo',  Error('R'))  cache.set('Bar',  1)  cache.get('Foo')  // Return value typed as Error.    cache.get('Bar')  // Return value typed as number.  cache.get('Qux')  // Compilation error. 

What would the type of K and V be?

How should I deal with a player whose roleplay cuts into other players enjoyment of the session?

I’m a very new DM running a homebrew campaign for a couple of friends.

One of my players, who is by far the most experienced, plays a bard who is definitely optimised for roleplay, and that seems to be the part of the game she enjoys the most.

This is fine, of course, but lately I think it’s been derailing the rest of the party’s experience. The rest of the party is made up of players who either struggle with roleplay or have optimised their character for combat. This player has spent 15-20 mintues interrogating an NPC in a zone of truth (even after I made it clear that there was nothing else to gain from the NPC) while the rest of the party has no idea what to do. She also interjects into other player’s rare roleplay moments to describe what her Bard is doing. The rest of the party gets tired or disengaged when the session is too roleplay-heavy, so I’ve been trying to reward any plot-progression they achieve with big, exciting combat encounters.

Then last session, as I was very clearly building up to a big encounter, the Bard player decided that she would rather try to reason with the angry, weapons-drawn guards. A couple of lucky persuasion rolls later, and the whole encounter (which I’d spent hours lovingly prepping) was circumvented. I understand that players messing up planned events is a natural part of being a DM, but I’m bothered by the fact that she didn’t give the other players a chance to decide for themselves whether they wanted to fight.

I don’t want this one player to feel like she’s being strong-armed by the DM or railroaded into certain outcomes, but I also want to give the rest of the party a chance to do what they love best –beating up some bad guys. How can I manage the roleplay needs of this player while also making sure that the rest of the party gets to experience the combat they want?

What happens to a character whose load exceeds maximum?

Rules give us 3 value ranges for load: Light, Medium and Heavy.

There are respective bonuses/penalties to those loads. I couldn’t find any mention of what happens after exceeding heavy load range (endpoint is named maximum load).

Can such character even move? Does such character get damaged by being smashed to the ground by his/her own equipment?

Also – what happens to creatures that are extremely heavy on their own (let’s say dragons) when their strength drops to very low levels? I can’t believe that such dragon would be able to move if it had strength of a regular human.

Given a list of integers and a target integer, return the number of triplets whose product is the target integer and two adjacent triplets

Question: Given a list of integers (possibly negative) and a target integer, return the number of triplets whose product is the target integer and two of the triplets must be adjacent.

More precisely, given a triplet $ (i,j,k)$ with $ i<j<k,$ it satisfies the question above if $ A[i] \times A[j] \times A[k] = target$ and either ($ j = i+1$ and $ k > j+1$ ) or ($ k = j+1$ and $ i < j -1$ .)

For example, if the list given is $ A = [1,2,2,2,4]$ and target $ = 8,$ then the answer is $ 3$ as $ (0, 1, 4) , (1, 2, 3)$ and $ (0, 3, 4)$ are the only triplets satisfying conditions above if we use $ 0$ -based numbering.

I stucked at this question for 3 hours and not able to solve it.

Any hint is appreciated.

How should a SAML Assertion whose SessionNotOnOrAfter value is exactly the same value as its AuthnInstant?

I am receiving SOAP requests with SAML AuthnStatements whose SessionNotOnOrAfter timestamp is EXACTLY the same value as its AuthnInstant:

<saml:AuthnStatement AuthnInstant="2020-04-22T21:11:41.453Z" SessionNotOnOrAfter="2020-04-22T21:11:41.453Z"> 

I am using ApacheWSS4J to validate the SOAP Signatures it also validates a variety of SAML 2.0 features including the AuthN statement. Messages which fit this pattern fail validation because as soon as I get the message it’s AuthnStatement is instantly expired!

In order to either configure, or create my own validations I would like to learn about this condition through the lens of the SAML standard.

Does this condition represent an AuthN statement which is instantly invalid?

What does the SAML standard say, if anything, about a SessionNotOnOrAfter being exactly equal to AuthnInstant?