c # – Gets all objects with an object matching a string

I have a database of members. Members have a list of phone numbers. I'm trying to get all the members who have the specified phone number.

public class Member {
...
public ObservableCollection Telephones {get; together; }
}

public class Phone {
public string Number {get; together; }
...
}

...

IMongoCollection private _members;

...
private list GetMembers (phone chain) {
listing list = _members.Find (
member => member.Phones.First (
p => p.Number == phone) .Number.Equals (phone)). ToList ();
return list;
}

GetMembers returns an empty list (yes, the string phone corresponds to a member of the database). How can I get a list of members who have the given phone number?

dnd 5e – What are the consequences for Forge Clerics to gradually create objects with a value greater than 100 g?

I am currently doing a campaign in which one of the PCs is a clerk of the forge.

The blessing of Artisan allows the clergy of the forge to conduct a ritual to make non-magical objects worth not more than 100 grams. Raw materials of equivalent value must be provided for the manufacture of the article.

An armor is in the list of examples of items that a Cleric of the Forge could create with this power. However, some armor (in middle and heavy armor categories) are worth more than 100g. RAW suggests that a clerk of the forge is unable to manufacture these objects.

My forge clerk asked me if he could work around this limitation by making a more expensive armor for several uses of the Artisan Blessing. For example, he thought that he could create a Splint armor (worth 200 g) on ​​two uses of the Artisan Blessing, at half the rate at a time.

Now, as I said, I am quite convinced that RAW is not allowed (although I am open to the contrary conviction), but what would be the consequences in terms of balancing to allow this in my game?

The PC would still need to provide enough raw materials to make the weave suit, and the process would take a lot longer. In addition, he still only provides an item that in many campaigns could easily be purchased at any nearby store. It does not seem unreasonable to allow my player to break RAW and make more expensive items, piece by piece.

Did I miss something or should it be ok?

Dg.Differential Geometry – Finds the local coordinates of the ends of a time-varying line (two other objects) to minimize line length variance

  1. Line A 'rotates cyclically around point A' according to a time-varying pattern and coordinates of point A & # 39; are fixed (that is, line A has only one degree of freedom).
  2. The BB line can move along the x and y axes (translational motion) and can also rotate around the B point with the constraint that the distance between points A and B remains constant.
  3. The simultaneous translation and rotation of the BB line also occurs cyclically according to a fixed time variant model, the cycle time corresponding to that of A +.
  4. Due to points 1, 2 and 3 above, the angles AB & ABB vary over time and are cyclic.

Using any numerical method, can we find the X point in the local coordinates of the A line (that is, the distance AX and the angle A (AX) are fixed) and the Y point in the local coordinates of the BB line (that is, the BY distance and the BY angle are fixed) ) so that the coefficient of variation (CV) of the distance between the point X and the point Y is minimal for a given set of snapshots spaced in time over an entire cycle? We need to exclude the trivial solution: the AB line (ie the A point inside the local coordinates of the A & A line and the B point inside the local coordinates of the line BB & # 39;). Please refer to the attached image.

I'm not sure this question is qualified to be part of mathoverflow.net, so move it to another math group if moderators find it.

php – How to add elements with "id" repeated in an array of objects?

I have a board of Objects:

painting: 8 [▼
  0 => array:4 [▼
    "fk_id_producto" => 401
    "cantidad" => 1
    "precio" => 9.0
    "producto" => "Cuzquena negra"
  ]
  1 => table: 4 [▼
    "fk_id_producto" => 438
    "cantidad" => 1
    "precio" => 25.0
    "producto" => "trio 2"
  ]
  2 => table: 4 [▼
    "fk_id_producto" => 357
    "cantidad" => 1
    "precio" => 70.0
    "producto" => "Seleccion marina mediana"
  ]
  3 => table: 4 [▼
    "fk_id_producto" => 401
    "cantidad" => 1
    "precio" => 9.0
    "producto" => "Cuzquena negra"
  ]
  4 => table: 4 [▼
    "fk_id_producto" => 402
    "cantidad" => 1
    "precio" => 9.0
    "producto" => "Cuzquena de trigo"
  ]
  5 => table: 4 [▼
    "fk_id_producto" => 401
    "cantidad" => 1
    "precio" => 9.0
    "producto" => "Cuzquena negra"
  ]
  6 => table: 4 [▼
    "fk_id_producto" => 401
    "cantidad" => 2
    "precio" => 9.0
    "producto" => "Cuzquena negra"
  ]
  7 => table: 4 [▼
    "fk_id_producto" => 401
    "cantidad" => 1
    "precio" => 9.0
    "producto" => "Cuzquena negra"
  ]
]

Try as follows:

foreach ($ array as $ key => $ value) {
$ total = 0;
$ details = $ array;
foreach ($ details like $ keyDet => $ valueDet) {
if ($ value['fk_id_producto'] == $ valueDet['fk_id_producto']) {
$ total = $ total + (intval ($ value['cantidad']));
}
}
$ table[$key]['cantidad']    = $ total;
}

I threw the signature board of Objects:

painting: 8 [▼
  0 => array:4 [▼
    "fk_id_producto" => 401
    "cantidad" => 5
    "precio" => 9.0
    "producto" => "Cuzquena negra"
  ]
  1 => table: 4 [▼
    "fk_id_producto" => 438
    "cantidad" => 1
    "precio" => 25.0
    "producto" => "trio 2"
  ]
  2 => table: 4 [▼
    "fk_id_producto" => 357
    "cantidad" => 1
    "precio" => 70.0
    "producto" => "Seleccion marina mediana"
  ]
  3 => table: 4 [▼
    "fk_id_producto" => 401
    "cantidad" => 5
    "precio" => 9.0
    "producto" => "Cuzquena negra"
  ]
  4 => table: 4 [▼
    "fk_id_producto" => 402
    "cantidad" => 1
    "precio" => 9.0
    "producto" => "Cuzquena de trigo"
  ]
  5 => table: 4 [▼
    "fk_id_producto" => 401
    "cantidad" => 5
    "precio" => 9.0
    "producto" => "Cuzquena negra"
  ]
  6 => table: 4 [▼
    "fk_id_producto" => 401
    "cantidad" => 10
    "precio" => 9.0
    "producto" => "Cuzquena negra"
  ]
  7 => table: 4 [▼
    "fk_id_producto" => 401
    "cantidad" => 5
    "precio" => 9.0
    "producto" => "Cuzquena negra"
  ]
]

First problem, do not add the amounts but the number of repetitions of the article.
Second problem, I can not eliminate the repeated without causing myself error.

unit – How can I optimize my game and its objects?

I have a 3D game in Unity and I use blender to design models. My game has a feature in which if you click a button, an object is cloned. An example of my game is a tree that is cloned about 100 times with different sizes and positions to form a forest.

The problem is that after a few presses on the button, the game really starts to fall behind. Is there a way to optimize the game in Unity or optimize models in Blender to reduce this delay? I use the instantiate function in Unity to perform my cloning.

Some useful information for a generic gameobject (all have a similar complexity):

  • faces: 12,226
  • triangles: 26,116
  • memory: 13.24 mb
  • gameobjects in scene not static
  • CPU usage mainly dedicated to rendering

Here is a screenshot showing my current game, where is the blue part of the graph in the middle when I click on the button:

Here is a detailed overview of the tips you can see:

5th dnd – Is a school of magic associated with magic objects?

Not in 5th, but in previous editions

The 5th rules do not seem to make general connections between magic objects and magic schools. An active spell clearly belongs to a particular school, like all spells; but descriptions of magic objects do not refer to schools of magic. Detecting the magic tells you that magical school is associated with a magical aura, "if any", so it's obvious that a magic effect does not necessarily belong to a particular school.

It would often be reasonable to say that a magic object producing a particular spell effect, such as a magic wand or parchment, carries the corresponding magic school, but there is no rule that such is the case. .

However, in previous D & D editions such as 3.5e, magic items were absolutely associated with magic schools. As described in SRD 3.5e, Detect the magic tells you which schools of magic an object fits, and each description of a magic object includes a note about the force and the schools (many objects belonging to more than one school!) of its magical aura. SMs who are able to describe magic items with special magic schools may be familiar with previous editions and extrapolate to the 5th edition.

In any case, it is of course up to the DM to choose whether or not he wishes auras for magical items to indicate a particular magic school. I would prefer to do it in my games, because it's a good way to suggest the probable function of an object without being explicit about it, and to give the impression of coherent rules of magic. Therefore, I would also say that mechanical interactions based on magic schools could apply to magic objects, as in the related example of the Eye dress, and so Non detection should protect against the magical senses of the dress. It's definitely my personal decision, though.

3.5nd dnd – Can you create spell-trigger objects at a lower launcher level than yours?

Take for example a parchment, but this also applies to chopsticks. The SRD says the following about burning parchments:

The base price of a scroll is its spell level × its caster level × 25 ".

Suppose now that a person from the level 4 launcher wants to create a parchment of a first level spell. Is there a way to make this scroll IF IF you are the Level 1 Launcher? So, all the effects of scale with the caster are reduced to 1, but also the costs of crafting?

The UI shakes when the user pulls objects on the screen [on hold]

How is this problem explained and what technique is used to solve it?

design – Practical caching of objects inverse relationship

In Django, I have the following relationship:

class A (models.Model):
b = templates.ForignKey (& # 39; B & # 39;)

class B (models.Model):
pass

A-> B can be accessed directly but B-> A requires a reverse relationship search.

In a particular scenario, we have a lot of B objects and we need a quick way to get A objects related to each of them. This would require a single search for each B object:

for b in b_queryset:
do_something (b.a_set.all ())

For the performance, I do the following:

class B (models.Model):
def get_a_set (auto):
try:
a_set = self._a_set
except AttributeError:
a_set = self._a_set = self.a_set.all ()
returns a_set

And before the loop, I cache the values ​​of _a set since we already have a list of A objects with prefetched B:

for an a_queryset:
otherwise hasattr (a.b, _a_set):
a.b._a_set = []
    a.b.append (a)

The goal is to cache A objects related to B and avoid expensive database queries.

Things to consider:

  • B.get_a_set () send back QuerySet or one listing is the same for our needs.
  • We are not afraid to cache the production of unsynchronized data with the database. The scenario in which this technique would be used does not guarantee A B relationships will change.

How is this workaround acceptable? What are the best alternatives?

javascript – Why in two instances of the same class, only the function of one of the objects of the event resize is executed?

I am a beginner with this JavaScript code and by doing a course, I found a totally unexpected behavior for me.

It turns out that I did a course for an object … very briefly, it would look like this:

miBase class
{
constructor (name)
{
this.name = name;
}

resize (name)
{
console.log (name + '+ this.name);
}
};

myObject class extends myBase
{
constructor (name)
{
super (name);

$ (window) .resize (function ()
{
resize (name)
});

}
};

Then I create two instances like this:

obj1 = new myObject ("Object1");
obj2 = new myObject ("Object2");

And when I resize the browser, I get a result like this:

Object1 Object2
Object2 Object2

Object1 Object2
Object2 Object2

Object1 Object2
Object2 Object2

It's something I did not expect. Only the "resize ()" function of one of the objects (the last one to be created) is running. I do not understand what's going on. I hoped to get something like this:

Object1 Object1
Object2 Object2

Object1 Object1
Object2 Object2

Object1 Object1
Object2 Object2 

Does anyone know why this is happening and more importantly, how can I avoid it?