java – Should all third party methods that access outside resources (like other databases) be wrapped up?

From the perspective of unit testing, the code under test should obviously not be accessing outside resources so the third party methods need to be mocked. However, it seems like this is poor practice because third party methods can change and become static/final which makes mocking difficult in Mockito. So in that sense, is it best practice to always wrap up third party methods?

I suppose this question may also apply to other programming languages and testing frameworks.

dnd 3.5e – Are there any non-epic methods of time travel (years/decades/centuries) in third edition?

Are there any non-epic methods of time travel (years/decades/centuries, not smaller than a year) in third edition?

I’m not looking at short duration tricks, nor am I looking for anything that is a one-way trip. Please exclude theoretical optimization tricks.

I am looking for a way to travel a large temporal distance, and back again, preferably affecting the destination in question. Forwards or backwards in time is fine.

Are there general methods (in number theory, algebraic geometry?) to find integral solutions of $x^p+y^q+z^r+cdots=t^s$?

I’ve already seen methods of solving equations of the form $x^p+y^q=z^r$ using the fact that $$2^a3^b+2^{a+1}3^b=2^a3^{b+1}.$$

Similarly, can we let, for $A_iin mathbb{Z}$, $$Omega =sum_{j_1,dots,j_k}a_{j_1,…,j_k}prod_{1leq ileq k} A_i^{j_i},$$ and consider $$sum_i B^{p_i}_i=beta^q$$ (for $beta,B,p,q$ in the same field) comparing this to $$Omega =prod A_i^{k_i}?$$ I’m not sure I stated this correctly or fully: for example, could we compare

$$eta^a(1+eta+Aeta^2)^b+eta^{a+1}(1+eta+Aeta^2)^b+Aeta^{a+2}(1+eta+Aeta^2)^b=eta^a(1+eta+Aeta^2)^{b+1}$$ to $$x^p+y^q+Az^r=t^s?$$ Over finite fields? Are there simpler methods?

Yours, Alex

❓ASK – Free Methods to Gain Followers or “Friends” on Social Media Sites | NewProxyLists

I want to know how do you gain followers/subscribers/friends on the following social media sites:

Twitter
Pinterest
Instagram
Youtube

I find Facebook easier than expected in the sense that when you add someone, they will most likely accept your friend request. But what about the social media sites I’ve mentioned above, how does one gain followers on those sites?

Thank you.

numerical integration – Different Methods in NIntegrate

I am trying to numerically calculate a multidimensional integral which involves Jacobi elliptic theta functions. The integrand is the following:

integrand(d_, x_, y_, xp_, x0_, T_) := 
 T^(-(d + 1)/2) (d-1 - y^2/(4T)) Exp(-y^2/(8T)) 
( EllipticTheta(3, 1/2 Pi (-x-x0), Exp(-Pi^2 T) ) + EllipticTheta(3, 1/2 Pi (-x+x0), Exp(-Pi^2 T) ) ) 
( EllipticTheta(3, 1/2 Pi (-xp-x0), Exp(-Pi^2 T) ) + EllipticTheta(3, 1/2 Pi (-xp+x0), Exp(-Pi^2 T) ))

My goal is to integrate this expression with respect to x0 and T for d=3, and get a 3d plot of the result as a function of x and xp (both variables between 0 and 1) – while manipulating y. After this, I need to take the derivative of the integrated result with respect to both x and xp.

For the integration, I have tried 3 different strategies. In the first one, I do not specify the Method:

integral(d_?NumericQ, x_?NumericQ, y_?NumericQ, xp_?NumericQ) := 
 NIntegrate(
  integrand(d, x, y, xp, x0, T), {T, 0, ∞}, {x0, 0, 1}, 
  PrecisionGoal -> 10, MinRecursion -> 10, MaxRecursion -> 20)

I’ve found that increasing the MinRecursion changes the results, and 10 seems to work well (higher values do not seem to improve the results). Since generating the full 3D plot takes somewhat long, I then generated the following table:

Table(integral(3, x, 1, 0), {x, 0.05, 1, 0.05})

with the outcome

{-43.386, -38.7746, -34.1253, -31.4359, -26.9778, -22.7969, -19.8602, -20.2972, -13.8984, -6.49645, -3.3476, -3.31147, 6.20662, 8.2472, 12.0905, 13.7228, 14.896, 15.814, 16.3162, 16.463}

In a second attempt, I tried Method->"LocalAdaptive" for the integration:

adaptintegral(d_?NumericQ, x_?NumericQ, y_?NumericQ, xp_?NumericQ) := 
 NIntegrate(
  integrand(d, x, y, xp, x0, T), {T, 0, ∞}, {x0, 0, 1}, 
  PrecisionGoal -> 10, MinRecursion -> 10, MaxRecursion -> 20, 
  Method -> "LocalAdaptive")

which produces the following numbers for the same table:

{-20.7877, -19.7131, -17.9935, -15.7272, -13.0363, -10.0544, -6.91493, -3.74124, -0.63984, 2.30356, 5.02495, 7.48073, 9.64493, 11.5056, 13.061, 14.316, 15.2788, 15.9584, 16.3626, 16.4967}

The outcome is very different compared to the first table, and since I did not get any error messages, I wonder if there is a way to tell which gives a more accurate estimate of the actual result.

I also tried the Method->"MonteCarlo":

mcintegral(d_?NumericQ, x_?NumericQ, y_?NumericQ, xp_?NumericQ) := 
 NIntegrate(
  integrand(d, x, y, xp, x0, T), {T, 0, ∞}, {x0, 0, 1}, 
  PrecisionGoal -> 10, MinRecursion -> 10, MaxRecursion -> 20, 
  Method -> "MonteCarlo")

which gives the following values for the same table

{-21.2913, -19.2249, -18.663, -16.2671, -13.3218, -9.81518, -4.44489, -3.11635, -0.264413, 2.72884, 4.44556, 8.09827, 9.49501, 11.4452, 13.0165, 14.0828, 15.279, 16.3008, 16.6255, 16.5606}

This one works much faster, but I also get a few error messages like this one

NIntegrate::maxp: The integral failed to converge after 50100 integrand evaluations. NIntegrate obtained -21.2913 and 1.3762138095540868` for the integral and error estimates.

Questions

  1. Is there a good way to compare these methods and make sure which results are reliable? I suspect this is due to a singularity in (part of) the integrated – since as T->0 the EllipticTheta function approaches to a sum of Dirac delta functions. Analytically, this does not seem to be a problem since the Exp(-y^2/(8T)) factor causes the integrand to become identical to zero. However, I imagine things are not as straight in numerics, but I also do not know how to overcome this hurdle.

  2. What can I do to speed up these computations? Especially, for generating and Manipulating the Plot3D of integral (or different variants of it) with {x,0,1},{xp,0,1}

  3. How to (numerically) take derivatives from integral w.r.t both x and xp? I both need to plot this derivative, as well as to integrate it against another kernel.

shipping methods – Magento 2.3.4 update: All Rest API are getting 500 error

I’ve recently updated my Magento 2.3.4. Now getting 500 error for all the Magento REST API being used on checkout, cart, or any other pages.

I’ve checked for System log but not getting anything related to error except 500error on browser network.
Please suggest the solutions If someone has encountered the same issue.

Below is the error screenshot

enter image description here

What are all the machine learning methods that can be used for Predict?

When I’m writing code for the Predict function, it allows me to choose what method I want to use. There are 7 options available from the drop-down after I type in Method ->: DecisionTree, GradientBoostedTrees, LinearRegression, NearestNeighbors, NeuralNetwork, RandomForest, and GaussianProcess. Are there any other methods that can be used? I couldn’t find any leads in the documentation. Any help is greatly appreciated!

How to initiate tabs widget when all payment methods are rendered

I want to initialize tabs widget on payment methods on checkout.

How would I know if all the payment methods are rendered and it is now safe to initialize tabs.

Thanks

How to tell Spring Security that my service class automatically has the “ROLE_ADMIN” and can access secured methods?

I have a web app build with Java and Spring MVC using Spring Security.

My services methods are locked down with security something like this …

public interface UserService {

  @PreAuthorize("hasRole('ROLE_ADMIN')")
  public Integer createUser(String username, String password) throws Exception;

}

public interface ConfigurationService {

  @PreAuthorize("hasRole('ROLE_ADMIN')")
  public Integer createConfiguration(ConfigurationDTO configurationDTO) throws Exception;

}

It all works fine. Users cannot access this functionality unless they are logged in as a user with “ROLE_ADMIN”.

However … the first time my application starts up (before any user is logged in), I want the application to set things up with default users and default configurations.

I have a service something like this that gets run on start up …

public class MainAppService {

   public void initialize() throws Exception {

     // if first time app is run then set things up
     userService.createUser("admin", "defaultpassword"); 
     configurationService.createConfiguration(myDefaultConfigutation);
     // and so on ...
   }
}

The problem is, the calls to ‘createUser’ and ‘createConfiguration’ fail with “Access Denied” errors because there is no user logged in.

Is there a way to tell Spring Security that my MainAppService class automatically has the “ROLE_ADMIN” and can access all of those secured methods?

web development – Methods to secure multiple sellers

I am in the process of creating a site that accommodates multiple sellers (multi-vendor). Sellers can perform Crud on their products.
My query concerns methods of data separation for sellers. Which methods are available to ensure sellers can only interact with products they have created.

A couple of ideas I had:

  1. Add a seller ID against product in product table
  2. Create separate product table for every seller

Apart from the above two any further suggestions and wondering how this is usually solved?