Does the order of MongoDB search terms matter for query performance?

Does the order of search terms in MongoDB matter? I came across this documentation from learnmongodbthehardway that cautions against the use of $ne and $nin:

If you need to use these [$nin and $ne] ensure you are filtering down using indexes as much as possible and leaving the $nin and $ne terms to the very last part of the query selector.

I always thought that the order of the search terms does not matter. I haven’t produced a rich enough dataset to prove/disprove this.

calculus – Express the integral in order dxdy and then change to dydx

My region is defined by:
$$
R={{(x,y) in mathbb{R}^2: y geq2-x^3 wedge ygeq x^2 wedge yleq sin(tfrac{pi}{2}x)+4 }}
$$

I am expressing the integral as:
$$
intint_RfdA = int_{-1}^1 int_{2-x^3}^{sin(frac{pi}{2}x)+4} f(x,y)dydx + int_1^2 int_{x^2}^{sin(frac{pi}{2}x)+
4}f(x,y)dydx.
$$

And changing the order:
$$
int_1^3int_{sqrt(3){2-y}}^{sqrt{y}}f(x,y)dxdy + int_3^5int_{frac{2}{pi}arcsin(y-4)}^{sqrt{y}}f(x,y)dxdy.
$$

I’m not sure if I’m thinking about it.

c++ – Why is transform matrix order is reversed in my Scene graph implementation?

I have researched this a lot and so far all the examples, tutorials etc always use the following order: Scale * Rotate * Translate but for some reason this order must always be backwards in my Scene Graph. I am not sure if this is intended due to transforming local matrix to world matrix or it is an inherent bug in my application.

Here is my simple Scene Graph implementation. I am using Vulkan and GLM math library.

void SceneNode::setTransform(glm::mat4 transform) {
  transformLocal = transform;
}

void SceneNode::update() {
  // if root node
  if (parentNode == nullptr) {
    transformWorld = transformLocal;
  } else {
    transformWorld = parent->transformWorld * transformLocal;
  }

  for (auto &node : children) {
    node->update();
  }
}

And my shader logic:

// initialization code hidden for simplicity

void main() {
  // worldTransform = transform matrix calculated during scene node update
  gl_Position = UniformCameraData.projectionView * ModelPushConstants.worldTransform * vec4(vPosition, 1.0f);

  outColor = vColor;
}

As a demo, I have created a super simple scene with spheres:

Root
  Sphere Center -> Rotate around its own axis
    Sphere 1 -> Position somewhere near the parent and Rotate around its own axis
    Sphere 2 -> Position somewhere near the parent andRotate around its own axis
    Sphere 2 -> Position somewhere near the parent andRotate around its own axis

This scene graph gives me one sphere in the middle that rotates and three spheres that rotate due to being children of this sphere; plus, the spheres themselves rotate around their own axis:

Demo - Intended

However, the implementation of it is quiet weird to me. The order of transformations is Translate * Rotate * Scale instead of the other way around:

child1->setTransform(
          glm::translate(glm::mat4{1.0}, glm::vec3{2.0, 0.0, 0.0}) *
          glm::rotate(glm::mat4{1.0f}, glm::radians(frame * 0.9f),
                      glm::vec3{0.0, 0.0, -1.0}) *
          glm::scale(glm::mat4{1.0}, glm::vec3{0.4, 0.4, 0.4}));

// ...other children transformations

scene->update();

When I change the order of transformations, the rotation happens around the central sphere:

child1->setTransform(
          glm::rotate(glm::mat4{1.0f}, glm::radians(frame * 0.9f),
                      glm::vec3{0.0, 0.0, -1.0}) *
          glm::translate(glm::mat4{1.0}, glm::vec3{2.0, 0.0, 0.0}) *
          glm::scale(glm::mat4{1.0}, glm::vec3{0.4, 0.4, 0.4}));

// ...other children transformations

scene->update();

Demo - Wrong transformation

As you can see, the cyan color sphere rotates around the parent instead of its own center.

I was confused by this so, I added translation to the root node (e.g (2.0, 1.0)) and got the same result. If I rotate the sphere, then translate, it will rotate against (0, 0), then translate to (2.0, 1.0) at the same time, which will mean that it is at (2.0, 1.0) and rotating against (0.0, 0.0). On the other hand, if I translate first, then rotate, it will rotate against (2.0, 1.0) and translate to (2.0, 1.0) at the same time, which will mean that its rotating against the newly translated center.

Logically this makes sense to me because these multiplications are happening at the same time and the result is written to node but I still do not understand why the typically suggested transformation order is Scale * Rotate * Translate. Can someone explain to me what I am missing here that I have to use multiply transformations is in reverse order?

magento2 – Magento 2 – How to get product attribute in order api

I added two new product attributes to a product called

netsuite_internal_id & ava_tax_code

if I do a GET to /rest/V1/products/{sku}, I can see them in custom_attributes.attribute_code.

When a customer places and order I need those product attribute to show up in the “items” node. When doing a GET to /rest/V1/orders/{orderId}

ORDER REST API
enter image description here

PRODUCT REST API
enter image description here

c# – Need help with my risk game program – i need to insert 2 players, throw x number of dices, order them and confront the results of the 2 players

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Text;

namespace ConsoleApp8
{
class Program
{
static List names;
static List dices; // (2, 3)
static List player1Dices = new List();
static List player2Dices = new List();

    static List<string> PromptNames()
    {
        Console.Write("Nome del primo giocatore: ");
        string player1 = Console.ReadLine();
        Console.Write("Nome del secondo giocatore: ");
        string player2 = Console.ReadLine();

        List<string> names = new List<string>();

        names.Add(player1);
        names.Add(player2);
        return names;
    }

    static int GetDieValue(string x, string msg)
    {
        Console.Write("{0}, {1} ", x, msg);
        string rawDie = Console.ReadLine();
        int parsedDie;
        // qui devi usare do, while perché non sai a priori quante volte un giocatore potrebbe inserire un valore sbagliato
        if (!Int32.TryParse(rawDie, out parsedDie))
        {
            Console.WriteLine("Meti un numero");
            return GetDieValue(x, msg);
        }
        return parsedDie;
    }

    static List<int> PromptDices()
    {
        int p1Dices = GetDieValue(names(0), "con quanti dadi vuoi attaccare?");
        int p2Dices = GetDieValue(names(1), "con quanti dadi ti vuoi difendere?");

        return new List<int>() { p1Dices, p2Dices };
    }
    static void Play()
    {
        Console.WriteLine("{0} attacca con {1} dadi", names(0), dices(0));
        Console.WriteLine("{0} difende con {1} dadi", names(1), dices(1));
        CalculateResult();

    }
    static void CalculateResult()
    {
        System.Random random = new System.Random();
        for (int i = 0; i <= dices.Count; i++)
        {
            player1Dices.Add(random.Next(1, 7));
        }
        Console.WriteLine("Prima: {0}{1}{2}", player1Dices(0), player1Dices(1), player1Dices(2));
        player1Dices = player1Dices.OrderByDescending(x => x).ToList();
        Console.WriteLine("Dopo: {0}{1}{2}", player1Dices(0), player1Dices(1), player1Dices(2));


        for (int i = 0; i <= dices.Count; i++)
        {
            player2Dices.Add(random.Next(1, 7));
        }
        Console.WriteLine("Prima: {0}{1}{2}", player2Dices(0), player2Dices(1), player2Dices(2));
        player2Dices = player2Dices.OrderByDescending(x => x).ToList();
        Console.WriteLine("Dopo: {0}{1}{2}", player2Dices(0), player2Dices(1), player2Dices(2));

    }
   
    private static void PlayAgain(string x)
    {
        Console.WriteLine("Se vuoi finire il gioco scrivi Exit");
        string Exit = x;
        do
        {
            RunGame();
            player1Dices.Clear();
            player2Dices.Clear();
        }
        while (x != Console.ReadLine());
        


    }

    static void RunGame()
    {
        names = PromptNames();
        dices = PromptDices();
        CalculateResult();
        Play();
        PlayAgain();
                
        // generate random numbers - and sort them
        // display results - compare dices
        // repeat or quit?
    }

    private static void PlayAgain()
    {
        throw new NotImplementedException();
    }

    static void Main(string() args)
    {
        RunGame();
        Console.WriteLine("Thanks for playing");
        Console.ReadKey();
    }
}

}