## Google Sheets: How can I Set the Order on Items in a Chart Legend?

I have these two charts which pull the same data from the same table. The legend items appear in reverse order in the second chart. Anyone know how to make those match?

Reference: https://imgur.com/a/FbLRdyX

## Unity toggleable shader property misbehaves when set by code?

``````(Toggle(ENABLE_COLOR_BLEND)) _EnableColorBlend ("Enable Color Blend", Int) = 0
``````

``````#pragma shader_feature ENABLE_COLOR_BLEND
``````

``````#ifdef ENABLE_COLOR_BLEND
color = lerp(_DryColor, _WetColor, _ColorBlend);
#endif
``````

And there it is in the inspector, and when I toggle it, color blending is turned on and the material is rendered as it should be. if I turn it off, it’s off.

But if I try to set it like this in code:

``````Renderer.material.SetInt("_EnableColorBlend", 1);
``````

The material is rendered like if EnableColorBlend is off.

In the inspector it’s ticked, and as soon as I turn it off, it gets ticked again. (I set it in an Update) But for some reason, it’s still rendered like color blending is off.

And if I remove the SetInt above, and set it by hand, everything works fine.

Why?

Idea: If I set it by hand, there is a smooth transition (don’t know why) instead of an instant change in shade.
Maybe by setting it constantly to 1, it always just starts the transition, but can’t finish it?

EDIT: Just checked it with a guard, and it still behaves the same.

``````if (Renderer.material.GetInt("_EnableColorBlend") == 0) Renderer.material.SetInt("_EnableColorBlend", 1);
``````

## linear algebra – Need help to solve simple set of equations

I have below set of equations. All equations are inter-connected to each other and to find out the solution right now I am manually doing the tuning by trial-error method. To make this automated, I would like to know how to solve this for Xt and Xc for Yt=0.1 and Yc=-0.7.

Yt = -0.3759 * Xt + 0.2294

Yt = 0.2744 * Xc + 0.2294

Yc = 0.0325 * Xt – 0.1645

Yc = -0.1006 * Xc – 0.1645

Here,

Yt = 0.1

Yc = -0.7

And, I want to find the Xt and Xc which can satisfy above all equations.

Darshan

## formal languages – Is the empty string and some words of even length are elements of this set?

$$L = {w in {a,b}^*| text{the first, the middle, and the last characters of w are identical}}$$.

I have my answers, but I need confirmation:

Is the empty string $$epsilon in L$$? Yes. Reason: there is no first, middle, or last character to break the rule.

Words of even length, assuming the first and last characters of them are identical, again, must be in $$L$$, as there is no middle character to break the rule in such words.

This is in the context of theory of computation by the way.

## How does having a large mempool and allowing a greater transaction ancestry set change the interaction with your peers?

Bitcoin Core by default allows up to 300 MiB of mempool data, and restricts unconfirmed transaction trees to an ancestry set of at most 25 transactions and 101 kvB of transaction data. Since these are config values, you can obviously use other values than these. How does this change your node’s interaction with its peers? Do peers send data that exceeds your node’s preferences and your node drops that data upon arrival or does your node inform its peers what to send? Is this the same for mempool data generally and unconfirmed chains specifically? If you allow more data via higher values, does your node forward previously unacceptable data to its peers once their backlog clears enough for the data to be accepted by them?

## Magento2: How to set minimum order amount for specific group

I have created some customers group.

How to set minimum order amount only for specific group?

## How to set filter tcpdump by tcp.len

How can I set a filter with `tcpdump` to filter `tcp.len !=0`

in Wireshark . it’s easy, but how can I set that in `tcpdump` ?

## Unable to set User SharePoint group column (lookup) value

Would like to request for some assistance in SharePoint.

I have a SharePoint group called Users and SharePoint List called Role and Department.
I have added Role and Department to Users column as lookup but there is no option to update the Role and Department for each Users. Is it possible to update the value of this field for each Users and how? My goal is to be able to identify the Role and Department of the login user from PowerApps.

My user is the Admin of Office 365.

## looping – How can I replace a set of Nested For Loops with a Functional Code Alternative?

Despite having looked over various posts concerning optimizing nested For loop expressions into a functional programming equivalent I still can not figure out how to actually to do this. Such constructs are inefficient in Mathematica and hence, I seek to find a more efficient approach. Sadly, having started with programming with FORTRAN (prior to IV), some ideas die hard in an aging brain.

I have a very large array that I must evaluate. This array m, is 31×2754, but for purposes of example I have down-sampled so that it is only a 30 x 32 matrix. It produces a square matrix whose order is the size of the columns (here 32, when downsampled, but 2754×2754 when fully sampled). Although a doubly nested set of For loops provides the answer I seek and is relatively efficient when the matrix is only 32×32, it’s efficiency degrades rapidly as n approaches 2754. I am at a loss to how to convert the following procedural code snippet into a functional programming equivalent that is more efficient.

The test input (ignoring how I get there, which itself is rather complicated) is:

``````m = {{0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1,
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 0, 0, 0, 0, 0, 0,
0}, {0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1,
0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0}, {0, 1, 1, 0, 1, 1, 1, 0, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
0}, {0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1,
1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1,
0}, {0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1,
0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 1, 1,
1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1}}

Dimensions(m)

{30, 32}
``````

Although not essential, to be sure that the output is properly created I create
a constant array and fill the matrix c, which will be the eventual output matrix
with a value that WILL NOT be present in the matrix upon completion, so that by
quick observation I can be sure that the matrix has been properly populated.

This is done as follows and establishes the order of the square matrix, where the length of columnlabels for this snippet is 32 (the actual column labels are irrelevant
here):

`````` c = ConstantArray(3, {Length(columnlabels), Length(columnlabels)});

{characterrows, charactercolumns} = Dimensions(c)
``````

The loop construct I wish to replace with a functional approach effectively compares two column of m, each of which has only two distinct values (either 0 or 1), and for which their product partial order potentially generates 4 distinct possibilities (vertices) ({0,0},{1,0},{0,1},{1,1}} and for which I want to assign to the each pair of columns a 1 if less than 4 of these possibilities are actually present in the comparison and a 0 if all 4 possibilities are present when comparing the two columns). This construct is as follows:

`````` t0 = AbsoluteTime();

For(i = 1, i <= Length(columnlabels), i++,
For(j = 1, j <= Length(columnlabels), j++,
f = m((All, i));
g = m((All, j));
c((i, j)) = If(Length(Tally(Table({g((n)), f((n))}, {n, 1, Length(g)}))) < 4, 1, 0);
)
)

t1 = AbsoluteTime();
timeelapsed = UnitConvert(Quantity(t1 - t0, "Seconds"), "Minutes")
``````

What is the most efficient functional programming expression needed to replace this nested set of For loops?

## Is there a pattern for choosing one of a set of options at random when their selection criteria are equal?

I want to choose between several options, and if the criteria I’m using for selection happen to be equal, I want one at random (reasonably so, so it’s equal-chance each time, rather than arbitrary). This is easily done with nested ifs, but it gets pretty ugly and ends up duplicating code.

A simplified example case, in case that’s not clear.

``````extern crate rand;

fn main() {
let a = 5;
let b = 5;

if a > b {
println!("Do the thing where a is bigger");
} else if b < a {
println!("Do the thing where b is bigger");
} else {
if rand::random::<bool>() {
// I don't want to duplicate the code here!
println!("Do the thing where a is bigger");
} else {
// Or here!
println!("Do the thing where b is bigger");
}
}

}
``````

(rust playground)

Is there a better way to do this which doesn’t require duplicating code? In this simplified example I’m only choosing between two possibilities, but it could actually be a longer list. (What about acting based on the highest of `a`, `b`, `c`, `d`, where it’s possible that there’s a two, three, or four-way tie?)

I happen to be learning Rust so if there’s any clever language features that’d be cool, but I’m also interested in the general case if possible.