## How to put a condition in TWIG "if the user is flagged"?

I created a flag to flag user accounts. In my TWIG file I want to display a text if the account is flagged.

Here is the link of my flag in TWIG :

``````{{ content.flag_request_association_role }}
``````

How to put a condition in TWIG "if the user is flagged" ?

Posted on Categories Articles

## homotopy theory – Filling condition for quasi-categories

I am trying to get a better understanding of how the inner horn filling condition in higher cells corresponds to higher associativity laws. For instance, I am trying to understand how the difference of the inner horn filling condition and outer horn filling condition makes the difference of invertibility of cells.

Let $$Delta^n amalg_{Delta^0} Delta^m$$ be the gluing of $$Delta^n$$ and $$Delta^m$$ along the head of one $$Delta$$ and the tail of another; the map $$Delta^0 rightarrow Delta^n$$ sends $$0$$ to $$n$$, and the map $$Delta^0 rightarrow Delta^m$$ sends $$0$$ to $$0$$. There is an injection $$Delta^n amalg_{Delta^0} Delta^m rightarrow Delta^{n+ m}$$.

Consider the following alternative filling condition:

$$text{ All maps } Delta^n amalg_{Delta^0} Delta^m rightarrow X text{ lift along } Delta^n amalg_{Delta^0} Delta^m rightarrow Delta^{n+m}$$

Is this filling condition equivalent to the inner horn filling condition?

Other insights on the matter of “why inner horns?” and filling conditions for $$n geq 3$$ as higher associativities are much appreciated.

Posted on Categories Articles

## differential equations – NDsolve Initial Condition is a Function of the Solution

So this may be a terribly no good bad thing to ask of NDSolve, but it is physically relevant. I am trying to solve something like Fick’s Law:
$$frac{partial varphi}{partial t}=frac{partial^2 varphi}{partial r^2}+F(r,t)$$
Subject to a boundary condition which looks something like:
$$varphi (R,t)=varphi_0-int_0^R varphi(r,t)dr$$
Which is an attempt to simulate the case where whatever is diffusing into the medium of interest is limited in quantity. I assume simply plugging a recursive boundary condition is going to go poorly, is there any option here other than writing my own solver?

Posted on Categories Articles

## finite automata – Sufficient condition for \$xy^*z subseteq L\$ for a DFA with \$n\$ states

In chapter 2 of the New Turing Omnibus, the author considers an unknown finite automata with 6 states. Through trial and error, it is deduced that the words 0101, 0100101, 0100100101 are accepted. It is then stated that using the pumping lemma, it can be shown that if 01(001)^n01 is accepted for n=0,1,2,3,4,5 then all strings of the form 01(001)*01 must also be accepted.

I know of the pumping lemma but do not see how the next leap has been made. Why is it sufficient to only test n up (number of states) – 1?

Posted on Categories Articles

## algorithms – Why does case 3 regularity condition of master theorem always hold when f(n)=\$n^k\$ and f(n)=\$Omega(n^{lg_b^{a+epsilon}})\$

In case of $$f(n)=Omega(n^{log_b^{a+epsilon}})$$, we need to find $$c<1$$ such that for sufficiently large n

$$a*Omega((frac{n}{b})^{log_b^{a+epsilon}})leq c*Omega(n^{log_b^{a+epsilon}})$$

By slightly modifying the left part we obtain the following inequality

$$frac{a}{a+epsilon}*Omega(n^{log_b^{a+epsilon}})leq c*Omega(n^{log_b^{a+epsilon}})$$

Thus we can take $$c=frac{a}{a+epsilon}$$ and here $$c<1$$ as $$epsilon>0$$ according to case 3 of master theorem.

Posted on Categories Articles

## c# – How can i change the line color of an entry based on a condition in xamarin.forms So i do some validations on my entries and i would like to change the color to red when the value is invalid.

Is there a way to do this in xamarin right now ?

I know that there’s renderer to change the color so it’s always the chosen color but i just want to change it based on a condition.

Thank you.

Posted on Categories Articles

## Replace Condition in Replacement Rules

In finding an answer to my other question, I’m finding myself needing to manipulate the conditions imposed on replacement rules, but this is proving to be a little difficult. In particular, how should I go about removing instances of `Condition` and `PatternTest`?

``````f(x_?InexactNumberQ) := x^2;
g(x_) /; FooQ(x) := x^3;

Attributes(ExpandValues) = {HoldAll};
ExpandValues(symbol_) := Join @@ Through(
{OwnValues, DownValues, UpValues, SubValues, DefaultValues, NValues}(symbol)
);
ExpandValues(symbol_, symbols__) := Join(ExpandValues(symbol), ExpandValues(symbols));
``````

then the replacement rules that need to be modified are:

``````{
HoldPattern(f((x_)?InexactNumberQ)) :> x^2,
HoldPattern(g(x_) /; FooQ(x)) :> x^3
}
``````

I would like these to be modified to not have any conditions on the arguments, but trying to replace the condition and pattern test is proving difficult. This for example does not work:

``````{
HoldPattern(Condition(p_, q_)) :> p,
HoldPattern(PatternTest(p_, q_)) :> p
}
``````

I’ve also tried using `Verbatim` which the documentation suggests is useful to transform other transformation rules, but I have not gotten them to work. I’m also thinking that the use of Verbatim won’t work generally because it is too literal.

``````{
Condition -> (#1 &),
Patterntest -> (#1 &)
}
``````

but when the replacement appears within a `HoldPattern`, the resulting rule after replacement does not work.

Posted on Categories Articles

## game design – How can players randomly – and secretly – choose 5 cards out of 25 that match a specific condition

I think any method with identifying symbols on the backs of the cards is likely to fail.

With just 25 symbols, it would be very easy for players to accidentally memorize a telltale clue of one or more of the cards, spoiling the game for themselves, even if they’re actively trying not to notice.

I’ve seen games that try to obfuscate this information by using fluorescent ink revealed by a UV light, or overlapping patterns you need to look at through a coloured filter, so you only clearly see the pattern at the designated “setup” or “check” time, and can’t easily use it to track a card throughout play. But for a mystery game like this, leaking that info at setup time is already enough to spoil the puzzle.

What I’d propose instead is a shuffling approach.

Start by laying out the cards face-up, in a 5×5 matrix, with cards of the same taste all in a row, and cards of the same colour in a column. Let’s say it looks like…

``````AV  AW  AX  AY  AZ
BV  BW  BX  BY  BZ
CV  CW  CX  CY  CZ
DV  DW  DX  DY  DZ
EV  EW  EX  EY  EZ
``````

Turn each card over while keeping it in its place in the matrix. Now the matrix should look like this:

``````⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
``````

But the players might still remember which row was which taste, or which column was which colour. So now we’ll shuffle them, like a shell game. Slide one row out and move it to one end or the other:

``````                                         ⬜⬜⬜⬜⬜     ⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜                                 ⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜                                 ⬜⬜⬜⬜⬜    ⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜    ⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜    ⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜    ⬜⬜⬜⬜⬜
``````

Then do the same for a column, and repeat. You can select which row/column to slide each time using a dice roll, rather than leaving it up to the players.

Each time we do one of these shifts, we preserve the fact that each row contains a single taste, and each column contains a single colour, we just switch which one is which in a way that – hopefully, after enough shuffles – your players lose track of.

To make these shuffles easier, you could stack each column into a deck. Then swap the positions of these five decks a few times. Then unpack back to the matrix and stack each row into a deck, and swap the decks around again. You just need to make sure you use the same stacking order in all decks during packing and unpacking (eg. always left-to-right / top-to-bottom). Flipping the order in one deck will make an invalid answer.

Another trick you can use is to have each player take a turn applying a row or column shuffle while the other players are occupied with something else, so no one player can keep track of where every row/column got moved to. This way you can get to complete uncertainty with fewer swaps, where you’d need a higher number to throw off a player with a sharp eye and good memory who can watch the whole process.

After our shuffling, we have a permuted matrix that maybe looks a bit like this, if we looked up from under the glass table:

``````BX  BW  BY  BV  BZ
DX  DW  DY  DV  DZ
EX  EW  EY  EV  EZ
AX  AW  AY  AV  AZ
CX  CW  CY  CV  CZ
``````

Now your players choose a random card from the matrix to add to the answer, keeping it face-down so no one sees it. Again you could use dice to make this choice. This leaves us with…

``````BX  BW  BY  BV  BZ   Answer: DW
DX      DY  DV  DZ
EX  EW  EY  EV  EZ
AX  AW  AY  AV  AZ
CX  CW  CY  CV  CZ
``````

Now they remove every card in the incomplete row and column and add them to the deck of clues.

``````BX      BY  BV  BZ   Answer: DW
Clues:  BW EW AW CW DX DY DV DZ
EX      EY  EV  EZ
AX      AY  AV  AZ
CX      CY  CV  CZ
``````

Slide the remaining cards to return to a square matrix, and repeat:

``````BX  BY  BV (BZ)    Answer: DW
EX  EY  EV  EZ     Clues:  BW EW AW CW DX DY DV DZ
AX  AY  AV  AZ
CX  CY  CV  CZ

EX  EY  EV    Answer: DW BZ
AX (AY) AV    Clues:  BW EW AW CW DX DY DV DZ BX BY BV EZ AZ CZ
CX  CY  CV

EX  EV   Answer: DW BZ AY
CX (CV)  Clues:  BW EW AW CW DX DY DV DZ BX BY BV EZ AZ CZ EY CY AX AV

(EX)     Answer: DW BZ AY CV
Clues:  BW EW AW CW DX DY DV DZ BX BY BV EZ AZ CZ EY CY AX AV EV CX

Answer: DW BZ AY CV EX
Clues:  BW EW AW CW DX DY DV DZ BX BY BV EZ AZ CZ EY CY AX AV EV CX
``````

This procedure ensures you get exactly one of each flavour and one of each colour in the answer pile, and all the remaining cards in the clue pile.

If you find this runs a bit long, you can also abbreviate it. Once you have a shuffled matrix, just take one diagonal into the answer deck and the rest into the clue deck:

``````(BX) BW  BY  BV  BZ   Answer: BX DW EY AV CZ
DX (DW) DY  DV  DZ   Clues:  BW BY BV BZ DX DY DV DZ EX EW
EX  EW (EY) EV  EZ           EV EZ AX AW AY AZ CX CW CY CX
AX  AW  AY (AV) AZ
CX  CW  CY  CV (CZ)
``````

If your initial shuffle was enough to mix up your players’ memory of which row/column is which, then this is just as good. But you might find randomizing at the end involves easier manipulations than the row/column shuffling, so splitting your randomizing between the two phases might help the setup phase go quicker.

Posted on Categories Articles

## Condition format in Excel base on cell value

How to format a range base on previous column value. Ex: A2=33% (is Best Before Date); B2 is 33%, C2 is 31% (to be format in red due to less than A2=33%)

## algorithms – Longest common sub sequences with a condition

Consider a sequences if called good if it contains at least one pair one adjacent numbers which are equal.A good sub-sequence of a array is a sub sequence of that array which is good and has its length is highest.Now you are given two array $$S$$ and $$T$$ with integers,you need to find sub sequences with is common to both arrays and has maximum length and is a good sub sequence.

This is a pure dynamic programming problem,in which states are $$dp(i)(j)$$ is answer for $$S(1:i)$$ and $$T(1:j)$$ ($$A(1:i)$$ means subarray of $$A$$ from $$1$$ to $$i$$). But i could not find transition between states,could anyone help me.

Posted on Categories Articles