## Redirect users from admin pages the optimal solution

On two different sites I use two somewhat different solutions. Are they different in terms of security and performance? Which is better? Are there even better ones?

Solution 1.

``/** Redirect users from admin pages if not administrators **/ add_action( 'admin_init', function() {     if( ! current_user_can( 'manage_options' ) && ( ! wp_doing_ajax() ) ) {         wp_safe_redirect( site_url() );         exit;     } } ); ``

Solution 2.

``/** Redirect users from admin pages if not administrators **/ add_action( 'admin_init', function() {     if( ! in_array( 'administrator', wp_get_current_user()->roles ) ) {         wp_redirect( get_bloginfo( 'wpurl' ) );         exit;     } } ); ``

## PDE solution positivity constraint

I have a 2d PDE and NDSolve returns a solution that takes negative values but I want the function to be positive

``     f[x,y]>=0  ``

everywhere. How do I include this simple constraint?

## How can I find in mathematica if my equation have solution or not on a given interval?

I’m new to mathematica, I usually used wolfram alpha, however since the equation that I’m working with is a long equation I need to use mathematica. This is an example of the problem. So, I want to know if the equation will have solution or not when m>=4 and n>=3.41421m. I don’t know what command to use and when I enter this, it said that `m>=4 is not a valid variable`. What should I do?

`Solve[{Binomial[n-1,2]-2[(Binomial[m-1,2])+(n-m)(m-1)-1]<=0}, {m>=4, n>=3.41421m}, Reals]`

## Solution verification for functional dependency using armstrong axioms

I have the following functional dependencies which includes all attributes of the relation:

CF supposedly is a candidate key. Is the following reasoning correct:

ACF => AB (Augmentation)

AB => C

D => E

## Full line trajectories plot for the solution of Second Order nonlinear coupled differential equations

I wanted to plot a phase plane containing the trajectories of the solutions found by using ‘NDSolve’ using the initial conditions for x[0], y[0], x'[0] and y'[0]. The equations are: x”[t] – 2 y'[t] == -x[t] + y[t]^2; y”[t] + 2 x'[t] == x[t] + y[t] + x[t]*y[t]

The equilibrium point for the system is (0,0). I have plotted the stream plot for the system but unable to plot a phase portrait that would give me the full line trajectories of the system for different initial conditions. I am also looking for any periodic solution if present in it. The stream plot I got is given below and I would take initial conditions from it.

I get this by using the Parametric Plot of the NDSolve solution:

Kindly help in this capacity. Thanks in advance.

## Pls how do I setup a from and to address and allow my UPS integrated solution calculate shipping based off the two addresses? [closed]

So, I am setting up a website to handle shipping services similar to DHL and UPS, but I am also using UPS services to handle the shipping cost through their API to my specific users, and I want to be able to calculate shipping by allowing users to enter a from and to shipping address, and calculate the shipping based on the distance. Any help would be much appreciated.

## How to know when Findroot fails to find a solution

My problem is very simple. Assume you have this piece of code :

``FindRoot[{x^2 + 1 == 0}, {x, -1, 1}] ``

Now, this code returns

``FindRoot::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations. {x -> -1.} ``

Which is as expected since the equation has no real root. Now my question is, how can I get the fact that FindRoot failed in a variable ? Say I want to display a message "Failed search", when FindRoot fails for whatever reason, how do I collect the fact that the function failed ? I was looking into `Catch[]`, but it seems that no exception is thrown.

## If No PayPal or CreditCard, What other alternatives solution for making international payments ?

I know this must have been asked several times already but what is the definitive solution without having any issues ?

My cc already got deactivated twice because some international sellers have not implemented 3d secure verification. Same problem with PayPal. Even if the transaction goes through the cc issuer calls to get confirmation and if I am not reachable on the phone they deactivate my card.

The cc company also blocked a verification amount charged by Entropay and warned me not to…

If No PayPal or CreditCard, What other alternatives solution for making international payments ?

## Solution for a large amount of user logins [closed]

I’m looking to build a site for a friend but it has to support user logins (with custom roles) in the thousands and this is where I’m stuck.

I’m looking to make it a static site hosted on netlify and netlify has an identity service that lets you have 1000 user accounts with roles in the free version and a bit more but at a big price jump of \$ 99/month.

I also looked at auth0 because it offers 7k user accounts for the free tier but no custom roles and in order to get custom roles you need to upgrade to the next tier which actually cuts down the amount of accounts you can have to 1k.

I’m not sure how else to handle this many user accounts without a hefty price. I could maybe host a database on a cheap server but I feel like costs might get out of control with that as well.

## Canonical solution of a scoping problem

Scoping is a recurrent issue on this forum.

Yet, I stumble again and again at the same thing. Googling over this site does not quickly bring a solution. Two reasons:

1. There are many low quality answers such as this one (and I can elaborate on this, if needed).
2. There are many very good answers (this and this), but they are too long.

Sometimes I just want to learn by examples, not by reading many pages of dry theory. Therefore I would like to ask this question again even at risk being downvoted or the question being closed.

Consider this code

``ClearAll[g,i,list];  list=Range[3] g[l_]:=Module[{i},l/.{i_->2i}]  g[list] i=5 g[list]  Out[2]= {1,2,3} Out[4]= {2,4,6} Out[5]= 5 Out[6]= 10 ``

Or a very similar one

``ClearAll[g,i,list];  list=Range[3] g[l_]:=Cases[l,i_->2i]  g[list] i=5 g[list]  Out[8]= {1,2,3} Out[10]= {2,4,6} Out[11]= 5 Out[12]= {10,10,10} ``

It is clear to me that setting the global variable `i` interferes with the function definition. I would like to know what is the canonical way of avoiding this interference?.

Please, avoid answer like `2 list`.